Is there any chance to make the solution by @David here


more robust in the following sense: In my case, some parallel kernels die regularly during intensive computation. Of course, the newly resurrected ones are not part of kernels - leading to a bunch of warnings every now and then. Is it somehow possible to update the list kernels kind of dynamically everytime a new kernel appears (which is only if a kernel died and is resurrected)?

For completeness I will just copy paste the code from the original answer.

(* Pattern that translates the kernel's ID to
   a number from 1 to $KernelCount *)
kernels = ParallelTable[$KernelID -> i, {i, $KernelCount}];
SetSharedVariable[kernels]; (* for Mathematica 7 *)

(* This is the list that will display each kernel's current operation *)
currentNumber = ConstantArray[0, Length@kernels];

PrintTemporary["Current calculations:"];

(* Start the computation *)
    Pause@RandomReal[{0, .25}]; (* Long calculation *)
    currentNumber[[$KernelID /. kernels]] = i,
    {i, 100},
    Method -> "FinestGrained"

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.