NVIDIA GeForce RTX 3080 with CUDA capability sm_86 is not compatible with the current PyTorch

遇到的问题

最近在带4卡GeForce RTX 3080 的服务器上安装了一个高版本的pytorch,发现在运行如下命令时报如下错误:

运行命令如下:
import torch

print(torch.__version__)
print(torch.cuda.is_available())
torch.zeros(1).cuda()
print(torch.cuda.get_arch_list())

报错如下:

NVIDIA GeForce RTX 3080 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 3080 GPU with PyTorch, please check the instructions at https://pytorch.org/get-started/locally/

  warnings.warn(incompatible_device_warn.format(device_name, capability, " ".join(arch_list), device_name))

即当前显卡的算力sm_86与当前安装的pytorch版本所能支持的算力[sm_37 sm_50 sm_60 sm_70]并不兼容。

解决办法

  1. 查看了系统当前的版本
    (1)ubuntu 22.04
    (2)cuda 11.4
    (3)Python 3.7
    (4)显卡 GeForce RTX 3080,算力为8.6,可在如下官方链接中查看:显卡算力查看

  2. 根据网上网友提供的相关资料,找到了当下不同Pytorch版本所支持的算力如下表所示
    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述
    从上图中可以看到pytorch的1.8.0,且是cuda11.1的版本是支持显卡算例为sm_86的。因此,在本服务器安装的时候,安装上述对应的版本(值的注意的是:虽然该版本所对应的cuda与本服务器所已经安装的cuda11.4版本不对应,但最后安装完毕后,pytorch可正常调用显卡资源。可能cuda版本是向下兼容的)

安装命令如下:

pip install torch==1.8.0+cu111 torchvision==0.9.0+cu111 torchaudio==0.8.0 -f https://download.pytorch.org/whl/torch_stable.html
  1. 输入如下代码,对安装的pytorch进行测试验证:
import torch

print(torch.__version__)
print(torch.cuda.is_available())
torch.zeros(1).cuda()
print(torch.cuda.get_arch_list())

输出结果如下:
在这里插入图片描述
之前所报的错误已经消失了。

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值