Skip to content

Commit

Permalink
Make step trial optional
Browse files Browse the repository at this point in the history
  • Loading branch information
charleskawczynski committed May 16, 2024
1 parent 6822697 commit 01277ca
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "ClimaTimeSteppers"
uuid = "595c0a79-7f3d-439a-bc5a-b232dc3bde79"
authors = ["Climate Modeling Alliance"]
version = "0.7.27"
version = "0.7.28"

[deps]
ClimaComms = "3a4d1b5c-c61d-41fd-a00a-5873ba7a1b0d"
Expand Down
3 changes: 2 additions & 1 deletion ext/ClimaTimeSteppersBenchmarkToolsExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ function CTS.benchmark_step(
table_summary = OrderedCollections.OrderedDict()
for k in keys(trials)
isnothing(trials[k]) && continue
table_summary[k] = get_summary(trials[k], trials["step!"])
trial_step = haskey(trials, "step!") ? trials["step!"] : nothing
table_summary[k] = get_summary(trials[k], trial_step)
end

if !isnothing(only)
Expand Down
4 changes: 2 additions & 2 deletions ext/benchmark_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
##### BenchmarkTools's trial utils
#####

get_summary(trial, trial_step) = (;
get_summary(trial, trial_step = nothing) = (;
# Using some BenchmarkTools internals :/
mem = BenchmarkTools.prettymemory(trial.memory),
mem_val = trial.memory,
Expand All @@ -13,7 +13,7 @@ get_summary(trial, trial_step) = (;
t_mean_val = StatsBase.mean(trial.times),
t_med = BenchmarkTools.prettytime(StatsBase.median(trial.times)),
n_samples = length(trial),
percentage = minimum(trial.times) / minimum(trial_step.times) * 100,
percentage = isnothing(trial_step) ? -1 : minimum(trial.times) / minimum(trial_step.times) * 100,
)

function tabulate_summary(summary; n_calls_per_step)
Expand Down

0 comments on commit 01277ca

Please sign in to comment.