Skip to content

Commit

Permalink
use Base.@precompile
Browse files Browse the repository at this point in the history
  • Loading branch information
LenkaNovak authored and juliasloan25 committed May 3, 2024
1 parent d959a06 commit f11da89
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 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,25 @@ 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);
## precompile the coupler loop before running, so that our runtime analysis is accurate
Base.precompile(solve_coupler!, (typeof(cs),))

## 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 f11da89

Please sign in to comment.