当前位置:网站首页>PyTorch安装并使用gpu加速
PyTorch安装并使用gpu加速
2022-07-01 00:32:00 【彭祥.】
之前的学习中,我们接触到了pytorch,当时博主考虑到自己显卡性能和CUDA版本等问题,所以安装的是cpu版本的,后来博主在学习过程中需要安装gpu版本的,因此便只能再次安装。
博主这次使用的是conda安装,因为使用pip好像并不支持
由于博主之前已经安装并配置好了Anoconda,所以博主只需要创建虚拟空间后安装即可
激活虚拟环境
conda activate your_env_name(虚拟环境名称)

pytorch各版本安装
https://pytorch.org/get-started/previous-versions/
博主使用的是cuda8,即对应下面这条安装语句
conda install pytorch==1.0.0 torchvision==0.2.1 cuda80 -c pytorch


安装成功
我们回到我们的pycharm中看一下:
pytorch判断gpu是否可用,测试一下:
import torch
print('CUDA版本:',torch.version.cuda)
print('Pytorch版本:',torch.__version__)
print('显卡是否可用:','可用' if(torch.cuda.is_available()) else '不可用')
print('显卡数量:',torch.cuda.device_count())
print('当前显卡的CUDA算力:',torch.cuda.get_device_capability(0))
print('当前显卡型号:',torch.cuda.get_device_name(0))

虽然显卡很拉跨,但毕竟还算是完美运行
边栏推荐
- 2022就要过去一半了,挣钱好难
- 20220216 misc buuctf another world WinHex, ASCII conversion flag zip file extraction and repair if you give me three days of brightness zip to rar, Morse code waveform conversion mysterious tornado br
- When we look at the industrial Internet, we always look at it from the opposite of the consumer Internet
- Why should VR panoramic shooting join us? Leverage resources to achieve win-win results
- Software engineering best practices - project requirements analysis
- 2022-2028 global retro glass industry research and trend analysis report
- Wechat official account development (1) introduction to wechat official account
- leetcode 474. Ones and zeroes (medium)
- Design e-commerce seckill system
- Combining online and offline, VR panorama is a good way to transform furniture online!
猜你喜欢

20220216 misc buuctf backdoor killing (d shield scanning) - clues in the packet (Base64 to image)

Wechat official account development (1) introduction to wechat official account

CentOS install MySQL

Oracle临时表详解

2022-2028 global rampant travel industry research and trend analysis report

Line number of Jenkins pipeline script execution exception

Manage edge browser settings (ie mode, homepage binding, etc.) through group policy in the enterprise

Two-stage RO: part 1

Design e-commerce seckill system

2022-2028 global weight loss ginger tea industry research and trend analysis report
随机推荐
SSM integration process (integration configuration, function module development, interface test)
在指南针上买基金安全吗?
Rust book materials - yazhijia Library
The difference between union and union all in MySQL
20220216 misc buuctf another world WinHex, ASCII conversion flag zip file extraction and repair if you give me three days of brightness zip to rar, Morse code waveform conversion mysterious tornado br
CTF tool (1) -- archpr -- including installation / use process
[untitled]
The girlfriend said: if you want to understand the three MySQL logs, I will let you heiheihei!
MySQL index test
Simple application example of rhai script engine
Ditto set global paste only text shortcuts
Which is better, server rental or hosting services in the United States?
连表查询 select 生成
Why should VR panoramic shooting join us? Leverage resources to achieve win-win results
CentOS installation starts redis
New trend of embedded software development: Devops
深度学习的历史
A detailed explanation of the implementation principle of go Distributed Link Tracking
Redis - understand the master-slave replication mechanism
LVM snapshot: backup based on LVM snapshot