icon4py-testing 0.2.0rc2__tar.gz → 0.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {icon4py_testing-0.2.0rc2 → icon4py_testing-0.3.0}/PKG-INFO +5 -8
- {icon4py_testing-0.2.0rc2 → icon4py_testing-0.3.0}/pyproject.toml +7 -10
- {icon4py_testing-0.2.0rc2 → icon4py_testing-0.3.0}/src/icon4py/model/testing/__init__.py +1 -1
- icon4py_testing-0.3.0/src/icon4py/model/testing/datatest_utils.py +140 -0
- {icon4py_testing-0.2.0rc2 → icon4py_testing-0.3.0}/src/icon4py/model/testing/definitions.py +16 -31
- {icon4py_testing-0.2.0rc2 → icon4py_testing-0.3.0}/src/icon4py/model/testing/filters.py +2 -7
- {icon4py_testing-0.2.0rc2 → icon4py_testing-0.3.0}/src/icon4py/model/testing/fixtures/benchmark.py +14 -6
- {icon4py_testing-0.2.0rc2 → icon4py_testing-0.3.0}/src/icon4py/model/testing/grid_utils.py +21 -10
- {icon4py_testing-0.2.0rc2 → icon4py_testing-0.3.0}/src/icon4py/model/testing/parallel_helpers.py +2 -1
- {icon4py_testing-0.2.0rc2 → icon4py_testing-0.3.0}/src/icon4py/model/testing/pytest_hooks.py +177 -28
- {icon4py_testing-0.2.0rc2 → icon4py_testing-0.3.0}/src/icon4py/model/testing/serialbox.py +24 -19
- {icon4py_testing-0.2.0rc2 → icon4py_testing-0.3.0}/src/icon4py/model/testing/stencil_tests.py +1 -3
- {icon4py_testing-0.2.0rc2 → icon4py_testing-0.3.0}/src/icon4py/model/testing/test_utils.py +66 -9
- {icon4py_testing-0.2.0rc2 → icon4py_testing-0.3.0}/src/icon4py_testing.egg-info/PKG-INFO +5 -8
- {icon4py_testing-0.2.0rc2 → icon4py_testing-0.3.0}/src/icon4py_testing.egg-info/requires.txt +2 -3
- icon4py_testing-0.2.0rc2/src/icon4py/model/testing/datatest_utils.py +0 -346
- {icon4py_testing-0.2.0rc2 → icon4py_testing-0.3.0}/README.md +0 -0
- {icon4py_testing-0.2.0rc2 → icon4py_testing-0.3.0}/setup.cfg +0 -0
- {icon4py_testing-0.2.0rc2 → icon4py_testing-0.3.0}/src/icon4py/model/testing/config.py +0 -0
- {icon4py_testing-0.2.0rc2 → icon4py_testing-0.3.0}/src/icon4py/model/testing/data_handling.py +0 -0
- {icon4py_testing-0.2.0rc2 → icon4py_testing-0.3.0}/src/icon4py/model/testing/fixtures/__init__.py +0 -0
- {icon4py_testing-0.2.0rc2 → icon4py_testing-0.3.0}/src/icon4py/model/testing/fixtures/datatest.py +0 -0
- {icon4py_testing-0.2.0rc2 → icon4py_testing-0.3.0}/src/icon4py/model/testing/fixtures/stencil_tests.py +0 -0
- {icon4py_testing-0.2.0rc2 → icon4py_testing-0.3.0}/src/icon4py/model/testing/locking.py +0 -0
- {icon4py_testing-0.2.0rc2 → icon4py_testing-0.3.0}/src/icon4py/model/testing/py.typed +0 -0
- {icon4py_testing-0.2.0rc2 → icon4py_testing-0.3.0}/src/icon4py/model/testing/reference_funcs.py +0 -0
- {icon4py_testing-0.2.0rc2 → icon4py_testing-0.3.0}/src/icon4py_testing.egg-info/SOURCES.txt +0 -0
- {icon4py_testing-0.2.0rc2 → icon4py_testing-0.3.0}/src/icon4py_testing.egg-info/dependency_links.txt +0 -0
- {icon4py_testing-0.2.0rc2 → icon4py_testing-0.3.0}/src/icon4py_testing.egg-info/top_level.txt +0 -0
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: icon4py-testing
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.0
|
|
4
4
|
Summary: Testing utils for the icon4py model.
|
|
5
5
|
Author-email: ETH Zurich <gridtools@cscs.ch>
|
|
6
6
|
License: BSD-3 License
|
|
7
7
|
Project-URL: Homepage, https://github.com/C2SM/icon4py
|
|
8
|
-
Classifier: Development Status ::
|
|
8
|
+
Classifier: Development Status :: 4 - Beta
|
|
9
9
|
Classifier: Intended Audience :: Science/Research
|
|
10
10
|
Classifier: License :: OSI Approved :: BSD License
|
|
11
11
|
Classifier: Operating System :: POSIX
|
|
12
12
|
Classifier: Programming Language :: Python
|
|
13
13
|
Classifier: Programming Language :: Python :: 3
|
|
14
14
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
17
15
|
Classifier: Programming Language :: Python :: 3.12
|
|
18
16
|
Classifier: Programming Language :: Python :: 3.13
|
|
19
17
|
Classifier: Programming Language :: Python :: 3.14
|
|
@@ -21,16 +19,15 @@ Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
|
21
19
|
Classifier: Topic :: Scientific/Engineering :: Atmospheric Science
|
|
22
20
|
Classifier: Topic :: Scientific/Engineering :: Mathematics
|
|
23
21
|
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
24
|
-
Requires-Python: >=3.
|
|
22
|
+
Requires-Python: >=3.12
|
|
25
23
|
Description-Content-Type: text/markdown
|
|
26
|
-
Requires-Dist: icon4py-common[io]~=0.
|
|
24
|
+
Requires-Dist: icon4py-common[io]~=0.3.0
|
|
27
25
|
Requires-Dist: filelock<3.20,>=3.18.0
|
|
28
|
-
Requires-Dist: gt4py==1.1.
|
|
26
|
+
Requires-Dist: gt4py==1.1.12
|
|
29
27
|
Requires-Dist: numpy>=1.23.3
|
|
30
28
|
Requires-Dist: packaging>=20.0
|
|
31
29
|
Requires-Dist: pooch>=1.7.0
|
|
32
30
|
Requires-Dist: pytest>=8.0.1
|
|
33
31
|
Requires-Dist: serialbox4py>=2.6.2
|
|
34
|
-
Requires-Dist: typing-extensions>=4.11.0
|
|
35
32
|
|
|
36
33
|
# Testing utils for Python ICON port
|
|
@@ -8,15 +8,13 @@ requires = ["setuptools>=61.0", "wheel>=0.40.0"]
|
|
|
8
8
|
[project]
|
|
9
9
|
authors = [{email = "gridtools@cscs.ch", name = "ETH Zurich"}]
|
|
10
10
|
classifiers = [
|
|
11
|
-
'Development Status ::
|
|
11
|
+
'Development Status :: 4 - Beta',
|
|
12
12
|
'Intended Audience :: Science/Research',
|
|
13
13
|
'License :: OSI Approved :: BSD License',
|
|
14
14
|
'Operating System :: POSIX',
|
|
15
15
|
'Programming Language :: Python',
|
|
16
16
|
'Programming Language :: Python :: 3',
|
|
17
17
|
'Programming Language :: Python :: 3 :: Only',
|
|
18
|
-
'Programming Language :: Python :: 3.10',
|
|
19
|
-
'Programming Language :: Python :: 3.11',
|
|
20
18
|
'Programming Language :: Python :: 3.12',
|
|
21
19
|
'Programming Language :: Python :: 3.13',
|
|
22
20
|
'Programming Language :: Python :: 3.14',
|
|
@@ -27,27 +25,26 @@ classifiers = [
|
|
|
27
25
|
]
|
|
28
26
|
dependencies = [
|
|
29
27
|
# workspace members
|
|
30
|
-
'icon4py-common[io]~=0.
|
|
28
|
+
'icon4py-common[io]~=0.3.0',
|
|
31
29
|
# external dependencies
|
|
32
30
|
# TODO(msimberg): https://github.com/tox-dev/filelock/pull/408 added in 3.20.4
|
|
33
31
|
# and 3.21.0 seems to lead to hangs in CI. Investigate if other lock types are
|
|
34
32
|
# safe or if this is a bug in filelock.
|
|
35
33
|
"filelock>=3.18.0,<3.20",
|
|
36
|
-
"gt4py==1.1.
|
|
34
|
+
"gt4py==1.1.12",
|
|
37
35
|
"numpy>=1.23.3",
|
|
38
36
|
'packaging>=20.0',
|
|
39
37
|
"pooch>=1.7.0",
|
|
40
38
|
"pytest>=8.0.1",
|
|
41
|
-
"serialbox4py>=2.6.2"
|
|
42
|
-
"typing-extensions>=4.11.0"
|
|
39
|
+
"serialbox4py>=2.6.2"
|
|
43
40
|
]
|
|
44
41
|
description = "Testing utils for the icon4py model."
|
|
45
42
|
license = {text = "BSD-3 License"}
|
|
46
43
|
name = "icon4py-testing"
|
|
47
44
|
readme = "README.md"
|
|
48
|
-
requires-python = ">=3.
|
|
45
|
+
requires-python = ">=3.12"
|
|
49
46
|
# managed by bump-my-version:
|
|
50
|
-
version = "0.
|
|
47
|
+
version = "0.3.0"
|
|
51
48
|
|
|
52
49
|
[project.urls]
|
|
53
50
|
Homepage = 'https://github.com/C2SM/icon4py'
|
|
@@ -56,7 +53,7 @@ Homepage = 'https://github.com/C2SM/icon4py'
|
|
|
56
53
|
[tool.bumpversion]
|
|
57
54
|
allow_dirty = false
|
|
58
55
|
commit = false
|
|
59
|
-
current_version = "0.
|
|
56
|
+
current_version = "0.3.0"
|
|
60
57
|
ignore_missing_version = false
|
|
61
58
|
message = 'Bump icon4py-testing version: {current_version} → {new_version}'
|
|
62
59
|
parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)(?:(?P<pre_l>a|b|rc)(?P<pre_n>\\d+))?"
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
# ICON4Py - ICON inspired code in Python and GT4Py
|
|
2
|
+
#
|
|
3
|
+
# Copyright (c) 2022-2024, ETH Zurich and MeteoSwiss
|
|
4
|
+
# All rights reserved.
|
|
5
|
+
#
|
|
6
|
+
# Please, refer to the LICENSE file in the root directory.
|
|
7
|
+
# SPDX-License-Identifier: BSD-3-Clause
|
|
8
|
+
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
import logging
|
|
12
|
+
import pathlib
|
|
13
|
+
import urllib.parse
|
|
14
|
+
|
|
15
|
+
import gt4py.next.typing as gtx_typing
|
|
16
|
+
|
|
17
|
+
from icon4py.model.common.decomposition import definitions as decomposition
|
|
18
|
+
from icon4py.model.standalone_driver import config as driver_config
|
|
19
|
+
from icon4py.model.testing import data_handling, definitions, serialbox
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
logger = logging.getLogger(__name__)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def get_process_properties_for_run(
|
|
26
|
+
run_instance: decomposition.RunType,
|
|
27
|
+
) -> decomposition.ProcessProperties:
|
|
28
|
+
return decomposition.get_process_properties(run_instance)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def get_experiment_name_with_version(
|
|
32
|
+
experiment_description: definitions.ExperimentDescription,
|
|
33
|
+
) -> str:
|
|
34
|
+
"""Generate experiment name with version suffix."""
|
|
35
|
+
return f"{experiment_description.name}_v{experiment_description.version:02d}"
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def get_ranked_experiment_name_with_version(
|
|
39
|
+
experiment_description: definitions.ExperimentDescription, comm_size: int
|
|
40
|
+
) -> str:
|
|
41
|
+
"""Generate ranked experiment name with version suffix."""
|
|
42
|
+
return f"mpitask{comm_size}_{get_experiment_name_with_version(experiment_description)}"
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def get_experiment_archive_filename(
|
|
46
|
+
experiment_description: definitions.ExperimentDescription, comm_size: int
|
|
47
|
+
) -> str:
|
|
48
|
+
"""Generate ranked archive filename for an experiment."""
|
|
49
|
+
return f"{get_ranked_experiment_name_with_version(experiment_description, comm_size)}.tar.gz"
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def get_experiment_archive_url(root_url: str, filepath: str) -> str:
|
|
53
|
+
"""Build a download URL for experiment archive from root URL."""
|
|
54
|
+
return f"{root_url}/{urllib.parse.quote(filepath)}"
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def get_grid_archive_filename(grid: definitions.GridDescription) -> str:
|
|
58
|
+
return f"{grid.name}.tar.gz"
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def get_grid_filename(grid: definitions.GridDescription) -> str:
|
|
62
|
+
return f"{grid.name}.nc"
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def get_grid_filepath(grid: definitions.GridDescription) -> pathlib.Path:
|
|
66
|
+
return definitions.grids_path().joinpath(grid.name, get_grid_filename(grid))
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def get_grid_archive_url(root_url: str, grid: definitions.GridDescription) -> str:
|
|
70
|
+
"""Build a download URL for a grid archive from root URL."""
|
|
71
|
+
filepath = f"{definitions.GRID_DATA_DIR}/{get_grid_archive_filename(grid)}"
|
|
72
|
+
return f"{root_url}/{urllib.parse.quote(filepath)}"
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def get_muphys_archive_url(root_url: str, experiment_type: str, experiment_name: str) -> str:
|
|
76
|
+
"""Build a download URL for a muphys archive from root URL."""
|
|
77
|
+
filepath = f"{definitions.MUPHYS_DATA_DIR}/{experiment_type}/{experiment_name}.tar.gz"
|
|
78
|
+
return f"{root_url}/{urllib.parse.quote(filepath)}"
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def get_path_for_experiment(
|
|
82
|
+
experiment_description: definitions.ExperimentDescription,
|
|
83
|
+
process_props: decomposition.ProcessProperties,
|
|
84
|
+
) -> pathlib.Path:
|
|
85
|
+
"""Get the path to an experiment root directory."""
|
|
86
|
+
|
|
87
|
+
experiment_dir = get_ranked_experiment_name_with_version(
|
|
88
|
+
experiment_description,
|
|
89
|
+
process_props.comm_size,
|
|
90
|
+
)
|
|
91
|
+
return definitions.serialized_data_path() / experiment_dir
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
def get_datapath_for_experiment(
|
|
95
|
+
experiment_description: definitions.ExperimentDescription,
|
|
96
|
+
process_props: decomposition.ProcessProperties,
|
|
97
|
+
) -> pathlib.Path:
|
|
98
|
+
"""Get the path to serialized data for an experiment."""
|
|
99
|
+
|
|
100
|
+
experiment_path = get_path_for_experiment(
|
|
101
|
+
experiment_description,
|
|
102
|
+
process_props,
|
|
103
|
+
)
|
|
104
|
+
return experiment_path.joinpath(definitions.SERIALIZED_DATA_SUBDIR)
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
def create_icon_serial_data_provider(
|
|
108
|
+
datapath: pathlib.Path,
|
|
109
|
+
rank: int,
|
|
110
|
+
backend: gtx_typing.Backend | None,
|
|
111
|
+
) -> serialbox.IconSerialDataProvider:
|
|
112
|
+
return serialbox.IconSerialDataProvider(
|
|
113
|
+
backend=backend,
|
|
114
|
+
fname_prefix="icon_pydycore",
|
|
115
|
+
path=str(datapath),
|
|
116
|
+
mpi_rank=rank,
|
|
117
|
+
do_print=True,
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
def download_experiment(
|
|
122
|
+
experiment_description: definitions.ExperimentDescription,
|
|
123
|
+
processor_props: decomposition.ProcessProperties,
|
|
124
|
+
) -> None:
|
|
125
|
+
"""Download data and config for an experiment--if not already present."""
|
|
126
|
+
comm_size = processor_props.comm_size
|
|
127
|
+
root_url = definitions.TESTDATA_ROOT_URL
|
|
128
|
+
archive_filename = get_experiment_archive_filename(experiment_description, comm_size)
|
|
129
|
+
archive_path = definitions.EXPERIMENT_DATA_DIR + "/" + archive_filename
|
|
130
|
+
uri = get_experiment_archive_url(root_url, archive_path)
|
|
131
|
+
destination_path = get_datapath_for_experiment(experiment_description, processor_props)
|
|
132
|
+
data_handling.download_test_data(destination_path.parent, uri)
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
def create_experiment_configuration(
|
|
136
|
+
experiment_description: definitions.ExperimentDescription,
|
|
137
|
+
processor_props: decomposition.ProcessProperties,
|
|
138
|
+
) -> driver_config.ExperimentConfig:
|
|
139
|
+
experiment_path = get_path_for_experiment(experiment_description, processor_props)
|
|
140
|
+
return driver_config.read_experiment_config_from_fortran(experiment_path)
|
|
@@ -11,26 +11,15 @@ from __future__ import annotations
|
|
|
11
11
|
import copy
|
|
12
12
|
import dataclasses
|
|
13
13
|
import pathlib
|
|
14
|
-
from typing import
|
|
15
|
-
|
|
16
|
-
from icon4py.model.
|
|
17
|
-
single_moment_six_class_gscp_graupel as graupel,
|
|
18
|
-
)
|
|
19
|
-
from icon4py.model.common.grid import icon as icon_grid, vertical as v_grid
|
|
20
|
-
from icon4py.model.common.interpolation import interpolation_factory
|
|
21
|
-
from icon4py.model.common.metrics import metrics_factory
|
|
14
|
+
from typing import Final
|
|
15
|
+
|
|
16
|
+
from icon4py.model.common.grid import icon as icon_grid
|
|
22
17
|
from icon4py.model.standalone_driver import config as driver_config
|
|
23
18
|
from icon4py.model.testing import config
|
|
24
19
|
|
|
25
20
|
|
|
26
|
-
if TYPE_CHECKING:
|
|
27
|
-
from icon4py.model.atmosphere.diffusion import diffusion
|
|
28
|
-
from icon4py.model.atmosphere.dycore import solve_nonhydro as solve_nh
|
|
29
|
-
|
|
30
|
-
|
|
31
21
|
SERIALIZED_DATA_DIR: Final = "ser_icondata"
|
|
32
22
|
SERIALIZED_DATA_SUBDIR: Final = "ser_data"
|
|
33
|
-
NAMELIST_ICON_FNAME: Final = "NAMELIST_ICON_output_atm"
|
|
34
23
|
GRID_DATA_DIR: Final = "grids"
|
|
35
24
|
EXPERIMENT_DATA_DIR: Final = "experiments"
|
|
36
25
|
MUPHYS_DATA_DIR: Final = "muphys"
|
|
@@ -45,7 +34,7 @@ def grids_path() -> pathlib.Path:
|
|
|
45
34
|
return config.TEST_DATA_PATH.joinpath(GRID_DATA_DIR)
|
|
46
35
|
|
|
47
36
|
|
|
48
|
-
@dataclasses.dataclass
|
|
37
|
+
@dataclasses.dataclass(frozen=True)
|
|
49
38
|
class GridDescription:
|
|
50
39
|
name: str
|
|
51
40
|
description: str
|
|
@@ -162,32 +151,23 @@ class Grids:
|
|
|
162
151
|
)
|
|
163
152
|
|
|
164
153
|
|
|
165
|
-
@dataclasses.dataclass
|
|
154
|
+
@dataclasses.dataclass(frozen=True)
|
|
166
155
|
class ExperimentDescription:
|
|
167
156
|
name: str
|
|
168
157
|
long_name: str
|
|
169
158
|
grid: GridDescription
|
|
170
|
-
version: int =
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
@dataclasses.dataclass
|
|
174
|
-
class ExperimentConfig:
|
|
175
|
-
driver: driver_config.DriverConfig
|
|
176
|
-
vertical_grid: v_grid.VerticalGridConfig
|
|
177
|
-
nonhydrostatic: solve_nh.NonHydrostaticConfig
|
|
178
|
-
diffusion: diffusion.DiffusionConfig
|
|
179
|
-
metrics: metrics_factory.MetricsConfig
|
|
180
|
-
interpolation: interpolation_factory.InterpolationConfig
|
|
181
|
-
graupel: graupel.SingleMomentSixClassIconGraupelConfig
|
|
159
|
+
version: int = 5
|
|
182
160
|
|
|
183
161
|
|
|
184
162
|
@dataclasses.dataclass
|
|
185
163
|
class Experiment:
|
|
186
164
|
description: ExperimentDescription
|
|
187
|
-
_config: ExperimentConfig
|
|
165
|
+
_config: driver_config.ExperimentConfig
|
|
188
166
|
|
|
189
167
|
def __init__(
|
|
190
|
-
self,
|
|
168
|
+
self,
|
|
169
|
+
experiment_description: ExperimentDescription,
|
|
170
|
+
experiment_config: driver_config.ExperimentConfig,
|
|
191
171
|
) -> None:
|
|
192
172
|
self.description = experiment_description
|
|
193
173
|
self._config = experiment_config
|
|
@@ -201,7 +181,7 @@ class Experiment:
|
|
|
201
181
|
return self.description.grid
|
|
202
182
|
|
|
203
183
|
@property
|
|
204
|
-
def config(self) -> ExperimentConfig:
|
|
184
|
+
def config(self) -> driver_config.ExperimentConfig:
|
|
205
185
|
# Return a deep copy so that tests cannot mutate the shared cached config.
|
|
206
186
|
return copy.deepcopy(self._config)
|
|
207
187
|
|
|
@@ -212,6 +192,11 @@ class Experiments:
|
|
|
212
192
|
long_name="EXCLAIM Aquaplanet experiment",
|
|
213
193
|
grid=Grids.R02B04_GLOBAL,
|
|
214
194
|
)
|
|
195
|
+
EXCLAIM_APE_AES: Final = ExperimentDescription(
|
|
196
|
+
name="exclaim_ape_aesPhys",
|
|
197
|
+
long_name="EXCLAIM Aquaplanet experiment. JW IC and AES physics",
|
|
198
|
+
grid=Grids.R02B04_GLOBAL,
|
|
199
|
+
)
|
|
215
200
|
MCH_CH_R04B09: Final = ExperimentDescription(
|
|
216
201
|
name="exclaim_ch_r04b09_dsl",
|
|
217
202
|
long_name="Regional setup used by EXCLAIM to validate the icon-exclaim.",
|
|
@@ -10,7 +10,7 @@ from __future__ import annotations
|
|
|
10
10
|
|
|
11
11
|
import functools
|
|
12
12
|
from collections.abc import Callable
|
|
13
|
-
from typing import NamedTuple
|
|
13
|
+
from typing import NamedTuple
|
|
14
14
|
|
|
15
15
|
import pytest
|
|
16
16
|
|
|
@@ -19,8 +19,7 @@ from icon4py.model.common.utils import device_utils
|
|
|
19
19
|
from icon4py.model.testing import test_utils
|
|
20
20
|
|
|
21
21
|
|
|
22
|
-
T =
|
|
23
|
-
Predicate: TypeAlias = Callable[[T], bool]
|
|
22
|
+
type Predicate[T] = Callable[[T], bool]
|
|
24
23
|
|
|
25
24
|
|
|
26
25
|
class ItemFilter(NamedTuple):
|
|
@@ -55,10 +54,6 @@ item_marker_filters: dict[str, ItemFilter] = {
|
|
|
55
54
|
pytest.xfail, " gt4py _compiled_programs returns error when backend is None."
|
|
56
55
|
),
|
|
57
56
|
),
|
|
58
|
-
pytest.mark.uses_as_offset.name: ItemFilter(
|
|
59
|
-
condition=lambda item: test_utils.is_embedded(test_utils.get_backend_fixture_value(item)),
|
|
60
|
-
action=functools.partial(pytest.xfail, "Embedded backend does not support as_offset."),
|
|
61
|
-
),
|
|
62
57
|
pytest.mark.uses_concat_where.name: ItemFilter(
|
|
63
58
|
condition=lambda item: test_utils.is_embedded(test_utils.get_backend_fixture_value(item)),
|
|
64
59
|
action=functools.partial(pytest.xfail, "Embedded backend does not support concat_where."),
|
{icon4py_testing-0.2.0rc2 → icon4py_testing-0.3.0}/src/icon4py/model/testing/fixtures/benchmark.py
RENAMED
|
@@ -13,17 +13,18 @@ import gt4py.next as gtx
|
|
|
13
13
|
import pytest
|
|
14
14
|
|
|
15
15
|
import icon4py.model.common.dimension as dims
|
|
16
|
-
from icon4py.model.common import model_backends, model_options
|
|
16
|
+
from icon4py.model.common import model_backends, model_options, topography
|
|
17
17
|
from icon4py.model.common.decomposition import definitions as decomposition
|
|
18
18
|
from icon4py.model.common.grid import (
|
|
19
19
|
geometry as grid_geometry,
|
|
20
20
|
geometry_attributes as geometry_meta,
|
|
21
|
+
geometry_config,
|
|
21
22
|
grid_manager as gm,
|
|
22
23
|
vertical as v_grid,
|
|
23
24
|
)
|
|
24
|
-
from icon4py.model.common.initialization import topography
|
|
25
25
|
from icon4py.model.common.interpolation import interpolation_attributes, interpolation_factory
|
|
26
26
|
from icon4py.model.common.metrics import metrics_attributes, metrics_factory
|
|
27
|
+
from icon4py.model.common.topography.analytical import jablonowski_williamson as jw_topo
|
|
27
28
|
|
|
28
29
|
|
|
29
30
|
@pytest.fixture(
|
|
@@ -43,11 +44,13 @@ def geometry_field_source(
|
|
|
43
44
|
geometry_field_source = grid_geometry.GridGeometry(
|
|
44
45
|
grid=mesh,
|
|
45
46
|
decomposition_info=decomposition_info,
|
|
46
|
-
exchange=decomposition.single_node_exchange,
|
|
47
47
|
backend=generic_concrete_backend,
|
|
48
48
|
coordinates=grid_manager.coordinates,
|
|
49
49
|
extra_fields=grid_manager.geometry_fields,
|
|
50
50
|
metadata=geometry_meta.attrs,
|
|
51
|
+
config=geometry_config.GeometryConfig(),
|
|
52
|
+
process_props=decomposition.SingleNodeProcessProperties(),
|
|
53
|
+
exchange=decomposition.single_node_exchange,
|
|
51
54
|
)
|
|
52
55
|
yield geometry_field_source
|
|
53
56
|
|
|
@@ -107,9 +110,14 @@ def metrics_field_source(
|
|
|
107
110
|
vct_b=vct_b,
|
|
108
111
|
)
|
|
109
112
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
+
config = topography.TopographyConfig(
|
|
114
|
+
config=jw_topo.JablonowskiWilliamsonConfig(),
|
|
115
|
+
)
|
|
116
|
+
topo_c = topography.create(
|
|
117
|
+
config=config,
|
|
118
|
+
grid_manager=grid_manager,
|
|
119
|
+
backend=generic_concrete_backend,
|
|
120
|
+
exchange=decomposition.single_node_exchange,
|
|
113
121
|
)
|
|
114
122
|
|
|
115
123
|
metrics_field_source = metrics_factory.MetricsFieldsFactory(
|
|
@@ -19,6 +19,7 @@ from icon4py.model.common.grid import (
|
|
|
19
19
|
vertical as v_grid,
|
|
20
20
|
)
|
|
21
21
|
from icon4py.model.common.utils import data_allocation as data_alloc
|
|
22
|
+
from icon4py.model.standalone_driver import config as driver_config
|
|
22
23
|
from icon4py.model.testing import config, data_handling, datatest_utils as dt_utils, definitions
|
|
23
24
|
|
|
24
25
|
|
|
@@ -96,24 +97,34 @@ def _download_grid_file(grid: definitions.GridDescription) -> pathlib.Path:
|
|
|
96
97
|
|
|
97
98
|
|
|
98
99
|
def get_grid_geometry(
|
|
99
|
-
backend: gtx_typing.Backend | None,
|
|
100
|
+
backend: gtx_typing.Backend | None,
|
|
101
|
+
grid: definitions.GridDescription,
|
|
102
|
+
experiment_config: driver_config.ExperimentConfig,
|
|
100
103
|
) -> geometry.GridGeometry:
|
|
101
|
-
register_name = "_".join(
|
|
104
|
+
register_name = "_".join(
|
|
105
|
+
(
|
|
106
|
+
grid.name,
|
|
107
|
+
data_alloc.backend_name(backend),
|
|
108
|
+
str(experiment_config.geometry.use_analytical_means),
|
|
109
|
+
)
|
|
110
|
+
)
|
|
102
111
|
|
|
103
112
|
def _construct_grid_geometry() -> geometry.GridGeometry:
|
|
104
113
|
gm = get_grid_manager_from_identifier(
|
|
105
|
-
|
|
106
|
-
num_levels=
|
|
114
|
+
grid,
|
|
115
|
+
num_levels=experiment_config.vertical_grid.num_levels,
|
|
107
116
|
keep_skip_values=True,
|
|
108
117
|
allocator=model_backends.get_allocator(backend),
|
|
109
118
|
)
|
|
110
119
|
return geometry.GridGeometry(
|
|
111
|
-
gm.grid,
|
|
112
|
-
gm.decomposition_info,
|
|
113
|
-
backend,
|
|
114
|
-
gm.coordinates,
|
|
115
|
-
gm.geometry_fields,
|
|
116
|
-
geometry_attrs.attrs,
|
|
120
|
+
grid=gm.grid,
|
|
121
|
+
decomposition_info=gm.decomposition_info,
|
|
122
|
+
backend=backend,
|
|
123
|
+
coordinates=gm.coordinates,
|
|
124
|
+
extra_fields=gm.geometry_fields,
|
|
125
|
+
metadata=geometry_attrs.attrs,
|
|
126
|
+
config=experiment_config.geometry,
|
|
127
|
+
process_props=decomposition.SingleNodeProcessProperties(),
|
|
117
128
|
exchange=decomposition.single_node_exchange,
|
|
118
129
|
)
|
|
119
130
|
|
{icon4py_testing-0.2.0rc2 → icon4py_testing-0.3.0}/src/icon4py/model/testing/parallel_helpers.py
RENAMED
|
@@ -75,6 +75,7 @@ def gather_field(field: np.ndarray, process_props: decomp_defs.ProcessProperties
|
|
|
75
75
|
|
|
76
76
|
|
|
77
77
|
def check_local_global_field(
|
|
78
|
+
*,
|
|
78
79
|
decomposition_info: decomp_defs.DecompositionInfo,
|
|
79
80
|
process_props: decomp_defs.ProcessProperties, # F811 # fixture
|
|
80
81
|
dim: gtx.Dimension,
|
|
@@ -155,5 +156,5 @@ def check_local_global_field(
|
|
|
155
156
|
|
|
156
157
|
# abuse err_msg to print the domain region
|
|
157
158
|
test_utils.assert_dallclose(
|
|
158
|
-
|
|
159
|
+
sorted_, global_reference_field, atol=atol, rtol=rtol, err_msg="internal"
|
|
159
160
|
)
|