【问题标题】:Can not open a CUDA project in the CLion IDE无法在 CLion IDE 中打开 CUDA 项目
【发布时间】:2020-07-12 08:51:35
【问题描述】:

我最近开始使用新的 CLion 2020 版本学习 CUDA。我在使用 CUDA 11.0 和 CLion 2020.2 EAP 的 Windows 机器上(在稳定版 2020.1.2 上也是如此)

从项目向导打开一个新项目时,我从 CMake 收到此错误:

-- The CUDA compiler identification is unknown
-- Detecting CUDA compiler ABI info
-- Detecting CUDA compiler ABI info - failed
-- 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:/Program Files/CMake/share/cmake-3.18/Modules/CMakeTestCUDACompiler.cmake:52 (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/AregevDev/Desktop/CudaTest/cmake-build-debug/CMakeFiles/CMakeTmp
    
    Run Build Command(s):nmake /nologo cmTC_56b95\fast &&   "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\bin\HostX64\x64\nmake.exe"  -f CMakeFiles\cmTC_56b95.dir\build.make /nologo -L                  CMakeFiles\cmTC_56b95.dir\build
    Building CUDA object CMakeFiles/cmTC_56b95.dir/main.cu.obj
        C:\PROGRA~1\NVIDIA~2\CUDA\v11.0\bin\nvcc.exe      -c C:\Users\AregevDev\Desktop\CudaTest\cmake-build-debug\CMakeFiles\CMakeTmp\main.cu -o CMakeFiles\cmTC_56b95.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/Community/VC/Tools/MSVC/14.26.28801/bin/HostX64/x64/../../../../../../../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\Community\VC\Tools\MSVC\14.26.28801\bin\HostX64\x64\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/AregevDev/Desktop/CudaTest/cmake-build-debug/CMakeFiles/CMakeOutput.log".
See also "C:/Users/AregevDev/Desktop/CudaTest/cmake-build-debug/CMakeFiles/CMakeError.log".

我在PATH 中有cl.exe。从 VS 开发人员提示符运行它时,它确实有效。 我的设置页面如下所示:

我不知道它有什么问题,也许 CUDA 支持坏了

【问题讨论】:

    标签: cuda clion jetbrains-ide


    【解决方案1】:

    您需要使用与 CLion 捆绑的 CMake。您当前使用的 cmake 版本不受支持。单击 CMake 选项,您将能够看到列为“捆绑”的 CMake。

    【讨论】:

      猜你喜欢
      • 2021-04-19
      • 2015-10-08
      • 2018-08-08
      • 1970-01-01
      • 1970-01-01
      • 2014-03-18
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多