Repository navigation
fix: reject an existing checkpoint step with a clear error - #63
Merged
Merged
Conversation
Saving an iteration whose files already exist crashed with FileExistsError from the exclusive rank-file creation. Re-saving now replaces only this rank's previous files, so ranks writing the same step concurrently never touch each other; a regression test pins the directory contents and the deterministic results.
Owner
|
Thanks for the report. Replacing a published step in place can lose it if the write fails part way, and other ranks cannot roll back with it. So I changed this to a clear error instead: a solver that reaches an existing step now raises a ValueError on all ranks that names the path and says to use a new checkpoint_directory or resume=. The earlier checkpoint stays intact. Tests are updated to match. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Re-running a solver with the same
checkpoint_directorycrashes insave_checkpoint(diffct/_solver_state.py):rank.mkdir()raisesFileExistsErroroncestep-.../rank-...already exists, so a resumed orrepeated run can never re-checkpoint into the folder it created itself. I hit
this re-running
cglstwice into an existing directory.Two tweaks: create the rank directory with
exist_ok=True, and unlink arank's own
.npyfile before recreating it (other ranks may still be writingthe same step concurrently).
No functional change beyond the fixed crash: 12/12 in
tests/test_solver_checkpoint_edges.pywith the patch - the newtest_reusing_a_checkpoint_directory_replaces_stepsfails on main.