On Sat, 07 Jan 2012 10:27:48 -0000, Szabolcs Horv=E1t <
szho...@gmail.com>
wrote:
This behaviour is new in 8 and controlled using the DistributedContexts
option (which has default value of $DefaultContexts). It applies to all
Parallel` functions that in some sense iterate over a list (these are now
built around the new internal function parallelIterate which performs the
distribution of values). Here Parallelize[Table[...]] gets changed into
ParallelTable which meets this criterion. Apart from changing the option
value, an easy way to avoid distribution for specific symbols is to define
them in a context that is not a member of $DistributedContexts:
In[1]:= LaunchKernels[2]
Out[1]= {KernelObject[1, "local"], KernelObject[2, "local"]}
In[2]:= InputForm[$DistributedContexts]
Out[2]//InputForm= "Global`"
In[3]:= undistributed`x = 1
Out[3]= 1
In[4]:= ParallelEvaluate[undistributed`x]
Out[4]= {1, 1}
In[5]:= ParallelEvaluate[undistributed`x = 2]
Out[5]= {2, 2}
In[6]:= Parallelize[Table[undistributed`x, {10}]]
Out[6]= {2, 2, 2, 2, 2, 2, 2, 2, 2, 2}