


Introduction
nvidia-smi - NVIDIA System Management Interface program
nvidia smi (also known as NVSMI) provides support for nvidia Tesla, Quadro, GRID and GeForce devices provide monitoring and management capabilities. GeForce Titan series devices support most features, with very limited information provided for the rest of the GeForce brand. NVSMI is a cross-platform tool that supports all Linux distributions supported by standard NVIDIA drivers, as well as 64-bit versions of Windows starting with Windows Server 2008 R2.
✨nvidia-smi
NVIDIA System Management Interface (nvidia-smi) is a command line tool based on the NVIDIA Management Library (NVML), designed to assist in the management and monitoring of NVIDIA GPU devices .
This utility allows administrators to query GPU device status and allows administrators to modify GPU device status with appropriate permissions. It targets Tesla, GRID, Quadro and Titan X products, but other NVIDIA GPUs also have limited support.
NVIDIA-smi ships with the NVIDIA GPU display driver on Linux, as well as 64-bit Windows Server 2008 R2 and Windows 7. Nvidia-smi can report query information as XML or human-readable plain text to standard output or a file.
✨Commonly used nvidia-smi commands display all GPU information
nvidia-smi
Refresh GPU information every 1 second
nvidia-smi -l 1
List all current GPUs Device
nvidia-smi -L
View current GPU clock speed, default clock speed and maximum possible clock speed
nvidia-smi -q -d CLOCK
PS:
nvidia- smi command
Input directly on the command linenvidia-smi
The command should be a command that all alchemists are familiar with.
Note: It is recommended to use
watch -n 0.5 nvidia-smi
to dynamically observe the status of the GPU.
Through the nvidia-smi command, we will get such an informative page:
Tue Nov 9 13:47:51 2021
-----------------------------------------------------------------------------
| NVIDIA-SMI 495.44 Driver Version: 495.44 CUDA Version: 11.5 |
|------------------------------- ---------------------- ----------------------
| 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 GeForce ... Off | 00000000:17:00.0 Off | N/A |
| 62% 78C P2 155W / 170W | 10123MiB / 12051MiB | 100% Default |
| | | N/A |
------------------------------- ---------------------- ----------------------
| 1 NVIDIA GeForce ... Off | 00000000:65:00.0 Off | N/A |
|100% 92C P2 136W / 170W | 10121MiB / 12053MiB | 99% Default |
| | | N/A |
------------------------------- ---------------------- ----------------------
| 2 NVIDIA GeForce ... Off | 00000000:B5:00.0 Off | N/A |
| 32% 34C P8 12W / 170W | 5MiB / 12053MiB | 0% Default |
| | | N/A |
------------------------------- ---------------------- ----------------------
| 3 NVIDIA GeForce ... Off | 00000000:B6:00.0 Off | N/A |
| 30% 37C P8 13W / 170W | 5MiB / 12053MiB | 0% Default |
| | | N/A |
------------------------------- ---------------------- ----------------------+-----------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=============================================================================|
| 0 N/A N/A 1258 G /usr/lib/xorg/Xorg 6MiB |
| 0 N/A N/A 10426 C ...a3/envs/JJ_env/bin/python 10111MiB |
| 1 N/A N/A 1258 G /usr/lib/xorg/Xorg 4MiB |
| 1 N/A N/A 10427 C ...a3/envs/JJ_env/bin/python 10111MiB |
| 2 N/A N/A 1258 G /usr/lib/xorg/Xorg 4MiB |
| 3 N/A N/A 1258 G /usr/lib/xorg/Xorg 4MiB |
+-----------------------------------------------------------------------------+
其中显存占用和 GPU 利用率当然是我们最常来查看的参数,但是在一些情况下(比如要重点监控 GPU 的散热情况时)其他参数也很有用,笔者简单总结了一下该命令输出的各个参数的含义如下图:
可以看到其中各个位置的对应含义在输出本身中其实都已经指出了(蓝框),红框则指出了输出各个部分的含义,大部分输出的作用一目了然,这里笔者将其中几个不那么直观的参数简单整理一下:
Fan:从0到100%之间变动,这个速度是计算机期望的风扇转速,实际情况下如果风扇堵转,可能打不到显示的转速。
Perf:是性能状态,从P0到P12,P0表示最大性能,P12表示状态最小性能。
Persistence-M:是持续模式的状态,持续模式虽然耗能大,但是在新的GPU应用启动时,花费的时间更少,这里显示的是off的状态。
Disp.A:Display Active,表示GPU的显示是否初始化。
Compute M:是计算模式。
Volatile Uncorr. ECC:是否开启 ECC 纠错。
type:进程类型。C 表示计算进程,G 表示图形进程,C+G 表示都有。
nvidia-smi 命令的其他参数
除了直接运行 nvidia-smi
命令之外,还可以加一些参数,来查看一些本机 Nvidia GPU 的其他一些状态。下面笔者简单介绍几个常用的参数,其他的有需要可以去手册中查找:man nvidia-smi
。
-L
-L
参数显示连接到系统的 GPU 列表。
nvidia-smi -L # 输出: GPU 0: NVIDIA GeForce RTX 3060 (UUID: GPU-55275dff-****-****-****-6408855fced9) GPU 1: NVIDIA GeForce RTX 3060 (UUID: GPU-0a1e7f37-****-****-****-df9a8bce6d6b) GPU 2: NVIDIA GeForce RTX 3060 (UUID: GPU-38e2771e-****-****-****-d5cbb85c58d8) GPU 3: NVIDIA GeForce RTX 3060 (UUID: GPU-8b45b004-****-****-****-46c05975a9f0)
GPU UUID
:此值是GPU的全球唯一不可变字母数字标识符。它与主板上的物理标签无关。
-i
-i
参数指定某个 GPU,多用于查看 GPU 信息时指定其中一个 GPU。
-q
-q
参数查看 GPU 的全部信息。可通过 -i
参数指定查看某个 GPU 的参数。
如:
nvidia-smi -i 0 -q
输出太长了,笔者这里就不列了,大家可以自己试一下,是很完整的信息。
topo
topo
展示多GPU系统的拓扑连接信息,通常配合 -m
参数即 nvidia-smi topo -m
,其他参数可自行查阅。
输出如下,这里用代码块没法对齐,就直接贴图了:
The above is the detailed content of What are the commonly used nvidia-smi commands in Linux?. For more information, please follow other related articles on the PHP Chinese website!

