NVIDIA显卡资源监控

1 概述

nvitop 是一个交互式 NVIDIA 设备和过程监控工具。它具有丰富多彩且信息丰富的界面,可不断更新设备和进程的状态。
作为资源监视器,它包括许多功能和选项,例如树视图,环境变量查看,进程过滤,进程指标监视等。
除此之外,该软件包还为深度学习研究人员提供了 CUDA 设备选择工具 nvisel 。它还提供了方便的API,允许开发人员编写自己的监视工具。

2 安装

github可以访问的直接到如下链接去下载就可以
https://github.com/XuehaiPan/nvitop
github如果无法访问的话,可以后台直接私信
如果有python环境,建议直接pip安装

pip3 install --upgrade nvitop

3 用法

  1. 查看设备和进程状态,类似于nvidia-smi
# Query the status of all devices
$ nvitop -1  # or use `python3 -m nvitop -1`

# Specify query devices (by integer indices)
$ nvitop -1 -o 0 1  # only show <GPU 0> and <GPU 1>

# Only show devices in `CUDA_VISIBLE_DEVICES` (by integer indices or UUID strings)
$ nvitop -1 -ov

# Only show GPU processes with the compute context (type: 'C' or 'C+G')
$ nvitop -1 -c

当 -1 开关打开时,结果将仅显示一次(与 的默认 nvidia-smi 行为相同)。这要快得多,并且资源使用率更低。有关更多命令选项,请参阅命令行选项。

  1. 资源监控

作为资源监控运行

# Monitor mode (when the display mode is omitted, `NVITOP_MONITOR_MODE` will be used)
$ nvitop  # or use `python3 -m nvitop`

# Automatically configure the display mode according to the terminal size
$ nvitop -m auto     # shortcut: `a` key

# Arbitrarily display as `full` mode
$ nvitop -m full     # shortcut: `f` key

# Arbitrarily display as `compact` mode
$ nvitop -m compact  # shortcut: `c` key

# Specify query devices (by integer indices)
$ nvitop -o 0 1  # only show <GPU 0> and <GPU 1>

# Only show devices in `CUDA_VISIBLE_DEVICES` (by integer indices or UUID strings)
$ nvitop -ov

# Only show GPU processes with the compute context (type: 'C' or 'C+G')
$ nvitop -c

# Use ASCII characters only
$ nvitop -U  # useful for terminals without Unicode support

# For light terminals
$ nvitop --light

# For spectrum-like bar charts (requires the terminal supports 256-color)
$ nvitop --colorful

在监视模式下,您可以使用 / / 键中断/终止 Ctrl-c / T K 终止进程。建议在树视图屏幕中终止或终止进程(快捷方式: t )。对于普通用户, nvitop 会浅化其他用户的进程(在低强度的颜色中)。对于系统管理员,您可以使用 终止 sudo nvitop 其他用户的进程。

4 软件特性或亮点

  1. 信息丰富且花哨的输出:显示比彩色花哨框图更多的 nvidia-smi 信息。

  2. 监控模式:可以作为资源监视器运行,而不是只打印一次结果。

  • 条形图和历史图表

  • 进程分类

  • 进程过滤

  • 通过键盘可以发送信号给进程

  • GPU进程及其父进程的树状显示

  • 帮助显示

  • 支持鼠标操作

  1. 支持交互式操作

  2. 有效

  3. 可移植,适用于windwos或者linux环境

  • 使用跨平台库 PSout 获取主机进程信息,而不是在子进程中调用 ps -p

  • 纯Python编写,易于安装 pip

  1. 可集成,易于集成到其他应用中,而不仅仅是监控。


支持windows

5 总结

更多关于该工具的使用,可以到如下地址查看:
https://nvitop.readthedocs.io/e

posted @ 2024-03-15 09:59    阅读(6)  评论(0编辑  收藏  举报