Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions ci/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,30 @@ test_tools_datatests_aarch64:
# extends: [.test_model_datatests, .test_template_x86_64]
test_model_datatests_aarch64:
extends: [.test_model_datatests, .test_template_aarch64]

.test_single_precision:
stage: test
script:
- nox -s "test_model-3.10(datatest, $COMPONENT)" -- --single-precision --backend=$BACKEND --level=$LEVEL
rules:
- if: $BACKEND == 'dace_gpu' && $COMPONENT != 'dycore'
when: never # run only in daily CI, to save compute resources
- if: $COMPONENT == 'common' && $LEVEL == 'integration'
variables:
NUM_PROCESSES: 1
SLURM_TIMELIMIT: '00:45:00'
- if: $BACKEND == 'dace_gpu'
variables:
NUM_PROCESSES: 8
SLURM_TIMELIMIT: '01:00:00'
- if: $BACKEND == 'embedded'
variables:
SLURM_TIMELIMIT: '00:15:00'
- when: on_success
variables:
SLURM_TIMELIMIT: '00:30:00'
parallel:
matrix:
- COMPONENT: [dycore]
BACKEND: [embedded, dace_gpu, gtfn_cpu, gtfn_gpu]
LEVEL: [integration]
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def apply_flux_limiter(
p_mflx_tracer_h=p_mflx_tracer_h,
r_m=self._r_m,
p_dtime=dtime,
dbl_eps=constants.DBL_EPS,
wp_eps=constants.WP_EPS,
horizontal_start=self._start_cell_lateral_boundary_level_2, # originally i_rlstart_c = get_startrow_c(startrow_e=5) = 2
horizontal_end=self._end_cell_local,
vertical_start=0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,7 @@ def _compute_numerical_flux(
k=self._k_field,
slevp1_ti=self._slevp1_ti,
nlev=self._nlev,
dbl_eps=constants.DBL_EPS,
wp_eps=constants.WP_EPS,
p_dtime=dtime,
horizontal_start=horizontal_start,
horizontal_end=horizontal_end,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ def _compute_monotone_horizontal_multiplicative_flux_factors_p_m(
z_tracer_new_low: fa.CellKField[ta.wpfloat],
z_max: fa.CellKField[ta.vpfloat],
z_min: fa.CellKField[ta.vpfloat],
dbl_eps: ta.wpfloat,
wp_eps: ta.wpfloat,
) -> tuple[fa.CellKField[ta.wpfloat], fa.CellKField[ta.wpfloat]]:
r_p = (astype(z_max, wpfloat) - z_tracer_new_low) / (astype(z_mflx_anti_in, wpfloat) + dbl_eps)
r_m = (z_tracer_new_low - astype(z_min, wpfloat)) / (astype(z_mflx_anti_out, wpfloat) + dbl_eps)
r_p = (astype(z_max, wpfloat) - z_tracer_new_low) / (astype(z_mflx_anti_in, wpfloat) + wp_eps)
r_m = (z_tracer_new_low - astype(z_min, wpfloat)) / (astype(z_mflx_anti_out, wpfloat) + wp_eps)

return r_p, r_m

Expand All @@ -57,7 +57,7 @@ def _compute_monotone_horizontal_multiplicative_flux_factors(
z_tracer_new_low: fa.CellKField[ta.wpfloat],
beta_fct: ta.wpfloat,
r_beta_fct: ta.wpfloat,
dbl_eps: ta.wpfloat,
wp_eps: ta.wpfloat,
) -> tuple[fa.CellKField[ta.wpfloat], fa.CellKField[ta.wpfloat]]:
z_max, z_min = _compute_monotone_horizontal_multiplicative_flux_factors_min_max(
z_tracer_max, z_tracer_min, beta_fct, r_beta_fct
Expand All @@ -69,7 +69,7 @@ def _compute_monotone_horizontal_multiplicative_flux_factors(
z_tracer_new_low,
z_max,
z_min,
dbl_eps,
wp_eps,
)
return r_p, r_m

Expand All @@ -85,7 +85,7 @@ def compute_monotone_horizontal_multiplicative_flux_factors(
r_m: fa.CellKField[ta.wpfloat],
beta_fct: ta.wpfloat,
r_beta_fct: ta.wpfloat,
dbl_eps: ta.wpfloat,
wp_eps: ta.wpfloat,
horizontal_start: gtx.int32,
horizontal_end: gtx.int32,
vertical_start: gtx.int32,
Expand All @@ -99,7 +99,7 @@ def compute_monotone_horizontal_multiplicative_flux_factors(
z_tracer_new_low,
beta_fct,
r_beta_fct,
dbl_eps,
wp_eps,
out=(r_p, r_m),
domain={
dims.CellDim: (horizontal_start, horizontal_end),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ def _compute_positive_definite_horizontal_multiplicative_flux_factor(
p_rhodz_now: fa.CellKField[ta.wpfloat],
p_mflx_tracer_h: fa.EdgeKField[ta.wpfloat],
p_dtime: ta.wpfloat,
dbl_eps: ta.wpfloat,
wp_eps: ta.wpfloat,
) -> fa.CellKField[ta.wpfloat]:
p_m = neighbor_sum(maximum(0.0, p_mflx_tracer_h(C2E) * geofac_div * p_dtime), axis=C2EDim)
r_m = minimum(1.0, (p_cc * p_rhodz_now) / (p_m + dbl_eps))
r_m = minimum(1.0, (p_cc * p_rhodz_now) / (p_m + wp_eps))
return r_m


Expand All @@ -35,7 +35,7 @@ def compute_positive_definite_horizontal_multiplicative_flux_factor(
p_mflx_tracer_h: fa.EdgeKField[ta.wpfloat],
r_m: fa.CellKField[ta.wpfloat],
p_dtime: ta.wpfloat,
dbl_eps: ta.wpfloat,
wp_eps: ta.wpfloat,
horizontal_start: gtx.int32,
horizontal_end: gtx.int32,
vertical_start: gtx.int32,
Expand All @@ -47,7 +47,7 @@ def compute_positive_definite_horizontal_multiplicative_flux_factor(
p_rhodz_now,
p_mflx_tracer_h,
p_dtime,
dbl_eps,
wp_eps,
out=r_m,
domain={
dims.CellDim: (horizontal_start, horizontal_end),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
import gt4py.next as gtx
from gt4py.next import abs, where # noqa: A004

from icon4py.model.common import dimension as dims, field_type_aliases as fa, type_alias as ta
from icon4py.model.common import dimension as dims, field_type_aliases as fa
from icon4py.model.common.dimension import Koff
from icon4py.model.common.type_alias import wpfloat


# TODO(dastrm): this stencil has no test
Expand All @@ -19,13 +20,13 @@

@gtx.field_operator
def _compute_courant_number_below(
p_cellmass_now: fa.CellKField[ta.wpfloat],
z_mass: fa.CellKField[ta.wpfloat],
z_cfl: fa.CellKField[ta.wpfloat],
p_cellmass_now: fa.CellKField[wpfloat],
z_mass: fa.CellKField[wpfloat],
z_cfl: fa.CellKField[wpfloat],
k: fa.KField[gtx.int32],
nlev: gtx.int32,
dbl_eps: ta.wpfloat,
) -> fa.CellKField[ta.wpfloat]:
wp_eps: wpfloat,
) -> fa.CellKField[wpfloat]:
z_mass_pos = z_mass > 0.0

in_bounds_p0 = k <= nlev - 1
Expand Down Expand Up @@ -63,20 +64,20 @@ def _compute_courant_number_below(
p_cellmass_now_jks = where(mass_gt_cellmass_p3, p_cellmass_now(Koff[4]), p_cellmass_now_jks)

z_cflfrac = where(z_mass_pos, z_mass / p_cellmass_now_jks, 0.0)
z_cfl = z_cfl + where(z_cflfrac < 1.0, z_cflfrac, 1.0 - dbl_eps)
z_cfl = z_cfl + where(z_cflfrac < 1.0, z_cflfrac, 1.0 - wp_eps)

return z_cfl


@gtx.field_operator
def _compute_courant_number_above(
p_cellmass_now: fa.CellKField[ta.wpfloat],
z_mass: fa.CellKField[ta.wpfloat],
z_cfl: fa.CellKField[ta.wpfloat],
p_cellmass_now: fa.CellKField[wpfloat],
z_mass: fa.CellKField[wpfloat],
z_cfl: fa.CellKField[wpfloat],
k: fa.KField[gtx.int32],
slevp1_ti: gtx.int32,
dbl_eps: ta.wpfloat,
) -> fa.CellKField[ta.wpfloat]:
wp_eps: wpfloat,
) -> fa.CellKField[wpfloat]:
z_mass_neg = z_mass <= 0.0

in_bounds_m0 = k >= slevp1_ti + 1
Expand Down Expand Up @@ -116,26 +117,26 @@ def _compute_courant_number_above(
z_cfl = z_cfl - where(mass_gt_cellmass_m3, 1.0, 0.0)

z_cflfrac = where(z_mass_neg, z_mass / p_cellmass_now_jks, 0.0)
z_cfl = z_cfl + where(abs(z_cflfrac) < 1.0, z_cflfrac, dbl_eps - 1.0)
z_cfl = z_cfl + where(abs(z_cflfrac) < 1.0, z_cflfrac, wp_eps - 1.0)

return z_cfl


@gtx.field_operator
def _compute_ppm4gpu_courant_number(
p_mflx_contra_v: fa.CellKField[ta.wpfloat],
p_cellmass_now: fa.CellKField[ta.wpfloat],
z_cfl: fa.CellKField[ta.wpfloat],
p_mflx_contra_v: fa.CellKField[wpfloat],
p_cellmass_now: fa.CellKField[wpfloat],
z_cfl: fa.CellKField[wpfloat],
k: fa.KField[gtx.int32],
slevp1_ti: gtx.int32,
nlev: gtx.int32,
dbl_eps: ta.wpfloat,
p_dtime: ta.wpfloat,
) -> fa.CellKField[ta.wpfloat]:
wp_eps: wpfloat,
p_dtime: wpfloat,
) -> fa.CellKField[wpfloat]:
z_mass = p_dtime * p_mflx_contra_v

cfl_below = _compute_courant_number_below(p_cellmass_now, z_mass, z_cfl, k, nlev, dbl_eps)
cfl_above = _compute_courant_number_above(p_cellmass_now, z_mass, z_cfl, k, slevp1_ti, dbl_eps)
cfl_below = _compute_courant_number_below(p_cellmass_now, z_mass, z_cfl, k, nlev, wp_eps)
cfl_above = _compute_courant_number_above(p_cellmass_now, z_mass, z_cfl, k, slevp1_ti, wp_eps)

z_cfl = cfl_below + cfl_above

Expand All @@ -144,14 +145,14 @@ def _compute_ppm4gpu_courant_number(

@gtx.program(grid_type=gtx.GridType.UNSTRUCTURED)
def compute_ppm4gpu_courant_number(
p_mflx_contra_v: fa.CellKField[ta.wpfloat],
p_cellmass_now: fa.CellKField[ta.wpfloat],
z_cfl: fa.CellKField[ta.wpfloat],
p_mflx_contra_v: fa.CellKField[wpfloat],
p_cellmass_now: fa.CellKField[wpfloat],
z_cfl: fa.CellKField[wpfloat],
k: fa.KField[gtx.int32],
slevp1_ti: gtx.int32,
nlev: gtx.int32,
dbl_eps: ta.wpfloat,
p_dtime: ta.wpfloat,
wp_eps: wpfloat,
p_dtime: wpfloat,
horizontal_start: gtx.int32,
horizontal_end: gtx.int32,
vertical_start: gtx.int32,
Expand All @@ -164,7 +165,7 @@ def compute_ppm4gpu_courant_number(
k,
slevp1_ti,
nlev,
dbl_eps,
wp_eps,
p_dtime,
out=z_cfl,
domain={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def _prepare_numerical_quadrature_for_cubic_reconstruction(
wgt_zeta_2: ta.wpfloat,
wgt_eta_1: ta.wpfloat,
wgt_eta_2: ta.wpfloat,
dbl_eps: ta.wpfloat,
wp_eps: ta.wpfloat,
eps: ta.wpfloat,
) -> tuple[
fa.EdgeKField[ta.vpfloat],
Expand Down Expand Up @@ -97,7 +97,7 @@ def _prepare_numerical_quadrature_for_cubic_reconstruction(
p_coords_dreg_v_3_y_wp = astype(p_coords_dreg_v_3_y, wpfloat)
p_coords_dreg_v_4_y_wp = astype(p_coords_dreg_v_4_y, wpfloat)

wgt_t_detjac_1 = dbl_eps + z_wgt_1 * (
wgt_t_detjac_1 = wp_eps + z_wgt_1 * (
(
z_eta_1_1 * (p_coords_dreg_v_2_x_wp - p_coords_dreg_v_1_x_wp)
+ z_eta_1_2 * (p_coords_dreg_v_3_x_wp - p_coords_dreg_v_4_x_wp)
Expand All @@ -115,7 +115,7 @@ def _prepare_numerical_quadrature_for_cubic_reconstruction(
- z_eta_1_4 * (p_coords_dreg_v_2_x_wp - p_coords_dreg_v_3_x_wp)
)
)
wgt_t_detjac_2 = dbl_eps + z_wgt_2 * (
wgt_t_detjac_2 = wp_eps + z_wgt_2 * (
(
z_eta_2_1 * (p_coords_dreg_v_2_x_wp - p_coords_dreg_v_1_x_wp)
+ z_eta_2_2 * (p_coords_dreg_v_3_x_wp - p_coords_dreg_v_4_x_wp)
Expand All @@ -133,7 +133,7 @@ def _prepare_numerical_quadrature_for_cubic_reconstruction(
- z_eta_2_4 * (p_coords_dreg_v_2_x_wp - p_coords_dreg_v_3_x_wp)
)
)
wgt_t_detjac_3 = dbl_eps + z_wgt_3 * (
wgt_t_detjac_3 = wp_eps + z_wgt_3 * (
(
z_eta_3_1 * (p_coords_dreg_v_2_x_wp - p_coords_dreg_v_1_x_wp)
+ z_eta_3_2 * (p_coords_dreg_v_3_x_wp - p_coords_dreg_v_4_x_wp)
Expand All @@ -151,7 +151,7 @@ def _prepare_numerical_quadrature_for_cubic_reconstruction(
- z_eta_3_4 * (p_coords_dreg_v_2_x_wp - p_coords_dreg_v_3_x_wp)
)
)
wgt_t_detjac_4 = dbl_eps + z_wgt_4 * (
wgt_t_detjac_4 = wp_eps + z_wgt_4 * (
(
z_eta_4_1 * (p_coords_dreg_v_2_x_wp - p_coords_dreg_v_1_x_wp)
+ z_eta_4_2 * (p_coords_dreg_v_3_x_wp - p_coords_dreg_v_4_x_wp)
Expand Down Expand Up @@ -342,7 +342,7 @@ def prepare_numerical_quadrature_for_cubic_reconstruction(
wgt_zeta_2: ta.wpfloat,
wgt_eta_1: ta.wpfloat,
wgt_eta_2: ta.wpfloat,
dbl_eps: ta.wpfloat,
wp_eps: ta.wpfloat,
eps: ta.wpfloat,
horizontal_start: gtx.int32,
horizontal_end: gtx.int32,
Expand Down Expand Up @@ -386,7 +386,7 @@ def prepare_numerical_quadrature_for_cubic_reconstruction(
wgt_zeta_2,
wgt_eta_1,
wgt_eta_2,
dbl_eps,
wp_eps,
eps,
out=(
p_quad_vector_sum_1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def _prepare_numerical_quadrature_list_for_cubic_reconstruction(
wgt_zeta_2: ta.wpfloat,
wgt_eta_1: ta.wpfloat,
wgt_eta_2: ta.wpfloat,
dbl_eps: ta.wpfloat,
wp_eps: ta.wpfloat,
eps: ta.wpfloat,
) -> tuple[
fa.EdgeKField[ta.vpfloat],
Expand Down Expand Up @@ -110,7 +110,7 @@ def _prepare_numerical_quadrature_list_for_cubic_reconstruction(

wgt_t_detjac_1 = where(
famask_bool,
dbl_eps
wp_eps
+ z_wgt_1
* (
(
Expand All @@ -134,7 +134,7 @@ def _prepare_numerical_quadrature_list_for_cubic_reconstruction(
)
wgt_t_detjac_2 = where(
famask_bool,
dbl_eps
wp_eps
+ z_wgt_2
* (
(
Expand All @@ -158,7 +158,7 @@ def _prepare_numerical_quadrature_list_for_cubic_reconstruction(
)
wgt_t_detjac_3 = where(
famask_bool,
dbl_eps
wp_eps
+ z_wgt_3
* (
(
Expand All @@ -182,7 +182,7 @@ def _prepare_numerical_quadrature_list_for_cubic_reconstruction(
)
wgt_t_detjac_4 = where(
famask_bool,
dbl_eps
wp_eps
+ z_wgt_4
* (
(
Expand Down Expand Up @@ -378,7 +378,7 @@ def prepare_numerical_quadrature_list_for_cubic_reconstruction(
wgt_zeta_2: ta.wpfloat,
wgt_eta_1: ta.wpfloat,
wgt_eta_2: ta.wpfloat,
dbl_eps: ta.wpfloat,
wp_eps: ta.wpfloat,
eps: ta.wpfloat,
horizontal_start: gtx.int32,
horizontal_end: gtx.int32,
Expand Down Expand Up @@ -424,7 +424,7 @@ def prepare_numerical_quadrature_list_for_cubic_reconstruction(
wgt_zeta_2,
wgt_eta_1,
wgt_eta_2,
dbl_eps,
wp_eps,
eps,
out=(
p_quad_vector_sum_1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def test_advection_run_single_step(
prep_adv = construct_prep_adv(advection_init_savepoint)
p_tracer_now = advection_init_savepoint.tracer(ntracer)
p_tracer_new = data_alloc.zero_field(icon_grid, dims.CellDim, dims.KDim, allocator=backend)
dtime = advection_init_savepoint.get_metadata("dtime").get("dtime")
dtime = advection_init_savepoint.dtime()

log_serialized(diagnostic_state, prep_adv, p_tracer_now, dtime)

Expand Down
Loading