I am running a parallelized algorithm using WolframScript and inside the function being passed to the various kernels, I have print statements that track the computation and output the print statements to the terminal. However, whenever a print statement is executed in the slave kernels, its prepended by

From KernelObject[<n>, Local kernel]:

where <n> is the $KernelID. So for example, a full print statement would return

From KernelObject[6, Local kernel]:
<my print statement>

where in the code, I have Print[<my print statement>]. However, with the number of kernels I have up and running, these prepended messages take up a lot of screen real estate. Is it possible to turn off these From KernelObject... messages so that I just have the original Print statement printed to screen? I am pretty new to Wolframscript so I haven't been able to determine a potential solution myself. Perhaps printing to an output stream?

A minimal working example would be for example

wolframscript -code 'ParallelEvaluate[Print["Hello"]]'

to be executed in the terminal. In my specific case, all the code is in a Wolfram Language Script file, so I am executing wolframscript -file <myfile>. But the results are identical, the print messages are prepended by the above message.



Ok, I've managed to implement this in the standard front end by using Trace[ParallelEvaluate[Print["Test"]], CellPrint], which shows me the exact pattern to overload in the Downvalues of CellPrint. So I simply set

CellPrint[Cell[s_, "Print", label_, ShowCellLabel -> True]] := 
   CellPrint[Cell[s, "Print", ShowCellLabel -> False]]];

which is a bit brute force, but it works. However, this doesnt solve my problem. This only works in the FrontEnd, and not when using Wolframscript. Running Trace[ParallelEvaluate[Print["Test"]], Print] in a Terminal using

wolframscript -c 'Trace[ParallelEvaluate[Print["Test"]], Print]'

Shows me

{HoldForm[Print[From KernelObject[1, Local kernel]:]], HoldForm[Null], HoldForm[Print[d
]], HoldForm[Null]}

so it looks like wolframscript is inserting the values I want to print into a list of other strings that get printed along with it. I'm not sure how to proceed from this point.

  • $\begingroup$ You can try to apply the approach described in this answer: "Customize how many of the same warning messages are printed from parallel kernels?" $\endgroup$ Commented Jul 27, 2022 at 11:56
  • $\begingroup$ Thanks for the link. Messing with the backend like this is a whole new territory for me. I tried implementing your solution through that link, but I was unsuccessful. I tried removing the ShowCellLabel and CellLabel options (and tried analyzing with Trace). I noticed, after running Unprotect[CellPrint] that CellPrint has other downvalues that are pretty obscure. If i remove all of them, then ParallelEvaluate[Print["Test"]] evaluates to nothing, theres no print statement, even with the custom definition as the only downvalue. $\endgroup$
    – shanedrum
    Commented Aug 3, 2022 at 12:22
  • $\begingroup$ Perhaps $Post can be used? For example, set $Post=If[Head[#]===String,ToUpperCase[#],#]& and then type "Hello". This will not work for Print results, but perhaps one can adapt it. $\endgroup$
    – user293787
    Commented Aug 3, 2022 at 13:51

1 Answer 1


I've managed to switch off printing of the "From remote kernel:" lines. The basic idea is to redefine Print for them:

Print["From remote kernel:"] = Null;

I've put it in a "test.m" file as follows:

Print["From remote kernel:"] = Null;

Here is how it is executed in the command prompt:


P.S. It seems in your case something other is being printed. Hence you can try the following instead:

Print[expr_] /; ! FreeQ[expr, _KernelObject] = Null;
Print[expr_] /; ! FreeQ[expr, s_String /; StringContainsQ[s, "KernelObject"]] = Null;
  • 1
    $\begingroup$ This solves my problem, thanks for the solution. I combined all three down value definitions in my WL script and I now get the desired result. $\endgroup$
    – shanedrum
    Commented Aug 4, 2022 at 8:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.