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.
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.