nvidia-sminvidia-smi
这个命令行实用程序用于查询和管理由 NVML 管理库暴露的 GPU 状态。其输出(如下所示样本)对于 NVIDIA GPU 用户来说非常熟悉,甚至被戏称为 GPU 界的 Hello World。
nvidia-smi 报告以下信息:
- GPU 身份信息,如显卡型号名称、UUID 和 PCI ID
- 内核执行时间和内存分配的实时利用率指标
- 实时功耗和温度信息
有关这些指标的详细说明(包括如何解读功率和温度读数),请参见 Modal 文档中的这个页面。
nvidia-smi 还可以列出当前使用 GPU 的进程(-q、--query、pmon 参数)。常见的管理任务包括设置持久模式(-pm)、计算模式(-c)、功耗限制(-pl)、应用/锁定时钟(-ac、-lgc、-lmc)以及执行 GPU 重置(-r)。
输出可以格式化为人类可读的文本或 XML(-x 参数)。虽然 nvidia-smi 的文本输出格式不保证稳定,但底层的 NVML C 库 为工具开发提供了稳定的 API。
nvidia-smi 的文档可以在 这里 找到,官方 Python 绑定可以在 这里 找到。
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 580.95.05 Driver Version: 580.95.05 CUDA Version: 13.0 |
|-----------------------------------------+------------------------+----------------------+
| GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|=========================================+========================+======================|
| 0 NVIDIA B200 On | 00000000:51:00.0 Off | 0 |
| N/A 27C P0 136W / 1000W | 0MiB / 183359MiB | 0% Default |
| | | Disabled |
+-----------------------------------------+------------------------+----------------------+
| 1 NVIDIA B200 On | 00000000:52:00.0 Off | 0 |
| N/A 25C P0 140W / 1000W | 0MiB / 183359MiB | 0% Default |
| | | Disabled |
+-----------------------------------------+------------------------+----------------------+
| 2 NVIDIA B200 On | 00000000:62:00.0 Off | 0 |
| N/A 27C P0 138W / 1000W | 0MiB / 183359MiB | 0% Default |
| | | Disabled |
+-----------------------------------------+------------------------+----------------------+
| 3 NVIDIA B200 On | 00000000:63:00.0 Off | 0 |
| N/A 26C P0 138W / 1000W | 0MiB / 183359MiB | 0% Default |
| | | Disabled |
+-----------------------------------------+------------------------+----------------------+
| 4 NVIDIA B200 On | 00000000:75:00.0 Off | 0 |
| N/A 27C P0 139W / 1000W | 0MiB / 183359MiB | 0% Default |
| | | Disabled |
+-----------------------------------------+------------------------+----------------------+
| 5 NVIDIA B200 On | 00000000:76:00.0 Off | 0 |
| N/A 25C P0 140W / 1000W | 0MiB / 183359MiB | 0% Default |
| | | Disabled |
+-----------------------------------------+------------------------+----------------------+
| 6 NVIDIA B200 On | 00000000:86:00.0 Off | 0 |
| N/A 27C P0 142W / 1000W | 0MiB / 183359MiB | 0% Default |
| | | Disabled |
+-----------------------------------------+------------------------+----------------------+
| 7 NVIDIA B200 On | 00000000:87:00.0 Off | 0 |
| N/A 26C P0 138W / 1000W | 0MiB / 183359MiB | 0% Default |
| | | Disabled |
+-----------------------------------------+------------------------+----------------------+英文原文(Modal GPU Glossary)
This command line utility is used to query and manage the state of the GPU exposed by the NVML management libraries. Its outputs, a sample of which appears below, are familiar to users of NVIDIA GPUs to the point of being a meme.
nvidia-smi reports the following:
- GPU identity information like the card's model name, a UUID, and the PCI ID
- live utilization metrics for kernel execution time and memory allocation
- live power and thermal information
For details on these metrics, including how to interpret power and thermal readings, see this page on the Modal docs.
nvidia-smi can also list processes currently using the GPU (-q, --query, pmon). Common management tasks include setting persistence mode (-pm), compute mode (-c), power limits (-pl), application/locked clocks (-ac, -lgc, -lmc), and performing GPU resets (-r).
Output can be formatted as human-readable text or XML (-x). While nvidia-smi's text output format is not guaranteed to be stable, the underlying NVML C library offers a stable API for tool development.
The documentation for nvidia-smi can be found here, and the official Python bindings can be found here.
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 580.95.05 Driver Version: 580.95.05 CUDA Version: 13.0 |
|-----------------------------------------+------------------------+----------------------+
| GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|=========================================+========================+======================|
| 0 NVIDIA B200 On | 00000000:51:00.0 Off | 0 |
| N/A 27C P0 136W / 1000W | 0MiB / 183359MiB | 0% Default |
| | | Disabled |
+-----------------------------------------+------------------------+----------------------+
| 1 NVIDIA B200 On | 00000000:52:00.0 Off | 0 |
| N/A 25C P0 140W / 1000W | 0MiB / 183359MiB | 0% Default |
| | | Disabled |
+-----------------------------------------+------------------------+----------------------+
| 2 NVIDIA B200 On | 00000000:62:00.0 Off | 0 |
| N/A 27C P0 138W / 1000W | 0MiB / 183359MiB | 0% Default |
| | | Disabled |
+-----------------------------------------+------------------------+----------------------+
| 3 NVIDIA B200 On | 00000000:63:00.0 Off | 0 |
| N/A 26C P0 138W / 1000W | 0MiB / 183359MiB | 0% Default |
| | | Disabled |
+-----------------------------------------+------------------------+----------------------+
| 4 NVIDIA B200 On | 00000000:75:00.0 Off | 0 |
| N/A 27C P0 139W / 1000W | 0MiB / 183359MiB | 0% Default |
| | | Disabled |
+-----------------------------------------+------------------------+----------------------+
| 5 NVIDIA B200 On | 00000000:76:00.0 Off | 0 |
| N/A 25C P0 140W / 1000W | 0MiB / 183359MiB | 0% Default |
| | | Disabled |
+-----------------------------------------+------------------------+----------------------+
| 6 NVIDIA B200 On | 00000000:86:00.0 Off | 0 |
| N/A 27C P0 142W / 1000W | 0MiB / 183359MiB | 0% Default |
| | | Disabled |
+-----------------------------------------+------------------------+----------------------+
| 7 NVIDIA B200 On | 00000000:87:00.0 Off | 0 |
| N/A 26C P0 138W / 1000W | 0MiB / 183359MiB | 0% Default |
| | | Disabled |
+-----------------------------------------+------------------------+----------------------+相关词条
本词条改编自 Modal GPU Glossary(CC BY 4.0)· 中文翻译 miter6/gpu-glossary-zh,MAE 整理排版。