Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Normalization for showspeed #237

Open
milankl opened this issue Apr 29, 2022 · 1 comment
Open

Normalization for showspeed #237

milankl opened this issue Apr 29, 2022 · 1 comment

Comments

@milankl
Copy link

milankl commented Apr 29, 2022

function speedstring(sec_per_iter)
if sec_per_iter == Inf
return " N/A s/it"
end
ns_per_iter = 1_000_000_000 * sec_per_iter
for (divideby, unit) in (
(1, "ns"),
(1_000, "μs"),
(1_000_000, "ms"),
(1_000_000_000, "s"),
(60 * 1_000_000_000, "m"),
(60 * 60 * 1_000_000_000, "hr"),
(24 * 60 * 60 * 1_000_000_000, "d")
)
if round(ns_per_iter / divideby) < 100
return @sprintf "%5.2f %2s/it" (ns_per_iter / divideby) unit
end
end

At the moment speed is always shown as time/iteration which is nice because it's general. However, when running many simulations, the loop is over time so often people think in terms of simulated time per wall clock time. E.g. in weather forecasting we often think in terms of simulated days per day. Is there general interest for a PR to extend Progress(...,speednorm::Dates.Period) with speednorm of units simulated time / iteration (= the time step) to allow for say

1 m/it

to be displayed with speednorm=Dates.Minute(30) meaning that every iteration simulates a 30min time step as

30 m/m

?

@samhatfield what we just discussed

@milankl
Copy link
Author

milankl commented Apr 12, 2023

SpeedyWeather.jl has this now implemented as

Weather is speedy: 100%|███████████████████████████████| Time: 0:00:29 (80.91 years/day)

Meaning the model ran at a speed such that in 1 day it would simualte 80 years of the Earth's atmosphere. If there's more general interest to make this feature available here too let me know. I believe it would be of interest to anyone who would use it to monitor the progress of a simulation which integrates in time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant