Skip to content

Commit

Permalink
first step outside @Elapsed
Browse files Browse the repository at this point in the history
  • Loading branch information
LenkaNovak authored and juliasloan25 committed May 2, 2024
1 parent 2ef593e commit 0f00201
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions experiments/AMIP/coupler_driver.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -798,18 +797,29 @@ 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
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)
Expand Down

0 comments on commit 0f00201

Please sign in to comment.