Mathematica 9 is now available
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.
Mathematica > Systems Interfaces & Deployment > Parallel Computing > Data Parallelism > ParallelCombine >
Mathematica > Core Language > Tuning & Debugging > Parallel Computing > Data Parallelism > ParallelCombine >

ParallelCombine

ParallelCombine
evaluates in parallel by distributing parts of the computation to all parallel kernels and combining the partial results with comb.
ParallelCombine
is equivalent to ParallelCombine if h has attribute Flat, and ParallelCombine[f, h[e1, e2, ...], Join] otherwise.
  • ParallelCombine forms expressions , , ..., , evaluates these on all available kernels, and combines the results with .
  • The default combiner Join is appropriate for functions f such that the result of has head h. This includes all functions with attribute Listable.
  • For heads h with attribute Flat the default combiner h effectively implements the associative law .
Apply f in parallel to chunks of a list (with 4 parallel kernels available):
Show where each computation takes place:
By default Join is used as a combiner function:
Do a parallel filtering operation:
Apply f in parallel to chunks of a list (with 4 parallel kernels available):
In[1]:=
Click for copyable input
Out[1]=
Show where each computation takes place:
In[2]:=
Click for copyable input
Out[2]=
 
By default Join is used as a combiner function:
In[1]:=
Click for copyable input
Out[1]=
Do a parallel filtering operation:
In[2]:=
Click for copyable input
Out[2]=
All Listable functions can be parallelized with ParallelCombine:
If the function is not Listable use an explicit Map:
Many functional programming constructs can be parallelized with ParallelCombine:
The result need not have the same length as the input:
Evaluate the elements of a list in parallel:
The overall count of matching elements is equal to the sum of the partial counts:
An element appears in a list if it appears in at least one of the pieces:
An element does not appear on a list if it appears in none of the pieces:
Each subkernel performs a smaller number of additions and the combiner combines the results:
Automatically pick the combiner for Flat functions:
Typical Flat functions:
Listable functions of several arguments:
Break the computation into the smallest possible subunits:
Break the computation into as many pieces as there are available kernels:
Break the computation into at most 2 evaluations per kernel for the entire job:
Break the computation into evaluations of at most 5 elements each:
The default option setting balances evaluation size and number of evaluations:
Visualize the number of evaluations per kernel and items per evaluation:
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:
Reduce an associative expression in parallel:
Find out how a computation is distributed among all kernels:
A parallel version of MapThread:
An implementation of ParallelMap:
For listable functions ParallelCombine and ParallelMap are equivalent:
Parallelize is often implemented in terms of ParallelCombine:
Parallel versions of many data-parallel commands can easily be written with ParallelCombine:
Functions defined interactively are automatically distributed to all kernels when needed:
Distribute definitions manually and disable automatic distribution:
The function is now evaluated on the parallel kernels:
The combiner must be compatible with the type of the partial results:
The default combiner is Join, which is appropriate for list-like results:
Functions may simplify short argument lists, but not longer ones:
Such simplification of partial expressions may make parallel evaluation impossible:
Prevent simplification of partial expressions and apply the desired function only at the end:
New in 7 | Last modified in 8
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team
Format:   HTML  |  CDF