Nvidia MX550配置pytorch GPU, cuda, cudnn

电脑型号MX550, GPU一般般,但是想着说可以搞搞cuda调调代码,就捣鼓了一下。

nvidia控制面板查询到版本支持的cuda最高不超过,11.6.我们下载的版本只要不超过11.6就行。

本来查了很多攻略,基本上都是去官网下载cudatoolkit和cudnn本地安装,感觉有点麻烦,在有conda的情况下,可以直接在pytorch官网查到相关命令,这里我下载的是cuda11.6版本的,命令如下:

pytorch官网:PyTorch

conda install pytorch torchvision torchaudio pytorch-cuda=11.6 -c pytorch -c nvidia

在solve environment的时候可能会出现报错: failed with initial frozen solve. Retrying with flexible solve.

这种大部分情况是网络问题,可以考虑给conda换源,清华源豆瓣源都很快,也可以给自己开着手机热点,用手机流量下载。

 后面就是漫长的下载过程,如下。

 下载完成会出现以下提示

然后输入nvcc -V 命令,就可以查看到安装的cuda信息

 大致就配好环境了,可以测试以下能否调用GPU。

print('CUDA版本:',torch.version.cuda)
print('Pytorch版本:',torch.__version__)
print('显卡是否可用:','可用' if(torch.cuda.is_available()) else '不可用')
print('显卡数量:',torch.cuda.device_count())
print('是否支持BF16数字格式:','支持' if (torch.cuda.is_bf16_supported()) else '不支持')
print('当前显卡型号:',torch.cuda.get_device_name())
print('当前显卡的CUDA算力:',torch.cuda.get_device_capability())
print('当前显卡的总显存:',torch.cuda.get_device_properties(0).total_memory/1024/1024/1024,'GB')
print('是否支持TensorCore:','支持' if (torch.cuda.get_device_properties(0).major >= 7) else '不支持')
print('当前显卡的显存使用率:',torch.cuda.memory_allocated(0)/torch.cuda.get_device_properties(0).total_memory*100,'%')

输出结果:

>>> import torch
>>> print('CUDA版本:',torch.version.cuda)
CUDA版本: 11.6
>>> print('Pytorch版本:',torch.__version__)
Pytorch版本: 1.13.1
>>> print('显卡是否可用:','可用' if(torch.cuda.is_available()) else '不可用')
显卡是否可用: 可用
>>> print('显卡数量:',torch.cuda.device_count())
显卡数量: 1
>>> print('是否支持BF16数字格式:','支持' if (torch.cuda.is_bf16_supported()) else '不支持')
是否支持BF16数字格式: 不支持
>>> print('当前显卡型号:',torch.cuda.get_device_name())
当前显卡型号: NVIDIA GeForce MX550
>>> print('当前显卡的CUDA算力:',torch.cuda.get_device_capability())
当前显卡的CUDA算力: (7, 5)
>>> print('当前显卡的总显存:',torch.cuda.get_device_properties(0).total_memory/1024/1024/1024,'GB')
当前显卡的总显存: 1.999755859375 GB
>>> print('是否支持TensorCore:','支持' if (torch.cuda.get_device_properties(0).major >= 7) else '不支持')
是否支持TensorCore: 支持
>>> print('当前显卡的显存使用率:',torch.cuda.memory_allocated(0)/torch.cuda.get_device_properties(0).total_memory*100,'%')
当前显卡的显存使用率: 0.0 %

结果显示pytorch可以正常调用GPU,cuda安装好了。

tips:查询cuda和cudnn对应版本网址:https://developer.nvidia.com/rdp/cudnn-archive

参考网址:

https://histone.blog.csdn.net/article/details/125065627?spm=1001.2101.3001.6661.1&utm_medium=distribute.pc_relevant_t0.none-task-blog-2%7Edefault%7ECTRLIST%7ERate-1-125065627-blog-123670141.pc_relevant_recovery_v2&depth_1-utm_source=distribute.pc_relevant_t0.none-task-blog-2%7Edefault%7ECTRLIST%7ERate-1-125065627-blog-123670141.pc_relevant_recovery_v2&utm_relevant_index=1https://histone.blog.csdn.net/article/details/125065627?spm=1001.2101.3001.6661.1&utm_medium=distribute.pc_relevant_t0.none-task-blog-2~default~CTRLIST~Rate-1-125065627-blog-123670141.pc_relevant_recovery_v2&depth_1-utm_source=distribute.pc_relevant_t0.none-task-blog-2~default~CTRLIST~Rate-1-125065627-blog-123670141.pc_relevant_recovery_v2&utm_relevant_index=1RTX 3060 快速配置GPU版本tensorflow_rtx 3060 tensorflow_Sciws的博客-CSDN博客

conda虚拟环境中安装cuda和cudnn,再也不用头疼版本号的问题了_遇到坎就得迈过去的博客-CSDN博客_conda cudnn

  • 2
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 4
    评论
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值