If a level specification prevents parallelization,
ParallelMap evaluates like
Map:
Side effects cannot be used in the function mapped in parallel:
Use a shared variable to support side effects:
A function used that is not known on the parallel kernels may lead to sequential evaluation:
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:
Definitions from contexts other than the default context are not distributed automatically:
Use
DistributeDefinitions to distribute such definitions:
Alternatively, set the
DistributedContexts option to include all contexts:
Trivial operations may take longer when parallelized:
Measure the minimum parallel communication overhead:
Compare with a simple calculation done on the master kernel itself:
Functions may simplify short argument lists, but not longer ones:
Such simplification of partial expressions may make parallel mapping impossible:
Prevent simplification of partial expressions and apply the desired function only at the end: