| 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: , |
|