Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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?

share|improve this question
    
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. –  Szabolcs Feb 20 at 16:17
add comment

1 Answer

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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