evaluates expr using automatic parallelization.

Details and Options

  • Parallelize[expr] automatically distributes different parts of the evaluation of expr among different available kernels and processors.
  • Parallelize[expr] normally gives the same result as evaluating expr, except for side effects during the computation.
  • Parallelize has attribute HoldFirst, so that expressions are not evaluated before parallelization.
  • The Method option for Parallelize specifies the parallelization method to use. Possible settings include:
  • "CoarsestGrained"break the computation into as many pieces as there are available kernels
    "FinestGrained"break the computation into the smallest possible subunits
    "EvaluationsPerKernel"->ebreak the computation into at most e pieces per kernel
    "ItemsPerEvaluation"->mbreak the computation into evaluations of at most m subunits each
    Automaticcompromise between overhead and load-balancing
  • Method->"CoarsestGrained" is suitable for computations involving many subunits, all of which take the same amount of time. It minimizes overhead, but does not provide any load balancing.
  • Method->"FinestGrained" is suitable for computations involving few subunits whose evaluations take different amounts of time. It leads to higher overhead, but maximizes load balancing.
  • The DistributedContexts option for Parallelize specifies which symbols appearing in expr have their definitions automatically distributed to all available kernels before the computation.
  • The default value is DistributedContexts:>$Context, which distributes definitions of all symbols in the current context, but does not distribute definitions of symbols from packages.


open all close all

Basic Examples  (3)

Map a function in parallel:

Click for copyable input

Generate a table in parallel:

Click for copyable input

Functions defined interactively can immediately be used in parallel:

Click for copyable input
Click for copyable input

Scope  (13)

Generalizations & Extensions  (3)

Options  (11)

Applications  (4)

Properties & Relations  (7)

Possible Issues  (8)

Neat Examples  (1)

Introduced in 2008
Updated in 2010