3
$\begingroup$

Is there a way to access NewExpressionStore from within a parallelized calculation? I have tried variations of

Module[{x = "a", s = Language`NewExpressionStore["store"]}, 
 s["put"[x, "value", 1]]; SetSharedVariable[s]; 
 ParallelMap[Print[s["get"[#, "value"]]] &, {x, x}];]

(*
Language`ExpressionStore::nostore :  -- Message text not found -- (Language`ExpressionStore[store])
Language`ExpressionStore::nostore :  -- Message text not found -- (Language`ExpressionStore[store])
Null
Null
*)

The sequential equivalent prints two 1 as expected.

Module[{x = "a", s = Language`NewExpressionStore["store"]}, 
 s["put"[x, "value", 1]]; Map[Print[s["get"[#, "value"]]] &, {x, x}];]
(*
1
1
*)
$\endgroup$
  • 1
    $\begingroup$ In case you don't get a workaround for this, you can use an Association or HashTable for this purpose. $\endgroup$ – Jason B. Jul 17 '18 at 13:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.