nvitop 安装及使用

因为nvitop采用纯Python编写,所以推荐采用pip命令进行安装,官方安装说明文档中提供了五种安装方式:

  • 使用pipx进行安装
pipx run nvitop
  • 使用pip3进行安装
pip3 install --upgrade nvitop
  • 使用conda进行安装
conda install -c conda-forge nvitop
  • 从Github拉取最新版本进行安装
pip3 install git+https://github.com/XuehaiPan/nvitop.git#egg=nvitop
  • clone项目并手动安装
git clone --depth=1 https://github.com/XuehaiPan/nvitop.git
cd nvitop
pip3 install .

「注意」 如果在安装后遇到nvitop: command not found错误,请检查你是否将Python控制台脚本路径(例如,${HOME}/.local/bin)添加到您的PATH环境变量中。或者,你可以直接使用python3 -m nvitop命令

使用方法

命令行使用方法

# 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
posted @ 2024-11-08 10:30  XXLLA  阅读(158)  评论(0编辑  收藏  举报