查询显卡信息
因显卡一般是PCI
接口,可以通过lspci
查询显卡相关信息:
方式1
lspci -vnn | grep VGA -A 12
输出:
03:00.0 VGA compatible controller [0300]: Matrox Electronics Systems Ltd. Integrated Matrox G200eW3 Graphics Controller [102b:0536] (rev 04) (prog-if 00 [VGA controller])
Subsystem: Dell Device [1028:07e5]
Flags: bus master, 66MHz, medium devsel, latency 0, IRQ 11, NUMA node 0
Memory at 91000000 (32-bit, prefetchable) [size=16M]
Memory at 92808000 (32-bit, non-prefetchable) [size=16K]
Memory at 92000000 (32-bit, non-prefetchable) [size=8M]
Expansion ROM at <unassigned> [disabled]
Capabilities: [dc] Power Management version 3
Kernel modules: mgag200
16:00.0 PCI bridge [0604]: Intel Corporation Sky Lake-E PCI Express Root Port A [8086:2030] (rev 07) (prog-if 00 [Normal decode])
Flags: bus master, fast devsel, latency 0, IRQ 27, NUMA node 0
Bus: primary=16, secondary=17, subordinate=17, sec-latency=0
- 名称型号:
Integrated Matrox G200eW3 Graphics Controller
PCI ID
:[102b:0536]
方式2
lspci | grep -i nvidia
lspci | grep -i vga
查看显卡驱动
lshw -c video
lshw -numeric -C display
查看显卡信息
在终端的命令框中输入以下语句,查看GPU使用情况:
nvidia-smi
watch -n 5 nvidia-smi #5秒刷新一次显卡信息
结果如下:
PS D:\MyJupyter> nvidia-smi
Tue Nov 17 11:08:44 2020
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 456.71 Driver Version: 456.71 CUDA Version: 11.1 |
|-------------------------------+----------------------+----------------------+
| GPU Name TCC/WDDM | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
|===============================+======================+======================|
| 0 GeForce MX250 WDDM | 00000000:01:00.0 Off | N/A |
| N/A 38C P8 N/A / N/A | 64MiB / 2048MiB | 0% Default |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=============================================================================|
| No running processes found |
+-----------------------------------------------------------------------------+
参数介绍(第一个表格):
GPU
:GPU 编号;Name
:GPU 型号;Persistence-M
:持续模式的状态。持续模式虽然耗能大,但在新的GPU应用启动时,花费的时间更少;TCC/WDDM
:两种驱动模式,TCC
全称为Tesla Compute Cluster
,WDDM
全称为Windows Display Driver Model
;Fan
:风扇转速,从0到100%之间变动;Temp
:温度,单位是摄氏度;Perf
:性能状态,从P0到P12,P0表示最大性能,P12表示状态最小性能(即 GPU 未工作时为P0,达到最大工作限度时为P12)。Pwr:Usage/Cap
:能耗;Bus-Id
:GPU线程ID,格式domain:bus:device.function
;Disp.A
:Display Active,表示GPU的显示是否初始化;Memory Usage
:显存使用率;Volatile GPU-Util
:浮动的GPU使用率;Uncorr. ECC
:Error Correcting Code,是否开启错误检查与纠正;Compute M
:compute mode,计算模式。
参数介绍(Processes 表示每个进程对 GPU 的显存使用率):
GPU
:GPU 编号;PID
:进程ID;Process name
:进程名称;GPU Memory Usage
:进程占用GPU显存大小
查看还在占用显存的进程
fuser -v /dev/nvidia*
参考: