CUDA/NVCC/Windows/Ninja: CUDA architecture flags break in response files
Hi, I use CMake to compile CUDA accelerated code. I set the CUDA architectures according to the docs as
#...
set(CMAKE_CUDA_ARCHITECTURES 50 52 60 61 70 75 80 86)
#...
However on Windows nvcc throws the following error:
[1/7] Building CUDA object CMakeFiles\spline_psf_cu_impl.dir\src\spline_psf_gpu.cu.obj
FAILED: CMakeFiles/spline_psf_cu_impl.dir/src/spline_psf_gpu.cu.obj
C:\PROGRA~1\NVIDIA~2\CUDA\v11.7\bin\nvcc.exe -forward-unknown-to-host-compiler --options-file CMakeFiles\spline_psf_cu_impl.dir\src\spline_psf_gpu.cu.obj.rsp -MD -MT CMakeFiles\spline_psf_cu_impl.dir\src\spline_psf_gpu.cu.obj -MF CMakeFiles\spline_psf_cu_impl.dir\src\spline_psf_gpu.cu.obj.d -x cu -rdc=true -c %SRC_DIR%\cpp_cuda_c\src\spline_psf_gpu.cu -o CMakeFiles\spline_psf_cu_impl.dir\src\spline_psf_gpu.cu.obj -Xcompiler=-FdCMakeFiles\spline_psf_cu_impl.dir\spline_psf_cu_impl.pdb,-FS
nvcc fatal : 'sm_52' is not in 'keyword=value' format
I believe this should be a CMake bug, no? The build on linux works fine. You can take a look at the GH Action log
or reproduce it with a fork of this https://github.com/Haydnspass/SplinePSF/commit/0326f76e492b9aa54c8ff0088764da843d047257
Interestingly the status badge is still green even if the build fails. PS: CMake also seems not too handle to long lines on windows, that's why I have to set https://github.com/Haydnspass/SplinePSF/blob/0326f76e492b9aa54c8ff0088764da843d047257/cpp_cuda_c/CMakeLists.txt#L7