0
$\begingroup$

I'm trying to do a calculation in parallel that requires setting $MaxPiecewiseCases. How can I do this? This small test case doesn't work for me:

$MaxPiecewiseCases = 1000;
Print[$MaxPiecewiseCases];
ParallelEvaluate[$MaxPiecewiseCases = 500; Print[$MaxPiecewiseCases]];

Instead the output is:

During evaluation of In[118]:= 1000
(kernel 7) 100
(kernel 8) 100
(kernel 9) 100
...
$\endgroup$
  • 2
    $\begingroup$ I get 500 from the parallel kernels in V9.0.1, V8.0.4 (Mac OSX). $\endgroup$ – Michael E2 Jun 16 '14 at 13:11
  • $\begingroup$ Hummm, If I restart Mathematica, and run the setup before any other calculations, it works. Should have thought of that. $\endgroup$ – Gremlin Jun 16 '14 at 13:26
  • $\begingroup$ Note that if any of the parallel kernels crashes and is (automatically or otherwise) restarted, this setting will be lost. Whether or not that is a problem for you depends on the application, obviously, but if it is--it's better to make the setting in $InitCode rather than explicitly. $\endgroup$ – Oleksandr R. Jun 16 '14 at 14:06
  • 1
    $\begingroup$ @OleksandrR. Parallel`Developer`$InitCode is hard to find within Mathematica. $\endgroup$ – Michael E2 Jun 16 '14 at 16:28

Browse other questions tagged or ask your own question.