int index_x = blockIdx.x * blockDim.x + threadIdx.x;
int index_y = blockIdx.y * blockDim.y + threadIdx.y;
// map the two 2D indices to a single linear, 1D index
int grid_width = gridDim.x * blockDim.x;
int i = index_y * grid_width + index_x;
You must Log In to send a PM.
Please Log In | Register to add a comment.
Not a member? Register Now