Skip to main content

Module checkpoint

Module checkpoint 

Source
Expand description

Checkpointing support for evolution state persistence

This module provides serialization and recovery of evolution state, enabling long-running experiments to be paused and resumed.

The state submodule (data structures) is always available. The recovery submodule (file I/O) requires the checkpoint feature and a target with a filesystem.

The second half of that condition is not a new restriction, it is the one CheckpointError already encodes: its Io variant is #[cfg(not(target_arch = "wasm32"))] and its docs read “native only”, with Storage(String) offered as the wasm alternative. The module gate had not been kept in step, so on wasm32 the file-I/O code was still compiled while the error variant its ? operators desugar into was not — cargo check --target wasm32-unknown-unknown failed on the default feature set with a dozen “? couldn’t convert the error to CheckpointError”.

Gating the module rather than adding a wasm From<io::Error> is the fix that matches the intent: wasm32-unknown-unknown has no filesystem, so File::create there could only ever be a compile-time promise of a runtime failure.

Modules§

prelude
Prelude for checkpoint module

Structs§

Checkpoint
Complete evolution state for checkpointing
CheckpointBuilder
Builder for creating checkpoints
CheckpointManager
Checkpoint manager for automatic saving
CmaEsCheckpointState
CMA-ES checkpoint state
HyperparameterState
Hyperparameter learning state

Enums§

AlgorithmState
Algorithm-specific state variants
CheckpointFormat
Format for checkpoint serialization

Constants§

CHECKPOINT_VERSION
Current checkpoint format version
DEFAULT_MAX_CHECKPOINT_BYTES
Default cap on the size (in bytes) of a checkpoint file that load_checkpoint will deserialize (EV-48). Files larger than this, and individual length-prefixed fields larger than this, are rejected with a typed error rather than triggering an unbounded allocation.
MIN_SUPPORTED_CHECKPOINT_VERSION
Oldest checkpoint schema version this build can still load (EV-45).

Traits§

SnapshotRng
An RNG whose complete internal state can be captured to bytes and restored, enabling bit-identical checkpoint resume.

Functions§

load_checkpoint
Load a checkpoint from a file using the default size limit (DEFAULT_MAX_CHECKPOINT_BYTES).
load_checkpoint_with_limit
Load a checkpoint from a file, rejecting inputs larger than max_bytes.
save_checkpoint
Save a checkpoint to a file