MemProfileCallback¶
- class jaxrens.cli.monitor.MemProfileCallback(out_path)[source]¶
Bases:
objectOne-shot device-memory snapshot on the first post-compile iteration.
Intended as a debug aid when the NS loop OOMs or when you want to see which HLO op owns the peak allocation (typically the vmap’d backward pass through the energy backend inside the galilean/HMC kernels).
Enabled only when the
JAXRENS_MEMPROFenv var names the output filename; otherwise the callback is not constructed and the run pays nothing. Inspect the result withpprof -top -cum <file.prof.gz>.Fires twice at most: once from
on_startwith the.baselinesuffix (captures post-init state before any NS compile) and once from the firston_iterationafter the first step completes (captures the steady-state live set). The baseline snapshot is the only one that survives when iter 0 itself OOMs — which is the common failure mode we’re trying to diagnose.- Parameters:
out_path (Path | str)