Skip to content

Commit

Permalink
Enable progress estimate for restarted simulations
Browse files Browse the repository at this point in the history
  • Loading branch information
nefrathenrici committed Mar 20, 2024
1 parent bdd8a7b commit 635c5b8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
9 changes: 5 additions & 4 deletions src/callbacks/callbacks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ end
import Dates
function print_walltime_estimate(integrator)
(; walltime_estimate, dt, t_end) = integrator.p
t_start = integrator.sol.prob.tspan[1]
wte = walltime_estimate

# Notes on `ready_to_report`
Expand Down Expand Up @@ -258,11 +259,11 @@ function print_walltime_estimate(integrator)

if wte.n_calls == wte.n_next && ready_to_report
t = integrator.t
n_steps_total = ceil(Int, t_end / dt)
n_steps = ceil(Int, t / dt)
n_steps_total = ceil(Int, (t_end - t_start) / dt)
n_steps = ceil(Int, (t - t_start) / dt)
wall_time_ave_per_step = wte.∑Δt_wall / n_steps
wall_time_ave_per_step_str = time_and_units_str(wall_time_ave_per_step)
percent_complete = round(t / t_end * 100; digits = 1)
percent_complete = round((t - t_start) / t_end * 100; digits = 1)
n_steps_remaining = n_steps_total - n_steps
wall_time_remaining = wall_time_ave_per_step * n_steps_remaining
wall_time_remaining_str = time_and_units_str(wall_time_remaining)
Expand All @@ -272,7 +273,7 @@ function print_walltime_estimate(integrator)
simulation_time = time_and_units_str(Float64(t))
sypd = round(
simulated_years_per_day(
EfficiencyStats((zero(t), t), wte.∑Δt_wall),
EfficiencyStats((t_start, t), wte.∑Δt_wall),
);
digits = 3,
)
Expand Down
2 changes: 1 addition & 1 deletion src/callbacks/get_callbacks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ function get_callbacks(config, sim_info, atmos, params, Y, p, t_start)
(; dt, output_dir) = sim_info

callbacks = ()
if parsed_args["log_progress"] && !sim_info.restart
if parsed_args["log_progress"]
@info "Progress logging enabled."
callbacks = (
callbacks...,
Expand Down
1 change: 0 additions & 1 deletion src/solver/type_getters.jl
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,6 @@ function get_simulation(config::AtmosConfig)
s = @timed_str begin
(Y, t_start) = get_state_restart(config)
spaces = get_spaces_restart(Y)
@warn "Progress estimates do not support restarted simulations"
end
@info "Allocating Y: $s"
else
Expand Down

0 comments on commit 635c5b8

Please sign in to comment.