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

Parallelization

Parallelization
is an option for Compile that specifies whether it should create a compiled function that could run in parallel.
  • 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.
  • 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:
Truecreate parallel code
Falsecreate single-thread code
Automaticuse parallelization for optimal arguments
Listable compiled functions can execute in parallel:
This shows the operation running sequentially:
Typically, $ProcessorCount is used to determine how many threads can be used:
Listable compiled functions can execute in parallel:
In[1]:=
Click for copyable input
Out[1]=
This shows the operation running sequentially:
In[2]:=
Click for copyable input
Out[2]=
Typically, $ProcessorCount is used to determine how many threads can be used:
In[3]:=
Click for copyable input
Out[3]=
New in 8