For example, I define a function f.
f[x_] := x^2;
And when I execute
ParallelTable[f[i], {i, 1, 10}]
I get
{1, 4, 9, 16, 25, 36, 49, 64, 81, 100}
as expected. (my function definition has propagated to the parallel kernels)
Now, if I do
Unprotect[Print];
Print = Null;
and
ParallelDo[Print[i], {i, 1, 10}]
I expect nothing to be printed out because I have changed the Print function. But instead, I get the printout.
1
3
5
7
9
10
2
4
6
8
Why did my function definition propagate to the parallel kernels in the first example, but not in the second example?
SetSharedVariable
/SetSharedFunction
. $\endgroup$