
上QQ阅读APP看书,第一时间看更新
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