evaluates expr in parallel imax times.


evaluates expr in parallel with the variable i successively taking on the values 1 through imax (in steps of 1).


starts with i=imin.


uses steps di.


uses the successive values i1, i2, .


evaluates expr looping in parallel over different values of j, etc. for each i.

Details and Options

  • ParallelDo is a parallel version of Do that automatically distributes different evaluations of expr among different kernels and processors.
  • If side effects involve unshared variables, they will in general work differently than in Do.
  • Parallelize[Do[expr,iter, ]] is equivalent to ParallelDo[expr,iter,].
  • The following options can be given:
  • Method Automaticgranularity of parallelization
    DistributedContexts $DistributedContextscontexts used to distribute symbols to parallel computations
    ProgressReporting $ProgressReportingwhether to report the progress of the computation
  • The Method option 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 specifies which symbols appearing in expr have their definitions automatically distributed to all available kernels before the computation.
  • The default value is DistributedContexts:>$DistributedContexts with $DistributedContexts:=$Context, which distributes definitions of all symbols in the current context, but does not distribute definitions of symbols from packages.
  • The ProgressReporting option specifies whether to report the progress of the parallel computation.
  • The default value is ProgressReporting:>$ProgressReporting.


open allclose all

Basic Examples  (3)

ParallelDo works like Do, but in parallel:

No results are returned by ParallelDo:

Use a shared variable to communicate results found to the master kernel:

Options  (9)

Method  (2)

Calculations with vastly differing runtimes should be parallelized as finely as possible:

A large number of simple calculations should be distributed into as few batches as possible:

DistributedContexts  (5)

By default, definitions in the current context are distributed automatically:

Do not distribute any definitions of functions:

Distribute definitions for all symbols in all contexts appearing in a parallel computation:

Distribute only definitions in the given contexts:

Restore the value of the DistributedContexts option to its default:

ProgressReporting  (2)

Do not show a temporary progress report:

Use Method"FinestGrained" for the most accurate progress report:

Applications  (1)

Generate a number of animation frames and save them to individual files:

Import every 5^(th) file and display it:

Properties & Relations  (2)

ParallelDo performs the same iterations as ParallelTable, but does not return the values:

Parallelization happens along the outermost (first) index:

Possible Issues  (2)

A function used that is not known on the parallel kernels has no effect:

Define the function on all parallel kernels:

The function is now evaluated on the parallel kernels:

Definitions of functions in the current context are distributed automatically:

Side effects are local to each parallel kernel:

Use a shared variable to support global side effects:

Wolfram Research (2008), ParallelDo, Wolfram Language function, (updated 2010).


Wolfram Research (2008), ParallelDo, Wolfram Language function, (updated 2010).


Wolfram Language. 2008. "ParallelDo." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2010.


Wolfram Language. (2008). ParallelDo. Wolfram Language & System Documentation Center. Retrieved from


@misc{reference.wolfram_2023_paralleldo, author="Wolfram Research", title="{ParallelDo}", year="2010", howpublished="\url{}", note=[Accessed: 28-February-2024 ]}


@online{reference.wolfram_2023_paralleldo, organization={Wolfram Research}, title={ParallelDo}, year={2010}, url={}, note=[Accessed: 28-February-2024 ]}