Nvbenjo
Nvbenjo is a utility for benchmarking inference of deep learning models on NVIDIA GPUs.
It supports models in Onnx format as well as PyTorch models, including torch.compile and ahead-of-time (AOT) compiled models.
Nvbenjo generates comprehensive benchmark results including:
- CSV file with all measurement data (latency, throughput, memory usage, etc.)
- Plots visualizing the benchmark results
Demo
Installing
pip install nvbenjo
If you need a specific version of PyTorch or want to benchmark Onnx models adapt your install:
pip install torch torchvision --index-url https://download.pytorch.org/whl/cu130
pip install onnx onnxruntime-gpu
pip install nvbenjo
Usage
# Specify models to run in the command line
nvbenjo \
"+nvbenjo.models={\
efficientnet: {type_or_path: 'torchvision:efficientnet_b0', shape:['B',3,224,224], batch_sizes: [16,32]},\
resnet: {type_or_path: 'torchvision:wide_resnet101_2', shape: ['B',3,224,224], batch_sizes: [16,32]}\
}"
# or better, specify your own config (or one of the pre-defined config files)
nvbenjo -cn small
nvbenjo -cn="/my/config/path/myconfig.yaml"
# override single arguments of your config
nvbenjo -cn="/my/config/path/myconfig.yaml" nvbenjo.models.mymodel.num_batches=10
# show current config and help
nvbenjo -cn="/my/config/path/myconfig.yaml" --help
Take a look at the Documentation for more information as well as example configurations.
Docker
The image bundles nvbenjo, its CUDA dependencies and nvbandwidth.
# build (the Onnx Runtime GPU backend is included by default)
docker build -t nvbenjo .
# run
mkdir -p outputs
docker run --rm -it --gpus all \
-v "$PWD/outputs:/outputs" \
-v nvbenjo-torch-cache:/root/.cache/torch \
nvbenjo \
nvbenjo -cn small
nvbandwidth is on the PATH as well:
docker run --rm --gpus all nvbenjo nvbandwidth
Development
Example using uv:
uv sync --group dev --extra onnx-cpu # or gpu
uv run nvbenjo
# for a quick run
uv run nvbenjo -cn small
# tests
uv run pytest
uv run nox
# docs
uv run --extra onnx-cpu sphinx-build -b html docs docs/_build/html
google-chrome docs/_build/html/index.html
Metadata
Release files for nvbenjo 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| nvbenjo-0.4.0.tar.gz | 520.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| nvbenjo-0.4.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 567.8 kB
Release files / nvbenjo-0.4.0.tar.gz
| Download URL | nvbenjo-0.4.0.tar.gz |
|---|---|
| Size | 520.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c18b6c8aaa8cc6da4b6b4be98d23bf2cbdfe7b24b59d13df395cd307ae9bebe8
|
|
BLAKE2b-256 checksum How to use checksums |
9c7d8c0651c00dc5b42cda35b52f9f764c8cf19207b21a06b76586d7ad9ff313
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.24 {"installer":{"name":"uv","version":"0.12.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / nvbenjo-0.4.0-py3-none-any.whl
| Download URL | nvbenjo-0.4.0-py3-none-any.whl |
|---|---|
| Size | 47.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
42e973e13a418238d52a2cd69579f03060823963e092e456d05b603950997c29
|
|
BLAKE2b-256 checksum How to use checksums |
8d0a36429c87fbfaabb9cb6649ecd4db1c6ed71434b50ab1deb7801cf68ce8c1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.24 {"installer":{"name":"uv","version":"0.12.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|