Re: ParallelTable slows down computation
- To: mathgroup at smc.vnet.net
- Subject: [mg105723] Re: [mg105692] ParallelTable slows down computation
- From: Mark McClure <mcmcclur at unca.edu>
- Date: Wed, 16 Dec 2009 06:21:03 -0500 (EST)
- References: <200912151233.HAA15506@smc.vnet.net>
On Tue, Dec 15, 2009 at 7:33 AM, K <kgspga at googlemail.com> wrote: > I was trying to evaluate definite integrals of different product > combinations of trigonometric functions like so: > ... > Now I thought that this computation could be almost perfectly > parallelized by having, e.g., nn = 0,...,7 evaluated by one kernel > and nn=8, ..., 15 by the other and typed: > ... > The result, however, was disappointing: Two symbolic computations that appear superficially similar may actually take vastly different amounts of time to perform and there may be no general a priori way to determine which will take longer. Thus, the computation of a large number of symbolic computations typically parallelizes very poorly, since there is no way to break the problems up into parts that take comparable times. In particular, the integrals in your computation take a wide range of times to compute. Here's a simple illustration of the range of timings in your computation. ClearSystemCache[]; timings = Table[Timing[Integrate[ Sin[ph] Sin[nn*ph]*Cos[mm*ph]/(2 Pi), {ph, Pi/2, Pi}]][[1]], {nn, 0, 15}, {mm, 0, 15}]; ListPlot[Flatten[timings]] In contrast, here is a collection of trivial computations that take similar amounts of time. AbsoluteTiming[ Table[Total[RandomReal[{0, 1}, {500}]], {500}, {500}]; ] {2.781051, Null} In this case, we do gain the expected benifit by performing the computation in parallel. LaunchKernels[2]; AbsoluteTiming[ ParallelTable[Total[RandomReal[{0, 1}, {500}]], {500}, {500}]; ] {1.632608, Null} Mark McClure
- References:
- ParallelTable slows down computation
- From: K <kgspga@googlemail.com>
- ParallelTable slows down computation