When several thread is executed in parallel, they follow a certain communication pattern that indicates where it is taking inputs and where it is writing its output in memory. We will discuss each communication pattern one by one. It will help you to identify communication patterns related to your application and how to write code for that.
Parallel communication patterns
Map
In this communication pattern, each thread or task takes a single input and produces a single output. Basically, it is a one-to-one operation. The vector addition program and element-wise squaring program, seen in the previous sections, are examples of the map pattern. The code of the map pattern will look as follows:
d_out[i] = d_in[i] * 2...