SetSharedFunction
This feature is not supported on the Wolfram Cloud.

SetSharedFunction[f1,f2,]
declares the symbols as shared functions whose downvalues are synchronized among all parallel kernels.

DetailsDetails

  • Downvalues for a shared function defined on any kernel are maintained by the master kernel and every access on a parallel subkernel is synchronized through the master kernel.
  • Expressions of the form that would remain unevaluated give Null.

ExamplesExamplesopen allclose all

Basic Examples  (1)Basic Examples  (1)

Make fs be a (global) shared function:

In[1]:=
Click for copyable input

Each subkernel makes a definition for the same shared variable:

In[2]:=
Click for copyable input
Out[2]=
In[3]:=
Click for copyable input
Out[3]=

Without sharing, each subkernel has its own (local) copy of the function:

In[4]:=
Click for copyable input
Out[4]=
In[5]:=
Click for copyable input
Out[5]=
Introduced in 2008
(7.0)