From eff210698e15fec692950feb122f7b5981d84d87 Mon Sep 17 00:00:00 2001 From: LenkaNovak Date: Thu, 2 May 2024 13:41:50 -0700 Subject: [PATCH] first step outside @elapsed --- experiments/AMIP/coupler_driver.jl | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/experiments/AMIP/coupler_driver.jl b/experiments/AMIP/coupler_driver.jl index b9ff99ce54..24791559ed 100644 --- a/experiments/AMIP/coupler_driver.jl +++ b/experiments/AMIP/coupler_driver.jl @@ -710,8 +710,7 @@ function solve_coupler!(cs) ClimaComms.iamroot(comms_ctx) && @info("Starting coupling loop") ## step in time - ## Use ClimaComms.@elapsed to time the simulation on both CPU and GPU - walltime = ClimaComms.@elapsed comms_ctx.device for t in ((tspan[begin] + Δt_cpl):Δt_cpl:tspan[end]) + for t in (tspan[begin]:Δt_cpl:tspan[end]) cs.dates.date[1] = TimeManager.current_date(cs, t) @@ -798,9 +797,8 @@ function solve_coupler!(cs) TimeManager.trigger_callback!(cs, cs.callbacks.checkpoint) end - ClimaComms.iamroot(comms_ctx) && @show(walltime) - return walltime + return nothing end ## exit if running performance anaysis #hide @@ -808,8 +806,20 @@ if haskey(ENV, "CI_PERF_SKIP_COUPLED_RUN") #hide throw(:exit_profile_init) #hide end #hide -## run the coupled simulation -walltime = solve_coupler!(cs); +## run the coupled simulation for one timestep to precompile everything before timing +cs.tspan[2] = Δt_cpl +solve_coupler!(cs) + +## run the coupled simulation for the full timespan and time it +cs.tspan[1] = Δt_cpl +cs.tspan[2] = tspan[2] +## Use ClimaComms.@elapsed to time the simulation on both CPU and GPU +walltime = ClimaComms.@elapsed comms_ctx.device begin + s = CA.@timed_str begin + solve_coupler!(cs); + end +end +ClimaComms.iamroot(comms_ctx) && @show(walltime) ## Use ClimaAtmos calculation to show the simulated years per day of the simulation (SYPD) es = CA.EfficiencyStats(tspan, walltime)