Skip to content

Commit 0964af7

Browse files
Add option to not crop table
1 parent 5cbfa42 commit 0964af7

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

ext/ClimaTimeSteppersBenchmarkToolsExt.jl

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ function CTS.benchmark_step(
5353
device::ClimaComms.AbstractDevice;
5454
with_cu_prof = :bprofile,
5555
trace = false,
56+
crop = false,
5657
)
5758
(; u, p, t, dt, sol, alg) = integrator
5859
(; f) = sol.prob
@@ -66,15 +67,15 @@ function CTS.benchmark_step(
6667
trials₀ = OrderedCollections.OrderedDict()
6768

6869
#! format: off
69-
trials₀["Wfact"] = get_trial(wfact_fun(integrator), (W, u, p, dt, t), "Wfact", device; with_cu_prof, trace);
70-
trials₀["ldiv!"] = get_trial(LA.ldiv!, (X, W, u), "ldiv!", device; with_cu_prof, trace);
71-
trials₀["T_imp!"] = get_trial(implicit_fun(integrator), implicit_args(integrator), "T_imp!", device; with_cu_prof, trace);
72-
trials₀["T_exp_T_lim!"] = get_trial(remaining_fun(integrator), remaining_args(integrator), "T_exp_T_lim!", device; with_cu_prof, trace);
73-
trials₀["lim!"] = get_trial(f.lim!, (Xlim, p, t, u), "lim!", device; with_cu_prof, trace);
74-
trials₀["dss!"] = get_trial(f.dss!, (u, p, t), "dss!", device; with_cu_prof, trace);
75-
trials₀["post_explicit!"] = get_trial(f.post_explicit!, (u, p, t), "post_explicit!", device; with_cu_prof, trace);
76-
trials₀["post_implicit!"] = get_trial(f.post_implicit!, (u, p, t), "post_implicit!", device; with_cu_prof, trace);
77-
trials₀["step!"] = get_trial(SciMLBase.step!, (integrator, ), "step!", device; with_cu_prof, trace);
70+
trials₀["Wfact"] = get_trial(wfact_fun(integrator), (W, u, p, dt, t), "Wfact", device; with_cu_prof, trace, crop);
71+
trials₀["ldiv!"] = get_trial(LA.ldiv!, (X, W, u), "ldiv!", device; with_cu_prof, trace, crop);
72+
trials₀["T_imp!"] = get_trial(implicit_fun(integrator), implicit_args(integrator), "T_imp!", device; with_cu_prof, trace, crop);
73+
trials₀["T_exp_T_lim!"] = get_trial(remaining_fun(integrator), remaining_args(integrator), "T_exp_T_lim!", device; with_cu_prof, trace, crop);
74+
trials₀["lim!"] = get_trial(f.lim!, (Xlim, p, t, u), "lim!", device; with_cu_prof, trace, crop);
75+
trials₀["dss!"] = get_trial(f.dss!, (u, p, t), "dss!", device; with_cu_prof, trace, crop);
76+
trials₀["post_explicit!"] = get_trial(f.post_explicit!, (u, p, t), "post_explicit!", device; with_cu_prof, trace, crop);
77+
trials₀["post_implicit!"] = get_trial(f.post_implicit!, (u, p, t), "post_implicit!", device; with_cu_prof, trace, crop);
78+
trials₀["step!"] = get_trial(SciMLBase.step!, (integrator, ), "step!", device; with_cu_prof, trace, crop);
7879
#! format: on
7980

8081
trials = OrderedCollections.OrderedDict()

ext/benchmark_utils.jl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ function tabulate_summary(summary; n_calls_per_step)
4848
)
4949
end
5050

51-
get_trial(f::Nothing, args, name, device; with_cu_prof = :bprofile, trace = false) = nothing
52-
function get_trial(f, args, name, device; with_cu_prof = :bprofile, trace = false)
51+
get_trial(f::Nothing, args, name, device; with_cu_prof = :bprofile, trace = false, crop = false) = nothing
52+
function get_trial(f, args, name, device; with_cu_prof = :bprofile, trace = false, crop = false)
5353
f(args...) # compile first
5454
b = if device isa ClimaComms.CUDADevice
5555
BenchmarkTools.@benchmarkable CUDA.@sync $f($(args)...)
@@ -65,7 +65,9 @@ function get_trial(f, args, name, device; with_cu_prof = :bprofile, trace = fals
6565
else
6666
CUDA.@profile trace = trace f(args...)
6767
end
68-
println(p)
68+
io = IOContext(stdout, :crop => crop)
69+
show(io, p)
70+
println()
6971
end
7072
println()
7173
return trial

0 commit comments

Comments
 (0)