[Date Index]
[Thread Index]
[Author Index]
Re: creating Graphics using ParallelTable[]
*To*: mathgroup at smc.vnet.net
*Subject*: [mg99885] Re: creating Graphics using ParallelTable[]
*From*: mark mcclure <mcmcclur at unca.edu>
*Date*: Mon, 18 May 2009 02:32:05 -0400 (EDT)
*References*: <gum0ar$q33$1@smc.vnet.net>
> I generate "video frames" from time-consuming 3DPlot[]s
> (to export them into a video file later on):
>
> frame[x_] := Plot3D[... something big using x ...];
> movieframes = Table[frame[x], {x, start, end,
> (end-start)/steps}];
>
> I have a double core CPU; so now I would like to create
> these frames in parallel with Mathematica 7, using
> ParallelTable[]. But I don't derive any advantage from
> doing this:
As you mention in you message, there is overhead
associated with parallel processing so it is certainly
possible for a parallel implementation to run slower.
It's hard to know what's going on without a closer look at
your code but I would not be too surprised if a two core
machine doesn't yield much benefit on this type of
problem. Here's a specific example:
frame[R_] := ParametricPlot3D[
{r*Cos[t], r*Sin[t], Sin[(r*R)^2]/r},
{r, 0, 1}, {t, 0, 2 Pi},
PlotPoints -> 100, BoxRatios -> {1, 1, 1/3}];
Table[frame[R], {R, 0.5, 5, 0.5}]; // AbsoluteTiming
This runs in about 8 seconds on my Mac Pro running V7.0.
The following runs in only 3 seconds:
LaunchKernels[];
DistributeDefinitions[frame];
ParallelTable[frame[R], {R, 0.5, 5, 0.5}]; // AbsoluteTiming
My machine launches 8 kernels when I do that, but I
certainly didn't get an eight-fold increase in speed.
Furthermore, my laptop (which gives me only 2 kernels)
runs the parallel version with no speed up at all.
One reason that we might not expect this example to run
well in parallel is that the run time of frame[n] varies
quite a lot with n. If the computation is broken into
halves, the second half takes much more than half the
computation time.
> My Windows taskmanager shows three "MathKernel.exe".
> When I use ParallelTable[] for the described problem,
> only one "MathKernel.exe" is working, causing 50% CPU
> load and using much RAM. The other two "MathKernel.exe"s
> don't cause any load and almost don't use any RAM.
Now that is strange. This is not at all what I see on
my Mac.
Mark McClure
Prev by Date:
**Interesting Mersenne identities and a prime based graph sequence**
Next by Date:
**Followup question: Problem with parallel evaluation of integrals depending on a parameter**
Previous by thread:
**creating Graphics using ParallelTable[]**
Next by thread:
**Re: creating Graphics using ParallelTable[]**
| |