Ubuntu 16.04 顯卡狀態查詢命令
1. nvidia-smi
strong@foreverstrong:~$ nvidia-smi
Mon Sep 2 10:57:09 2019
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 384.130 Driver Version: 384.130 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
|===============================+======================+======================|
| 0 GeForce GTX 1080 Off | 00000000:01:00.0 On | N/A |
| 0% 47C P8 8W / 180W | 249MiB / 8110MiB | 0% Default |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: GPU Memory |
| GPU PID Type Process name Usage |
|=============================================================================|
| 0 1508 G /usr/lib/xorg/Xorg 191MiB |
| 0 1723 G /opt/teamviewer/tv_bin/TeamViewer 12MiB |
| 0 1959 G compiz 42MiB |
+-----------------------------------------------------------------------------+
strong@foreverstrong:~$
2. nvidia-smi -l SEC, --loop=SEC
Continuously report query data at the specified interval, rather than the default of just once. The application will sleep in-between queries. Note that on Linux ECC error or XID error events will print out during the sleep period if the -x flag was not specified. Pressing Ctrl+C at any time will abort the loop, which will otherwise run indefinitely. If no argument is specified for the -l form a default interval of 5 seconds is used.
以指定的時間間隔連續報告查詢數據,而不是默認的一次。應用程序將在中間查詢之間休眠。請注意,如果未指定 -x 標誌,則在 Linux ECC 錯誤或 XID 錯誤事件將在睡眠期間打印輸出。任何時候按 Ctrl + C 都會中止循環,否則循環將無限期地運行。如果沒有爲 -l 表單指定參數,則使用默認的 5 秒間隔。
使用默認值,每 5 秒間隔刷新一次。
strong@foreverstrong:~$ nvidia-smi -l
每 5 秒間隔刷新一次。
strong@foreverstrong:~$ nvidia-smi -l 5
3. watch -n 2 nvidia-smi
每 2 秒間隔刷新一次。
strong@foreverstrong:~$ watch -n 2 nvidia-smi
每 9 秒間隔刷新一次。
strong@foreverstrong:~$ watch -n 9 nvidia-smi