Re: creating Graphics using ParallelTable[]
- To: mathgroup at smc.vnet.net
- Subject: [mg99871] Re: creating Graphics using ParallelTable[]
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Mon, 18 May 2009 02:29:34 -0400 (EDT)
- References: <gum0ar$q33$1@smc.vnet.net>
Hi, frame[t_?NumericQ] := Plot3D[Sin[x*y + t], {x, 0, Pi}, {y, 0, Pi}, PlotPoints -> 128] DistributeDefinitions[frame] movieframes = ParallelTable[frame[x], {x, 0, 16, 1}]; ListAnimate[movieframes] gives a speedup of 3.26 in the Parallel Kernel Status window on my Quad core May be it help you post the full code and not only fragments. Regards Jens Jan-Philip Gehrcke wrote: > Hello all, > > 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: > > 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. > > $ProcessorCount is 2, there is 1 "master" and 2 "local" in "Parallel > Kernel Status". The "parallelizeabletest" ParallelTable[$KernelID, > {10}] succeeds. > > I tried `DistributeDefinitions[frame];` before invoking ParallelTable > [], but it did not change anything. > > One core needs about 20 seconds to create one single frame without > displaying it: An extensive analytical function (among others there > are nested Coth[]s) has to be calculated with Plotpoints->100 option. > > In my opinion - simply expressed - each core can take one `x` out of > the queue and create the corresponding 3DPlot Graphics object, while > the other core is doing the same. This should work, because the tasks > are totally independent and my way to use the Table[] is the least > complex one. I don't see the "data management overhead" that often > reduces or even prevents advantages from parallelizing, because each > core just needs to get the function definitions and a simple number: > `x` - no more overhead. > > (At which point) do I think wrong or does Mathematica work weird (less > likely..)? > > Is there a way for me to create these frames using all my CPU power? > > Sincereley, > > Jan-Philip Gehrcke >