如何确定以下内存访问是否已合并:
// Thread-ID
int idx = blockIdx.x * blockDim.x + threadIdx.x;
// Offset:
int offset = gridDim.x * blockDim.x;
while ( idx < NUMELEMENTS )
{
// Do Something
// ....
// Write to Array which contains results of calculations
results[ idx ] = df2;
// Next Element
idx += offset;
}
NUMELEMENTS
是要处理的单个数据元素的完整数量。该数组results
作为指针传递给内核函数,并在之前分配到全局内存中。
我的问题:行中的写访问是否results[ idx ] = df2;
合并?
我相信这是因为每个线程都处理连续的索引项,但我对此并不完全确定并且我不知道如何判断。
谢谢!