k4bench.analysis.event_size¶
k4bench.analysis.event_size ¶
What each output file a job wrote holds on disk: {label}_event_size.json.
The runners measure every file a successful run wrote, right after it, while
the files still exist (:func:record_event_size): ddsim's output file, and
every file a k4run job created in its working directory. Each file has its
size on disk; a podio file, an EDM4hep ROOT file whose events tree podio
wrote, also has its events, its ROOT compression setting and, for every
collection of its events, the bytes its branches take compressed, as they lie
in the file, and uncompressed. :func:load_event_size reads the files back
as :class:OutputFile records, whose :meth:OutputFile.per_event gives each
collection's bytes per event.
How a collection's bytes are counted
podio writes each collection of the events tree as a branch of its name
(<name>_objIdx for a subset collection) and one _<name>_<member>
branch for each of its relations and vector members; split, each of those has
a sub-branch per data member. A collection's bytes are those of all its
branches and their sub-branches together, TKey headers included, as uproot
counts them per branch (compressed_bytes, uncompressed_bytes). The
collections are those podio's own metadata lists for the events category,
with their types. The branches of no collection, podio's frame parameters,
are :data:FRAME_PARAMETERS. The collections and the frame parameters
together are the events tree; what the file holds besides, the metadata and
run trees and ROOT's own records, is in the file's size only.
What the numbers do not say:
- what a production file of the same events would take: the benchmark writes tens to a few thousand events with the job's own compression setting, and a file with more events fills ROOT's baskets further, which can compress a little differently;
- the size of a file in any other format: an LCIO (
.slcio) or RNTuple file has its size on disk only.
What each event holds
Measured with per_event, a podio file also has, entry by entry, each
collection's entries (its elements, read from the count its branch keeps
per entry), each calorimeter hit collection's energy_gev
(:data:CALORIMETER_TYPES, the sum of its hits' energies) and the
event_headers (the EventHeader's event and run number, None for an
entry without one). Each collection is read on its own: one whose counts or
energies cannot be read has none, which never reads as zero, and the bytes of
every collection are kept whatever its per-event reading did.
:meth:OutputFile.event_counts and :meth:OutputFile.event_energies give
them back as frames indexed by entry.
CollectionSize
dataclass
¶
CollectionSize(name: str, type: str, subset: bool, compressed_bytes: int, uncompressed_bytes: int, entries: tuple[int, ...] | None = None, energy_gev: tuple[float, ...] | None = None)
One collection's branches in a file's events tree.
OutputFile
dataclass
¶
OutputFile(name: str, bytes: int, events: int | None = None, compression: int | None = None, collections: tuple[CollectionSize, ...] = (), event_numbers: tuple[int | None, ...] | None = None, run_numbers: tuple[int | None, ...] | None = None)
One file a job wrote.
per_event ¶
Each collection's bytes per event, largest first: type,
subset, compressed_kb and uncompressed_kb per event, and
its share of the event's compressed bytes, indexed by
collection. Empty for a file without events.
Source code in k4bench/analysis/event_size.py
event_counts ¶
Each measured collection's elements per entry: one column per
collection, indexed by entry. Empty when none was measured.
Source code in k4bench/analysis/event_size.py
event_energies ¶
Each measured calorimeter hit collection's summed energy (GeV)
per entry: one column per collection, indexed by entry.
Source code in k4bench/analysis/event_size.py
describe_compression ¶
A ROOT compression setting in words: 101 is "ZLIB level 1".
Source code in k4bench/analysis/event_size.py
load_event_size ¶
load_event_size(run_dir: str | Path) -> tuple[dict[str, tuple[OutputFile, ...]], dict[str, str]]
Every label's output files in run_dir that could be read, and why each other could not: each record is read on its own, so one that is malformed hides no other configuration. Both empty when it has none.
Source code in k4bench/analysis/event_size.py
read_event_size ¶
read_event_size(path: Path) -> tuple[OutputFile, ...]
The output files one _event_size.json records.
Raises ValueError for an unsupported schema_version
(:func:~k4bench.plugin.schema.validate_event_size_schema) or a file
that is not an event-size record.
Source code in k4bench/analysis/event_size.py
record_event_size ¶
Write what each of files (name to path) holds to json_path, and what each event holds when per_event, warning about a file that could not be read. A failure costs only this record, never the run.
Source code in k4bench/analysis/event_size.py
measure_outputs ¶
The _event_size.json record of files, name to path: each one's
size on disk and, for a podio file, what its events hold, event by event
when per_event.
Source code in k4bench/analysis/event_size.py
event_content ¶
What each event of an open uproot root_file holds, up to
entry_stop: collections, each collection's measured entries and
energy_gev by name (a collection that could not be read is left out),
and event_headers. Empty for a file that is not a podio file.
Source code in k4bench/analysis/event_size.py
collection_sizes ¶
collection_sizes(branches: Iterable, collections: Mapping[str, tuple[str, bool]]) -> tuple[list[dict], dict]
The bytes of each of collections (name to type and whether it is a
subset) among an events tree's top-level branches (uproot's), and of the
branches of none, as (collections, parameters). Collections are in
collections' order.
Source code in k4bench/analysis/event_size.py
podio_collections ¶
The events category's collections podio's metadata lists in an open
uproot file, name to type and whether it is a subset; None for a file
that is not a podio file.
Source code in k4bench/analysis/event_size.py
read_event_headers ¶
Each entry's EventHeader event and run number up to entry_stop,
None for an entry without one; None when the file has no
EventHeader collection or it could not be read.