k4bench.runner.k4run¶
k4bench.runner.k4run ¶
Execute a single k4run job and return a :class:RunResult.
Design principle
Like :mod:k4bench.runner.ddsim, this module owns instrumentation and not
the job's configuration, and here k4Bench knows even less about the job: it is
any set of Gaudi options files. The runner manages only --num-events, to
compute events/sec, and appends the k4BenchAuditor's options file after the
job's own. Input files, geometry and the job's own switches are passed through
verbatim via extra_args.
Per-event and per-component costs
When available, the k4BenchAuditor is enabled on every algorithm and service.
It writes the per-event JSON in the same format as the DDG4 timing plugin, the
per-component JSON, and the resolved job options, all inside the log
directory. The run-level virtual-memory peak is copied into
:class:RunResult. Given a heap path, the job also records which component
allocated each heap block, and the auditor writes what each held there.
After a successful run, what each file the job created holds on disk,
collection by collection for its EDM4hep files, is written to
<label>_event_size.json in the log directory
(:mod:k4bench.analysis.event_size), and what each event holds too when the
caller asks for it.
run_k4run ¶
run_k4run(*, options: list[str], label: str, n_events: int, work_dir: Path, log_dir: Path, setup_script: Path | None = None, extra_args: list[str] | None = None, verbose: bool = False, heap_json_path: Path | None = None, per_event_content: bool = False) -> RunResult
Run one k4run job in work_dir and return collected metrics.
The runner injects --num-events and, when the auditor is available,
appends its options file after options. All other job arguments should
be supplied via extra_args.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
options
|
list[str]
|
Gaudi options files, loaded in order. Relative paths are resolved by k4run against work_dir. |
required |
label
|
str
|
Human-readable name for this run. Used as the stem of the log and of
the auditor's output files, and stored in :attr: |
required |
n_events
|
int
|
Number of events; passed to |
required |
work_dir
|
Path
|
Directory the job runs in. The job's own outputs are written there;
:attr: |
required |
log_dir
|
Path
|
Directory where |
required |
setup_script
|
Path | None
|
Optional shell script sourced before k4run. |
None
|
extra_args
|
list[str] | None
|
Additional k4run arguments passed through verbatim, after the options files, so the options files' own argument parsers read them. |
None
|
verbose
|
bool
|
Stream k4run output live to stdout. |
False
|
heap_json_path
|
Path | None
|
Where the auditor writes the heap each component held. Given one, the job records which component allocated every heap block, which makes it slower: a run with one is never a timed run. |
None
|
per_event_content
|
bool
|
Also record what each event of the job's EDM4hep files holds, collection by collection, in its event size record. |
False
|
Returns:
| Type | Description |
|---|---|
RunResult
|
Process-level timing, memory, and throughput metrics. |
Source code in k4bench/runner/k4run.py
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 | |
marlin_processor_dump ¶
Marlin -x in the jobs' environment: every Marlin processor type the
stack's MARLIN_DLL libraries register, with its parameters, as steering
XML. None when Marlin cannot be run there.