解决:NVIDIA GeForce RTX 3090 with CUDA capability sm_86 is not compatible with ...


报错描述:

NVIDIA GeForce RTX 3090 with CUDA capability sm_86 is not compatible with the current PyTorch installation.
The current PyTorch install supports CUDA capabilities sm_37 sm_50 sm_60 sm_70.
If you want to use the NVIDIA GeForce RTX 3090 GPU with PyTorch, please check the instructions at https://pytorch.org/get-started/locally/

错误描述: CUDA capability sm_86 是说当前 GPU 3090 算力是 8.6,与安装的 PyTorch 版本不匹配。虽然错误描述里说的是 PyTorch,但实际上是说 PyTorch 依赖的 CUDA 版本(因为我们安装的是 CUDA 版本的 PyTorch,如果使用 CPU 版的就不会有这个问题)。所以说,当前的 PyTorch CUDA 版本支持算力为只有 3.7、5.0、6.0、7.0,低于 GPU 3090 算力。

关于 GPU 算力和 CUDA 算力的关系是:

查看显卡算力:CUDA GPU | NVIDIA Developer

 查看CUDA的算力:NVIDIA Ampere GPU Architecture Compatibility

简而言之:GPU的算力需要高于CUDA的算力(但是二者的算力必须在同版本下,比如都是8.x(Gpu sm_8.a>CUDA sm_8.b)。如果GPU的算力为8.x,CUDA的算力为7.x,即使满足>的条件,但也是不行的)



报错环境:

Linux:Ubuntu 18.04
GPU:NVIDIA GeForce RTX 3090
CUDA:11.3
Pytorch:1.12.0
Python:3.9


解决方案


PyTorch官网 下载合适的 Pytorch 版本,CUDA 11.6 最高支持算力是 8.6,所以就下载支持 CUDA 11.6 以上的 PyTorch 版本(目前最高也就是 11.6 了)。


解决方案:

# 首先卸载已有的pytorch
pip uninstall torch
pip uninstall torchvision
pip uninstall torchaudio
# 安装
pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu116

这里需要注意一下,安装新pyotrch的时候可能会下载超时报错:

这个大概率是网络原因造成的(自备梯子下载更快,我没有使用镜像,速度15-20mb/s)

pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='download.pytorch.org', port=443): Read timed out.

 如果报错了就将安装的命令行换成:

pip3 --default-timeout=1688 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu116

这里的--default-timeout=1688其实意思就是让其检测延迟的时间变长,以防止因为你的网络问题而直接报错

如果没有报错就当我没说, 

安装成功后 问题解决

猜你喜欢

转载自blog.csdn.net/zcyzcyjava/article/details/127377343