Skip to content

Commit

Permalink
show percentage of simulation progress
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshuaLampert committed Oct 5, 2023
1 parent 67ddfbb commit ff0e609
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
9 changes: 7 additions & 2 deletions src/callbacks_step/alive.jl
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,14 @@ function (alive_callback::AliveCallback)(integrator)
println(""^100)
println()
elseif mpi_isroot()
t = integrator.t
t_final = last(integrator.sol.prob.tspan)
sim_time_percentage = t / t_final * 100
runtime_absolute = 1.0e-9 * (time_ns() - alive_callback.start_time)
@printf("#timesteps: %6d │ Δt: %.4e │ sim. time: %.4e │ run time: %.4e s\n",
integrator.stats.naccept, integrator.dt, integrator.t, runtime_absolute)
println(rpad(@sprintf("#timesteps: %6d │ Δt: %.4e │ sim. time: %.4e (%5.3f%%)",
integrator.stats.naccept, integrator.dt, t,
sim_time_percentage), 71) *
@sprintf("│ run time: %.4e s", runtime_absolute))
end

# avoid re-evaluating possible FSAL stages
Expand Down
8 changes: 6 additions & 2 deletions src/callbacks_step/analysis.jl
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,10 @@ function (analysis_callback::AnalysisCallback)(u_ode, du_ode, integrator, semi)
@unpack dt, t = integrator
iter = integrator.stats.naccept

# Compute the percentage of the simulation that is done
t_final = last(integrator.sol.prob.tspan)
sim_time_percentage = t / t_final * 100

# Record performance measurements and compute performance index (PID)
runtime_since_last_analysis = 1.0e-9 * (time_ns() -
analysis_callback.start_time_last_analysis)
Expand Down Expand Up @@ -291,8 +295,8 @@ function (analysis_callback::AnalysisCallback)(u_ode, du_ode, integrator, semi)
" " *
" └── GC time: " *
@sprintf("%10.8e s (%5.3f%%)", gc_time_absolute, gc_time_percentage))
mpi_println(" sim. time: " * @sprintf("%10.8e", t) *
" " *
mpi_println(rpad(" sim. time: " *
@sprintf("%10.8e (%5.3f%%)", t, sim_time_percentage), 46) *
" time/DOF/rhs!: " * @sprintf("%10.8e s", runtime_relative))
mpi_println(" " * " " *
" " *
Expand Down

0 comments on commit ff0e609

Please sign in to comment.