Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

maximum number of threads per block

Tags:

cuda

gpu

i have the following information:

Maximum number of threads per block:           512
Maximum sizes of each dimension of a block:    512 x 512 x 64

does this mean that the maximum number of threads in a 2d thread block is 512x512 which gives me a 262144 threads in every block?
if yes, then is it a good practice to have this number of threads in a a kernel of minimum 256 blocks?

like image 466
lina Avatar asked Jul 07 '11 15:07

lina


2 Answers

No, it means that the maximum threads per block is 512,

You can decide how to lay that out over [1 ... 512] x [1 ... 512] x [1 ... 64].

For instance 16x16 would be ok in 2D.

As for the deciding on the size of the block, lots of things come into consideration, like the amount of memory a block needs and how big a half-warp is on the hardware (I don't remember if its always 16 on Nvidia hardware).

like image 75
Martin Kristiansen Avatar answered Jan 22 '23 21:01

Martin Kristiansen


No, that means that your block can have 512 maximum X/Y or 64 Z, but not all at the same time. In fact, your info already said the maximum block size is 512 threads. Now, there is no optimal block, as it depends on the hardware your code is running on, and also depends on your specific algorithm.

like image 44
Vitor Avatar answered Jan 22 '23 21:01

Vitor