Skip to content

Add configurable and atomic checkpoint controls#15

Closed
Toti330 wants to merge 3 commits into
mainfrom
feat/checkpoint-controls
Closed

Add configurable and atomic checkpoint controls#15
Toti330 wants to merge 3 commits into
mainfrom
feat/checkpoint-controls

Conversation

@Toti330

@Toti330 Toti330 commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds explicit checkpoint frequency and overwrite controls, safer atomic checkpoint replacement, and validation for resume data.

Why this is useful

Checkpoint behavior was previously implicit and the main-loop sleep converted 0.1 seconds to 0 ms, causing continuous checkpoint writes. This PR makes checkpoint I/O deliberate, tunable, and safe to disable during measurement.

Implementation

  • Adds CHECKPOINT_FREQUENCY=none|very_low|low|medium|high|xhigh|atomic.
  • Uses exact cadences: disabled, 60s, 30s, 10s default, 1s, 250ms, and 100ms.
  • Adds CHECKPOINT_OVERWRITE=1 to discard an existing resume file intentionally.
  • Replaces files via temporary file plus rename so readers see a complete old or complete new checkpoint.
  • Stores absolute per-worker seed positions, limits rewind to the existing 2-seed policy, and validates entry count plus each worker range.
  • Fixes the scheduler sleep to Duration::from_secs_f32(0.1).

Independence

This PR is based directly on main and has no feature-branch dependency. It can be merged independently of timing, diagnostics, tuning, preflight, and progress logging.

Verification

  • cargo test --all-targets: 5 checkpoint tests passed.
  • Benchmark smoke run completed with CHECKPOINT_FREQUENCY=none.

Generated by GPT-5.6 Terra & Sol. Ideas from the author; implementation by AI.

@SuperB3333

Copy link
Copy Markdown
Owner

Implemented in 58c5e39

@SuperB3333 SuperB3333 closed this Jul 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants