Performance benchmarking for DD4hep-based simulations and reconstruction in Key4hep
Project description
Detector-agnostic performance benchmarking for Key4hep simulations
👉 Open the live dashboard · 📖 Read the docs
k4Bench measures where the time and memory go in DD4hep / Geant4 detector
simulations run through ddsim in the Key4hep stack.
Point it at any DD4hep compact geometry and it will tell you how long a simulation takes, how much memory it needs, and — crucially — which subdetector is responsible. It does this without you editing a single XML file or recompiling anything.
What it does
- ⚡ Geometry sweeps — automatically run a baseline, then re-run with each subdetector removed (or only a chosen subset kept) to measure each detector's cost. The original geometry is never touched.
- ⏱️ Per-event & per-detector timing — C++ Geant4 timing plugins record per-event wall time, RSS memory, and per-subdetector stepping time.
- 📊 Analysis & dashboard — load results into pandas, plot them with the bundled helpers, or browse historical trends across Key4hep releases on the live dashboard.
- 🔭 Detector-agnostic — works on any DD4hep compact XML. FCC-ee detectors (ALLEGRO, IDEA) are the worked examples and nightly-CI targets, not a limit.
Quick start
The recommended install is from source, so the C++ timing plugins are built and you get the full set of metrics:
# 1. Clone the repository
git clone https://github.com/key4hep/k4Bench.git
cd k4Bench
# 2. Source setup.sh to source Key4hep, make a CVMFS-aware venv, install deps,
# build the timing plugins, and install pre-commit hooks.
source setup.sh
# 3. Install the k4bench command (editable)
pip install --no-build-isolation -e .
# 4. Benchmark a geometry (single particle-gun run)
k4bench --xml $K4GEO/FCCee/ALLEGRO/compact/ALLEGRO_o1_v03/ALLEGRO_o1_v03.xml \
--events 100 \
--ddsim-args="--enableGun --gun.particle e- --gun.distribution uniform"
Want to know each subdetector's cost? Add --sweep:
k4bench --xml ALLEGRO_o1_v03.xml --sweep \
--ddsim-args="--enableGun --gun.particle e- --gun.distribution uniform"
Results print as a summary table and are written as CSV (plus per-event /
per-region JSON) under logs/<geometry>/.
Also on PyPI:
pip install k4bench --no-deps(inside Key4hep) gives you run-level metrics, but not the C++ timing plugins — so per-event and per-detector timing are unavailable. Installing from source is recommended.
Analyse and plot the results
The bundled analysis helpers load a run directory into pandas and produce ready-made Plotly figures:
from k4bench.analysis import load_results, plot_run_overview
df = load_results("logs/ALLEGRO_o1_v03") # one row per run
plot_run_overview("logs/ALLEGRO_o1_v03").show() # bar charts across runs
Documentation
Full documentation — installation, every CLI option, the sweep modes, the timing plugins, the architecture, and the dashboard — lives at:
📖 https://key4hep.github.io/k4Bench/
| I want to… | Start here |
|---|---|
| Install and run my first benchmark | Getting started |
| Understand sweep modes & options | User guide |
| Understand how it works | Architecture |
License
Distributed under the terms of the LICENSE in this repository.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file k4bench-0.0.13.tar.gz.
File metadata
- Download URL: k4bench-0.0.13.tar.gz
- Upload date:
- Size: 180.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2746110aa3913652d68408d06025d95adc514e13610b085098a94afd0c93dd46
|
|
| MD5 |
a0b3e8356065e283a385a6064e35c48e
|
|
| BLAKE2b-256 |
cccf72c00fdd67333396fef2dcc8c24c557fd18c46b5fc05fc13be235e625b2e
|
Provenance
The following attestation bundles were made for k4bench-0.0.13.tar.gz:
Publisher:
on-release-main.yml on key4hep/k4Bench
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
k4bench-0.0.13.tar.gz -
Subject digest:
2746110aa3913652d68408d06025d95adc514e13610b085098a94afd0c93dd46 - Sigstore transparency entry: 1712798048
- Sigstore integration time:
-
Permalink:
key4hep/k4Bench@0c0ea8b7ee9a1f9f8d07cf04fdcd03892c76bb07 -
Branch / Tag:
refs/tags/v0.0.13 - Owner: https://github.com/key4hep
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
on-release-main.yml@0c0ea8b7ee9a1f9f8d07cf04fdcd03892c76bb07 -
Trigger Event:
release
-
Statement type:
File details
Details for the file k4bench-0.0.13-py3-none-any.whl.
File metadata
- Download URL: k4bench-0.0.13-py3-none-any.whl
- Upload date:
- Size: 47.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3255c2f6c0446e22600c9ba2fc60b8d1eb250ebd5de8842b3827610a55a0ed21
|
|
| MD5 |
e38ddd987aebd1ace6e55ed5c4252dc7
|
|
| BLAKE2b-256 |
e7e35e239814433765f8becaa2aef16d8a8e5b7669bb521ae18e90ff37ad4dbb
|
Provenance
The following attestation bundles were made for k4bench-0.0.13-py3-none-any.whl:
Publisher:
on-release-main.yml on key4hep/k4Bench
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
k4bench-0.0.13-py3-none-any.whl -
Subject digest:
3255c2f6c0446e22600c9ba2fc60b8d1eb250ebd5de8842b3827610a55a0ed21 - Sigstore transparency entry: 1712798084
- Sigstore integration time:
-
Permalink:
key4hep/k4Bench@0c0ea8b7ee9a1f9f8d07cf04fdcd03892c76bb07 -
Branch / Tag:
refs/tags/v0.0.13 - Owner: https://github.com/key4hep
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
on-release-main.yml@0c0ea8b7ee9a1f9f8d07cf04fdcd03892c76bb07 -
Trigger Event:
release
-
Statement type: