Short version of the question: In C++'s OpenMP, I know how to get what I want, but I'm wondering whether Mathematica has the same option. It's called "dynamic scheduling" when parallelizing.
Long version of the question: Say I'm evaluating a parametrized expression, MyFunc[i]
, where the evaluation time depends on i
and is not constant. I would like to use my full computer power with ParallelTable
:
result = ParallelTable[MyFunc[i], {i,1000} (*, Method -> [what should this be?] *)];
I would like to have ParallelTable evaluate MyFunc[i]
on "first come first server" basis. In other words: Keep all Kernels busy as long as any instance of MyFunc[i]
is not evaluated until the number of parallel kernels available (threads) is higher than the number of remaining evaluations of MyFunc[i]
.
I noticed that Mathematica decides how the parallelization is done before the evaluation. This also seems to be the case in the documentation. All the options provided for Method->
decide on how to split the list, not how to evaluate the list.
So: Is there a way to get the parallelization as "first come first serve"?
MyFunc
depends on its argument, then this (mathematica.stackexchange.com/q/108035/21606) is related and goes into the same direction as the answer by @andre. $\endgroup$