Chapter 4

Map

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.

image

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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.