maximum number of threads per block

和自甴很熟 提交于 2019-12-08 17:30:24

问题


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?


回答1:


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




回答2:


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.



来源:https://stackoverflow.com/questions/6612935/maximum-number-of-threads-per-block

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!