nvitop是一款实用、高颜值的GPU进程管理工具

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

file

特性

  • 信息和漂亮的输出:使用彩色的盒子绘图显示比nvidia-smi更多的信息。

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

    • 条形图和历史图
    • 过程排序
    • 过程过滤
    • 通过按键向进程发送信号
    • GPU进程及其父进程的树视图屏幕
    • 环境变量屏幕
    • 帮助屏幕
    • 鼠标支持
  • 交互式:在显示器模式下响应用户输入(来自键盘和/或鼠标)。(与gpustat和py3nvml相比)

  • 高效

    • 直接使用NVML Python绑定查询设备状态,而不是解析nvidia-smi的输出。(vs. nvidia-htop)
    • 使用来自cachetools的TTLCache支持稀疏查询和缓存结果。(与gpustat相比)
    • 使用curss库显示信息,而不是用ANSI转义代码打印。(与py3nvml对)
    • 使用多线程异步收集信息,并更快地对应用户输入。(与nvtop)
  • 便携式:在Linux和Windows上工作。

    • 使用跨平台库psutil获取主机进程信息,而不是在子进程中调用ps -p 。(vs. nvidia-htop & py3nvml)
    • 用纯Python编写,易于使用pip安装。(vs. nvtop)
  • 可集成:易于集成到其他应用程序中,不仅仅是监控。(与nvidia-htop和nvtop相比)

依赖条件

  • Python 3.7+
  • NVIDIA Management Library (NVML)
  • nvidia-ml-py
  • psutil
  • cachetools
  • termcolor
  • curses* (with libncursesw)

安装

github地址: https://github.com/XuehaiPan/nvitop

以下是在Ubuntu系统下安装命令,其他系统类似

$ sudo apt install pip
$ pip install nvitop

使用nvitop, 可以实时监控显存的使用情况。

nvitop用法

usage: nvitop [--help] [--version] [--once | --monitor [{auto,full,compact}]] [--interval SEC] [--ascii] [--colorful]
              [--force-color] [--light] [--gpu-util-thresh th1 th2] [--mem-util-thresh th1 th2]
              [--only idx [idx ...]] [--only-visible] [--compute] [--only-compute] [--graphics] [--only-graphics]
              [--user [USERNAME ...]] [--pid PID [PID ...]]

file

举例

# 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

更多内容请参考https://github.com/XuehaiPan/nvitop

Git LFS 大文件储存工具
Git为github设置代理
标签:

发表我的评论

电子邮件地址不会被公开。 必填项已用*标注

44 + 19 =

ajax-loader