Skip to content

Commit

Permalink
fixup checkpoint timing race
Browse files Browse the repository at this point in the history
  • Loading branch information
wthrowe committed Feb 7, 2025
1 parent 81bf640 commit a895f4e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/Parallel/PhaseControl/CheckpointAndExitAfterWallclock.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,11 @@ struct CheckpointAndExitAfterWallclock : public PhaseChange {

private:
std::optional<double> wallclock_hours_for_checkpoint_and_exit_ = std::nullopt;
// This flag is set during arbitration when the class decides to
// halt the run. As it is not checkpointed, this distinguishes the
// state immediately after writing the checkpoint from that
// immediately after reading it during the restart.
//
// Phase arbitration is only run from Main, so there are no
// threading issues here.
// NOLINTNEXTLINE(spectre-mutable)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include "DataStructures/DataBox/DataBox.hpp"
#include "Framework/TestCreation.hpp"
#include "Framework/TestHelpers.hpp"
#include "Options/Protocols/FactoryCreation.hpp"
#include "Parallel/ExitCode.hpp"
#include "Parallel/GlobalCache.hpp"
Expand Down Expand Up @@ -100,8 +101,8 @@ SPECTRE_TEST_CASE("Unit.Parallel.PhaseControl.CheckpointAndExitAfterWallclock",
{
INFO("Restarting from checkpoint");
// Check behavior following the checkpoint phase
const PhaseControl::CheckpointAndExitAfterWallclock phase_change_restart(
0.0);
const PhaseControl::CheckpointAndExitAfterWallclock phase_change_restart =
serialize_and_deserialize(phase_change0);
PhaseChangeDecisionData phase_change_decision_data{
Parallel::Phase::Execute, false, true, Parallel::ExitCode::Complete};
auto decision_result = phase_change_restart.arbitrate_phase_change(
Expand Down

0 comments on commit a895f4e

Please sign in to comment.