繁体   English   中英

将 CUDA 计算能力确定为 __launch_bounds__ 的 constexpr

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM