Say I want to distribute a task in the following way on the available subkernels:

ParallelSubmit[
foo[x_] = x;
Print[foo[3]];
];

ParallelSubmit[
foo[x_] = x^2;
Print[foo[3]];
];

WaitAll[%]


Is there a way to re-define foo[x] explicitly for a kernel with a specific ID?

• When I saw your question a few days ago, I searched a bit, but couldn't find a simple solution with ParallelSubmit. Can you explain why you want to do this? Normally, computations would be run on the first available subkernel. Is it that some of your subkernels are slow and some are fast? – Szabolcs Jan 15 '18 at 19:14
• @Szabolcs: Say I have a task which is evaluated in parallel. According to the result I have to change a specific foo definition for further calculations which are evaluated in parallel. Would this be possible? – pawel_winzig Jan 16 '18 at 21:08