
上QQ阅读APP看书,第一时间看更新
Scatter
In a scatter pattern, a thread or a task takes a single input and computes where in the memory it should write the output. Array sorting is an example of a scatter operation. It can also be one-to-many operations. The code for scatter pattern will look as follows:
out[i-1] += 2 * in[i] and out[i+1] += 3*in[i]