Skip to content
Prev 632 / 2152 Next

How to check if %dopar% really run parallel?

There is a mistake.  Rather than:

    times(10000) %dopar% fun

you should write:

    times(10000) %dopar% fun()

On my machine, "fun" executes in about 0.4 seconds, so executing
it 10,000 times should take over an hour to execute.  Your error turned
a real program into a toy program.  The error also resulted in more
communication, since now the function itself is being returned by the
workers.

When I ran your benchmark on my machine with 100, rather than 10,000
tasks, I got the following results:

   user  system elapsed
 43.573   0.191  43.823
   user  system elapsed
  0.093   0.007  24.890

That's not so bad.

- Steve
On Tue, May 4, 2010 at 12:22 AM, Mario Valle <mvalle at cscs.ch> wrote: