Help with CMAKE_CUDA_ARCHITECTURES resulting in incorrect nvcc compiler flags

Brian Rosenberger
Fri, 11 Jun 2021 12:12:21 +0000
Usage

Hi,

I am trying to build against CUDA, but get a compiler error:
nvcc fatal : ‘sm_53’ is not in ‘keyword=value’ format

from
set(CMAKE_CUDA_ARCHITECTURES 53 75)

The command line generated is
C:\PROGRA~1\NVIDIA~2\CUDA\v11.2\bin\nvcc.exe -forward-unknown-to-host-compiler --options-file output\CMakeFiles\samediff_obj.dir\ops\declarable\helpers\cuda\imagesHelpers.cu.obj.rsp -MD -MT output\CMakeFiles\samediff_obj.dir\ops\declarable\helpers\cuda\imagesHelpers.cu.obj -MF output\CMakeFiles\samediff_obj.dir\ops\declarable\helpers\cuda\imagesHelpers.cu.obj.d -x cu -c …\src\main\cpp\blas\ops\declarable\helpers\cuda\imagesHelpers.cu -o output\CMakeFiles\samediff_obj.dir\ops\declarable\helpers\cuda\imagesHelpers.cu.obj -Xcompiler=-Fdoutput\CMakeFiles\samediff_obj.dir,-FS

with the option file being:
-D__CUDABLAS__=true -Imkldnn-build\include -Imkldnn-src\include -Imkldnn-build -Iflatbuffers-src\include -Isrc\main\include -I…\src\main\cpp\blas\samediff_obj -I…\src\main\cpp\blas\PUBLIC -I…\src\main\cpp\blas. -D_WINDOWS -Xcompiler=" /EHsc" -DCUDA_VERSION_MAJOR= -w --cudart=static --expt-extended-lambda -Xfatbin -compress-all -Xcompiler="-O2 -Ob2" -DNDEBUG –generate-code=arch=compute_53,code=[compute_53,sm_53] --generate-code=arch=compute_75,code=[compute_75,sm_75] -std=c++14

It does work when the --generate-code parameter is wrapped in quotes like this
–generate-code=“arch=compute_53,code=[compute_53,sm_53]” --generate-code="arch=compute_75,code=[compute_75,sm_75]"

Building on Windows, MSYS, MingW64, Ninja
cmake 3.20.3

Anyone has an idea how to fix that?
Thanks

Bru

2 posts - 2 participants