Skip to content

Commit

Permalink
Avoid a restart if the last timestep is about to complete
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeshingles committed Mar 8, 2025
1 parent 095cb37 commit b77e676
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sn3d.cc
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ auto walltime_sufficient_to_continue(const int nts, const int nts_prev, const in
estimated_time_per_timestep, nts_prev, nts);

bool do_this_full_loop = true;
if (walltimelimitseconds > 0) {
if (walltimelimitseconds > 0 && nts < globals::timestep_finish) {
const int wallclock_used_seconds = std::time(nullptr) - real_time_start;
const int wallclock_remaining_seconds = walltimelimitseconds - wallclock_used_seconds;
printout("TIMED_RESTARTS: Used %d of %d seconds of wall time.\n", wallclock_used_seconds, walltimelimitseconds);
Expand Down Expand Up @@ -903,7 +903,7 @@ auto main(int argc, char *argv[]) -> int {
fclose(linestat_file);
}

if ((globals::ntimesteps != globals::timestep_finish) || (terminate_early)) {
if ((globals::ntimesteps > globals::timestep_finish) || (terminate_early)) {
printout("RESTART_NEEDED to continue model\n");
} else {
printout("No need for restart\n");
Expand Down

0 comments on commit b77e676

Please sign in to comment.