Consider the two cases:
ClearAll["Global`*"]
j = Reap[Do[{Sow[{i, i}, a]}; Sow[{i, i^2}, b], {i, 100}], _, Rule];
a /. Last@j
h = Reap[ParallelDo[{Sow[{i, i}, a]}; Sow[{i, i^2}, b], {i, 100}], _,
Rule];
a /. Last@h
The output of the first is a matrix, while the output of the second is a. I am obviously using ParallelDo, Sow and Reap in the wrong way.
Which is the correct way to use Reap and Sow with a ParallelDo?
SowandReap? From what I read in https://mathematica.stackexchange.com/questions/84534 they're not likely to perform well with each other to begin with. Normally divergent results betweenDoandParallelDois going to be an inter-kernel communication issue or a failure to share definitions, but I'm not sure you should expect any performance benefit even if you fix that issue. – eyorble Mar 13 '20 at 22:25Association(per kernel, of course)) and toMergethe results afterwards. – Henrik Schumacher Mar 14 '20 at 07:41SetSharedFunction[Sow]in advance. – user688486 Sep 17 '23 at 09:21