Chapter 4


This chapter goes into depth on the map pattern, introduced in Section 3.3.2. Both serial and parallel versions of this pattern are given in Figure 4.1. The map pattern compresses the time it takes to execute a loop, but it only applies when all instances of the loop body are independent.


Figure 4.1 Serial and parallel execution of a map pattern. In the map pattern, an elemental function is applied to all elements of a collection, producing a new collection with the same shape as the input. In serial execution, a map is often implemented as a loop (with each instance of the loop body consisting of one invocation of the elemental function), ...

Get Structured Parallel Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.