Database Reference
In-Depth Information
In both the cases, pmap is more than twice as fast when running it on a machine with
eight cores.
How it works…
Parallelization is a balancing act. If each separate work item is small, the overhead of creating
threads, coordinating between them, and passing data back and forth takes more time than
doing the work itself. However, when each thread has enough to do, we can get nice speedups
just by using pmap .
Behind the scenes, pmap takes each item and uses future to run it in a thread pool. It forces
only a couple of more items than the number of processors, so it keeps your machine busy
without generating more work or data than you need.
There's more…
For an in-depth, excellent discussion on the nuts and bolts of pmap , along with pointers
about things to watch out for, check out David Liebke's talk, From Concurrency to Parallelism
( http://youtu.be/ZampUP6PdQA ).
See also
F In the Partitioning Monte Carlo simulations for better pmap performance recipe,
later in this chapter, we'll take a look at a trick to make smaller tasks more suitable
for parallelization using pmap
 
Search WWH ::




Custom Search