I am new to CUDA. I know grid is 2D and thread could be 3D.
I want to write a device function to compute the result:
idx = blockIdx.x * blockDim.x + threadIdx.x;
idy = blockIdx.y * blockDim.y + threadIdx.y;
idz = ?
result [index] = a[idx] + b [idy] + c[idz];
index is the 1D index structure of the resulting 3D data, it’s computed by idx, idy and idz
idx, idy and idz relates to the threadIdx
Is there any easy way to do it without breaking down the y-z relationship into 1D?