Tag Info

New answers tagged


In this case you would need SetSharedFunction as you are dealing with DownValues. However, the communication overhead you introduce with this is likely going to negate any benefits or parallelization. Try to write parallel code that never requires write access to the same variable from different threads. Reformulate your problem in terms of ParallelMap or ...


You have to replace SetSharedVariable with SetSharedFunction. longComputation[n_] := n SetSharedFunction[zeros] ParallelDo[ zeros[n] = longComputation[n], {n, 30, 70, 10} ] Why? From the docs of SetSharedVariable: Shared variables without a value evaluate to Null. This is what was happening to you, because zeros[30] = ... defines a function ...

Top 50 recent answers are included