0
$\begingroup$

Is it possible to print all the output (inside a Print[] command) of a parallelized computation to the console? I can't find a control for this. I find that my computer can handle printing to the console much better than printing to the notebook.

Thanks

$\endgroup$
  • 1
    $\begingroup$ Just put your computation in a .m script and execute it from teh console via wolfram -script <scriptname.m>. Don't forget to set SetOptions[$Output, FormatType->OutputForm]; at the beginning of the script $\endgroup$ – Felix Jan 31 '17 at 0:04
  • $\begingroup$ Thanks for your answer. I tried what you suggested with a test file, reading SetOptions[$Output, FormatType -> OutputForm]; ParallelDo[Print[i], {i, 1, 10}]; wolfram -script doesn't work for me, but math -script does. However, nothing appears, the command seems to just finish without producing output. $\endgroup$ – Latrace Jan 31 '17 at 1:11
  • $\begingroup$ The following code works for me: echo 'SetOptions[$Output, FormatType -> OutputForm]; ParallelDo[Print[i], {i, 1, 10}];' > /tmp/test.m; math -script /tmp/test.m. Which version of Mathematica do you have? $\endgroup$ – Felix Jan 31 '17 at 2:13
  • $\begingroup$ Yes, that works for me too. I found the mistake... In the notebook my cells were not initialization cells, so in the created .m file all the lines were commented out. I changed that and it works fine, thank you! $\endgroup$ – Latrace Jan 31 '17 at 2:57

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.