【Bug解决】nvcc fatal : Unsupported gpu architecture ‘compute_86‘

报错描述:

在项目中添加DCN模块进行编译时出现以下报错:

/usr/bin/nvcc -DWITH_CUDA -I/data/dwl/anaconda3/envs/clrnet_base/lib/python3.8/site-packages/torch/include -I/data/dwl/anaconda3/envs/clrnet_base/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -I/data/dwl/anaconda3/envs/clrnet_base/lib/python3.8/site-packages/torch/include/TH -I/data/dwl/anaconda3/envs/clrnet_base/lib/python3.8/site-packages/torch/include/THC -I/data/dwl/anaconda3/envs/clrnet_base/include/python3.8 -c clrnet/ops/dcn/src/cuda/deform_conv_cuda_kernel.cu -o build/temp.linux-x86_64-cpython-38/clrnet/ops/dcn/src/cuda/deform_conv_cuda_kernel.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_BFLOAT16_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr --compiler-options '-fPIC' -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE=\"_gcc\" -DPYBIND11_STDLIB=\"_libstdcpp\" -DPYBIND11_BUILD_ABI=\"_cxxabi1011\" -DTORCH_EXTENSION_NAME=deform_conv_ext -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_86,code=compute_86 -gencode=arch=compute_86,code=sm_86 -std=c++14
nvcc fatal   : Unsupported gpu architecture 'compute_86'
error: command '/usr/bin/nvcc' failed with exit code 1

报错环境:

Linux:Ubuntu 20.04
GPU:NVIDIA GeForce RTX 3090
CUDA:11.1
Pytorch:1.8
Python:3.8

解决方案

错误原因: GPU 3090 硬件能够支持的算力比较高,能达到 8.6,而当前 CUDA 11.1 不支持算力 8.6。

解决方案: 通过下述脚本,设置环境变量,降低算力要求,即可:

export TORCH_CUDA_ARCH_LIST="7.5"

注:感觉该环境变量会有点问题,运行完代码又改回去了

你可能感兴趣的:(bug)