lina
lina

Reputation: 1707

maximum number of threads per block

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?

Upvotes: 9

Views: 15069

Answers (2)

Martin Kristiansen
Martin Kristiansen

Reputation: 10222

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).

Upvotes: 12

Vitor
Vitor

Reputation: 2792

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.

Upvotes: 1

Related Questions