From 9410c6ecbb3337ee0b407d32c5093690655d92b8 Mon Sep 17 00:00:00 2001 From: Charles Kawczynski Date: Fri, 15 Dec 2023 09:06:27 -0500 Subject: [PATCH] Improve names --- src/callbacks/callbacks.jl | 25 +++++++++++++------------ src/utils/utilities.jl | 5 +++-- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/callbacks/callbacks.jl b/src/callbacks/callbacks.jl index 08fd8709e28..24fcec1c203 100644 --- a/src/callbacks/callbacks.jl +++ b/src/callbacks/callbacks.jl @@ -476,16 +476,16 @@ function print_walltime_estimate(integrator) t = integrator.t n_steps_total = ceil(Int, t_end / dt) n_steps = ceil(Int, t / dt) - t_wall_ave_per_step = wte.∑Δt_wall / n_steps - twps = t_wall_ave_per_step - _twps = time_and_units(t_wall_ave_per_step) + 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) n_steps_remaining = n_steps_total - n_steps - erwt = twps * n_steps_remaining - _erwt = time_and_units(erwt) - etwt = time_and_units(twps * n_steps_total) - spent = time_and_units(wte.∑Δt_wall) - t_sim = time_and_units(Float64(t)) + wall_time_remaining = wall_time_ave_per_step * n_steps_remaining + wall_time_remaining_str = time_and_units_str(wall_time_remaining) + wall_time_total = + time_and_units_str(wall_time_ave_per_step * n_steps_total) + wall_time_spent = time_and_units_str(wte.∑Δt_wall) + simulation_time = time_and_units_str(Float64(t)) sypd = round( simulated_years_per_day( EfficiencyStats((zero(t), t), wte.∑Δt_wall), @@ -493,10 +493,11 @@ function print_walltime_estimate(integrator) digits = 3, ) estimated_finish_date = - Dates.now() + compound_period(erwt, Dates.Second) - @info "Progress" simulation_time = t_sim n_steps_completed = n_steps wall_time_per_step = - _twps wall_time_total = etwt wall_time_remaining = erwt wall_time_spent = - spent percent_complete = "$percent_complete%" sypd = sypd date_now = + Dates.now() + compound_period(wall_time_remaining, Dates.Second) + @info "Progress" simulation_time = simulation_time n_steps_completed = + n_steps wall_time_per_step = wall_time_ave_per_step_str wall_time_total = + wall_time_total wall_time_remaining = wall_time_remaining_str wall_time_spent = + wall_time_spent percent_complete = "$percent_complete%" sypd = sypd date_now = Dates.now() estimated_finish_date = estimated_finish_date wte.n_next *= 2 # doubling factor (to reduce log noise) end diff --git a/src/utils/utilities.jl b/src/utils/utilities.jl index 385e5c3153a..1d2a5ca6be4 100644 --- a/src/utils/utilities.jl +++ b/src/utils/utilities.jl @@ -238,12 +238,13 @@ define_time_per_times([ ]) """ - time_and_units(x::Real) + time_and_units_str(x::Real) Returns a truncated string of time and units, given a time `x` in Seconds. """ -time_and_units(x::Real) = trunc_time(string(compound_period(x, Dates.Second))) +time_and_units_str(x::Real) = + trunc_time(string(compound_period(x, Dates.Second))) """ compound_period(x::Real, ::Type{T}) where {T <: Dates.Period}