|
SOLUTIONS
|
BUILT-IN MATHEMATICA SYMBOL
Parallelization
Parallelization
is an option for Compile that specifies whether it should create a compiled function that could run in parallel.
DetailsDetails
- Parallelization applies to the execution of the compiled function.
- Compiled functions only run in parallel if Listable is one of the RuntimeAttributes and the function threads over list arguments.
- Compiled functions run in parallel using multiple threads of execution.
- Typically, $ProcessorCount is used to determine how many threads are used.
- If a compiled function running in parallel has several threads trying to call ordinary Mathematica code, only one thread can do this at any time.
- The following settings can be used:
-
True create parallel code False create single-thread code Automatic use parallelization for optimal arguments
ExamplesExamplesopen allclose all
Basic Examples (1)Basic Examples (1)
Listable compiled functions can execute in parallel:
| In[1]:= |
| Out[1]= |
This shows the operation running sequentially:
| In[2]:= |
| Out[2]= |
Typically, $ProcessorCount is used to determine how many threads can be used:
| In[3]:= |
| Out[3]= |
New in 8
Mathematica 9 is now available!
New to Mathematica?
Find your learning path »
Have a question?
Ask support »


