[英]Determining CUDA compute capability as constexpr for __launch_bounds__
In order to launch a CUDA kernel efficiently I'd like to use __launch_bounds__
with arguments that depend on the maximal threads per SM allowed in the current GPU, which in turn depends on that GPU's compute capability.
一种方法是通过从cudaGetDeviceProperties
返回的cudaDeviceProp
结构。 不幸的是,这不行: __launch_bounds__
要求其 arguments 为constexpr
。 因此,我不能调用cudaGetDeviceProperties
来指定__launch_bounds__
。
因此问题是:如何在编译时确定每个 SM 的最大线程数(首选)或 CUDA 功能编号,以便我可以将其传递给__launch_bounds__
?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.