Gumbly jr.
Gumbly jr.

Reputation: 739

CUDA - specifying optimum grid dimensions

I understand that when specifying a threadblock, it is recommended to create it with number of threads equal to some multiple of 32, since warp size is 32. Is it then advisable also to specify grid dimensions multiples of 32?

Upvotes: 0

Views: 74

Answers (1)

Robert Crovella
Robert Crovella

Reputation: 151869

Grids are processed in units of blocks. There's no particular dependence on 32 for the number of blocks - all blocks are independent of each other.

It is usually advisable to have at least enough blocks to saturate the GPU if possible. The rule of thumb here is a bit squishy, but shooting for at least 4-8 blocks for each SM in your GPU is usually a good starting point. Problem sizes smaller than this may not saturate the GPU.

Upvotes: 3

Related Questions