执行cmake ..失败求助:CUDA编译器报sm_30未定义错误
问题:CMake执行
cmake ..时CUDA编译失败 环境信息
- GPU:Nvidia GeForce RTX 3050 Ti Laptop GPU
- 运行环境:WSL Ubuntu 18.04
- CMake版本:
cmake version 3.17.0 CMake suite maintained and supported by Kitware (kitware.com/cmake).
错误详情
执行cmake ..命令时,出现如下错误:
-- The CUDA compiler identification is unknown -- Check for working CUDA compiler: /usr/bin/nvcc -- Check for working CUDA compiler: /usr/bin/nvcc - broken CMake Error at /usr/local/lib/python2.7/dist-packages/cmake/data/share/cmake-3.17/Modules/CMakeTestCUDACompiler.cmake:46 (message): The CUDA compiler "/usr/bin/nvcc" is not able to compile a simple test program. It fails with the following output: Change Dir: /mnt/d/CSNOVA/troy-nova/build/CMakeFiles/CMakeTmp Run Build Command(s):/usr/bin/make cmTC_f4d64/fast && /usr/bin/make -f CMakeFiles/cmTC_f4d64.dir/build.make CMakeFiles/cmTC_f4d64.dir/build make[1]: Entering directory '/mnt/d/CSNOVA/troy-nova/build/CMakeFiles/CMakeTmp' Building CUDA object CMakeFiles/cmTC_f4d64.dir/main.cu.o /usr/bin/nvcc -x cu -c /mnt/d/CSNOVA/troy-nova/build/CMakeFiles/CMakeTmp/main.cu -o CMakeFiles/cmTC_f4d64.dir/main.cu.o ptxas fatal : Value 'sm_30' is not defined for option 'gpu-name' CMakeFiles/cmTC_f4d64.dir/build.make:82: recipe for target 'CMakeFiles/cmTC_f4d64.dir/main.cu.o' failed make[1]: *** [CMakeFiles/cmTC_f4d64.dir/main.cu.o] Error 255 make[1]: Leaving directory '/mnt/d/CSNOVA/troy-nova/build/CMakeFiles/CMakeTmp' Makefile:138: recipe for target 'cmTC_f4d64/fast' failed make: *** [cmTC_f4d64/fast] Error 2 CMake will not be able to correctly generate this project. Call Stack (most recent call first): CMakeLists.txt:3 (project) -- Configuring incomplete, errors occurred! See also "/mnt/d/CSNOVA/troy-nova/build/CMakeFiles/CMakeOutput.log". See also "/mnt/d/CSNOVA/troy-nova/build/CMakeFiles/CMakeError.log".
尝试的解决方法
尝试指定CUDA架构执行cmake .. -DCMAKE_CUDA_ARCHITECTURES="86",但仍出现相同核心错误:
-- The CUDA compiler identification is unknown -- Check for working CUDA compiler: /usr/bin/nvcc -- Check for working CUDA compiler: /usr/bin/nvcc - broken CMake Error at /usr/local/lib/python2.7/dist-packages/cmake/data/share/cmake-3.17/Modules/CMakeTestCUDACompiler.cmake:46 (message): The CUDA compiler "/usr/bin/nvcc" is not able to compile a simple test program. It fails with the following output: Change Dir: /mnt/d/CSNOVA/troy-nova/build/CMakeFiles/CMakeTmp Run Build Command(s):/usr/bin/make cmTC_c1610/fast && /usr/bin/make -f CMakeFiles/cmTC_c1610.dir/build.make CMakeFiles/cmTC_c1610.dir/build make[1]: Entering directory '/mnt/d/CSNOVA/troy-nova/build/CMakeFiles/CMakeTmp' Building CUDA object CMakeFiles/cmTC_c1610.dir/main.cu.o /usr/bin/nvcc -x cu -c /mnt/d/CSNOVA/troy-nova/build/CMakeFiles/CMakeTmp/main.cu -o CMakeFiles/cmTC_c1610.dir/main.cu.o ptxas fatal : Value 'sm_30' is not defined for option 'gpu-name' CMakeFiles/cmTC_c1610.dir/build.make:82: recipe for target 'CMakeFiles/cmTC_c1610.dir/main.cu.o' failed make[1]: *** [CMakeFiles/cmTC_c1610.dir/main.cu.o] Error 255 make[1]: Leaving directory '/mnt/d/CSNOVA/troy-nova/build/CMakeFiles/CMakeTmp' Makefile:138: recipe for target 'cmTC_c1610/fast' failed make: *** [cmTC_c1610/fast] Error 2 CMake will not be able to correctly generate this project. Call Stack (most recent call first): CMakeLists.txt:3 (project) -- Configuring incomplete, errors occurred! See also "/mnt/d/CSNOVA/troy-nova/build/CMakeFiles/CMakeOutput.log". See also "/mnt/d/CSNOVA/troy-nova/build/CMakeFiles/CMakeError.log".
请问该错误出现的原因是什么?
内容的提问来源于stack exchange,提问作者zhengry22
相关产品推荐
相关产品推荐

