How to define iDs grids, blocks & threads?


I would like to know how to define a 1D block. I went through the programming guide, but can only find something about 2D and 3D blocks. How could I retrieve the thread ID from a 1D block?


In a 1D block, you use the .x fields: threadIdx.x, blockDim.x

The .y and .z fields are set to 1.


Here is how to define a 2D block and 2D grid:

dim3 dimBlock(BLOCK_SIZE, BLOCK_SIZE);

dim3 dimGrid(wB / dimBlock.x, hA / dimBlock.y);

Then how can I define a 1D block?


dim3 dimBlock(BLOCK_SIZE);
dim3 dimGrid(wB / dimBlock.x);

Thanks all!!!