This is documentation for Mathematica 7, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)

ParallelCombine

ParallelCombine[f, h[e1, e2, ...], comb]
evaluates f[h[e1, e2, ...]] in parallel by distributing parts of the computation to all parallel kernels and combining the partial results with comb.
ParallelCombine[f, h[e1, e2, ...]]
is equivalent to ParallelCombine[f, h[e1, e2, ...], h] if h has attribute Flat, and ParallelCombine[f, h[e1, e2, ...], Join] otherwise.
  • ParallelCombine[f, h[e1, ..., en], comb] forms expressions f[h[e1, ..., ek]], f[h[ek+1, ...]], ..., f[h[..., en]], evaluates these on all available kernels, and combines the results ri with comb[r1, r2, ...].
  • The default combiner Join is appropriate for functions f such that the result of f[h[e1, ..., ek]] 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 h[e1, ..., en] = h[h[e1, ..., ek], h[ek+1, ...], ..., h[..., en]].
  • With a compatible choice of comb, ParallelCombine[f, h[e1, e2, ...], comb] is equivalent to f[h[e1, e2, ...]].
  • If no kernels are available, ParallelCombine evaluates f[h[e1, e2, ...]] normally.
Apply f in parallel to chunks in a list (with 4 parallel kernels available):
Apply f in parallel to chunks in a list (with 4 parallel kernels available):
In[1]:=
Click for copyable input
Out[1]=
 
In[1]:=
Click for copyable input
Out[1]=
 
The overall count of matching elements is equal to the sum of the partial counts:
Reduce an associative expression in parallel:
Find out how a computation is distributed among all kernels:
An implementation of ParallelMap:
New in 7