I have this script, which does a bunch of image aligning in parallel: https://gist.github.com/8848a25a15da013ed1ad

However, on EVERY print, Mathematica also prints from what Kernel the message came and what the kernel's status is, etc. Is there a way to supress these debug messages?

Edit: The messages in question are these: https://gist.github.com/e8ae961dc46c66ed809f And example images are available here: http://dl.dropbox.com/u/10190786/done.zip

  • $\begingroup$ Have you tried Quiet[]? $\endgroup$ – J. M.'s ennui Feb 2 '12 at 10:59
  • $\begingroup$ I looked at its documentation, but i'm unsure where and how i would add it to my script. $\endgroup$ – Mithaldu Feb 2 '12 at 11:44

It is the Check function which is throwing the error. Try using:

 Do[Quiet@Check[{i[[1]], j[[1]], 
     FindGeometricTransform[i[[2]], j[[2]], 
      Transformation -> "Translation"]}, {i[[1]], j[[1]], err}], {i, 
 {j, files}]

If you leave off the Print command, it will silence all kernel outputs, and also speed up your computation (I'm sure other's could expound on this, but displaying outputs while running loops tends to slow things down). If you want to monitor the output of a parallel computation while it's running, check this SO post.

Edit Just realized that putting Quiet on Check kills the whole point of your computation. I think it would be best if you just do the calculation as a Table and extract the data at the end:

Quiet@ParallelTable[{i[[1]], j[[1]], 
    Quiet[FindGeometricTransform[i[[2]], j[[2]], 
      Transformation -> "Translation"]]}, {i, files}, {j, files}];

I'm not completely sure why I need both of those Quiet commands, but it seems to need it.

  • $\begingroup$ This looks promising. I used print because the goal here is to run these things on the command line and capture the output and because i know nothing about Mathematica. I only use it because it can do a single algorithm i need. Edit: Figured out that the ParallelTable bit needed a check to supress output on non-matches, now it's perfect. Thanks! :) $\endgroup$ – Mithaldu Feb 2 '12 at 18:26
  • $\begingroup$ Once that table is generated, you can always Export or Put or DumpSave to get at the results. $\endgroup$ – Eli Lansey Feb 2 '12 at 20:02
  • $\begingroup$ I just Printed it, since i post-process with Perl it's all fine. :) $\endgroup$ – Mithaldu Feb 2 '12 at 20:17

For anyone coming here looking for how to get rid of seemingly garbage messages like this when running parallel kernels in -script mode:

StringForm[From `1`:, Parallel`Kernels`kernel[Parallel`Kernels`Private`bk[
-subkernel -noinit -mathlink, 100, 1], {/usr/local/Wolfram/Mathematica/9/Executables/math -subkernel
-noinit -mathlink, SubKernels`LocalKernels`LowerPriority -> True}, 
SubKernels`LocalKernels`Private`speed$2381]], Parallel`Kernels`Private`id
$2384, Parallel`Kernels`Private`name$2384], Parallel`Kernels`Private`ek
    [Parallel`Kernels`Private`nev$2385, Parallel`Kernels`Private`pb$2385, 
Parallel`Kernels`Private`rd$2385], Parallel`Kernels`Private`sk
[Parallel`Kernels`Private`q$2386, Parallel`Kernels`Private`n0$2386, 

This is because the -script mode defaults to returning everything in InputForm mode, which does not work to well in this case.

The workaround, add this at the beginning of your script:

SetOptions[$Output, FormatType->OutputForm];
  • $\begingroup$ Your input here would be very valuable. $\endgroup$ – Szabolcs Jun 20 '14 at 14:38

Have you tried

     Check[{i[[1]], j[[1]], 
       FindGeometricTransform[i[[2]], j[[2]], 
        Transformation -> "Translation"]}, {i[[1]], j[[1]], err}], {i,
      files}], {j, files}]]]

in your code? (ie, just silence all messages)?

  • $\begingroup$ if this does not work, could you provide examples of files that do give the error? Because I tried with files = {{"n1", Polygon[{{1, 0}, {0, Sqrt[3]}, {-1, 0}}]}, {"n2", Polygon[{{1, 0}, {0, Sqrt[3] - 0.5}, {-0.5, 0}}]}} and I get no messages. Also, it is possible to prevent only certain messages from being displayed (which is probably best so that you can see if something actually goes wrong) $\endgroup$ – acl Feb 2 '12 at 14:06
  • $\begingroup$ Example images are available here: dl.dropbox.com/u/10190786/done.zip I also added a link to a paste of the messages that are annoying me. And well, adding Quiet around the Parallelize did nothing for me. :/ If it makes any difference, i'm using Mathematica 8 on Windows. $\endgroup$ – Mithaldu Feb 2 '12 at 14:47

Your Answer

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

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