当前位置:网站首页>RTX3090 与pytorch版本对应关系
RTX3090 与pytorch版本对应关系
2022-06-21 20:23:00 【mingqian_chu】
在RTX 3090 上判断,当前版本的的torch版本是否可以用,一般需要通过如下方式:
- conda activate torch1.8.1 ( 激活相关的虚拟环境)
python进入python 环境,import torch导入torch 安装包;- 测试
torch.cuda.is_available(), - 测试
torch.zero(1).cuda()
直到,第四步骤完成,才能说明当前版本的cuda 可以调用当前版本的pytorch;
问题的关键点:
- 安装pytorch 过程中, 需要两个注意点, 一个是当前安装的pytorch 版本, 该pytroch 版本官网指定包含了哪几个cuda 版本;
- 使用
pip install torch==1.8.1的方式安装,默认的是torch 版本+ 当前主机上的cuda 版本- 可能出现的问题, 当前主机的cuda 版本 不兼容该torch版本中官方发布的几个cuda 版本;
1. 问题现象
>>> torch.zeros(1).cuda()
/home/respecting/anaconda3/envs/torch1.8.1/lib/python3.7/site-packages/torch/cuda/__init__.py:104: UserWarning:
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/
1.1 问题分析
表明当前的安装的pytorch 版本没有匹配上合适的cuda, 即当前pytorch 版本的 cuda 版本没有对应到自己主机上,安装的cuda 版本,
pytorch 环境中安装的cuda 版本, 需要满足以下两个条件:
- 当前pytorch版本的算力支持 当前机器上显卡的算力;
- pytorch 中的 cuda 版本 不能高于当前机器上已经安装的 cuda 版本;
具体讲来, 同一个pytorch 版本,比如 pytorch 1.8.1 会对应到不同版本的 cuda
# ROCM 4.0.1 (Linux only)
pip install torch==1.8.1+rocm4.0.1 torchvision==0.9.1+rocm4.0.1 torchaudio==0.8.1 -f https://download.pytorch.org/whl/torch_stable.html
# ROCM 3.10 (Linux only)
pip install torch==1.8.1+rocm3.10 torchvision==0.9.1+rocm3.10 torchaudio==0.8.1 -f https://download.pytorch.org/whl/torch_stable.html
# CUDA 11.1
pip install torch==1.8.1+cu111 torchvision==0.9.1+cu111 torchaudio==0.8.1 -f https://download.pytorch.org/whl/torch_stable.html
# CUDA 10.2
pip install torch==1.8.1+cu102 torchvision==0.9.1+cu102 torchaudio==0.8.1 -f https://download.pytorch.org/whl/torch_stable.html
# CUDA 10.1
pip install torch==1.8.1+cu101 torchvision==0.9.1+cu101 torchaudio==0.8.1 -f https://download.pytorch.org/whl/torch_stable.html
# CPU only
pip install torch==1.8.1+cpu torchvision==0.9.1+cpu torchaudio==0.8.1 -f https://download.pytorch.org/whl/torch_stable.html
1.2 解决问题
pytorch 环境中安装的cuda 版本, 需要满足以下两个条件:
- 当前pytorch版本的算力支持 当前机器上显卡的算力;
- pytorch 中的 cuda 版本不能高于当前机器上已经安装的 cuda 版本;
知道了问题的原因之后, 我们便可以解决了:
- RTX3090 至少需要cuda 11.1 版本,才能够驱动该设备, 故我们可以安装cuda11.1 以上版本
- 所以在想要安装的 pytorch 版本中,找到大于
cuda11.1 <= pytorch-cuda --version <= 当前机器上安装的 cuda --version
由于笔者机器上安装的是 cuda11.2 , 而3090对应的cuda 版本必须大于等于cuda11.1,
故安装pytorch 1.8.1 中的 cuda11.1 版本, 卸载重新安装对应版本;
pip install -i https://pypi.douban.com/simple torch-1.8.1+cu111-cp37-cp37m-linux_x86_64.whl
Looking in indexes: https://pypi.douban.com/simple
Processing ./torch-1.8.1+cu111-cp37-cp37m-linux_x86_64.whl
Requirement already satisfied: numpy in /home/respecting/anaconda3/envs/torch1.8.1/lib/python3.7/site-packages (from torch==1.8.1+cu111) (1.21.6)
Requirement already satisfied: typing-extensions in /home/respecting/anaconda3/envs/torch1.8.1/lib/python3.7/site-packages (from torch==1.8.1+cu111) (4.2.0)
Installing collected packages: torch
Attempting uninstall: torch
Found existing installation: torch 1.8.1
Uninstalling torch-1.8.1:
Successfully uninstalled torch-1.8.1
Successfully installed torch-1.8.1+cu111
torchvision install
(torch1.8.1) [email protected]:/media/respecting/Ubuntu 18.0/June18$ pip install -i https://pypi.douban.com/simple torch-1.8.1+cu111-cp37-cp37m-linux_x86_64.whl
Looking in indexes: https://pypi.douban.com/simple
Processing ./torch-1.8.1+cu111-cp37-cp37m-linux_x86_64.whl
Requirement already satisfied: numpy in /home/respecting/anaconda3/envs/torch1.8.1/lib/python3.7/site-packages (from torch==1.8.1+cu111) (1.21.6)
Requirement already satisfied: typing-extensions in /home/respecting/anaconda3/envs/torch1.8.1/lib/python3.7/site-packages (from torch==1.8.1+cu111) (4.2.0)
Installing collected packages: torch
Attempting uninstall: torch
Found existing installation: torch 1.8.1
Uninstalling torch-1.8.1:
Successfully uninstalled torch-1.8.1
Successfully installed torch-1.8.1+cu111
2. 重新测试
(torch1.8.1) respecti[email protected]:~$ python
Python 3.7.13 (default, Mar 29 2022, 02:18:16)
[GCC 7.5.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> torch.zeros(1).cuda()
tensor([0.], device='cuda:0')
>>>
边栏推荐
- As we media, why can some people earn more than 10000 yuan a month, but you can only earn a few yuan a month?
- Which iPad apps can read English literature well?
- Implement a middleware from -1
- What is EGFP, green fluorescent protein
- 线粒体基因组常见缩写与术语
- leetcode刷题:顺丰科技智慧物流校园技术挑战赛
- 五分钟带你了解云原生
- Ruiji housekeeper, a century old classic, is waiting for your elegant journey to start again
- Worthington脱氧核糖核酸酶I解决方案
- HiCPlotter|HiC数据可视化工具
猜你喜欢

What websites or software are available to translate English literature into Chinese?

Huawei Hongmeng development lesson 3

Large language models teach agents to evolve. Openai reveals the complementary relationship between the two

Eureka控制台访问微服务暴露的info端点

InteliJ-IDEA-高效技巧(二)

利用tRNAscan-SE做tRNA分析

Do280openshift command and troubleshooting -- accessing resources and resource types

五分钟带你了解云原生

InteliJ-IDEA-高效技巧(一)

C# AboutBox怎么显示自己定义的界面
随机推荐
DateGridView首列排序
What websites or software are available to translate English literature into Chinese?
CF1481F AB Tree
Eureka控制台访问微服务暴露的info端点
Go unit test mocks the database CRUD
全屋智能家居品牌“智汀科技”有体验中心?
Specificity and application of Worthington Papain
电子招标采购商城系统:优化传统采购业务,提速企业数字化升级
How to check the duplicate of an English paper?
小程序怎样关联微信小程序二维码,实现二码合一聚合
PAML|计算dN/dS值的生信软件
大型语言模型教会智能体进化,OpenAI这项研究揭示了二者的互补关系
广东疾控提醒:暑期将至,返粤大学生这样安全“归巢”
Shanghai Xiangwei electromechanical Co., Ltd., a state-owned enterprise, has reached strategic cooperation with China and foreign countries and donated 200million yuan
Luogu p5440 [XR-2] miracle solution
HiC-Pro | HiC数据处理工具
棋牌类游戏
对“XXX::Invoke”类型的已垃圾回收委托进行了回调。这可能会导致应用程序崩溃、损坏和数据丢失。向非托管代码传递委托时,托管应用程序必须让这些委托保持活动状态,直到确信不会再次调用它们
LeetCode508-出现次数最多的子树元素和-深搜
Worthington胶原蛋白酶原料