7
$\begingroup$

The following command:

ParallelTable[Image[Graphics[{{Red, Disk[{5, 5}, 4]}}]], {i, 10}]

shows a very strange behaviour. It starts a new Mathematica process on every Parallel Kernel, so that using 6 Kernels I end up with 7 Mathematica Processes and 14 MathKernels running.

With Rasterize it is the same.

Can anyone explain/help?

$\endgroup$
1
  • $\begingroup$ When you cross post a question, please consider linking the various versions together, to avoid duplication of effort ... Please also consider registering your account here. It will make it much easier to reply to answers/comments in case you need clarifications. $\endgroup$
    – Szabolcs
    Commented Feb 20, 2014 at 16:17

1 Answer 1

8
$\begingroup$

Rasterization/rendering is done by the front end, not the kernel. Image[Graphics[...]] also does rasterization. The parallel subkernels do not have a front end attached so they cannot render graphics. When a kernel process doesn't have a front end attached and it needs to render graphics (e.g. for exporting), it will start up a front end process in the background to do the rendering for it. In your case each subkernel will do this separately.

Why you end up with additional kernel processes as well is explained here.

There are some other operations too that depend on a front end process but won't launch it automatically. You can use UsingFrontEnd to force the launching manually in that case.


Related: It is particularly important to be aware of this behaviour when running Mathematica in command line mode on a remote headless Linux computer, and trying to Export some graphics. The Export command will fail if there's no X server running because the helper front end process that's started by Export depends on X, even though it does't actually draw anything on screen. The typical workaround is to use Xvfb to allow the front end to start.

$\endgroup$

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.