pytorch 查看GPU信息

编程入门 行业动态 更新时间:2024-10-24 16:30:24

pytorch 查看GPU<a href=https://www.elefans.com/category/jswz/34/1770440.html style=信息"/>

pytorch 查看GPU信息

参考:

  1. torch.cuda用法
  2. 服务器GPU状态查询

1.先激活虚拟环境

conda activate yolov7_wxf

2.进入该环境中

$ python
Python 3.8.0 (default, Nov  6 2019, 21:49:08) 
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> print(torch.__version__)
1.8.1
// 查看GPU 能否使用
>>> torch.cuda.is_available()
True
// 查看显卡的数量
>>> print(torch.cuda.device_count())
2
// 查看显卡的系列
>>> print(torch.cuda.get_device_name(0))
Tesla T4
>>> print(torch.cuda.current_device())
0
# 查看GPU的容量
>>> torch.cuda.get_device_capability(device=0)
(7, 5)
// 查看当前cuda流
>>> torch.cuda.current_stream(device=0)
<torch.cuda.Stream device=cuda:0 cuda_stream=0x0>
// 查看显卡的属性
>>> print(torch.cuda.get_device_properties(0))
_CudaDeviceProperties(name='Tesla T4', major=7, minor=5, total_memory=15109MB, multi_processor_count=40)
>>> num = torch.cuda.device_count()
>>> infos = [torch.cuda.get_device_properties(i) for i in range(num)]
>>> print(infos)
[_CudaDeviceProperties(name='Tesla T4', major=7, minor=5, total_memory=15109MB, multi_processor_count=40), 
_CudaDeviceProperties(name='Tesla T4', major=7, minor=5, total_memory=15109MB, multi_processor_count=40)]
  1. nvidia-smi -i 0 -q 查看显卡所有信息
    -i 后面是显卡索引
nvidia-smi -i 0 -q==============NVSMI LOG==============Timestamp                                 : Mon Aug 15 08:57:45 2022
Driver Version                            : 470.141.03
CUDA Version                              : 11.4Attached GPUs                             : 2
GPU 00000000:03:00.0Product Name                          : Tesla T4Product Brand                         : NVIDIADisplay Mode                          : EnabledDisplay Active                        : DisabledPersistence Mode                      : DisabledMIG ModeCurrent                           : N/APending                           : N/AAccounting Mode                       : DisabledAccounting Mode Buffer Size           : 4000Driver ModelCurrent                           : N/APending                           : N/ASerial Number                         : 1325021113102GPU UUID                              : GPU-e7b126ca-6e16-3cd4-a183-57fdaf803c4cMinor Number                          : 0VBIOS Version                         : 90.04.96.00.9FMultiGPU Board                        : NoBoard ID                              : 0x300GPU Part Number                       : 900-2G183-0000-000Module ID                             : 0Inforom VersionImage Version                     : G183.0200.00.02OEM Object                        : 1.1ECC Object                        : 5.0Power Management Object           : N/AGPU Operation ModeCurrent                           : N/APending                           : N/AGSP Firmware Version                  : N/AGPU Virtualization ModeVirtualization Mode               : NoneHost VGPU Mode                    : N/AIBMNPURelaxed Ordering Mode             : N/APCIBus                               : 0x03Device                            : 0x00Domain                            : 0x0000Device Id                         : 0x1EB810DEBus Id                            : 00000000:03:00.0Sub System Id                     : 0x12A210DEGPU Link InfoPCIe GenerationMax                       : 3Current                   : 3Link WidthMax                       : 16xCurrent                   : 8xBridge ChipType                          : N/AFirmware                      : N/AReplays Since Reset               : 0Replay Number Rollovers           : 0Tx Throughput                     : 320000 KB/sRx Throughput                     : 2462000 KB/sFan Speed                             : N/APerformance State                     : P0Clocks Throttle ReasonsIdle                              : Not ActiveApplications Clocks Setting       : Not ActiveSW Power Cap                      : Not ActiveHW Slowdown                       : Not ActiveHW Thermal Slowdown           : Not ActiveHW Power Brake Slowdown       : Not ActiveSync Boost                        : Not ActiveSW Thermal Slowdown               : ActiveDisplay Clock Setting             : Not ActiveFB Memory UsageTotal                             : 15109 MiBUsed                              : 11797 MiBFree                              : 3312 MiBBAR1 Memory UsageTotal                             : 256 MiBUsed                              : 5 MiBFree                              : 251 MiBCompute Mode                          : DefaultUtilizationGpu                               : 99 %Memory                            : 22 %Encoder                           : 0 %Decoder                           : 0 %Encoder StatsActive Sessions                   : 0Average FPS                       : 0Average Latency                   : 0FBC StatsActive Sessions                   : 0Average FPS                       : 0Average Latency                   : 0Ecc ModeCurrent                           : EnabledPending                           : EnabledECC ErrorsVolatileSRAM Correctable              : 0SRAM Uncorrectable            : 0DRAM Correctable              : 0DRAM Uncorrectable            : 0AggregateSRAM Correctable              : 0SRAM Uncorrectable            : 0DRAM Correctable              : 0DRAM Uncorrectable            : 0Retired PagesSingle Bit ECC                    : 0Double Bit ECC                    : 0Pending Page Blacklist            : NoRemapped Rows                         : N/ATemperatureGPU Current Temp                  : 86 CGPU Shutdown Temp                 : 96 CGPU Slowdown Temp                 : 93 CGPU Max Operating Temp            : 85 CGPU Target Temperature            : N/AMemory Current Temp               : N/AMemory Max Operating Temp         : N/APower ReadingsPower Management                  : SupportedPower Draw                        : 52.15 WPower Limit                       : 70.00 WDefault Power Limit               : 70.00 WEnforced Power Limit              : 70.00 WMin Power Limit                   : 60.00 WMax Power Limit                   : 70.00 WClocksGraphics                          : 300 MHzSM                                : 300 MHzMemory                            : 5000 MHzVideo                             : 540 MHzApplications ClocksGraphics                          : 585 MHzMemory                            : 5001 MHzDefault Applications ClocksGraphics                          : 585 MHzMemory                            : 5001 MHzMax ClocksGraphics                          : 1590 MHzSM                                : 1590 MHzMemory                            : 5001 MHzVideo                             : 1470 MHzMax Customer Boost ClocksGraphics                          : 1590 MHzClock PolicyAuto Boost                        : N/AAuto Boost Default                : N/AVoltageGraphics                          : N/AProcessesGPU instance ID                   : N/ACompute instance ID               : N/AProcess ID                        : 1241Type                          : GName                          : /usr/lib/xorg/XorgUsed GPU Memory               : 4 MiBGPU instance ID                   : N/ACompute instance ID               : N/AProcess ID                        : 1932Type                          : GName                          : /usr/lib/xorg/XorgUsed GPU Memory               : 4 MiBGPU instance ID                   : N/ACompute instance ID               : N/AProcess ID                        : 26683Type                          : CName                          : /home/ls/anaconda3/envs/yolov7_wxf/bin/pythonUsed GPU Memory               : 11783 MiB

更多推荐

pytorch 查看GPU信息

本文发布于:2024-02-08 13:43:15,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1674161.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:信息   pytorch   GPU

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!