Cannot compile newly crated Cuda project
已回答
Hey,
I'm trying to start a Cuda project with CLion.
I'm on Windows 11, using the Visual Studio toolchain:

nvcc is on the path:
> nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2021 NVIDIA Corporation
Built on Mon_May__3_19:41:42_Pacific_Daylight_Time_2021
Cuda compilation tools, release 11.3, V11.3.109
Build cuda_11.3.r11.3/compiler.29920130_0
Immediately after creating a new "Cuda Executable" project with the default settings I get the following error in the CMake log:
C:\Users\Karel\AppData\Local\JetBrains\Toolbox\apps\CLion\ch-0\211.7442.42\bin\cmake\win\bin\cmake.exe -DCMAKE_BUILD_TYPE=Debug -G "CodeBlocks - NMake Makefiles" C:\Users\Karel\Desktop\untitled
-- The CUDA compiler identification is unknown
-- Detecting CUDA compiler ABI info
CMake Error in C:/Users/Karel/Desktop/untitled/cmake-build-debug/CMakeFiles/CMakeTmp/CMakeLists.txt:
CUDA_ARCHITECTURES is empty for target "cmTC_1fd33".
CMake Error in C:/Users/Karel/Desktop/untitled/cmake-build-debug/CMakeFiles/CMakeTmp/CMakeLists.txt:
CUDA_ARCHITECTURES is empty for target "cmTC_1fd33".
CMake Error at C:/Users/Karel/AppData/Local/JetBrains/Toolbox/apps/CLion/ch-0/211.7442.42/bin/cmake/win/share/cmake-3.19/Modules/CMakeDetermineCompilerABI.cmake:48 (try_compile):
Failed to generate test project build system.
Call Stack (most recent call first):
C:/Users/Karel/AppData/Local/JetBrains/Toolbox/apps/CLion/ch-0/211.7442.42/bin/cmake/win/share/cmake-3.19/Modules/CMakeTestCUDACompiler.cmake:19 (CMAKE_DETERMINE_COMPILER_ABI)
CMakeLists.txt:2 (project)
-- Configuring incomplete, errors occurred!
See also "C:/Users/Karel/Desktop/untitled/cmake-build-debug/CMakeFiles/CMakeOutput.log".
See also "C:/Users/Karel/Desktop/untitled/cmake-build-debug/CMakeFiles/CMakeError.log".
[Failed to reload]
I tried various things to fix this:
- create a new project again
- adding set(CUDA_ARCHITECTURES 70) in CMakeLists
- adding -DCUDA_ARCHITECTURES=70 in the CMake options field in settings
- setting CMAKE_CUDA_COMPILER to the nvcc path as described here: https://www.jetbrains.com/help/clion/cuda-projects.html#set-nvcc
None of these options solved my issue.
What could be going wrong here? Thanks!
请先登录再写评论。
Hello!
Please select
amd64in theArchitecturefield of the toolchain. It should help with the default CUDA project.I had the exact same problem as OP, and selecting amd64, in addition to setting Visual Studio as the default (as opposed to MinGW) in architecture fixed it for me.
However, this seems to be a bug, why did it default to x86? Shouldn't it be obvious to CLion that my computer is amd64 architecture?