ParallelDo
evaluates expr in parallel with the variable i successively taking on the values 1 through imax (in steps of 1).
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 Automatic granularity of parallelization DistributedContexts $DistributedContexts contexts used to distribute symbols to parallel computations ProgressReporting $ProgressReporting whether 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"->e break the computation into at most e pieces per kernel "ItemsPerEvaluation"->m break the computation into evaluations of at most m subunits each Automatic compromise 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.
Examples
open allclose allBasic Examples (3)Summary of the most common use cases
ParallelDo works like Do, but in parallel:

https://wolfram.com/xid/0rsz1su7i-c8yhm9


https://wolfram.com/xid/0rsz1su7i-dy5k2k

No results are returned by ParallelDo:

https://wolfram.com/xid/0rsz1su7i-dj3qx2
Use a shared variable to communicate results found to the master kernel:

https://wolfram.com/xid/0rsz1su7i-bmafci

https://wolfram.com/xid/0rsz1su7i-v8a0u
![]() |

Options (9)Common values & functionality for each option
Method (2)
DistributedContexts (5)
By default, definitions in the current context are distributed automatically:

https://wolfram.com/xid/0rsz1su7i-g9gh34

https://wolfram.com/xid/0rsz1su7i-clbr3t
Do not distribute any definitions of functions:

https://wolfram.com/xid/0rsz1su7i-6xao0

https://wolfram.com/xid/0rsz1su7i-kx0x4h
Distribute definitions for all symbols in all contexts appearing in a parallel computation:

https://wolfram.com/xid/0rsz1su7i-hu6d1y

https://wolfram.com/xid/0rsz1su7i-s80e6
Distribute only definitions in the given contexts:

https://wolfram.com/xid/0rsz1su7i-yht7o

https://wolfram.com/xid/0rsz1su7i-n7ym7a
Restore the value of the DistributedContexts option to its default:

https://wolfram.com/xid/0rsz1su7i-qkhgjy

ProgressReporting (2)
Do not show a temporary progress report:

https://wolfram.com/xid/0rsz1su7i-bzw7un
Use Method"FinestGrained" for the most accurate progress report:

https://wolfram.com/xid/0rsz1su7i-w8nh1s
![]() |
Applications (1)Sample problems that can be solved with this function
Properties & Relations (2)Properties of the function, and connections to other functions
ParallelDo performs the same iterations as ParallelTable, but does not return the values:

https://wolfram.com/xid/0rsz1su7i-b12pi4


https://wolfram.com/xid/0rsz1su7i-hysuqh
Parallelization happens along the outermost (first) index:

https://wolfram.com/xid/0rsz1su7i-fjj6q1
Possible Issues (2)Common pitfalls and unexpected behavior
A function used that is not known on the parallel kernels has no effect:

https://wolfram.com/xid/0rsz1su7i-em4wbu

https://wolfram.com/xid/0rsz1su7i-jofo5
Define the function on all parallel kernels:

https://wolfram.com/xid/0rsz1su7i-m3hzn
The function is now evaluated on the parallel kernels:

https://wolfram.com/xid/0rsz1su7i-jtpu5w
Definitions of functions in the current context are distributed automatically:

https://wolfram.com/xid/0rsz1su7i-5axng5

https://wolfram.com/xid/0rsz1su7i-3cyctq
Side effects are local to each parallel kernel:

https://wolfram.com/xid/0rsz1su7i-h6cblz

https://wolfram.com/xid/0rsz1su7i-bf2q17

Use a shared variable to support global side effects:

https://wolfram.com/xid/0rsz1su7i-g8q98c

https://wolfram.com/xid/0rsz1su7i-f8hnf9

Wolfram Research (2008), ParallelDo, Wolfram Language function, https://reference.wolfram.com/language/ref/ParallelDo.html (updated 2021).
Text
Wolfram Research (2008), ParallelDo, Wolfram Language function, https://reference.wolfram.com/language/ref/ParallelDo.html (updated 2021).
Wolfram Research (2008), ParallelDo, Wolfram Language function, https://reference.wolfram.com/language/ref/ParallelDo.html (updated 2021).
CMS
Wolfram Language. 2008. "ParallelDo." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2021. https://reference.wolfram.com/language/ref/ParallelDo.html.
Wolfram Language. 2008. "ParallelDo." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2021. https://reference.wolfram.com/language/ref/ParallelDo.html.
APA
Wolfram Language. (2008). ParallelDo. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ParallelDo.html
Wolfram Language. (2008). ParallelDo. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ParallelDo.html
BibTeX
@misc{reference.wolfram_2025_paralleldo, author="Wolfram Research", title="{ParallelDo}", year="2021", howpublished="\url{https://reference.wolfram.com/language/ref/ParallelDo.html}", note=[Accessed: 24-March-2025
]}
BibLaTeX
@online{reference.wolfram_2025_paralleldo, organization={Wolfram Research}, title={ParallelDo}, year={2021}, url={https://reference.wolfram.com/language/ref/ParallelDo.html}, note=[Accessed: 24-March-2025
]}