k4bench.labels¶
k4bench.labels ¶
Shared contracts and human labels for benchmark-run identifiers.
A run carries machine strings for its configuration, detector, EOS sample
directory (p8_ee_Zbb_ecm91) and LCG/Spack platform triplet
(x86_64-almalinux9-gcc14.2.0-opt). This module owns the stable configuration
vocabulary and turns the latter two scope identifiers into something a person
reads.
It lives at the top level, and depends on nothing, because its consumers sit in
different layers and must not import each other: the benchmark writes these
identifiers, the e-group email and dashboard display them, and the blame ranker
puts them in the prompt a model judges with (:mod:k4bench.blame.rank). That
last consumer is why the vocabulary below is behaviour, not styling — widening
:data:_PARTICLE_LABELS changes what the model is told is being simulated, so
it is versioned and tested here rather than tweaked as presentation.
Every function degrades to the raw string when a name does not match a known layout: an unrecognized future sample reads plainly instead of being guessed at and rendered as garbled physics.
PlatformLabel
dataclass
¶
A recognized platform triplet, split into the parts that mean something
on their own — a caller that needs only the compiler or only the build type
(an opt vs. dbg build reads differently for a codegen change) gets
it from here rather than re-splitting the slug and re-deriving the layout
this module already decided.
pretty_sample ¶
Human-readable label for an EOS sample directory name.
Covers the two naming layouts currently produced by the benchmark:
single-particle guns (single_{particle}_{energy}) and generator
samples ({gen}_{beams}_{process}_ecm{energy}, e.g.
p8_ee_Zbb_ecm91). Anything else is returned unchanged.
This is the full form, naming every part of the sample. Use it in prose
and wherever there is room for it; :func:compact_sample is the one for a
narrow table cell.
Source code in k4bench/labels.py
compact_sample ¶
Narrow-cell label for an EOS sample directory name, e.g.
p8_ee_Zbb_ecm91 -> Z→bb · 91 GeV and single_e-_10GeV ->
e⁻ gun · 10 GeV.
Half the width of :func:pretty_sample, for the markdown tables in a
pull-request comment and the dashboard's dataframe columns, where the full
form wraps over several lines and costs more room than the column it sits
in is worth. It keeps what separates one sample from another — the process
and the energy — and drops the generator and beams while they are the
defaults every sample shares (:data:_DEFAULT_GENERATOR,
:data:_DEFAULT_BEAMS).
"gun" is what tells a single-particle run from a generator sample once the generator's name is gone, so it stays even though the directory spells it as a prefix rather than a suffix.
Purely presentational, unlike :func:pretty_sample, which is also what the
ranker's prompt says is being simulated. Nothing that judges anything reads
this.
Source code in k4bench/labels.py
pretty_metric ¶
Human-readable metric name, suffixed with the sub-detector for a
region-level row, e.g. ("mean_rss_mb", "EMEC_turbine") ->
Mean event RSS · EMEC_turbine.
The sub-detector keeps its raw name: it is a DD4hep DetElement identifier, which is what the dashboard labels the series with and what someone searching the geometry types.
Source code in k4bench/labels.py
pretty_release ¶
Human-readable label for a Key4hep release tag, e.g.
key4hep-2026-07-10 -> 2026-07-10.
The prefix is the same on every tag, so it distinguishes nothing and only costs width in a label. Anything without it is returned unchanged.
Source code in k4bench/labels.py
describe_platform ¶
describe_platform(platform: str) -> PlatformLabel | None
platform split into its four labelled parts, or None when it does
not match the {arch}-{os}{ver}-{compiler}{ver}-{type} layout, e.g.
x86_64-almalinux9-gcc14.2.0-opt -> x86_64 / AlmaLinux 9 /
GCC 14.2.0 / optimized.
Source code in k4bench/labels.py
pretty_platform ¶
One-line platform label, e.g. x86_64-almalinux9-gcc14.2.0-opt ->
AlmaLinux 9 · GCC 14.2.0 (optimized). Falls back to the raw string for
anything :func:describe_platform does not recognize.
The architecture is deliberately omitted: every run group in one report
shares it, so it carries no information in a UI label. Callers that need it
(the ranker's run context) use :func:describe_platform.