nvcc 致命:安装 cuda9.0 时不支持 gpu 架构“compute_20”
Posted
技术标签:
【中文标题】nvcc 致命:安装 cuda9.0 时不支持 gpu 架构“compute_20”【英文标题】:nvcc fatal : Unsupported gpu architecture 'compute_20' while cuda9.0 is installed 【发布时间】:2017-11-06 03:15:21 【问题描述】:我在安装 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
【问题讨论】:
compute_20 不受 CUDA 9 支持。修改您的 makefile 或 CMakeLists.txt 以删除对 cc2.x GPU 的引用。 【参考方案1】:“compute_20”、“sm_20”和“sm_21”架构在 CUDA 8 和 9 中已弃用
分辨率
-
更改为兼容的 CUDA 版本
修改您的 CMake 文件以删除这些已弃用的架构
【讨论】:
实际上,对sm_2x
的支持在 CUDA 8 中弃用(请参阅工具链打印的弃用消息),然后支持被删除在 CUDA 9 中。【参考方案2】:
修改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()
【讨论】:
【参考方案3】:我使用以下方法修复了 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。
【讨论】:
以上是关于nvcc 致命:安装 cuda9.0 时不支持 gpu 架构“compute_20”的主要内容,如果未能解决你的问题,请参考以下文章
nvcc 致命:不支持的 gpu 架构“compute_86”
anconda1.8+cuda9.0+cudnn7.0.5+tensorflow1.7(win10)安装