问小白 wenxiaobai
资讯
历史
科技
环境与自然
成长
游戏
财经
文学与艺术
美食
健康
家居
文化
情感
汽车
三农
军事
旅行
运动
教育
生活
星座命理

Nvidia-smi简介及常用指令及其参数说明

创作时间:
作者:
@小白创作中心

Nvidia-smi简介及常用指令及其参数说明

引用
CSDN
1.
https://blog.csdn.net/C_chuxin/article/details/82993350

Nvidia-smi是NVIDIA公司提供的一个系统管理工具,用于监控和管理NVIDIA GPU设备。它能够显示GPU的使用情况、温度、功耗等关键信息,并支持对GPU进行一些配置操作。对于从事AI、深度学习等领域的技术人员来说,掌握Nvidia-smi的使用是非常有必要的。

一、什么是Nvidia-smi

nvidia-smi是NVIDIA的系统管理界面,其中smi是System management interface的缩写。它可以收集各种级别的信息,查看显存使用情况。此外,可以启用和禁用GPU配置选项(如ECC内存功能)。

二、常用的Nvidia-smi指令

(以下图片主要来自http://hui.sohu.com/infonews/article/6337322514200395777)

  1. nvidia-smi
  • 功能:显示出当前GPU的所有基础信息。

解释相关参数含义:

  • GPU:本机中的GPU编号
  • Name:GPU 类型
  • Persistence-M:
  • Fan:风扇转速
  • Temp:温度,单位摄氏度
  • Perf:表征性能状态,从P0到P12,P0表示最大性能,P12表示状态最小性能
  • Pwr:Usage/Cap:能耗表示
  • Bus-Id:涉及GPU总线的相关信息;
  • Disp.A:Display Active,表示GPU的显示是否初始化
  • Memory-Usage:显存使用率
  • Volatile GPU-Util:浮动的GPU利用率
  • Uncorr. ECC:关于ECC的东西
  • Compute M.:计算模式
  • Processes 显示每块GPU上每个进程所使用的显存情况。

(更详细的说明可参考https://blog.csdn.net/sallyxyl1993/article/details/62220424)

  1. nvidia-smi -L 命令
  • 功能:列出所有可用的NVIDIA设备
  1. nvidia-smi topo --matrix 命令
  • 功能:查看系统拓扑
  • 说明:要正确地利用更先进的NVIDIA GPU功能(如GPUDirect),使用系统拓扑正确配置往往是至关重要的。该拓扑指的是PCI Express设备(GPUs, InfiniBand HCAs, storage controllers, 等)如何互相连接以及如何连接到系统的CPU。如果使用不正确的拓扑,某些功能可能会减慢甚至停止工作
  1. nvidia-smi -q -d CLOCK 命令
  • 功能:查看当前的GPU时钟速度、默认时钟速度和最大可能的时钟速度

  1. nvidia-smi -q -d SUPPORTED_CLOCKS
  • 功能:显示每个GPU的可用时钟速度列表
  1. nvidia-smi vgpu
  • 功能:查看当前vGPU的状态信息:
  • 补充说明:虚拟图形处理单元(vGPU)是在虚拟桌面上渲染图形的一个组件。倘若没有此组件,显示如下:
  1. nvidia-smi vgpu -p
  • 功能:循环显示虚拟桌面中应用程序对GPU资源的占用情况
  1. nvidia-smi -q
  • 功能:查看当前所有GPU的信息,也可以通过参数i指定具体的GPU。
  • 通过nvidia-smi -q我们可以获取以下有用的信息:
  • 系统中的GPU的基本信息
  • GPU的SN号、VBIOS、PN号等信息:
  • GPU的总线、PCI-E总线倍速、风扇转速等信息:
  • 补充:PCI是Peripheral Component Interconnect(外设部件互连标准)的缩写,它是目前个人电脑中使用最为广泛的接口,几乎所有的主板产品上都带有这种插槽。
  • GPU的显存、BAR1、所有资源利用率、ECC模式等信息:

三、各种指令参数总结

(参考:https://www.cnblogs.com/xuyuan77/p/7856487.html)

输入指令 nvidia-smi -h

输出如下信息:

NVIDIA System Management Interface – v352.79

NVSMI provides monitoring information for Tesla and select Quadro devices.

The data is presented in either a plain text or an XML format, via stdout or a file.

NVSMI also provides several management operations for changing the device state.

Note that the functionality of NVSMI is exposed through the NVML C-based

library. See the NVIDIA developer website for more information about NVML.

Python wrappers to NVML are also available. The output of NVSMI is

not guaranteed to be backwards compatible; NVML and the bindings are backwards

compatible.

http://developer.nvidia.com/nvidia-management-library-nvml/

http://pypi.python.org/pypi/nvidia-ml-py/

Supported products:

  • Full Support

  • All Tesla products, starting with the Fermi architecture

  • All Quadro products, starting with the Fermi architecture

  • All GRID products, starting with the Kepler architecture

  • GeForce Titan products, starting with the Kepler architecture

  • Limited Support

  • All Geforce products, starting with the Fermi architecture

命令

nvidia-smi [OPTION1 [ARG1]] [OPTION2 [ARG2]]...

参数

参数 详解

-h, –help Print usage information and exit.

LIST OPTIONS:

参数 详解

-L, –list-gpus Display a list of GPUs connected to the system.

SUMMARY OPTIONS:

参数 详解

-i,–id= Target a specific GPU.

-f,–filename= Log to a specified file, rather than to stdout.

-l,–loop= Probe until Ctrl+C at specified second interval.

QUERY OPTIONS:

参数 详解

-q, –query

-u,–unit Show unit, rather than GPU, attributes.

-i,–id= Target a specific GPU or Unit.

-f,–filename= Log to a specified file, rather than to stdout.

-x,–xml-format Produce XML output.

–dtd When showing xml output, embed DTD.

-d,–display= Display only selected information: MEMORY,

-l, –loop= Probe until Ctrl+C at specified second interval.

-lms, –loop-ms= Probe until Ctrl+C at specified millisecond interval.

SELECTIVE QUERY OPTIONS:

参数 详解 补充

–query-gpu= Information about GPU. Call –help-query-gpu for more info.

–query-supported-clocks= List of supported clocks. Call –help-query-supported-clocks for more info.

–query-compute-apps= List of currently active compute processes. Call –help-query-compute-apps for more info.

–query-accounted-apps= List of accounted compute processes. Call –help-query-accounted-apps for more info.

–query-retired-pages= List of device memory pages that have been retired. Call –help-query-retired-pages for more info.

[mandatory]

参数 命令

-i, –id= Target a specific GPU or Unit.

-f, –filename= Log to a specified file, rather than to stdout.

-l, –loop= Probe until Ctrl+C at specified second interval.

-lms, –loop-ms= Probe until Ctrl+C at specified millisecond interval.

DEVICE MODIFICATION OPTIONS:

参数 命令 补充

-pm, –persistence-mode= Set persistence mode: 0/DISABLED, 1/ENABLED

-e, –ecc-config= Toggle ECC support: 0/DISABLED, 1/ENABLED

-p, –reset-ecc-errors= Reset ECC error counts: 0/VOLATILE, 1/AGGREGATE

-c, –compute-mode= Set MODE for compute applications: 0/DEFAULT,1/EXCLUSIVE_THREAD (deprecated),2/PROHIBITED, 3/EXCLUSIVE_PROCESS

–gom= Set GPU Operation Mode: 0/ALL_ON, 1/COMPUTE, 2/LOW_DP

-r –gpu-reset Trigger reset of the GPU.

UNIT MODIFICATION OPTIONS:

参数 命令

-t, –toggle-led= Set Unit LED state: 0/GREEN, 1/AMBER

-i, –id= Target a specific Unit.

SHOW DTD OPTIONS:

参数 命令

–dtd Print device DTD and exit.

-f, –filename= Log to a specified file, rather than to stdout.

-u, –unit Show unit, rather than device, DTD.

–debug= Log encrypted debug information to a specified file.

Process Monitoring:

参数 命令 补充

pmon Displays process stats in scrolling format. “nvidia-smi pmon -h” for more information.

TOPOLOGY: (EXPERIMENTAL)

参数 命令 补充

topo Displays device/system topology. “nvidia-smi topo -h” for more information. Please see the nvidia-smi(1) manual page for more detailed information.

© 2023 北京元石科技有限公司 ◎ 京公网安备 11010802042949号