jaxrens.io.restart_truncate¶
Truncate-on-restart helpers for the streamed output artifacts.
On restart the live NS state is restored from a checkpoint written at global
iteration M (= checkpoint['iteration'] = n_dead), but the append-only
output streams (.energies, .traj, the per-iteration HDF5 logs) may
contain records past M — whatever the previous process flushed before it
died between two checkpoints. Resuming and appending would duplicate the
[M, last_flushed] window, corrupting the dead-point sequence (log_Z is
reconstructed from dead-point row order, see
postprocess/thermodynamics.py) and the trajectory.
These helpers rewind each artifact to the checkpoint by dropping every record
whose global iteration label is >= restart_iteration. They rely on the
loop emitting a monotonic record_iteration across restart (see
sampling/run_loop.py), so the cut point is unambiguous and stable across
repeated restarts.
All helpers are no-ops when restart_iteration <= 0 (fresh run) or the file
does not exist yet.
Functions
Drop |
|
Keep only extxyz frames whose |
|
Resize every per-iteration dataset to drop rows >= restart_iteration. |
|
Delete per-iteration groups (keyed by |