As the title states: what exactly is the difference between @parallel
and pmap
? I don't mean the obvious one's a macro for a loop and the other works on functions, I mean how exactly does their implementation differ and how should I use this knowledge to choose between them?
The reason I ask is that a lot of the applications I write could use either construct: I could write a loop and calculate something with @parallel
, or wrap what would have been in the loop into a function and call pmap
on that. I have been following the advice of using @parallel
for things which are quick to evaluate and pmap
for calls where each task takes much longer (as it states in the documentation), but I feel that if I have a better understanding of what it's doing I'd be able to make better choices.
For example: does @parallel
divide up the work before evaluating? I noticed that if I run a parallel loop where each inner call takes a random amount of time, @parallel
can take a long time because at the end I have very few processes still working. pmap
on the same microtests doesn't seem to have this: is pmap
re-distributing the work as needed?
Other questions like this all stem from my ignorance of what exactly how pmap
differs from @parallel
.