DIAGPT profiling#
Set DIAGPT_PROFILE=1 to print machine-readable records after the
off-diagonal OpenMP region. Profiling is disabled by default.
DIAGPT_PROFILE=1 DIAGPT_PROFILE_SAMPLE_STRIDE=1024 \
OMP_NUM_THREADS=16 OMP_DYNAMIC=FALSE build/bin/diagpt < input.inp
Records use the stable form:
[DIAGPT PROFILE] key=value
Exact counters include rows, determinant pairs, row/advance/direct HNTD calls,
nonzero row couplings, diagram IDs and families, H2 writes, and per-thread
row/pair load. The serial wall timer covers packed-index setup. Worker timers
cover worker-local backplay reset and redefinition, row fill, and complete pair
loops. workspace_wall_s remains in schema version one and is zero after the
serial per-determinant workspace array was removed.
Calling a clock around every pair phase would materially perturb large runs.
Therefore advance-backplay, classification, diagram dispatch, and direct-HNTD
subphase timers sample every DIAGPT_PROFILE_SAMPLE_STRIDE pair handled by each
worker. Their values are sampled worker-seconds, not elapsed wall time and not
automatically extrapolated totals. sampled_pairs and the stride are always
printed with them.
The profile validates these invariants before printing invariants_ok=1:
redef_calls == ncf - 1;rows == ncf - 1;sparse row candidates equal row HNTD calls, while intersection candidates bound advance HNTD calls;
classified_pairs == pairs;pairs == direct_hntd_calls == h2_writes;the sum of diagram-ID dispatch counts equals
pairs;all reported durations are nonnegative.
Use benchmarks/diagpt/run_benchmark.py for checksum-validated Ce3+/Pr3+
scaling runs and structured JSON/CSV output. Do not compare exact timing values
in regression tests; compare absolute energies against the versioned tolerance,
H2 provenance, actual OpenMP team size, and global counter invariants. Timer
records use wide scientific notation so production-scale aggregate CPU values
remain parseable.
The benchmark runner accepts --profile-mode off|base|dj. Use separate output
roots for matched modes because each invocation replaces prior results for that
case. The selected mode and both profiling environment switches are retained in
JSON and CSV provenance. Pass the prior mode’s result.json through
--reference-result to make cross-mode energy, normalized off-diagonal H2, and
shared exact-work equality part of harness acceptance rather than a manual
comparison.
D/J detail profiling#
Exact inner D/J counters are a build-time opt-in so their hot-loop branches and
contained helper wrappers are absent from ordinary optimized binaries. The
small capability/provenance state remains available in every build. Configure a
dedicated profiling build, then set DIAGPT_PROFILE_DJ=1 at runtime. The runtime
switch also enables the base profile, so DIAGPT_PROFILE is not needed.
cmake -S . -B build-dj-profile -DMPPT_ENABLE_DIAGPT_DJ_PROFILE=ON
cmake --build build-dj-profile --target diagpt
DIAGPT_PROFILE_DJ=1 OMP_NUM_THREADS=16 OMP_DYNAMIC=FALSE \
build-dj-profile/bin/diagpt < input.inp
An ordinary build fails explicitly if DIAGPT_PROFILE_DJ=1 is requested. The
benchmark harness’s dj mode therefore requires the dedicated binary.
The dj_* extension reports exact D/J dispatch and routine calls, aggregate
worker time, formal ibeq/ipeq and open-orbital loop visits, rejection stages,
tested terms, nonzero contributions, hainij updates, D/J-scoped ai, cont,
and deco4 outcomes, and selected PPAA/PAPA/PACV/CVCV integral routes. The
j0001 duration is inclusive of its nested j0002; separate nested and direct
j0002 times allow an exclusive value to be derived.
Reverse D/J calls intentionally exchange occupied and virtual arrays. Therefore
*_ibeq_visits and *_ipeq_visits name formal kernel arguments rather than a
fixed physical orbital side. Zero-map rejection totals remain exact across both
directions.
For every redefined row, detail mode also prepares stable compact metadata for
nonzero equivalence entries and existing open-hole/open-particle lists. Entries
retain source position, spatial and spin-orbital identity, spin, irrep, selected
ERI class, and packed self-pair index. This metadata is measured but is not used
to change D/J traversal, sorting, screening, or accumulation order.
Equivalence-map entries represent paired spatial orbitals, so their
spin_orbital and spin fields use the documented sentinels 0 and -1;
open-hole and open-particle entries retain explicit spin-orbital identity.
Detail counters use one record per OpenMP worker and are merged after the
parallel join. Their conservation checks cover D/J routine multiplicities,
nested/direct j0002, ai route outcomes, cont spin cases, deco4 branches,
selected ERI classes, compact-list bounds, and finite nonnegative durations.
Exact inner-loop counters and clocks intentionally add overhead in the dedicated
build. Measure its profile-off overhead separately; production overhead is gated
with an adjacent ordinary optimized build compiled with the option left OFF.