Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'Parallelising - troubleshooting' topicStudent Support Forum > General > Archives > "Parallelising - troubleshooting"

Next Comment >Help | Reply To Topic
Author Comment/Response
Wade
10/06/11 06:14am

I have a Map that is taking too long, and since it's embarrassingly parallel, I thought I'd try the ParallelMap function.

The statement looks like this:
data = ParallelMap[(counter++; {p, #1, g[p, #1, a, b]}) &, mesh];

I've shared the counter variable using
SetSharedVariable[counter];

I haven't distributed any definitions, since my understanding is that ParallelMap is clever enough to share everything that's necessary. Is that correct?

g is a fairly complicated function, which does use a few different global variables.

At the moment, it appears to run the function g[] sequentially on the master kernal - if I put a Print[$KernalID] in the virtual function above, I get the IDs of the 4 sub-kernals, but if I put Print[$KernalID] inside the function g, I get the ID of the master kernal. It takes as long to run as with just regular Map.

I don't get any errors or warnings.

Any ideas?

Thanks,

Wade (PhD student, Australia)



URL: ,

Subject (listing for 'Parallelising - troubleshooting')
Author Date Posted
Parallelising - troubleshooting Wade 10/06/11 06:14am
Re: Parallelising - troubleshooting qm2008q 11/25/11 07:16am
Next Comment >Help | Reply To Topic