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

虽然显卡很拉跨,但毕竟还算是完美运行
边栏推荐
- 20220215-ctf-misc-buuctf-einstein-binwalk analyze picture-dd command separate zip file -- look for password in picture attribute
- Inventory the six second level capabilities of Huawei cloud gaussdb (for redis)
- Self examination before school starts
- Kubernetes ---- pod configuration container start command
- 20220215 misc buctf easycap Wireshark tracks TCP flow hidden key (use of WinHex tool)
- Never use redis expired monitoring to implement scheduled tasks!
- Oracle临时表详解
- Operation record of reinitialization instance of Dameng database
- What value should testers play in requirements review? Two minutes will stop you from being stupid
- CentOS install MySQL
猜你喜欢

What should I do without 50W bride price
![[UML] UML class diagram](/img/6f/30bd15967103969e600d69e618d8bf.png)
[UML] UML class diagram

Redis - how to understand publishing and subscribing

Bridge emqx cloud data to AWS IOT through the public network

20220215 CTF misc buuctf Xiaoming's safe binwalk analysis DD command separate rar file archpr brute force password cracking

How to edit special effects in VR panorama? How to display detailed functions?

Makefile notes (Yiwen Institute makefile)

优质的水泵 SolidWorks模型素材推荐,不容错过

20220215 CTF misc buuctf the world in the mirror the use of stegsolve tool data extract

Confirm() method of window
随机推荐
Yboj mesh sequence [Lagrange interpolation]
Solving the weird problem that the query conditions affect the value of query fields in MySQL query
2022-2028 global single travel industry research and trend analysis report
Teach you how to use Hal library to get started -- become a lighting master
ABAQUS 2022 software installation package and installation tutorial
Introduction to ES6 promise, new features of ES7 and es8 async and await
Vulnerability discovery - App application vulnerability probe type utilization and repair
[UML] UML class diagram
Manage edge browser settings (ie mode, homepage binding, etc.) through group policy in the enterprise
CentOS install MySQL
Tide - rust web framework based on async STD
Cloud security daily 220630: the IBM data protection platform has found an arbitrary code execution vulnerability, which needs to be upgraded as soon as possible
JS bubble sort and select sort
Five minutes to understand the exploratory test
Self examination before school starts
[PHP] self developed framework qphp, used by qphp framework
LVM snapshot: backup based on LVM snapshot
Explain kubernetes backup and recovery tools velero | learn more about carina series phase III
Gateway service gateway
Inventory the six second level capabilities of Huawei cloud gaussdb (for redis)