当前位置:网站首页>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))

虽然显卡很拉跨,但毕竟还算是完美运行
边栏推荐
- C WinForm program interface optimization example
- 2022-2028 global plant peptone industry research and trend analysis report
- 1. crawler's beautifulsoup parsing library & online parsing image verification code
- When is it appropriate to replace a virtual machine with a virtual machine?
- CentOS 6.3 x64 PHP 5.2.6 扩展安装OpenSSL出错的解决方法
- Vmware16 installing win11 virtual machine (the most complete step + stepping on the pit)
- Stack frame
- LVM snapshot: preparation of backup based on LVM snapshot
- 2022就要过去一半了,挣钱好难
- 2022-2028 global mobile scanning radiology room industry survey and trend analysis report
猜你喜欢

Vmware16 installing win11 virtual machine (the most complete step + stepping on the pit)

C WinForm program interface optimization example

MySQL variables, stored procedures and functions

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

ABAQUS 2022 software installation package and installation tutorial

left join左连接匹配数据为NULL时显示指定值
![[designmode] factory pattern](/img/62/9be808b3e1c2139d564caa307fcd30.png)
[designmode] factory pattern

Gateway service gateway

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

Implementation of OSD on Hisilicon platform (1)
随机推荐
Longest valid bracket
$watch will not trigger data change - $watch not firing on data change
Pycharm useful shortcut keys
IFLYTEK active competition summary! (12)
Is it safe to choose mobile phone for stock trading account opening in Hangzhou?
2022-2028 global PTFE lined valve industry research and trend analysis report
Makefile notes (Yiwen Institute makefile)
2022-2028 global elevator emergency communication system industry research and trend analysis report
Operation record of reinitialization instance of Dameng database
What does it mean to open an account online? Is it safe to open an account online?
Unit test concept and purpose
Examples of topological sequences
How to specify the number of cycles in JSTL- How to loop over something a specified number of times in JSTL?
Bridge emqx cloud data to AWS IOT through the public network
2022-2028 global public address fire alarm system industry research and trend analysis report
Is it safe to buy funds on the compass?
When is it appropriate to replace a virtual machine with a virtual machine?
20220215 CTF misc buuctf the world in the mirror the use of stegsolve tool data extract
leetcode 474. Ones and zeroes (medium)
Bugku CTF daily one question dark cloud invitation code