CUDA: Replacement for (CUDA_SELECT_NVCC_ARCH_FLAGS and) CUDA_DETECT_INSTALLED_GPUS
(editing this issue description following... a bunch of events and the change of title.)
The FindCUDA
module is now deprecated. However, it contains some functionality which is useful and important, and not offered elsewhere via supported CMake mechanisms: The ability to determine which CUDA architectures the system's GPU has (with some default fallback). This currently "resides" in FindCUDA/select_compute_arch.cmake
, and is used by some(? many?) to set CUDA_ARCHITECTURES
values in recent version of CMake, or append to CUDA_NVCC_FLAGS
in earlier versions.
Now, TARGET_CMAKE_ARCHITRECTURES, plus a resolution of #22375 (closed), should obviate CUDA_SELECT_NVCC_ARCH_FLAGS
. But even if we are able to tell CMake to "just decide yourself which CUDA architectures to have the CUDA compiler target", it is still useful in many scenarios for the CMake user to have that information available when running their script Since select_compute_arch.cmake
is not officially offered to users, and unsupported when issues come up (e.g. #22386 (closed)) - itss CUDA_DETECT_INSTALLED_GPUS
function not the answer.
So, this is a request to have CMake offer a command/function which produces a proper list of the CUDA architrectures of GPUs on the system, in the format accepted by CUDA_ARCHITECTURES
+ better documentation for that format.