Linux:GeForce RTX 3090 with CUDA capability sm_86 is not compatible with the current PyTorch
问题描述
- 在使用比较新的显卡RTX 3090时,遇到如下问题:
- 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 GeForce RTX 3090 GPU with PyTorch, please check the instructions at https://pytorch.org/get-started/locally/
问题解析
- CUDA capability sm_86:GPU的算力8.6
- 可以通过该下述令进行查看现有CUDA版本以及支持的算力情况
torch.cuda.get_arch_list()
- 由上图可知,我目前使用的CUDA版本支持的最大算力仅为7.0
- 而问题中显示需要可以匹配算力8.6的CUDA才可以,因此报错。
- 因此,这个问题表面上是说PyTorch,实际上是PyTorch依赖的CUDA版本的问题
解决方法
-
先通过下述指令查看自己的GPU算力情况
nvidia-smi nvidia-smi -a ## 我的gpu是3090Ti
-
然后去英伟达官网查看对应的算力情况,英伟达官网,戳这里
-
-
RTX 3090的算力是8.6,但是当前的PyTorch依赖的CUDA版本支持的算力只有3.7、5.0、6.0、7.0
-
因此,需要对CUDA进行有针对性的升级
-
上pytorch官网查看(安装)最新版本的cuda以及对应的pytorch,pytorch官网,戳👉这里
-
-
然后,根据上图红框里的指令进行安装即可;
pip install torch==1.11.0+cu113 torchvision==0.12.0+cu113 torchaudio==0.11.0 --extra-index-url https://download.pytorch.org/whl/cu113
-
安装时,最好完全新建一个conda环境,从头开始,然后在新的conda环境里最安装上述指令,然后再安装其他库,要不然会显示python被损坏的问题。
-
下图便是安装好后,查看CUDA算力支持情况:
-