The five core elements of Linux are: 1. Kernel, 2. Command line interface, 3. File system, 4. Package management, 5. Community and open source. Together, these elements define the nature and functionality of Linux.

Linux user management and security can be achieved through the following steps: 1. Create users and groups, using commands such as sudouseradd-m-gdevelopers-s/bin/bashjohn. 2. Bulkly create users and set password policies, using the for loop and chpasswd commands. 3. Check and fix common errors, home directory and shell settings. 4. Implement best practices such as strong cryptographic policies, regular audits and the principle of minimum authority. 5. Optimize performance, use sudo and adjust PAM module configuration. Through these methods, users can be effectively managed and system security can be improved.

The core operations of Linux file system and process management include file system management and process control. 1) File system operations include creating, deleting, copying and moving files or directories, using commands such as mkdir, rmdir, cp and mv. 2) Process management involves starting, monitoring and killing processes, using commands such as ./my_script.sh&, top and kill.

Shell scripts are powerful tools for automated execution of commands in Linux systems. 1) The shell script executes commands line by line through the interpreter to process variable substitution and conditional judgment. 2) The basic usage includes backup operations, such as using the tar command to back up the directory. 3) Advanced usage involves the use of functions and case statements to manage services. 4) Debugging skills include using set-x to enable debugging mode and set-e to exit when the command fails. 5) Performance optimization is recommended to avoid subshells, use arrays and optimization loops.

Linux is a Unix-based multi-user, multi-tasking operating system that emphasizes simplicity, modularity and openness. Its core functions include: file system: organized in a tree structure, supports multiple file systems such as ext4, XFS, Btrfs, and use df-T to view file system types. Process management: View the process through the ps command, manage the process using PID, involving priority settings and signal processing. Network configuration: Flexible setting of IP addresses and managing network services, and use sudoipaddradd to configure IP. These features are applied in real-life operations through basic commands and advanced script automation, improving efficiency and reducing errors.

The methods to enter Linux maintenance mode include: 1. Edit the GRUB configuration file, add "single" or "1" parameters and update the GRUB configuration; 2. Edit the startup parameters in the GRUB menu, add "single" or "1". Exit maintenance mode only requires restarting the system. With these steps, you can quickly enter maintenance mode when needed and exit safely, ensuring system stability and security.

The core components of Linux include kernel, shell, file system, process management and memory management. 1) Kernel management system resources, 2) shell provides user interaction interface, 3) file system supports multiple formats, 4) Process management is implemented through system calls such as fork, and 5) memory management uses virtual memory technology.

The core components of the Linux system include the kernel, file system, and user space. 1. The kernel manages hardware resources and provides basic services. 2. The file system is responsible for data storage and organization. 3. Run user programs and services in the user space.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Notepad++7.3.1
Easy-to-use and free code editor

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

Dreamweaver CS6
Visual web development tools

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.
