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.3.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.3.0.tar.gz | 516.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| nvbenjo-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 562.0 kB
Release files / nvbenjo-0.3.0.tar.gz
| Download URL | nvbenjo-0.3.0.tar.gz |
|---|---|
| Size | 516.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b4ba1312b14ab3904bd5801172c5f21cc2a334631a1a230ad9adcb3e91206684
|
|
BLAKE2b-256 checksum How to use checksums |
1c762b995335444bfa9de645b113d42c7ec2c9828d7ff411525ed4b63879fa66
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.17 {"installer":{"name":"uv","version":"0.12.17","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.3.0-py3-none-any.whl
| Download URL | nvbenjo-0.3.0-py3-none-any.whl |
|---|---|
| Size | 45.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9471cd7044f1f5553e9560c64443db448d1e7d388ce6232192496d2bc222915f
|
|
BLAKE2b-256 checksum How to use checksums |
4b08393a057de4ee8c942911fe31870c78fb0376210d72d3fca2df54f69f035a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.17 {"installer":{"name":"uv","version":"0.12.17","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}
|