Skip to content

Commit 5c15dd6

Browse files
committed
Merge branch 'main' into distributed_standalone_driver
* main: Scheduled Halo Exchange (#980) Add missing metrics fields to `test_parallel_grid_manager.py` test (#1114) Muphys: Lowering with single precision (#1101) Add single-rank lsq pseudoinv factory test (#1099) Cleanup Diffusion config (#1060) Fortran bindings: fix numpy allocation and cleanups (#1112) fix: fix gt4py metrics extractor in the StencilTest benchmarking (#1111) py2fgen: don't recompile if unchanged (#1110) CI for standalone_driver (#1070) Update mpi4py and pymetis groups to make them optional (#1100) Bump mshick/add-pr-comment from 2 to 3 (#1109) Use inout fields for full_muphys as well (#1108) Update GPU configuration for graupel (#1104) Move the mask of _q_t_update outside in graupel (#1093) Update gt4py to v1.1.7 (#1105) cleanup for ugly if condition of single node default in lsq coeffs (#1103)
2 parents a57d8f4 + a967314 commit 5c15dd6

File tree

74 files changed

+1290
-754
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+1290
-754
lines changed

.github/workflows/mandatory_and_optional_test_reminder.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
permissions:
88
pull-requests: write
99
steps:
10-
- uses: mshick/add-pr-comment@v2
10+
- uses: mshick/add-pr-comment@v3
1111
with:
1212
refresh-message-position: true
1313
message: |2

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ repos:
103103
- <<: *uv-managed-hook
104104
id: mypy
105105
name: mypy static type checker
106-
entry: uv run --group dev --frozen --isolated mypy
106+
entry: uv run --group typing-distributed --frozen --isolated mypy
107107
types_or: [python, pyi]
108108
pass_filenames: false
109109

ci/default.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ test_tools_datatests_aarch64:
4545
when: never # run only in daily CI, to save compute resources
4646
- if: $BACKEND == 'dace_gpu' && $COMPONENT == 'driver'
4747
when: never # run only in daily CI, to save compute resources
48+
- if: $COMPONENT == 'standalone_driver'
49+
variables:
50+
SLURM_TIMELIMIT: '00:50:00'
4851
- if: $BACKEND == 'dace_gpu' || $BACKEND == 'gtfn_gpu'
4952
variables:
5053
NUM_PROCESSES: 8

model/atmosphere/advection/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ dependencies = [
2626
# workspace members
2727
"icon4py-common>=0.0.6",
2828
# external dependencies
29-
"gt4py==1.1.6",
29+
"gt4py==1.1.7",
3030
'packaging>=20.0'
3131
]
3232
description = "ICON advection."

model/atmosphere/advection/src/icon4py/model/atmosphere/advection/advection.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,9 @@ def run(
207207
log.debug("advection run - start")
208208

209209
log.debug("communication of prep_adv cell field: mass_flx_ic - start")
210-
self._exchange.exchange_and_wait(dims.CellDim, prep_adv.mass_flx_ic)
210+
self._exchange.exchange(
211+
dims.CellDim, prep_adv.mass_flx_ic, stream=decomposition.DEFAULT_STREAM
212+
)
211213
log.debug("communication of prep_adv cell field: mass_flx_ic - end")
212214

213215
log.debug("running stencil copy_cell_kdim_field - start")
@@ -313,7 +315,11 @@ def run(
313315
log.debug("advection run - start")
314316

315317
log.debug("communication of prep_adv cell field: mass_flx_ic - start")
316-
self._exchange.exchange_and_wait(dims.CellDim, prep_adv.mass_flx_ic)
318+
self._exchange.exchange(
319+
dims.CellDim,
320+
prep_adv.mass_flx_ic,
321+
stream=decomposition.DEFAULT_STREAM,
322+
)
317323
log.debug("communication of prep_adv cell field: mass_flx_ic - end")
318324

319325
# reintegrate density for conservation of mass
@@ -396,7 +402,11 @@ def run(
396402

397403
# exchange updated tracer values, originally happens only if iforcing /= inwp
398404
log.debug("communication of advection cell field: p_tracer_new - start")
399-
self._exchange.exchange_and_wait(dims.CellDim, p_tracer_new)
405+
self._exchange.exchange(
406+
dims.CellDim,
407+
p_tracer_new,
408+
stream=decomposition.DEFAULT_STREAM,
409+
)
400410
log.debug("communication of advection cell field: p_tracer_new - end")
401411

402412
# finalize step

model/atmosphere/advection/src/icon4py/model/atmosphere/advection/advection_horizontal.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ def apply_flux_limiter(
174174
)
175175

176176
log.debug("communication of advection cell field: r_m - start")
177-
self._exchange.exchange_and_wait(dims.CellDim, self._r_m)
177+
self._exchange.exchange(dims.CellDim, self._r_m, stream=decomposition.DEFAULT_STREAM)
178178
log.debug("communication of advection cell field: r_m - end")
179179

180180
# limit outward fluxes

model/atmosphere/advection/tests/advection/integration_tests/test_advection.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
construct_least_squares_state,
4848
construct_metric_state,
4949
construct_prep_adv,
50+
dummy_exchange,
5051
log_serialized,
5152
verify_advection_fields,
5253
)
@@ -161,6 +162,7 @@ def test_advection_run_single_step(
161162
),
162163
min_rlcell_int=icon_grid.end_index(h_grid.domain(dims.CellDim)(h_grid.Zone.LOCAL)),
163164
geometry_type=icon_grid.geometry_type,
165+
exchange=dummy_exchange,
164166
)
165167

166168
least_squares_state = construct_least_squares_state(least_squares_coeffs, backend=backend)
@@ -268,6 +270,7 @@ def test_compute_lsq_coeffs(
268270
start_idx,
269271
min_rlcell_int,
270272
icon_grid.geometry_type,
273+
exchange=dummy_exchange,
271274
)
272275

273276
assert test_helpers.dallclose(

model/atmosphere/advection/tests/advection/utils.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,3 +197,7 @@ def verify_advection_fields(
197197
p_tracer_new_ref.asnumpy()[p_tracer_new_range, :],
198198
atol=1e-16,
199199
)
200+
201+
202+
def dummy_exchange(*field: data_alloc.NDArray) -> None:
203+
return None

model/atmosphere/diffusion/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ dependencies = [
2626
# workspace members
2727
"icon4py-common>=0.0.6",
2828
# external dependencies
29-
"gt4py==1.1.6",
29+
"gt4py==1.1.7",
3030
'packaging>=20.0'
3131
]
3232
description = "ICON diffusion."

model/atmosphere/diffusion/src/icon4py/model/atmosphere/diffusion/diffusion.py

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,6 @@ def __init__(
153153
smagorinski_scaling_factor: float = 0.015,
154154
n_substeps: int = 5,
155155
zdiffu_t: bool = True,
156-
thslp_zdiffu: float = 0.025,
157-
thhgtd_zdiffu: float = 200.0,
158156
velocity_boundary_diffusion_denom: float = 200.0,
159157
temperature_boundary_diffusion_denom: float = 135.0,
160158
_nudge_max_coeff: float | None = None, # default is set in __init__
@@ -212,11 +210,6 @@ def __init__(
212210
#: Called 'l_zdiffu_t' in mo_nonhydrostatic_nml.f90
213211
self.apply_zdiffusion_t: bool = zdiffu_t
214212

215-
#:slope threshold (temperature diffusion): is used to build up an index list for application of truly horizontal diffusion in mo_vertical_grid.f90
216-
self.thslp_zdiffu = thslp_zdiffu
217-
#: threshold [m] for height difference between adjacent grid points, defaults to 200m (temperature diffusion)
218-
self.thhgtd_zdiffu = thhgtd_zdiffu
219-
220213
# from other namelists:
221214
# from parent namelist mo_nonhydrostatic_nml
222215

@@ -375,9 +368,6 @@ def _determine_smagorinski_factor(self, config: DiffusionConfig):
375368
smagorinski_height = None
376369
case _:
377370
raise NotImplementedError("Only implemented for diffusion type 4 and 5")
378-
smagorinski_factor = None
379-
smagorinski_height = None
380-
pass
381371
return smagorinski_factor, smagorinski_height
382372

383373

@@ -428,7 +418,7 @@ def __init__(
428418
self._cell_params = cell_params
429419

430420
self.halo_exchange_wait = decomposition.create_halo_exchange_wait(
431-
self._exchange
421+
self._exchange,
432422
) # wait on a communication handle
433423
self.rd_o_cvd: float = constants.GAS_CONSTANT_DRY_AIR / (
434424
constants.CPD - constants.GAS_CONSTANT_DRY_AIR
@@ -772,11 +762,12 @@ def _sync_cell_fields(self, prognostic_state):
772762
IF ( linit .OR. (iforcing /= inwp .AND. iforcing /= iaes) ) THEN
773763
"""
774764
log.debug("communication of prognostic cell fields: theta, w, exner - start")
775-
self._exchange.exchange_and_wait(
765+
self._exchange.exchange(
776766
dims.CellDim,
777767
prognostic_state.w,
778768
prognostic_state.theta_v,
779769
prognostic_state.exner,
770+
stream=decomposition.DEFAULT_STREAM,
780771
)
781772
log.debug("communication of prognostic cell fields: theta, w, exner - done")
782773

@@ -813,12 +804,17 @@ def _do_diffusion_step(
813804
log.debug("rbf interpolation 1: end")
814805

815806
# 2. HALO EXCHANGE -- CALL sync_patch_array_mult u_vert and v_vert
807+
# TODO(phimuell, muellch): Is asynchronous mode okay here.
808+
# NOTE: We do not specify a stream here but rely on the default argument.
809+
# We do this to ensure that the orchestrator works, but it is not aware
810+
# of the streams.
816811
log.debug("communication rbf extrapolation of vn - start")
817812
self._exchange(
818813
self.u_vert,
819814
self.v_vert,
820815
dim=dims.VertexDim,
821-
wait=True,
816+
full_exchange=True,
817+
# stream=decomposition.DEFAULT_STREAM, # noqa: ERA001 # See NOTE above.
822818
)
823819
log.debug("communication rbf extrapolation of vn - end")
824820

@@ -861,12 +857,14 @@ def _do_diffusion_step(
861857
log.debug("2nd rbf interpolation: end")
862858

863859
# 6. HALO EXCHANGE -- CALL sync_patch_array_mult (Vertex Fields)
860+
# TODO(phimuell, muellch): Is asynchronous mode okay here.
864861
log.debug("communication rbf extrapolation of z_nable2_e - start")
865862
self._exchange(
866863
self.u_vert,
867864
self.v_vert,
868865
dim=dims.VertexDim,
869-
wait=True,
866+
full_exchange=True,
867+
# stream=decomposition.DEFAULT_STREAM, # noqa: ERA001 # See NOTE above.
870868
)
871869
log.debug("communication rbf extrapolation of z_nable2_e - end")
872870

@@ -882,7 +880,12 @@ def _do_diffusion_step(
882880
log.debug("running stencils 04 05 06 (apply_diffusion_to_vn): end")
883881

884882
log.debug("communication of prognistic.vn : start")
885-
handle_edge_comm = self._exchange(prognostic_state.vn, dim=dims.EdgeDim, wait=False)
883+
handle_edge_comm = self._exchange(
884+
prognostic_state.vn,
885+
dim=dims.EdgeDim,
886+
full_exchange=False,
887+
# stream=decomposition.DEFAULT_STREAM, # noqa: ERA001 # See NOTE above.
888+
)
886889

887890
log.debug(
888891
"running stencils 07 08 09 10 (apply_diffusion_to_w_and_compute_horizontal_gradients_for_turbulence): start"
@@ -928,7 +931,8 @@ def _do_diffusion_step(
928931
log.debug("running stencil 13 to 16 apply_diffusion_to_theta_and_exner: end")
929932

930933
self.halo_exchange_wait(
931-
handle_edge_comm
934+
handle_edge_comm,
935+
# stream=decomposition.DEFAULT_STREAM, # noqa: ERA001 # See NOTE above.
932936
) # need to do this here, since we currently only use 1 communication object.
933937
log.debug("communication of prognogistic.vn - end")
934938

0 commit comments

Comments
 (0)