Skip to content

Commit

Permalink
Merge branch 'main' of github.com:C2SM/icon4py into mixed_precision_d…
Browse files Browse the repository at this point in the history
…ycore

Conflicts:
	model/atmosphere/diffusion/tests/stencil_tests/test_calculate_nabla2_and_smag_coefficients_for_vn.py
	model/atmosphere/diffusion/tests/stencil_tests/test_calculate_nabla4.py
	model/atmosphere/dycore/tests/stencil_tests/test_mo_solve_nonhydro_stencil_16_fused_btraj_traj_o1.py
	model/atmosphere/dycore/tests/stencil_tests/test_mo_velocity_advection_stencil_19.py
  • Loading branch information
Nina Burgdorfer authored and Nina Burgdorfer committed Nov 17, 2023
2 parents 5cfcbcb + 0583c30 commit 1ca0f29
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 5 deletions.
4 changes: 2 additions & 2 deletions ci/cscs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ variables:
build_job:
extends: .build_template

test_model_job:
test_model_job_embedded_simple_grid:
extends: .test_template
stage: test
script:
- tox -r -e py${pyversion_no_dot} -c model/ --verbose -- --benchmark-skip -n auto

benchmark_model_gtfn_cpu:
benchmark_model_gtfn_cpu_simple_grid:
extends: .test_template
stage: benchmark
script:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ def reference(

@pytest.fixture
def input_data(self, grid):
if np.any(grid.connectivities[E2C2VDim] == -1):
pytest.xfail("Stencil does not support missing neighbors.")

u_vert = random_field(grid, VertexDim, KDim, dtype=vpfloat)
v_vert = random_field(grid, VertexDim, KDim, dtype=vpfloat)
smag_offset = vpfloat("9.0")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ def reference(

@pytest.fixture
def input_data(self, grid):
if np.any(grid.connectivities[E2C2VDim] == -1):
pytest.xfail("Stencil does not support missing neighbors.")

u_vert = random_field(grid, VertexDim, KDim, dtype=vpfloat)
v_vert = random_field(grid, VertexDim, KDim, dtype=vpfloat)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ def reference(

@pytest.fixture
def input_data(self, grid):
if np.any(grid.connectivities[C2E2CDim] == -1):
pytest.xfail("Stencil does not support missing neighbors.")

mask = random_mask(grid, CellDim, KDim)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,9 @@ def reference(

@pytest.fixture
def input_data(self, grid):
if np.any(grid.connectivities[E2CDim] == -1):
pytest.xfail("Stencil does not support missing neighbors.")

p_vn = random_field(grid, EdgeDim, KDim, dtype=wpfloat)
p_vt = random_field(grid, EdgeDim, KDim, dtype=vpfloat)
pos_on_tplane_e_1 = random_field(grid, EdgeDim, E2CDim, dtype=wpfloat)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ def at_neighbor(i):

@pytest.fixture
def input_data(self, grid):
if np.any(grid.connectivities[E2CDim] == -1):
pytest.xfail("Stencil does not support missing neighbors.")

inv_dual_edge_length = random_field(grid, EdgeDim, dtype=wpfloat)
z_exner_ex_pr = random_field(grid, CellDim, KDim, dtype=vpfloat)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ def _apply_index_field(shape, to_index, neighbor_table, offset_field):

@pytest.fixture
def input_data(self, grid):
if np.any(grid.connectivities[E2CDim] == -1):
pytest.xfail("Stencil does not support missing neighbors.")

ikoffset = zero_field(grid, EdgeDim, E2CDim, KDim, dtype=int32)
rng = np.random.default_rng()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ def reference(

@pytest.fixture
def input_data(self, grid):
if np.any(grid.connectivities[E2CDim] == -1):
pytest.xfail("Stencil does not support missing neighbors.")

z_kin_hor_e = random_field(grid, EdgeDim, KDim, dtype=vpfloat)
coeff_gradekin = random_field(grid, EdgeDim, E2CDim, dtype=vpfloat)
coeff_gradekin_new = as_1D_sparse_field(coeff_gradekin, ECDim)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,14 @@ def reference(

w_con_e = np.where(
(levelmask_offset_0) | (levelmask_offset_1),
np.sum(c_lin_e * z_w_con_c_full[grid.connectivities[E2CDim]], axis=1),
np.sum(
np.where(
(grid.connectivities[E2CDim] != -1)[:, :, np.newaxis],
c_lin_e * z_w_con_c_full[grid.connectivities[E2CDim]],
0,
),
axis=1,
),
w_con_e,
)
difcoef = np.where(
Expand All @@ -125,7 +132,14 @@ def reference(
+ difcoef
* area_edge
* (
np.sum(geofac_grdiv * vn[grid.connectivities[E2C2EODim]], axis=1)
np.sum(
np.where(
(grid.connectivities[E2C2EODim] != -1)[:, :, np.newaxis],
geofac_grdiv * vn[grid.connectivities[E2C2EODim]],
0,
),
axis=1,
)
+ tangent_orientation
* inv_primal_edge_length
* (
Expand Down
2 changes: 1 addition & 1 deletion model/common/src/icon4py/model/common/grid/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class ClassLevelCache:
@staticmethod
def cache_method(method):
def wrapper(self, *args, **kwargs):
key = f"{method.__name__}_{args}_{kwargs}"
key = f"{self.__class__.__name__}_{method.__name__}_{args}_{kwargs}"
if key not in ClassLevelCache._cache:
ClassLevelCache._cache[key] = method(self, *args, **kwargs)
return ClassLevelCache._cache[key]
Expand Down

0 comments on commit 1ca0f29

Please sign in to comment.