Skip to content

Commit 6fafae9

Browse files
Merge pull request #2869 from CliMA/ck/nvtx_annot
Add some NVTX annotations
2 parents ba3cf37 + d3c1004 commit 6fafae9

File tree

4 files changed

+50
-16
lines changed

4 files changed

+50
-16
lines changed

src/cache/cloud_fraction.jl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import NVTX
12
import StaticArrays as SA
23
import ClimaCore.RecursiveApply: rzero, ,
34

@@ -13,15 +14,15 @@ end
1314
"""
1415
Compute the grid scale cloud fraction based on sub-grid scale properties
1516
"""
16-
function set_cloud_fraction!(Y, p, ::DryModel, _)
17+
NVTX.@annotate function set_cloud_fraction!(Y, p, ::DryModel, _)
1718
(; ᶜmixing_length) = p.precomputed
1819
(; turbconv_model) = p.atmos
1920
if isnothing(turbconv_model)
2021
compute_gm_mixing_length!(ᶜmixing_length, Y, p)
2122
end
2223
@. p.precomputed.ᶜcloud_fraction = 0
2324
end
24-
function set_cloud_fraction!(
25+
NVTX.@annotate function set_cloud_fraction!(
2526
Y,
2627
p,
2728
::Union{EquilMoistModel, NonEquilMoistModel},
@@ -36,7 +37,7 @@ function set_cloud_fraction!(
3637
end
3738
@. ᶜcloud_fraction = ifelse(TD.has_condensate(thermo_params, ᶜts), 1, 0)
3839
end
39-
function set_cloud_fraction!(
40+
NVTX.@annotate function set_cloud_fraction!(
4041
Y,
4142
p,
4243
::Union{EquilMoistModel, NonEquilMoistModel},

src/cache/diagnostic_edmf_precomputed_quantities.jl

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
#####
22
##### Precomputed quantities
33
#####
4+
import NVTX
45
import Thermodynamics as TD
56
import ClimaCore: Spaces, Fields, RecursiveApply
67

7-
function kinetic_energy!(
8+
NVTX.@annotate function kinetic_energy!(
89
K_level,
910
uₕ_level,
1011
u³_halflevel,
@@ -28,7 +29,7 @@ function kinetic_energy!(
2829
) / 2
2930
end
3031

31-
function set_diagnostic_edmfx_draft_quantities_level!(
32+
NVTX.@annotate function set_diagnostic_edmfx_draft_quantities_level!(
3233
thermo_params,
3334
ts_level,
3435
ρ_level,
@@ -50,7 +51,7 @@ function set_diagnostic_edmfx_draft_quantities_level!(
5051
return nothing
5152
end
5253

53-
function set_diagnostic_edmfx_env_quantities_level!(
54+
NVTX.@annotate function set_diagnostic_edmfx_env_quantities_level!(
5455
ρ_level,
5556
ρaʲs_level,
5657
u³_halflevel,
@@ -86,7 +87,11 @@ end
8687
Updates the bottom boundary conditions in precomputed quantities
8788
stored in `p` for diagnostic edmfx.
8889
"""
89-
function set_diagnostic_edmf_precomputed_quantities_bottom_bc!(Y, p, t)
90+
NVTX.@annotate function set_diagnostic_edmf_precomputed_quantities_bottom_bc!(
91+
Y,
92+
p,
93+
t,
94+
)
9095
(; turbconv_model) = p.atmos
9196
FT = eltype(Y)
9297
n = n_mass_flux_subdomains(turbconv_model)
@@ -207,7 +212,11 @@ function set_diagnostic_edmf_precomputed_quantities_bottom_bc!(Y, p, t)
207212
return nothing
208213
end
209214

210-
function set_diagnostic_edmf_precomputed_quantities_do_integral!(Y, p, t)
215+
NVTX.@annotate function set_diagnostic_edmf_precomputed_quantities_do_integral!(
216+
Y,
217+
p,
218+
t,
219+
)
211220
(; turbconv_model, precip_model) = p.atmos
212221
FT = eltype(Y)
213222
n = n_mass_flux_subdomains(turbconv_model)
@@ -693,7 +702,11 @@ end
693702
694703
Updates the top boundary condition of precomputed quantities stored in `p` for diagnostic edmfx.
695704
"""
696-
function set_diagnostic_edmf_precomputed_quantities_top_bc!(Y, p, t)
705+
NVTX.@annotate function set_diagnostic_edmf_precomputed_quantities_top_bc!(
706+
Y,
707+
p,
708+
t,
709+
)
697710
n = n_mass_flux_subdomains(p.atmos.turbconv_model)
698711
(; ᶜentrʲs, ᶜdetrʲs, ᶜS_q_totʲs, ᶜS_e_totʲs_helper) = p.precomputed
699712
(; ᶠu³⁰, ᶠu³ʲs, ᶜuʲs, ᶠnh_pressure³ʲs) = p.precomputed
@@ -741,7 +754,11 @@ end
741754
742755
Updates the environment closures in precomputed quantities stored in `p` for diagnostic edmfx.
743756
"""
744-
function set_diagnostic_edmf_precomputed_quantities_env_closures!(Y, p, t)
757+
NVTX.@annotate function set_diagnostic_edmf_precomputed_quantities_env_closures!(
758+
Y,
759+
p,
760+
t,
761+
)
745762
(; moisture_model, turbconv_model, precip_model) = p.atmos
746763
n = n_mass_flux_subdomains(turbconv_model)
747764
ᶜz = Fields.coordinate_field(Y.c).z

src/cache/prognostic_edmf_precomputed_quantities.jl

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#####
22
##### Precomputed quantities
33
#####
4+
import NVTX
45
import Thermodynamics as TD
56
import ClimaCore: Spaces, Fields
67

@@ -9,7 +10,12 @@ import ClimaCore: Spaces, Fields
910
1011
Updates the edmf environment precomputed quantities stored in `p` for edmfx.
1112
"""
12-
function set_prognostic_edmf_precomputed_quantities_environment!(Y, p, ᶠuₕ³, t)
13+
NVTX.@annotate function set_prognostic_edmf_precomputed_quantities_environment!(
14+
Y,
15+
p,
16+
ᶠuₕ³,
17+
t,
18+
)
1319
@assert !(p.atmos.moisture_model isa DryModel)
1420

1521
thermo_params = CAP.thermodynamics_params(p.params)
@@ -49,7 +55,12 @@ end
4955
Updates the draft thermo state and boundary conditions
5056
precomputed quantities stored in `p` for edmfx.
5157
"""
52-
function set_prognostic_edmf_precomputed_quantities_draft_and_bc!(Y, p, ᶠuₕ³, t)
58+
NVTX.@annotate function set_prognostic_edmf_precomputed_quantities_draft_and_bc!(
59+
Y,
60+
p,
61+
ᶠuₕ³,
62+
t,
63+
)
5364
(; moisture_model, turbconv_model) = p.atmos
5465
#EDMFX BCs only support total energy as state variable
5566
@assert !(moisture_model isa DryModel)
@@ -161,7 +172,11 @@ end
161172
162173
Updates the precomputed quantities stored in `p` for edmfx closures.
163174
"""
164-
function set_prognostic_edmf_precomputed_quantities_closures!(Y, p, t)
175+
NVTX.@annotate function set_prognostic_edmf_precomputed_quantities_closures!(
176+
Y,
177+
p,
178+
t,
179+
)
165180

166181
(; moisture_model, turbconv_model) = p.atmos
167182
@assert !(moisture_model isa DryModel)
@@ -339,7 +354,7 @@ function set_prognostic_edmf_precomputed_quantities_precipitation!(
339354
)
340355
return nothing
341356
end
342-
function set_prognostic_edmf_precomputed_quantities_precipitation!(
357+
NVTX.@annotate function set_prognostic_edmf_precomputed_quantities_precipitation!(
343358
Y,
344359
p,
345360
::Microphysics0Moment,
@@ -374,7 +389,7 @@ function set_prognostic_edmf_precomputed_quantities_precipitation!(
374389
)
375390
return nothing
376391
end
377-
function set_prognostic_edmf_precomputed_quantities_precipitation!(
392+
NVTX.@annotate function set_prognostic_edmf_precomputed_quantities_precipitation!(
378393
Y,
379394
p,
380395
::Microphysics1Moment,

src/prognostic_equations/gm_sgs_closures.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
##### Grid-mean SGS closures (mixing length)
33
#####
44

5+
import NVTX
56
import ClimaCore.Geometry as Geometry
67
import ClimaCore.Fields as Fields
78

@@ -22,7 +23,7 @@ function smagorinsky_lilly_length(c_smag, N_eff, dz, Pr, ϵ_st)
2223
c_smag * dz
2324
end
2425

25-
function compute_gm_mixing_length!(ᶜmixing_length, Y, p)
26+
NVTX.@annotate function compute_gm_mixing_length!(ᶜmixing_length, Y, p)
2627
(; params) = p
2728
thermo_params = CAP.thermodynamics_params(params)
2829

0 commit comments

Comments
 (0)