nvcc 致命问题:安装 cuda 9.1+caffe+openCV 3.4.0 时不支持 gpu 架构 'compute_20'
nvcc fatal : Unsupported gpu architecture 'compute_20' while cuda 9.1+caffe+openCV 3.4.0 is installed
我已经安装了CUDA 9.1+cudnn-9.1+opencv 3.4.0+caffe
。
当我在caffe
目录中尝试运行make all -j8
时,出现了这个错误:
nvcc fatal : Unsupported gpu architecture 'compute_20'
我试过运行:
"cmake -D CMAKE_BUILD_TYPE=RELEASE -D CUDA_GENERATION=Kepler .."
但是没用。
尝试手动编辑 Makefile.config
以从这些行中删除 compute_2*
架构(评论解释原因):
# CUDA architecture setting: going with all of them.
# For CUDA < 6.0, comment the *_50 through *_61 lines for compatibility.
# For CUDA < 8.0, comment the *_60 and *_61 lines for compatibility.
# For CUDA >= 9.0, comment the *_20 and *_21 lines for compatibility.
CUDA_ARCH := -gencode arch=compute_20,code=sm_20 \
-gencode arch=compute_20,code=sm_21 \
-gencode arch=compute_30,code=sm_30 \
-gencode arch=compute_35,code=sm_35 \
-gencode arch=compute_50,code=sm_50 \
-gencode arch=compute_52,code=sm_52 \
-gencode arch=compute_60,code=sm_60 \
-gencode arch=compute_61,code=sm_61 \
-gencode arch=compute_61,code=compute_61
并添加 compute_6* 架构(见评论),这样你的新 CUDA_ARCH 看起来像这样:
# CUDA architecture setting: going with all of them.
# For CUDA < 6.0, comment the *_50 through *_61 lines for compatibility.
# For CUDA < 8.0, comment the *_60 and *_61 lines for compatibility.
# For CUDA >= 9.0, comment the *_20 and *_21 lines for compatibility.
CUDA_ARCH := -gencode arch=compute_30,code=sm_30 \
-gencode arch=compute_35,code=sm_35 \
-gencode arch=compute_50,code=sm_50 \
-gencode arch=compute_52,code=sm_52 \
-gencode arch=compute_60,code=sm_60 \
-gencode arch=compute_61,code=sm_61 \
-gencode arch=compute_61,code=compute_61
那么您需要 make clean
,然后 make all
。
您可以像下面这样使用 cmake:
cmake [other_params] -D CUDA_ARCH_NAME="Pascal" ..
这帮我修好了
cd caffe && mkdir build && cd build && \
cmake -DUSE_CUDNN=1 -DUSE_NCCL=1 -DCUDA_ARCH_NAME=Manual -DCUDA_ARCH_BIN="50 52 60 61" .. && \
sudo make -j"$(nproc)"
刚刚删除 20
和 30
arch 支持
Makefile.config cmake 编译时不使用。因此,从中删除 compute_2* 架构并不能解决问题。相反,您应该编辑 caffe/Cuda.cmake。在第 9 行,去掉已知 GPU 架构列表中的 20 21(20)。
我已经安装了CUDA 9.1+cudnn-9.1+opencv 3.4.0+caffe
。
当我在caffe
目录中尝试运行make all -j8
时,出现了这个错误:
nvcc fatal : Unsupported gpu architecture 'compute_20'
我试过运行:
"cmake -D CMAKE_BUILD_TYPE=RELEASE -D CUDA_GENERATION=Kepler .."
但是没用。
尝试手动编辑 Makefile.config
以从这些行中删除 compute_2*
架构(评论解释原因):
# CUDA architecture setting: going with all of them.
# For CUDA < 6.0, comment the *_50 through *_61 lines for compatibility.
# For CUDA < 8.0, comment the *_60 and *_61 lines for compatibility.
# For CUDA >= 9.0, comment the *_20 and *_21 lines for compatibility.
CUDA_ARCH := -gencode arch=compute_20,code=sm_20 \
-gencode arch=compute_20,code=sm_21 \
-gencode arch=compute_30,code=sm_30 \
-gencode arch=compute_35,code=sm_35 \
-gencode arch=compute_50,code=sm_50 \
-gencode arch=compute_52,code=sm_52 \
-gencode arch=compute_60,code=sm_60 \
-gencode arch=compute_61,code=sm_61 \
-gencode arch=compute_61,code=compute_61
并添加 compute_6* 架构(见评论),这样你的新 CUDA_ARCH 看起来像这样:
# CUDA architecture setting: going with all of them.
# For CUDA < 6.0, comment the *_50 through *_61 lines for compatibility.
# For CUDA < 8.0, comment the *_60 and *_61 lines for compatibility.
# For CUDA >= 9.0, comment the *_20 and *_21 lines for compatibility.
CUDA_ARCH := -gencode arch=compute_30,code=sm_30 \
-gencode arch=compute_35,code=sm_35 \
-gencode arch=compute_50,code=sm_50 \
-gencode arch=compute_52,code=sm_52 \
-gencode arch=compute_60,code=sm_60 \
-gencode arch=compute_61,code=sm_61 \
-gencode arch=compute_61,code=compute_61
那么您需要 make clean
,然后 make all
。
您可以像下面这样使用 cmake:
cmake [other_params] -D CUDA_ARCH_NAME="Pascal" ..
这帮我修好了
cd caffe && mkdir build && cd build && \
cmake -DUSE_CUDNN=1 -DUSE_NCCL=1 -DCUDA_ARCH_NAME=Manual -DCUDA_ARCH_BIN="50 52 60 61" .. && \
sudo make -j"$(nproc)"
刚刚删除 20
和 30
arch 支持
Makefile.config cmake 编译时不使用。因此,从中删除 compute_2* 架构并不能解决问题。相反,您应该编辑 caffe/Cuda.cmake。在第 9 行,去掉已知 GPU 架构列表中的 20 21(20)。