I would like to pass on a definition from one Kernel to the other. With that I mean manually configured Kernels. In this case, I do not want to use the inbuilt Parallelization options, in order to enable parallel computation in the background while still using the main Kernel for other tasks. So would you know a way to share the definition in the following example? This code is in the first cell with the main Kernel:

Clear[f]; f[x_] := x^x; f[2]

In another Cell, this code should use the definition of f:

SetOptions[EvaluationCell[], Evaluator -> "Secundo"];

However, it outputs f[2] unevaluated even though I tried to share the definition. How can I do this without redefining the function on the new Kernel explicitly (functions of interest are quite longish) and without writing them into a package to load each time?

The final purpose is to distribute parallel tasks from a second Kernel while the first one still executes my calculations on the main Kernel using the remaining cores:

SetOptions[EvaluationCell[], Evaluator -> "Secundo"];
eids = Table[ParallelSubmit[{k}, {k,f[g[h[k]]]}], {k,10^6}];
res =.; resList ={};PrintTemporary[Dynamic[res]];
AbsoluteTiming[Table[{res, id, eids} = WaitNext[eids]; 
AppendTo[resList,res];, {i,Length[eids]}]];

In case you were wondering... But for this I simply need the second Kernel to get the information (about f,g,h) from the first one as in the minimal example above.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.