From 0964af7c6936bc2aa0942fae4641d489669573e6 Mon Sep 17 00:00:00 2001 From: Charles Kawczynski Date: Tue, 14 May 2024 10:01:38 -0400 Subject: [PATCH 1/2] Add option to not crop table --- ext/ClimaTimeSteppersBenchmarkToolsExt.jl | 19 ++++++++++--------- ext/benchmark_utils.jl | 8 +++++--- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/ext/ClimaTimeSteppersBenchmarkToolsExt.jl b/ext/ClimaTimeSteppersBenchmarkToolsExt.jl index 6876f80d..7429556b 100644 --- a/ext/ClimaTimeSteppersBenchmarkToolsExt.jl +++ b/ext/ClimaTimeSteppersBenchmarkToolsExt.jl @@ -53,6 +53,7 @@ function CTS.benchmark_step( device::ClimaComms.AbstractDevice; with_cu_prof = :bprofile, trace = false, + crop = false, ) (; u, p, t, dt, sol, alg) = integrator (; f) = sol.prob @@ -66,15 +67,15 @@ function CTS.benchmark_step( trials₀ = OrderedCollections.OrderedDict() #! format: off - trials₀["Wfact"] = get_trial(wfact_fun(integrator), (W, u, p, dt, t), "Wfact", device; with_cu_prof, trace); - trials₀["ldiv!"] = get_trial(LA.ldiv!, (X, W, u), "ldiv!", device; with_cu_prof, trace); - trials₀["T_imp!"] = get_trial(implicit_fun(integrator), implicit_args(integrator), "T_imp!", device; with_cu_prof, trace); - trials₀["T_exp_T_lim!"] = get_trial(remaining_fun(integrator), remaining_args(integrator), "T_exp_T_lim!", device; with_cu_prof, trace); - trials₀["lim!"] = get_trial(f.lim!, (Xlim, p, t, u), "lim!", device; with_cu_prof, trace); - trials₀["dss!"] = get_trial(f.dss!, (u, p, t), "dss!", device; with_cu_prof, trace); - trials₀["post_explicit!"] = get_trial(f.post_explicit!, (u, p, t), "post_explicit!", device; with_cu_prof, trace); - trials₀["post_implicit!"] = get_trial(f.post_implicit!, (u, p, t), "post_implicit!", device; with_cu_prof, trace); - trials₀["step!"] = get_trial(SciMLBase.step!, (integrator, ), "step!", device; with_cu_prof, trace); + trials₀["Wfact"] = get_trial(wfact_fun(integrator), (W, u, p, dt, t), "Wfact", device; with_cu_prof, trace, crop); + trials₀["ldiv!"] = get_trial(LA.ldiv!, (X, W, u), "ldiv!", device; with_cu_prof, trace, crop); + trials₀["T_imp!"] = get_trial(implicit_fun(integrator), implicit_args(integrator), "T_imp!", device; with_cu_prof, trace, crop); + trials₀["T_exp_T_lim!"] = get_trial(remaining_fun(integrator), remaining_args(integrator), "T_exp_T_lim!", device; with_cu_prof, trace, crop); + trials₀["lim!"] = get_trial(f.lim!, (Xlim, p, t, u), "lim!", device; with_cu_prof, trace, crop); + trials₀["dss!"] = get_trial(f.dss!, (u, p, t), "dss!", device; with_cu_prof, trace, crop); + trials₀["post_explicit!"] = get_trial(f.post_explicit!, (u, p, t), "post_explicit!", device; with_cu_prof, trace, crop); + trials₀["post_implicit!"] = get_trial(f.post_implicit!, (u, p, t), "post_implicit!", device; with_cu_prof, trace, crop); + trials₀["step!"] = get_trial(SciMLBase.step!, (integrator, ), "step!", device; with_cu_prof, trace, crop); #! format: on trials = OrderedCollections.OrderedDict() diff --git a/ext/benchmark_utils.jl b/ext/benchmark_utils.jl index dd8384ce..1c63bd64 100644 --- a/ext/benchmark_utils.jl +++ b/ext/benchmark_utils.jl @@ -48,8 +48,8 @@ function tabulate_summary(summary; n_calls_per_step) ) end -get_trial(f::Nothing, args, name, device; with_cu_prof = :bprofile, trace = false) = nothing -function get_trial(f, args, name, device; with_cu_prof = :bprofile, trace = false) +get_trial(f::Nothing, args, name, device; with_cu_prof = :bprofile, trace = false, crop = false) = nothing +function get_trial(f, args, name, device; with_cu_prof = :bprofile, trace = false, crop = false) f(args...) # compile first b = if device isa ClimaComms.CUDADevice BenchmarkTools.@benchmarkable CUDA.@sync $f($(args)...) @@ -65,7 +65,9 @@ function get_trial(f, args, name, device; with_cu_prof = :bprofile, trace = fals else CUDA.@profile trace = trace f(args...) end - println(p) + io = IOContext(stdout, :crop => crop) + show(io, p) + println() end println() return trial From f7ce318ba4caf183af007bffb1874c4160825274 Mon Sep 17 00:00:00 2001 From: Charles Kawczynski Date: Tue, 14 May 2024 10:03:11 -0400 Subject: [PATCH 2/2] Bump patch version --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index c6d28e6d..7bdc5122 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "ClimaTimeSteppers" uuid = "595c0a79-7f3d-439a-bc5a-b232dc3bde79" authors = ["Climate Modeling Alliance"] -version = "0.7.25" +version = "0.7.26" [deps] ClimaComms = "3a4d1b5c-c61d-41fd-a00a-5873ba7a1b0d"