3

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
*)
b3m2a1
  • 46,870
  • 3
  • 92
  • 239
Hector
  • 6,428
  • 15
  • 34

1 Answers1

1

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

Jason B.
  • 68,381
  • 3
  • 139
  • 286