一、安装pytorch环境?

1.默认进入colab jupyter界面,运行以下内容

!pip install torch
!pip install torchtext
!pip install torchvision

2.选择使用GPU

在这里插入图片描述
在这里插入图片描述

3. 搭建环境

import torch
from torch import nn, optim
from torchtext import data, datasets
 
if torch.cuda.is_available:
  print('PyTorch can use GPUs!')
else:
  print('PyTorch cannot use GPUs.') 
  
torch.manual_seed(123)
#return True

4.查看GPU信息

在这里插入图片描述
(1)第一列 GPU:编号0、1 Fan:GPU的风扇转速,0~100%,
(2)第二列 Name:型号Tesla K20c、Quadro K4000 Temp: 温度,单位摄氏度。
(3)第三列 Perf:性能状态,P0~P12,P0表示最大性能,P12表示状态最小性能。
(4)第四列 Persistence-M:持续模式的状态 Pwr:能耗
(5)第五列 Bus-Id: GPU总线,domain: bus:device.function
(6)第六列 Disp.A:Display Active,表示GPU的显示是否初始化。 Memory Usage 显存使用率。
(7)第七列 Volatile GPU-Util 浮动的GPU利用率。
(8)第八列 Uncorr. ECC ECC是“Error Checking and Correcting”的简写,“错误检查和纠正” Compute M是计算模式。

4.查看CPU信息

cat /proc/cpuinfo

在这里插入图片描述
physical id 物理CPU
cpu cores CPU内核的个数

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