Debug:nvcc fatal: Unsupported gpu architecture ‘compute_86‘; sm_86 is not compatible with Pytorch

Debug:nvcc fatal: Unsupported gpu architecture 'compute_86'

问题描述1
编译knn_cuda时,报了个错:

nvcc fatal : Unsupported gpu architecture ‘compute_86‘

意思是显卡算力太高,安装的cuda版本不支持(竟然还有这么神奇的错误),compute_86指显卡计算能力是8.6,RTX 30系,A系显卡都是这个算力。

解决方法
通过系统环境变量设置降低算力:

export TORCH_CUDA_ARCH_LIST="7.5"

然后就可以正常编译了

问题描述2
然后跑pytorch代码,又报了个错:

sm_86 is not compatible with the current Pytorch installation

也就是说pytorch的cuda版本与安装的cuda版本不匹配。

首先查看pytorch的信息:

python
import torch
print(torch.__version__)
# 1.9.0+cu102
exit()

发现pytorch的cuda是10.2版本的

再查看安装的cuda版本:

nvcc -V

发现是11.0版本的,匹配不上。

于是重新安装一个cuda版本为11.0的pytorch,问题解决。

你可能感兴趣的:(Debug经验,pytorch,深度学习,python)