7
$\begingroup$

This question already has an answer here:

I have been looking at the very first example on this page of the documentation in Mathematica 11.3 (default installation options) and I get a different result:

LaunchKernels[2]; 
Kernels[]; 
mykernel = First[Kernels[]]; 
a = 2; 
ParallelEvaluate[a === 2, mykernel]

Which outputs

True

whereas in the documentation it gives False.

Have there been any changes to parallel computing in Mathematica recently?

$\endgroup$

marked as duplicate by Szabolcs, Kuba May 11 '18 at 12:20

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    $\begingroup$ I updated some inaccurate comments in my answer. I think this is essentially a duplicate of the above QA (in the sense that both questions have the same answer). Please do report the documentation inconsistency to Wolfram. You can do that with the feedback link at the end of each online doc page. $\endgroup$ – Szabolcs May 11 '18 at 11:51
  • $\begingroup$ Will do today evening $\endgroup$ – ThunderBiggi May 11 '18 at 13:51
9
$\begingroup$

Yes, this has been deliberately changed in version 10.4. ParallelEvaluate will now automatically distribute definitions, just like the other parallel functions do.

Personally, I find this change counterproductive. I often used ParallelEvaluate to examine the state of subkernels, and not having automatic magic working in the background made this easier.

But luckily, there is an easy workaround through the DistributedContexts option. To get back the old behaviour, use

ParallelEvaluate[..., DistributedContexts -> None]
$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.