PRODUCTS
Products Overview
Mathematica
Mathematica Student Edition
Mathematica Home Edition
Wolfram
CDF Player
(free download)
Computable Document Format (CDF)
web
Mathematica
grid
Mathematica
Wolfram
Workbench
Wolfram
SystemModeler
Wolfram
Finance Platform
Mathematica
Add-Ons
Wolfram|Alpha Products
SOLUTIONS
Solutions Overview
Engineering
Aerospace Engineering & Defense
Chemical Engineering
Control Systems
Electrical Engineering
Image Processing
Industrial Engineering
Materials Science
Mechanical Engineering
Operations Research
Optics
Petroleum Engineering
Biotechnology & Medicine
Bioinformatics
Medical Imaging
Finance, Statistics & Business Analysis
Actuarial Sciences
Data Analysis & Mining
Econometrics
Economics
Financial Engineering & Mathematics
Financial Risk Management
Statistics
Software Engineering & Content Delivery
Authoring & Publishing
Interface Development
Software Engineering
Web Development
Science
Astronomy
Biological Sciences
Chemistry
Environmental Sciences
Geosciences
Social & Behavioral Sciences
Design, Arts & Entertainment
Game Design, Special Effects & Generative Art
Education
STEM Education Initiative
Higher Education
Community & Technical College Education
Primary & Secondary Education
Students
Technology
Computable Document Format (CDF)
High-Performance & Parallel Computing (HPC)
See Also: Technology Guide
PURCHASE
Online Store
Other Ways to Buy
Volume & Site Licensing
Contact Sales
Software
Service
Upgrades
Training
Books
Merchandise
SUPPORT
Support Overview
Mathematica
Documentation
Knowledge Base
Learning Center
Technical Services
Community & Forums
Training
Does My Site Have a License?
Wolfram User Portal
COMPANY
About Wolfram Research
News
Events
Wolfram Blog
Partnerships
Employment Opportunities
History of
Mathematica
Stephen Wolfram's Home Page
Contact Us
OUR SITES
All Sites
Wolfram|Alpha
Demonstrations Project
MathWorld
Integrator
Wolfram Functions Site
Mathematica Journal
Wolfram Media
Wolfram
Tones
Wolfram Science
Stephen Wolfram
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE
DOCUMENTATION CENTER
FOR THE LATEST INFORMATION.
DOCUMENTATION CENTER SEARCH
New to
Mathematica
?
Find your learning path
»
Mathematica
>
Systems Interfaces & Deployment
>
Parallel Computing
>
Data Parallelism
>
ParallelCombine
>
Mathematica
>
Core Language
>
Tuning & Debugging
>
Parallel Computing
>
Data Parallelism
>
ParallelCombine
>
BUILT-IN MATHEMATICA SYMBOL
ParallelMap
Parallelize
ParallelSum
ParallelProduct
Fold
See Also »
|
Data Parallelism
Parallel Computing
Summary of New Features in 7.0
New in 7.0: Alphabetical Listing
More About »
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
[
e
1
,
e
2
,
...
],
Join
]
otherwise.
MORE INFORMATION
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
.
With a compatible choice of
comb
,
ParallelCombine
is equivalent to
.
If no kernels are available,
ParallelCombine
evaluates
normally.
ParallelCombine
takes the same
Method
option as
Parallelize
.
ParallelCombine
takes the same
DistributedContexts
option as
Parallelize
; the default value is
DistributedContexts
:>
$DistributedContexts
.
EXAMPLES
CLOSE ALL
Basic Examples
(2)
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]:=
Out[1]=
Show where each computation takes place:
In[2]:=
Out[2]=
By default
Join
is used as a combiner function:
In[1]:=
Out[1]=
Do a parallel filtering operation:
In[2]:=
Out[2]=
Scope
(9)
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:
Generalizations & Extensions
(1)
Listable functions of several arguments:
Options
(11)
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:
Applications
(3)
Reduce an associative expression in parallel:
Find out how a computation is distributed among all kernels:
A parallel version of
MapThread
:
Properties & Relations
(5)
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:
Possible Issues
(2)
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:
SEE ALSO
ParallelMap
Parallelize
ParallelSum
ParallelProduct
Fold
MORE ABOUT
Data Parallelism
Parallel Computing
Summary of New Features in 7.0
New in 7.0: Alphabetical Listing
New in 7 | Last modified in 8