# what does the "dimension" of a block(or grid) mean some basic idea of CUDA

Hi, anyone,

I’m now very interested in CUDA though I’m a totally freshman.

My GPU is GTX 260+, from the device query in the GPU SDK, we can see that
“maximum size of each dimension of a block: 51251264”
“maximum size of each dimension of a grid: 65535655351”
Can anyone give me a detail description on what the above mean? For example, for a block, does “51251264” mean that the block has three dimensions, and we can assign at most 512 threads along X-axis, 512 threads along Y-axis, 64 threads along Z-axis? If not ,what does the number “512” and “64” mean?

Thanks a lot

Hi, anyone,

I’m now very interested in CUDA though I’m a totally freshman.

My GPU is GTX 260+, from the device query in the GPU SDK, we can see that
“maximum size of each dimension of a block: 51251264”
“maximum size of each dimension of a grid: 65535655351”
Can anyone give me a detail description on what the above mean? For example, for a block, does “51251264” mean that the block has three dimensions, and we can assign at most 512 threads along X-axis, 512 threads along Y-axis, 64 threads along Z-axis? If not ,what does the number “512” and “64” mean?

Thanks a lot

I think block dimension is capacity of thread in block for that dimension. But for block, there’s maximum in # of threads.
So dim_x * dim_y * dim_z <= maximum thread in a block need to be satisfied.

Same idea for Grid dimension too.

I think block dimension is capacity of thread in block for that dimension. But for block, there’s maximum in # of threads.
So dim_x * dim_y * dim_z <= maximum thread in a block need to be satisfied.

Same idea for Grid dimension too.

that is correct. i was confused about this too. see http://forums.nvidia.com/lofiversion/index.php?t177420.html

threadDim does not exist.

blockDim is how many threads in a block.

gridDim is how many blocks in a grid.

gridIdx does not exist. there is always exactly 1 grid. (per invocation of a kernel by a host)

a little confusing if you ask me. i’m use to, and was expecting, all those dims to be demoted down one level such that threadDim would exist and gridDim wouln’t. and threaddim would refer to number of threads and blockdim to number of blocks. seems to me that would be simpler and more intuitive. but that’s not the way nvidia did it. and it’d be pretty tough to change it now.

anyways, yes, you are correct.

that is correct. i was confused about this too. see http://forums.nvidia.com/lofiversion/index.php?t177420.html

threadDim does not exist.

blockDim is how many threads in a block.

gridDim is how many blocks in a grid.

gridIdx does not exist. there is always exactly 1 grid. (per invocation of a kernel by a host)

a little confusing if you ask me. i’m use to, and was expecting, all those dims to be demoted down one level such that threadDim would exist and gridDim wouln’t. and threaddim would refer to number of threads and blockdim to number of blocks. seems to me that would be simpler and more intuitive. but that’s not the way nvidia did it. and it’d be pretty tough to change it now.

anyways, yes, you are correct.