nvcc致命:不受支持的gpu架构' compute_20'而cuda9.0已安装

时间:2017-11-06 03:15:22

标签: c++ cmake cuda nvcc

安装GROMACS-5.1.2时遇到问题。错误说明了gpu架构' compute_20'不受支持。我有CUDA 9.0,g ++ 4.9.3和GTX1080 gpu。我现在应该怎么做?问题是什么?

[  0%] Built target fftwBuild    
[  1%] Building NVCC (Device) object src/gromacs/CMakeFiles/libgromacs.dir/gmxlib/cuda_tools/./libgromacs_generated_copyrite_gpu.cu.o    
nvcc fatal   : Unsupported gpu architecture 'compute_20'    
CMake Error at libgromacs_generated_copyrite_gpu.cu.o.cmake:208 (message):
Error generating      
/opt/gromacs/build-gromacs/src/gromacs/CMakeFiles/libgromacs.dir/gmxlib/cuda_tools/./libgromacs_generated_copyrite_gpu.cu.o

src/gromacs/CMakeFiles/libgromacs.dir/build.make:55: recipe for target 'src/gromacs/CMakeFiles/libgromacs.dir/gmxlib/cuda_tools/./libgromacs_generated_copyrite_gpu.cu.o' failed    
make[2]: *** [src/gromacs/CMakeFiles/libgromacs.dir/gmxlib/cuda_tools/./libgromacs_generated_copyrite_gpu.cu.o] Error 1
CMakeFiles/Makefile2:1938: recipe for target 'src/gromacs/CMakeFiles/libgromacs.dir/all' failed    
make[1]: *** [src/gromacs/CMakeFiles/libgromacs.dir/all] Error 2    
Makefile:143: recipe for target 'all' failed
make: *** [all] Error 2

3 个答案:

答案 0 :(得分:1)

修改文件gromacs-5.1.2 / cmake / gmxManageNvccConfig.cmake可以解决您的问题(第184至227行):

# First add flags that trigger SASS (binary) code generation for physical arch
if(CUDA_VERSION VERSION_LESS "9.00") # < 9.0
    list (APPEND GMX_CUDA_NVCC_GENCODE_FLAGS "-gencode;arch=compute_20,code=sm_20")
endif()
if(NOT CUDA_VERSION VERSION_LESS "4.2") # >= 4.2
    list (APPEND GMX_CUDA_NVCC_GENCODE_FLAGS "-gencode;arch=compute_30,code=sm_30")
endif()
if(NOT CUDA_VERSION VERSION_LESS "5.0") # >= 5.0
    list (APPEND GMX_CUDA_NVCC_GENCODE_FLAGS "-gencode;arch=compute_35,code=sm_35")
endif()
if(NOT CUDA_VERSION VERSION_LESS "6.5") # >= 6.5
    list (APPEND GMX_CUDA_NVCC_GENCODE_FLAGS "-gencode;arch=compute_37,code=sm_37")
    list (APPEND GMX_CUDA_NVCC_GENCODE_FLAGS "-gencode;arch=compute_50,code=sm_50")
endif()
if(NOT CUDA_VERSION VERSION_LESS "7.0") # >= 7.0
    list (APPEND GMX_CUDA_NVCC_GENCODE_FLAGS "-gencode;arch=compute_52,code=sm_52")
endif()
if(NOT CUDA_VERSION VERSION_LESS "8.0") # >= 8.0
    list (APPEND GMX_CUDA_NVCC_GENCODE_FLAGS "-gencode;arch=compute_60,code=sm_60")
    list (APPEND GMX_CUDA_NVCC_GENCODE_FLAGS "-gencode;arch=compute_61,code=sm_61")
endif()
if(NOT CUDA_VERSION VERSION_LESS "9.0") # >= 9.0
    list (APPEND GMX_CUDA_NVCC_GENCODE_FLAGS "-gencode;arch=compute_70,code=sm_70")
endif()

# Next add flags that trigger PTX code generation for the newest supported virtual arch
# that's useful to JIT to future architectures
if(CUDA_VERSION VERSION_LESS "4.2")
    list (APPEND GMX_CUDA_NVCC_GENCODE_FLAGS "-gencode;arch=compute_20,code=compute_20")
elseif(CUDA_VERSION VERSION_LESS "5.0")
    list (APPEND GMX_CUDA_NVCC_GENCODE_FLAGS "-gencode;arch=compute_30,code=compute_30")
elseif(CUDA_VERSION VERSION_LESS "6.5")
    list (APPEND GMX_CUDA_NVCC_GENCODE_FLAGS "-gencode;arch=compute_35,code=compute_35")
elseif(CUDA_VERSION VERSION_LESS "7.0")
    list (APPEND GMX_CUDA_NVCC_GENCODE_FLAGS "-gencode;arch=compute_50,code=compute_50")
elseif(CUDA_VERSION VERSION_LESS "8.0")
    list (APPEND GMX_CUDA_NVCC_GENCODE_FLAGS "-gencode;arch=compute_52,code=compute_52")
elseif(CUDA_VERSION VERSION_LESS "9.0")
    list (APPEND GMX_CUDA_NVCC_GENCODE_FLAGS "-gencode;arch=compute_60,code=compute_60")
    list (APPEND GMX_CUDA_NVCC_GENCODE_FLAGS "-gencode;arch=compute_61,code=compute_61")
else() # version >= 9.0
    list (APPEND GMX_CUDA_NVCC_GENCODE_FLAGS "-gencode;arch=compute_70,code=compute_70")
endif()

ENDIF()

答案 1 :(得分:0)

CUDA 8&amp; C中不推荐使用'compute_20','sm_20'和'sm_21'架构。 9

分辨率

  1. 更改为兼容的CUDA版本
  2. 修改您的CMake文件以删除这些已弃用的体系结构

答案 2 :(得分:0)

我使用以下命令修复了gromacs 5.1.5的类似问题:

# compile the deviceQuery utility:
cd /usr/local/cuda/samples/1_Utilities/deviceQuery
sudo make

# use it:
/usr/local/cuda/samples/bin/x86_64/linux/release/deviceQuery
# gives output like CUDA Capability Major/Minor version number:    6.0

# modify build:
rm CMakeCache.txt
cmake <args> DGMX_CUDA_TARGET_COMPUTE=compute_60

Matthieu的技巧性提示,以指向deviceQuery和gromacs开发人员以编写体面的安装docs