Re: Re: ParallelTable[ ]
- To: mathgroup at smc.vnet.net
- Subject: [mg100815] Re: [mg100801] Re: ParallelTable[ ]
- From: "Scot T. Martin" <smartin at seas.harvard.edu>
- Date: Sun, 14 Jun 2009 21:20:52 -0400 (EDT)
- References: <h0vtju$74n$1@smc.vnet.net> <200906140941.FAA14862@smc.vnet.net>
Jens, Thanks for for getting back to me on this. This is really my first foray into any attempts at parallel computing. I was imagining that ParallelTable[i^2, {i, 1000000}]] might be broken down to two processors, e.g., one processor takes items 1 to 500000 and the other processor takes items 500001 to 1000000. I am thinking that the overall computation should therefore be roughly twice as fast (after taking into account some time costs associated with reconstructing a unified list when the two processors report back, plus some general inefficiency in distribution of the problem (i.e., probably not best to put 500000 on each processor for an i^2 problem)). I think you're saying in the email below that the overhead from reconstructing a unified list exceeds the gain from distribution across two processors. So, if a seemingly straightforward divide-and-conquer problem does not speed up, what are the kinds of problems that ParrallelTable is good at and helps with? Scot On Sun, 14 Jun 2009, Jens-Peer Kuska wrote: > Hi, > > ParallelTable[] take longer, because parallel computing take > usual longer than serial one. Since the data must be distributed > to the processors and the results must be collected additional > to the original work, it must take longer ! You can't do more > and expect it will be faster. > > Regards > Jens > > Scot Martin 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! >> > >
- References:
- Re: ParallelTable[ ]
- From: Jens-Peer Kuska <kuska@informatik.uni-leipzig.de>
- Re: ParallelTable[ ]