Hi all,
I’m moving some of our internal libraries that use CUDA to cmake to generate a solution for Visual Studio (and then create conan packages from them).
I need to support different versions of CUDA (at the moment at least 10.0 and 11.1 , but more will be come in future).
I use the FindCUDAToolkit module to find the selected CUDA version, but I’m not able to force cmake to use these information when I specify CUDA as language to “cross compile” .cu files (i.e. project(${TARGET_NAME} LANGUAGES CXX CUDA VERSION ${TARGET_VERSION})
)
Some details:
I have a (cache) variable that defines the required CUDA version (AIENGINE_CUDA_VERSION="10.0"
)
FindCUDAToolkit is able to find the required cuda version, I use
# Set the CUDA toolkit root to point to our desiderate version
set(CUDAToolkit_ROOT "C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v${AIENGINE_CUDA_VERSION}")
# Check if the desiderate CUDA version exist
find_package(CUDAToolkit "${AIENGINE_CUDA_VERSION}" REQUIRED EXACT )
succeed with
-- Found CUDAToolkit: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.0/include (found suitable exact version "10.0.130")
But for some reason i’m not able to force cmake to actually use this version.
After the
project(${TARGET_NAME} LANGUAGES CXX CUDA VERSION ${TARGET_VERSION})
i get
-- The CUDA compiler identification is NVIDIA 11.1.74
-- Detecting CUDA compiler ABI info
-- Detecting CUDA compiler ABI info - done
-- Check for working CUDA compiler: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.1/bin/nvcc.exe - skipped
-- Detecting CUDA compile features
-- Detecting CUDA compile features - done
and then the generate solution is invalid.
I tweak some variables before the project command and apparently I’m able to force cuda 10.0
-- The CUDA compiler identification is NVIDIA 10.0.130
-- Detecting CUDA compiler ABI info
-- Detecting CUDA compiler ABI info - done
-- Check for working CUDA compiler: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.0/bin/nvcc.exe - skipped
-- Detecting CUDA compile features
-- Detecting CUDA compile features - done
but when I open the solution it still want to use the nvcc from cuda 11.1.
I’m sure that i miss something.
Someone can help me or gives me some hints?
Thanks