vidia自帶一個命令行工具可以查看顯存的使用情況:
nvidia-smi
表頭釋義:
- 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為單位。
watch用法

用法: watch [options] command 選項: -b, --beep beep if command has a non-zero exit -c, --color interpret ANSI color and style sequences -d, --differences[=<permanent>] highlight changes between updates -e, --errexit exit if command has a non-zero exit -g, --chgexit exit when output from command changes -n, --interval <secs> seconds to wait between updates -p, --precise attempt run command in precise intervals -t, --no-title turn off header -x, --exec pass command to exec instead of "sh -c" -h, --help 顯示此幫助然后離開 -v, --version output version information and exit
完結!