I am using Mathematica 12.x and have a compiled function, returning many things. I would like to run several instances of this compiled function, one for each core of my CPU, and then collect all of the results. After looking through SE page here I am not sure how to accomplish this.
My function is something like this:
{out1, out2, out3, out4, out5, out6} = compiledFunction[<integer args>]
How should I go about coding the ParallelEvaluate[]
to enable the behavior I want?
I would assume something like:
DistributeDefinitions[compiledFunction];
ParallelEvaluate[ SetSystemOptions[ "ParallelOptions" -> "ParallelThreadNumber" -> $ProcessorCount]];
ParallelEvaluate[{out1, out2, out3, out4, out5, out6} = compiledFunction[<integer args>]];
But this does not put all of the thread's instances of functions into the output variables. If I could, I could create out1a, out1b, ..., etc
and force them together as out1 = {out1a, out1b, ...}
but I am not sure how to do that, and if there's a better way?