因為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