I can not build CUDA project
I am having trouble with build CUDA project in CLion. I am having CLion 2020.1.2 and CUDA 11 installed on Windows 10 2004. After I create A simple CUDA project. I got following error:
With MinGW x64, the error message is like following:
C:\Users\RustedWizard\AppData\Local\JetBrains\Toolbox\apps\CLion\ch-0\201.7846.88\bin\cmake\win\bin\cmake.exe -DCMAKE_BUILD_TYPE=Debug -G "CodeBlocks - MinGW Makefiles" C:\Users\RustedWizard\CLionProjects\untitled2
-- The CUDA compiler identification is unknown
-- Check for working CUDA compiler: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.0/bin/nvcc.exe
-- Check for working CUDA compiler: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.0/bin/nvcc.exe -- broken
CMake Error at C:/Users/RustedWizard/AppData/Local/JetBrains/Toolbox/apps/CLion/ch-0/201.7846.88/bin/cmake/win/share/cmake-3.16/Modules/CMakeTestCUDACompiler.cmake:46 (message):
The CUDA compiler
"C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.0/bin/nvcc.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/Users/RustedWizard/CLionProjects/untitled2/cmake-build-debug/CMakeFiles/CMakeTmp
Run Build Command(s):C:/PROGRA~2/MINGW-~1/I686-8~1.0-P/mingw32/bin/mingw32-make.exe cmTC_d6d77/fast && C:/PROGRA~2/MINGW-~1/I686-8~1.0-P/mingw32/bin/mingw32-make.exe -f CMakeFiles\cmTC_d6d77.dir\build.make CMakeFiles/cmTC_d6d77.dir/build
mingw32-make.exe[1]: Entering directory 'C:/Users/RustedWizard/CLionProjects/untitled2/cmake-build-debug/CMakeFiles/CMakeTmp'
Building CUDA object CMakeFiles/cmTC_d6d77.dir/main.cu.obj
C:\PROGRA~1\NVIDIA~2\CUDA\v11.0\bin\nvcc.exe -x cu -c C:\Users\RustedWizard\CLionProjects\untitled2\cmake-build-debug\CMakeFiles\CMakeTmp\main.cu -o CMakeFiles\cmTC_d6d77.dir\main.cu.obj
nvcc fatal : Cannot find compiler 'cl.exe' in PATH
mingw32-make.exe[1]: *** [CMakeFiles\cmTC_d6d77.dir\build.make:65: CMakeFiles/cmTC_d6d77.dir/main.cu.obj] Error 1
mingw32-make.exe[1]: Leaving directory 'C:/Users/RustedWizard/CLionProjects/untitled2/cmake-build-debug/CMakeFiles/CMakeTmp'
mingw32-make.exe: *** [Makefile:120: cmTC_d6d77/fast] Error 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:2 (project)
-- Configuring incomplete, errors occurred!
See also "C:/Users/RustedWizard/CLionProjects/untitled2/cmake-build-debug/CMakeFiles/CMakeOutput.log".
See also "C:/Users/RustedWizard/CLionProjects/untitled2/cmake-build-debug/CMakeFiles/CMakeError.log".
[Finished]
With MSVC 2019 toolchain, the error message is like following:
C:\Users\RustedWizard\AppData\Local\JetBrains\Toolbox\apps\CLion\ch-0\201.7846.88\bin\cmake\win\bin\cmake.exe -DCMAKE_BUILD_TYPE=Debug -G "CodeBlocks - NMake Makefiles" C:\Users\RustedWizard\CLionProjects\untitled3
-- The CUDA compiler identification is unknown
-- Check for working CUDA compiler: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.0/bin/nvcc.exe
-- Check for working CUDA compiler: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.0/bin/nvcc.exe -- broken
CMake Error at C:/Users/RustedWizard/AppData/Local/JetBrains/Toolbox/apps/CLion/ch-0/201.7846.88/bin/cmake/win/share/cmake-3.16/Modules/CMakeTestCUDACompiler.cmake:46 (message):
The CUDA compiler
"C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.0/bin/nvcc.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/Users/RustedWizard/CLionProjects/untitled3/cmake-build-debug/CMakeFiles/CMakeTmp
Run Build Command(s):nmake /nologo cmTC_ec123\fast && "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.26.28801\bin\HostX86\x86\nmake.exe" -f CMakeFiles\cmTC_ec123.dir\build.make /nologo -L CMakeFiles\cmTC_ec123.dir\build
Building CUDA object CMakeFiles/cmTC_ec123.dir/main.cu.obj
C:\PROGRA~1\NVIDIA~2\CUDA\v11.0\bin\nvcc.exe -x cu -c C:\Users\RustedWizard\CLionProjects\untitled3\cmake-build-debug\CMakeFiles\CMakeTmp\main.cu -o CMakeFiles\cmTC_ec123.dir\main.cu.obj
nvcc fatal : Could not set up the environment for Microsoft Visual Studio using 'C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Tools/MSVC/14.26.28801/bin/HostX86/x86/../../../../../../../VC/Auxiliary/Build/vcvars64.bat'
NMAKE : fatal error U1077: 'C:\PROGRA~1\NVIDIA~2\CUDA\v11.0\bin\nvcc.exe' : return code '0x1'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.26.28801\bin\HostX86\x86\nmake.exe"' : return code '0x2'
Stop.
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:2 (project)
-- Configuring incomplete, errors occurred!
See also "C:/Users/RustedWizard/CLionProjects/untitled3/cmake-build-debug/CMakeFiles/CMakeOutput.log".
See also "C:/Users/RustedWizard/CLionProjects/untitled3/cmake-build-debug/CMakeFiles/CMakeError.log".
[Finished]
Anyone has any ideas?
请先登录再写评论。
In my case it was caused by the PATH environment variable being too long. The errors were solved after removing some unnecessary lines from PATH.
As your PATH variable is quite long as well, it might be worth considering this.
Got same error in CMakeError.log:
My OS is Ubuntu 20.04, and CUDA toolkit 11.0. CLion 2020.2.1
Actually, I can use the cmake 3.16.3 in ubuntu to successfully compile my project, but failed when I set it as the project cmake in clion--> setting-> Build.
Definitely I have add nvcc into the OS PATH and add following codes into CMakeList.txt
I'm having the same issue in Windows 10, tested with CUDA 10.1 and 11.1. I get the following error when enabling CUDA in cmake:
The code builds correctly from terminal if I set vcvars64.
These are my environment variables:
And this is my toolchain configuration:
Hello!
First of all: On Windows CUDA only works with the Microsoft Visual C++ toolchain - https://docs.nvidia.com/cuda/cuda-installation-guide-microsoft-windows/index.html.
Secondly: you are required to have x64 cl.exe in your PATH. Is this requirement met?
I see, I do not have cl.exe in my PATH. However, which cl.exe should I include in my PATH? since in MSVC toolchain, there're few of them, I don't know which to include?
Also, I have looked into the CMake error log, it's like following:
Seems like what it complain about is that the input is too long.
Any solutions?
Please attach a screenshot of `File | Settings | Build, Execution, Deployment | Toolchains` (please capture the screenshot after the compiler detection is completed).
I think the problem is triggered by the update of the visual studio 16.6.2. Because with toolchain "C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.26.28801/bin/Hostx64/x64/" and "C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.0/bin/nvcc.exe", I was able to compile the project. Also, with cmake gui, the nvcc pass the cmake process.
My log:
Compiling the CUDA compiler identification source file "CMakeCUDACompilerId.cu" failed.
Compiler: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.0/bin/nvcc.exe
Build flags:
Id flags: -v;--keep;--keep-dir;tmp
The output was:
1
用于 .NET Framework 的 Microsoft (R) 生成引擎版本 16.6.0+5ff7b0c9e
版权所有(C) Microsoft Corporation。保留所有权利。
生成启动时间为 2020/6/28 13:48:25。
节点 1 上的项目“C:\Users\yangy\Documents\Parallel\CuckooHashing\cmake-build-debug-visual-studio\CMakeFiles\3.17.0\CompilerIdCUDA\CompilerIdCUDA.vcxproj”(默认目标)。
PrepareForBuild:
正在创建目录“Debug\”。
正在创建目录“Debug\CompilerIdCUDA.tlog\”。
InitializeBuildStatus:
正在创建“Debug\CompilerIdCUDA.tlog\unsuccessfulbuild”,因为已指定“AlwaysCreate”。
AddCudaCompileDeps:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\bin\HostX64\x64\cl.exe /E /nologo /showIncludes /TP /D__CUDACC__ /D_MBCS /I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0\include" /I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0\bin" /I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0\include" /I. /FIcuda_runtime.h /c C:\Users\yangy\Documents\Parallel\CuckooHashing\cmake-build-debug-visual-studio\CMakeFiles\3.17.0\CompilerIdCUDA\CMakeCUDACompilerId.cu
项目“C:\Users\yangy\Documents\Parallel\CuckooHashing\cmake-build-debug-visual-studio\CMakeFiles\3.17.0\CompilerIdCUDA\CompilerIdCUDA.vcxproj”(1)正在节点 1 上生成“C:\Users\yangy\Documents\Parallel\CuckooHashing\cmake-build-debug-visual-studio\CMakeFiles\3.17.0\CompilerIdCUDA\CompilerIdCUDA.vcxproj”(1:2) (CudaBuildCore 个目标)。
CudaBuildCore:
Compiling CUDA source file CMakeCUDACompilerId.cu...
cmd.exe /C "C:\Users\yangy\AppData\Local\Temp\tmpc140474f141541609bc8ec883f938674.cmd"
"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0\bin\nvcc.exe" -gencode=arch=compute_52,code=\"sm_52,compute_52\" --use-local-env -ccbin "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\bin\HostX64\x64" -x cu -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0\include" -G --keep-dir x64\Debug -maxrregcount=0 --machine 64 --compile -cudart static -v -g -D_MBCS -Xcompiler "/EHsc /W0 /nologo /Od /FdDebug\vc142.pdb /FS /Zi /RTC1 /MDd " -o Debug\CMakeCUDACompilerId.cu.obj "C:\Users\yangy\Documents\Parallel\CuckooHashing\cmake-build-debug-visual-studio\CMakeFiles\3.17.0\CompilerIdCUDA\CMakeCUDACompilerId.cu"
C:\Users\yangy\Documents\Parallel\CuckooHashing\cmake-build-debug-visual-studio\CMakeFiles\3.17.0\CompilerIdCUDA>"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0\bin\nvcc.exe" -gencode=arch=compute_52,code=\"sm_52,compute_52\" --use-local-env -ccbin "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\bin\HostX64\x64" -x cu -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0\include" -G --keep-dir x64\Debug -maxrregcount=0 --machine 64 --compile -cudart static -v -g -D_MBCS -Xcompiler "/EHsc /W0 /nologo /Od /FdDebug\vc142.pdb /FS /Zi /RTC1 /MDd " -o Debug\CMakeCUDACompilerId.cu.obj "C:\Users\yangy\Documents\Parallel\CuckooHashing\cmake-build-debug-visual-studio\CMakeFiles\3.17.0\CompilerIdCUDA\CMakeCUDACompilerId.cu"
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\BuildCustomizations\CUDA 11.0.targets(770,9): error MSB3721: 命令“"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0\bin\nvcc.exe" -gencode=arch=compute_52,code=\"sm_52,compute_52\" --use-local-env -ccbin "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\bin\HostX64\x64" -x cu -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0\include" -G --keep-dir x64\Debug -maxrregcount=0 --machine 64 --compile -cudart static -v -g -D_MBCS -Xcompiler "/EHsc /W0 /nologo /Od /FdDebug\vc142.pdb /FS /Zi /RTC1 /MDd " -o Debug\CMakeCUDACompilerId.cu.obj "C:\Users\yangy\Documents\Parallel\CuckooHashing\cmake-build-debug-visual-studio\CMakeFiles\3.17.0\CompilerIdCUDA\CMakeCUDACompilerId.cu"”已退出,返回代码为 1。 [C:\Users\yangy\Documents\Parallel\CuckooHashing\cmake-build-debug-visual-studio\CMakeFiles\3.17.0\CompilerIdCUDA\CompilerIdCUDA.vcxproj]
已完成生成项目“C:\Users\yangy\Documents\Parallel\CuckooHashing\cmake-build-debug-visual-studio\CMakeFiles\3.17.0\CompilerIdCUDA\CompilerIdCUDA.vcxproj”(CudaBuildCore 个目标)的操作 - 失败。
已完成生成项目“C:\Users\yangy\Documents\Parallel\CuckooHashing\cmake-build-debug-visual-studio\CMakeFiles\3.17.0\CompilerIdCUDA\CompilerIdCUDA.vcxproj”(默认目标)的操作 - 失败。
生成失败。
“C:\Users\yangy\Documents\Parallel\CuckooHashing\cmake-build-debug-visual-studio\CMakeFiles\3.17.0\CompilerIdCUDA\CompilerIdCUDA.vcxproj”(默认目标) (1) ->
“C:\Users\yangy\Documents\Parallel\CuckooHashing\cmake-build-debug-visual-studio\CMakeFiles\3.17.0\CompilerIdCUDA\CompilerIdCUDA.vcxproj”(CudaBuildCore 目标) (1:2) ->
(CudaBuildCore 目标) ->
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\BuildCustomizations\CUDA 11.0.targets(770,9): error MSB3721: 命令“"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0\bin\nvcc.exe" -gencode=arch=compute_52,code=\"sm_52,compute_52\" --use-local-env -ccbin "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\bin\HostX64\x64" -x cu -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0\include" -G --keep-dir x64\Debug -maxrregcount=0 --machine 64 --compile -cudart static -v -g -D_MBCS -Xcompiler "/EHsc /W0 /nologo /Od /FdDebug\vc142.pdb /FS /Zi /RTC1 /MDd " -o Debug\CMakeCUDACompilerId.cu.obj "C:\Users\yangy\Documents\Parallel\CuckooHashing\cmake-build-debug-visual-studio\CMakeFiles\3.17.0\CompilerIdCUDA\CMakeCUDACompilerId.cu"”已退出,返回代码为 1。 [C:\Users\yangy\Documents\Parallel\CuckooHashing\cmake-build-debug-visual-studio\CMakeFiles\3.17.0\CompilerIdCUDA\CompilerIdCUDA.vcxproj]
0 个警告
1 个错误
已用时间 00:00:01.22
Compiling the CUDA compiler identification source file "CMakeCUDACompilerId.cu" failed.
Compiler: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.0/bin/nvcc.exe
Build flags:
Id flags: -v;--keep;--keep-dir;tmp
The output was:
1
用于 .NET Framework 的 Microsoft (R) 生成引擎版本 16.6.0+5ff7b0c9e
版权所有(C) Microsoft Corporation。保留所有权利。
生成启动时间为 2020/6/28 13:48:26。
节点 1 上的项目“C:\Users\yangy\Documents\Parallel\CuckooHashing\cmake-build-debug-visual-studio\CMakeFiles\3.17.0\CompilerIdCUDA\CompilerIdCUDA.vcxproj”(默认目标)。
PrepareForBuild:
正在创建目录“Debug\”。
正在创建目录“Debug\CompilerIdCUDA.tlog\”。
InitializeBuildStatus:
正在创建“Debug\CompilerIdCUDA.tlog\unsuccessfulbuild”,因为已指定“AlwaysCreate”。
AddCudaCompileDeps:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\bin\HostX64\x64\cl.exe /E /nologo /showIncludes /TP /D__CUDACC__ /D_MBCS /I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0\include" /I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0\bin" /I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0\include" /I. /FIcuda_runtime.h /c C:\Users\yangy\Documents\Parallel\CuckooHashing\cmake-build-debug-visual-studio\CMakeFiles\3.17.0\CompilerIdCUDA\CMakeCUDACompilerId.cu
项目“C:\Users\yangy\Documents\Parallel\CuckooHashing\cmake-build-debug-visual-studio\CMakeFiles\3.17.0\CompilerIdCUDA\CompilerIdCUDA.vcxproj”(1)正在节点 1 上生成“C:\Users\yangy\Documents\Parallel\CuckooHashing\cmake-build-debug-visual-studio\CMakeFiles\3.17.0\CompilerIdCUDA\CompilerIdCUDA.vcxproj”(1:2) (CudaBuildCore 个目标)。
CudaBuildCore:
Compiling CUDA source file CMakeCUDACompilerId.cu...
cmd.exe /C "C:\Users\yangy\AppData\Local\Temp\tmp9fb3b14acc084837983c20d066f1e283.cmd"
"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0\bin\nvcc.exe" -gencode=arch=compute_52,code=\"sm_52,compute_52\" --use-local-env -ccbin "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\bin\HostX64\x64" -x cu -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0\include" -G --keep-dir x64\Debug -maxrregcount=0 --machine 64 --compile -cudart static -v -g -D_MBCS -Xcompiler "/EHsc /W0 /nologo /Od /FdDebug\vc142.pdb /FS /Zi /RTC1 /MDd " -o Debug\CMakeCUDACompilerId.cu.obj "C:\Users\yangy\Documents\Parallel\CuckooHashing\cmake-build-debug-visual-studio\CMakeFiles\3.17.0\CompilerIdCUDA\CMakeCUDACompilerId.cu"
C:\Users\yangy\Documents\Parallel\CuckooHashing\cmake-build-debug-visual-studio\CMakeFiles\3.17.0\CompilerIdCUDA>"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0\bin\nvcc.exe" -gencode=arch=compute_52,code=\"sm_52,compute_52\" --use-local-env -ccbin "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\bin\HostX64\x64" -x cu -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0\include" -G --keep-dir x64\Debug -maxrregcount=0 --machine 64 --compile -cudart static -v -g -D_MBCS -Xcompiler "/EHsc /W0 /nologo /Od /FdDebug\vc142.pdb /FS /Zi /RTC1 /MDd " -o Debug\CMakeCUDACompilerId.cu.obj "C:\Users\yangy\Documents\Parallel\CuckooHashing\cmake-build-debug-visual-studio\CMakeFiles\3.17.0\CompilerIdCUDA\CMakeCUDACompilerId.cu"
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\BuildCustomizations\CUDA 11.0.targets(770,9): error MSB3721: 命令“"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0\bin\nvcc.exe" -gencode=arch=compute_52,code=\"sm_52,compute_52\" --use-local-env -ccbin "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\bin\HostX64\x64" -x cu -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0\include" -G --keep-dir x64\Debug -maxrregcount=0 --machine 64 --compile -cudart static -v -g -D_MBCS -Xcompiler "/EHsc /W0 /nologo /Od /FdDebug\vc142.pdb /FS /Zi /RTC1 /MDd " -o Debug\CMakeCUDACompilerId.cu.obj "C:\Users\yangy\Documents\Parallel\CuckooHashing\cmake-build-debug-visual-studio\CMakeFiles\3.17.0\CompilerIdCUDA\CMakeCUDACompilerId.cu"”已退出,返回代码为 1。 [C:\Users\yangy\Documents\Parallel\CuckooHashing\cmake-build-debug-visual-studio\CMakeFiles\3.17.0\CompilerIdCUDA\CompilerIdCUDA.vcxproj]
已完成生成项目“C:\Users\yangy\Documents\Parallel\CuckooHashing\cmake-build-debug-visual-studio\CMakeFiles\3.17.0\CompilerIdCUDA\CompilerIdCUDA.vcxproj”(CudaBuildCore 个目标)的操作 - 失败。
已完成生成项目“C:\Users\yangy\Documents\Parallel\CuckooHashing\cmake-build-debug-visual-studio\CMakeFiles\3.17.0\CompilerIdCUDA\CompilerIdCUDA.vcxproj”(默认目标)的操作 - 失败。
生成失败。
“C:\Users\yangy\Documents\Parallel\CuckooHashing\cmake-build-debug-visual-studio\CMakeFiles\3.17.0\CompilerIdCUDA\CompilerIdCUDA.vcxproj”(默认目标) (1) ->
“C:\Users\yangy\Documents\Parallel\CuckooHashing\cmake-build-debug-visual-studio\CMakeFiles\3.17.0\CompilerIdCUDA\CompilerIdCUDA.vcxproj”(CudaBuildCore 目标) (1:2) ->
(CudaBuildCore 目标) ->
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\BuildCustomizations\CUDA 11.0.targets(770,9): error MSB3721: 命令“"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0\bin\nvcc.exe" -gencode=arch=compute_52,code=\"sm_52,compute_52\" --use-local-env -ccbin "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\bin\HostX64\x64" -x cu -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0\include" -G --keep-dir x64\Debug -maxrregcount=0 --machine 64 --compile -cudart static -v -g -D_MBCS -Xcompiler "/EHsc /W0 /nologo /Od /FdDebug\vc142.pdb /FS /Zi /RTC1 /MDd " -o Debug\CMakeCUDACompilerId.cu.obj "C:\Users\yangy\Documents\Parallel\CuckooHashing\cmake-build-debug-visual-studio\CMakeFiles\3.17.0\CompilerIdCUDA\CMakeCUDACompilerId.cu"”已退出,返回代码为 1。 [C:\Users\yangy\Documents\Parallel\CuckooHashing\cmake-build-debug-visual-studio\CMakeFiles\3.17.0\CompilerIdCUDA\CompilerIdCUDA.vcxproj]
0 个警告
1 个错误
已用时间 00:00:01.24
Determining if the CUDA compiler works failed with the following output:
Change Dir: C:/Users/yangy/Documents/Parallel/CuckooHashing/cmake-build-debug-visual-studio/CMakeFiles/CMakeTmp
Run Build Command(s):C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/MSBuild/Current/Bin/MSBuild.exe cmTC_2b297.vcxproj /p:Configuration=Debug /p:Platform=x64 /p:VisualStudioVersion=16.0 /v:m && 用于 .NET Framework 的 Microsoft (R) 生成引擎版本 16.6.0+5ff7b0c9e
版权所有(C) Microsoft Corporation。保留所有权利。
Compiling CUDA source file main.cu...
C:\Users\yangy\Documents\Parallel\CuckooHashing\cmake-build-debug-visual-studio\CMakeFiles\CMakeTmp>"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0\bin\nvcc.exe" -gencode=arch=compute_52,code=\"sm_52,compute_52\" --use-local-env -ccbin "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\bin\HostX64\x64" -x cu -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0\include" --keep-dir x64\Debug -maxrregcount=0 --machine 64 --compile -cudart static -g -D"CMAKE_INTDIR=\"Debug\"" -D"CMAKE_INTDIR=\"Debug\"" -D_MBCS -Xcompiler "/EHsc /W1 /nologo /O2 /FdcmTC_2b297.dir\Debug\vc142.pdb /FS /Zi /MD " -o cmTC_2b297.dir\Debug\main.obj "C:\Users\yangy\Documents\Parallel\CuckooHashing\cmake-build-debug-visual-studio\CMakeFiles\CMakeTmp\main.cu"
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\BuildCustomizations\CUDA 11.0.targets(770,9): error MSB3721: 命令“"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0\bin\nvcc.exe" -gencode=arch=compute_52,code=\"sm_52,compute_52\" --use-local-env -ccbin "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\bin\HostX64\x64" -x cu -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0\include" --keep-dir x64\Debug -maxrregcount=0 --machine 64 --compile -cudart static -g -D"CMAKE_INTDIR=\"Debug\"" -D"CMAKE_INTDIR=\"Debug\"" -D_MBCS -Xcompiler "/EHsc /W1 /nologo /O2 /FdcmTC_2b297.dir\Debug\vc142.pdb /FS /Zi /MD " -o cmTC_2b297.dir\Debug\main.obj "C:\Users\yangy\Documents\Parallel\CuckooHashing\cmake-build-debug-visual-studio\CMakeFiles\CMakeTmp\main.cu"”已退出,返回代码为 1。 [C:\Users\yangy\Documents\Parallel\CuckooHashing\cmake-build-debug-visual-studio\CMakeFiles\CMakeTmp\cmTC_2b297.vcxproj]
Chensike89 victoryang00 please provide the following information:
nvcc --dryrun <some_cuda_file>
in terminal and attach the output.I can still build a cuda project by visual studio and it can be compiled successfully. But when i use Clion it failed with the same problem.
Can u help me? thanks a lot
.../x64 has already in my path.
ails with the following output:
Change Dir: E:/Code/CUDA/cuda1/cmake-build-debug/CMakeFiles/CMakeTmp
Run Build Command(s):nmake /nologo cmTC_25808\fast && "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.26.28801\bin\HostX64\x64\nmake.exe" -f CMakeFiles\cmTC_25808.dir\build.make /nologo -L CMakeFiles\cmTC_25808.dir\build
Building CUDA object CMakeFiles/cmTC_25808.dir/main.cu.obj
C:\PROGRA~1\NVIDIA~2\CUDA\v11.0\bin\nvcc.exe -x cu -c E:\Code\CUDA\cuda1\cmake-build-debug\CMakeFiles\CMakeTmp\main.cu -o CMakeFiles\cmTC_25808.dir\main.cu.obj
nvcc fatal : Could not set up the environment for Microsoft Visual Studio using 'C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Tools/MSVC/14.26.28801/bin/HostX64/x64/../../../../../../../VC/Auxiliary/Build/vcvars64.bat'
Having the same problem with CUDA 11.0, MSVC 14.26, and CLion 2020.2 Beta...
I cannot get over it...
Hi all!
Unfortunately, we didn't manage to reproduce the issue on our side.
We kindly ask you to do the following:
Following is my PATH:
User:
System:
Result from set PATH
I have just download and installed latest CUDA from Nvidia and confirmed that my Nvidia driver is the latest
I have the same problem, though the strange thing is that it worked just fine yesterday and I have no idea what has changed. I am using CLion 2020.3, MSVC 2019 14.28.29333 on Windows 10 (version 10.0.19042 Build 19042) and CMake 3.19.2 (but the same problem persists with the bundled cmake). The cmake project builds without issue using powershell but in CLion fails with
```
D:\cmake\cmake-3.19.2-win64-x64\cmake-3.19.2-win64-x64\bin\cmake.exe -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../install-msvc -G "CodeBlocks - NMake Makefiles" D:\CUDATests
-- The CUDA compiler identification is unknown
-- The CXX compiler identification is MSVC 19.28.29335.0
-- The C compiler identification is MSVC 19.28.29335.0
-- Detecting CUDA compiler ABI info
CMake Error in D:/CUDATests/cmake-build-release-visual-studio-x64/CMakeFiles/CMakeTmp/CMakeLists.txt:
CUDA_ARCHITECTURES is empty for target "cmTC_1c198".
CMake Error in D:/CUDATests/cmake-build-release-visual-studio-x64/CMakeFiles/CMakeTmp/CMakeLists.txt:
CUDA_ARCHITECTURES is empty for target "cmTC_1c198".
CMake Error at D:/cmake/cmake-3.19.2-win64-x64/cmake-3.19.2-win64-x64/share/cmake-3.19/Modules/CMakeDetermineCompilerABI.cmake:48 (try_compile):
Failed to generate test project build system.
Call Stack (most recent call first):
D:/cmake/cmake-3.19.2-win64-x64/cmake-3.19.2-win64-x64/share/cmake-3.19/Modules/CMakeTestCUDACompiler.cmake:19 (CMAKE_DETERMINE_COMPILER_ABI)
CMakeLists.txt:2 (project)
-- Configuring incomplete, errors occurred!
See also "D:/CUDATests/cmake-build-release-visual-studio-x64/CMakeFiles/CMakeOutput.log".
See also "D:/CUDATests/cmake-build-release-visual-studio-x64/CMakeFiles/CMakeError.log".
[Failed to reload]
```
The CMake error log from the build tree used by CLion is:
```
CLion Toolchains:
Indeed, I had the same issue and it's resolved by making PATH shorter!
Thanks.