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
  • 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, 2018 at 13:31

1 Answer 1

1
$\begingroup$

This will not work, anything placed in an expression store would only be available on that particular kernel.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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