MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: ParallelTable[ ]

  • To: mathgroup at smc.vnet.net
  • Subject: [mg100807] Re: ParallelTable[ ]
  • From: "Sjoerd C. de Vries" <sjoerd.c.devries at gmail.com>
  • Date: Sun, 14 Jun 2009 21:19:22 -0400 (EDT)
  • References: <h0vtju$74n$1@smc.vnet.net>

Can't check it now since I am currently working a single core laptop
which uses 1.7 and 1.6 seconds for these calculations, respectively.

Since parallel computing will have some overhead for interprocess
communication (initialisation, data transport etc.) you will need a
computation that takes really long so that the overhead is small
compared to that. Try to increase the length of the table by a factor
of 100. Actually, I think you'll gain most if every computational step
takes longer than just the evaluation of i^2. Try something like an
integration or a simplication of something non-trivial.

Some time is spend in generating the output (and suppressing it, as it
is too long).  This is the reason between the Timing and
AbsoluteTiming timings.
Timing just gives you the amount of CPU time spend by the kernel in
actual calculations whereas AbsoluteTiming also takes into account the
time the frontend spends in displaying stuff.

Cheers -- Sjoerd

On Jun 13, 12:04 pm, "Scot Martin" <smar... at seas.harvard.edu> wrote:
> Just started looking at the parallel computing. This seems a very good
> option for me because any "long" calculations I have are usually tied to
> list manipulation.
>
> For background,$ProcessorCount returns "2" on my machine.
>
> I tried this command:
>
> AbsoluteTiming[ParallelTable[i^2, {i, 1000000}]]
>
> The required time was 9.28 s.
>
> I followed with this command:
>
> AbsoluteTiming[Table[i^2, {i, 1000000}]]
>
> The requied time was 0.86 s.
>
> So, you can imagine my confusion. Can anyone explain why parallel table
> generation took 10 times as long?
>
> [Incidentally and perhaps related, the command of Timing[ParallelTable[i^=
2,
> {i, 1000000}]] takes 0.078 s. This leaves me very confused because the
> computer obviously take much longer to execute, i.e., I am sitting at my
> console for closer to 9.28 s than 0.078 s. The command of Timing[Table[i^=
2,
> {i, 1000000}]] takes 0.875 s. What gives?]
>
> Looking forward to everyone's insights!



  • Prev by Date: Re: weird escaping problem with StringPattern inside Module[]
  • Next by Date: Re: Re: ParallelTable[ ]
  • Previous by thread: Re: Re: ParallelTable[ ]
  • Next by thread: Problem of NUMERICAL constraints (Ndsolve) with Nminimize