A (user-)friendly wrapper to nvidia-smi.
It can be used to filter the GPUs based on resource usage (e.g. to choose the least utilized GPU on a multi-GPU system).
nvsmi --help
nvsmi ls --help
nvsmi ps --help
import nvsmi
nvsmi.get_gpus()
nvsmi.get_available_gpus()
nvsmi.get_gpu_processes()
- An nvidia GPU
nvidia-smi- Python 2.7 or 3.6+
The recommended installation method is pipx.
More specifically, you can install nvsmi for your user with:
pipx install nvsmiThe above command will create a virtual environment in ~/.local/pipx/venvs/nvsmi and
add the nvsmi executable in ~/.local/bin.
Alternatively you can use good old pip but this is more fragile than pipx:
pip install --user nvsmi