Linux查看顯卡信息:
lspci | grep -i vga
使用nvidia GPU可以:
lspci | grep -i nvidia
[root@gpu-server-002 ~]
# lspci | grep -i nvidia
02:00.0 VGA compatible controller: NVIDIA Corporation Device 1b06 (rev a1)
02:00.1 Audio device: NVIDIA Corporation Device 10ef (rev a1)
03:00.0 VGA compatible controller: NVIDIA Corporation Device 1b06 (rev a1)
03:00.1 Audio device: NVIDIA Corporation Device 10ef (rev a1)
82:00.0 VGA compatible controller: NVIDIA Corporation Device 1b06 (rev a1)
82:00.1 Audio device: NVIDIA Corporation Device 10ef (rev a1)
83:00.0 VGA compatible controller: NVIDIA Corporation Device 1b06 (rev a1)
83:00.1 Audio device: NVIDIA Corporation Device 10ef (rev a1)
|
前邊的序號 "00:0f.0"是顯卡的代號(這里是用的虛擬機);
查看指定顯卡的詳細信息用以下指令:
lspci -v -s 00:0f.0
Linux查看Nvidia顯卡信息及使用情況
Nvidia自帶一個命令行工具可以查看顯存的使用情況:
nvidia-smi
[root@gpu-server-002 ~]
# nvidia-smi
Tue Nov 27 00:20:51 2018
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 384.98 Driver Version: 384.98 |
|-------------------------------+----------------------+----------------------+
| 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 108... On | 00000000:02:00.0 Off | N
/A
|
| 66% 85C P2 175W / 250W | 10795MiB / 11172MiB | 100% Default |
+-------------------------------+----------------------+----------------------+
| 1 GeForce GTX 108... On | 00000000:03:00.0 Off | N
/A
|
| 56% 83C P2 162W / 250W | 10795MiB / 11172MiB | 100% Default |
+-------------------------------+----------------------+----------------------+
| 2 GeForce GTX 108... On | 00000000:82:00.0 Off | N
/A
|
| 52% 82C P2 250W / 250W | 10795MiB / 11172MiB | 90% Default |
+-------------------------------+----------------------+----------------------+
| 3 GeForce GTX 108... On | 00000000:83:00.0 Off | N
/A
|
| 54% 83C P2 126W / 250W | 10795MiB / 11172MiB | 82% Default |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: GPU Memory |
| GPU PID Type Process name Usage |
|=============================================================================|
| 0 11161 C python 10785MiB |
| 1 11161 C python 10785MiB |
| 2 12049 C python 10785MiB |
| 3 12049 C python 10785MiB |
|
表頭釋義:
Fan:顯示風扇轉速,數值在0到100%之間,是計算機的期望轉速,如果計算機不是通過風扇冷卻或者風扇壞了,顯示出來就是N/A;
Temp:顯卡內部的溫度,單位是攝氏度;
Perf:表征性能狀態,從P0到P12,P0表示最大性能,P12表示狀態最小性能;
Pwr:能耗表示;
Bus-Id:涉及GPU總線的相關信息;
Disp.A:是Display Active的意思,表示GPU的顯示是否初始化;
Memory Usage:顯存的使用率;
Volatile GPU-Util:浮動的GPU利用率;
Compute M:計算模式;
下邊的Processes顯示每塊GPU上每個進程所使用的顯存情況。
如果要周期性的輸出顯卡的使用情況,可以用watch指令實現:
watch -n 10 nvidia-smi
命令行參數-n后邊跟的是執行命令的周期,以s為單位。
---------------------
作者:-牧野-
來源:CSDN
原文:https://blog.csdn.net/dcrmg/article/details/78146797
版權聲明:本文為博主原創文章,轉載請附上博文鏈接!