Linux下监视NVIDIA的GPU使用情况

工作小计:

(1)Linux下可使用Nvidia自带的命令查看nvidia-smi查看显卡的数量及使用情况。

(2)使用watch命令进行Nvidia显卡使用情况的查看

watch命令使用格式及常用命令

Usage:
 watch [options] command

Options:
  -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     display this help and exit
 -v, --version  output version information and exit

周期性输出显卡使用情况

watch -n 10 nvidia-smi //每隔10秒输出显卡使用情况

退出显卡使用情况的显示

Ctrl+C结束watch命令,退出显卡使用情况的显示。