MemProfileCallback

class jaxrens.cli.monitor.MemProfileCallback(out_path)[source]

Bases: object

One-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_MEMPROF env var names the output filename; otherwise the callback is not constructed and the run pays nothing. Inspect the result with pprof -top -cum <file.prof.gz>.

Fires twice at most: once from on_start with the .baseline suffix (captures post-init state before any NS compile) and once from the first on_iteration after 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)