astronomix.setup_helpers package#
Submodules#
Module contents#
Setup / orchestration helpers for astronomix simulations.
- astronomix.setup_helpers.latest_checkpoint_step(directory) int | None[source]#
The most recent checkpoint step in
directory(Noneif empty).
- astronomix.setup_helpers.restart_from_latest_checkpoint(directory, params: SimulationParams, *, step: int | None = None, sharding: Sharding | None = None) Tuple[Array, SimulationParams, LoopState][source]#
Load the latest (or a specific) checkpoint and prepare a resumed run.
- Parameters:
directory – The checkpoint directory used as
snapshot_storage_path.params – The simulation parameters of the run to resume. Returned with
t_startset to the checkpoint’s time so the integration picks up where it left off.step – The checkpoint step to restore.
None(default) restores the latest one.sharding – Optional target sharding for the restored state / forcing (e.g. when resuming on a different device topology). When
Nonethe sharding stored in the checkpoint is recovered.
- Returns:
(primitive_state, params, restart_state)whereprimitive_stateis the restored (unpadded) state to pass as the first argument oftime_integration(),paramshast_startset to the checkpoint time, andrestart_stateis theLoopStatecarrying the PRNG key and OU forcing field to pass viarestart_state=.
Example:
ps, params, restart = restart_from_latest_checkpoint( path, params, sharding=sharding ) final = time_integration( ps, config, params, registered_variables, sharding=sharding, restart_state=restart, )