icon4py-testing 0.2.0__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.0 → icon4py_testing-0.3.0}/PKG-INFO +4 -7
- {icon4py_testing-0.2.0 → icon4py_testing-0.3.0}/pyproject.toml +6 -9
- {icon4py_testing-0.2.0 → 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.0 → icon4py_testing-0.3.0}/src/icon4py/model/testing/definitions.py +16 -32
- {icon4py_testing-0.2.0 → icon4py_testing-0.3.0}/src/icon4py/model/testing/filters.py +2 -7
- {icon4py_testing-0.2.0 → icon4py_testing-0.3.0}/src/icon4py/model/testing/fixtures/benchmark.py +14 -6
- {icon4py_testing-0.2.0 → icon4py_testing-0.3.0}/src/icon4py/model/testing/grid_utils.py +15 -4
- {icon4py_testing-0.2.0 → icon4py_testing-0.3.0}/src/icon4py/model/testing/pytest_hooks.py +177 -28
- {icon4py_testing-0.2.0 → icon4py_testing-0.3.0}/src/icon4py/model/testing/serialbox.py +12 -13
- {icon4py_testing-0.2.0 → icon4py_testing-0.3.0}/src/icon4py/model/testing/test_utils.py +64 -9
- {icon4py_testing-0.2.0 → icon4py_testing-0.3.0}/src/icon4py_testing.egg-info/PKG-INFO +4 -7
- {icon4py_testing-0.2.0 → icon4py_testing-0.3.0}/src/icon4py_testing.egg-info/requires.txt +2 -3
- icon4py_testing-0.2.0/src/icon4py/model/testing/datatest_utils.py +0 -346
- {icon4py_testing-0.2.0 → icon4py_testing-0.3.0}/README.md +0 -0
- {icon4py_testing-0.2.0 → icon4py_testing-0.3.0}/setup.cfg +0 -0
- {icon4py_testing-0.2.0 → icon4py_testing-0.3.0}/src/icon4py/model/testing/config.py +0 -0
- {icon4py_testing-0.2.0 → icon4py_testing-0.3.0}/src/icon4py/model/testing/data_handling.py +0 -0
- {icon4py_testing-0.2.0 → icon4py_testing-0.3.0}/src/icon4py/model/testing/fixtures/__init__.py +0 -0
- {icon4py_testing-0.2.0 → icon4py_testing-0.3.0}/src/icon4py/model/testing/fixtures/datatest.py +0 -0
- {icon4py_testing-0.2.0 → icon4py_testing-0.3.0}/src/icon4py/model/testing/fixtures/stencil_tests.py +0 -0
- {icon4py_testing-0.2.0 → icon4py_testing-0.3.0}/src/icon4py/model/testing/locking.py +0 -0
- {icon4py_testing-0.2.0 → icon4py_testing-0.3.0}/src/icon4py/model/testing/parallel_helpers.py +0 -0
- {icon4py_testing-0.2.0 → icon4py_testing-0.3.0}/src/icon4py/model/testing/py.typed +0 -0
- {icon4py_testing-0.2.0 → icon4py_testing-0.3.0}/src/icon4py/model/testing/reference_funcs.py +0 -0
- {icon4py_testing-0.2.0 → icon4py_testing-0.3.0}/src/icon4py/model/testing/stencil_tests.py +0 -0
- {icon4py_testing-0.2.0 → icon4py_testing-0.3.0}/src/icon4py_testing.egg-info/SOURCES.txt +0 -0
- {icon4py_testing-0.2.0 → icon4py_testing-0.3.0}/src/icon4py_testing.egg-info/dependency_links.txt +0 -0
- {icon4py_testing-0.2.0 → icon4py_testing-0.3.0}/src/icon4py_testing.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
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
|
|
@@ -12,8 +12,6 @@ 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
|
|
@@ -15,8 +15,6 @@ classifiers = [
|
|
|
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,27 +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_ATM_FNAME: Final = "NAMELIST_ICON_output_atm"
|
|
34
|
-
NAMELIST_MASTER_FNAME: Final = "icon_master.namelist"
|
|
35
23
|
GRID_DATA_DIR: Final = "grids"
|
|
36
24
|
EXPERIMENT_DATA_DIR: Final = "experiments"
|
|
37
25
|
MUPHYS_DATA_DIR: Final = "muphys"
|
|
@@ -46,7 +34,7 @@ def grids_path() -> pathlib.Path:
|
|
|
46
34
|
return config.TEST_DATA_PATH.joinpath(GRID_DATA_DIR)
|
|
47
35
|
|
|
48
36
|
|
|
49
|
-
@dataclasses.dataclass
|
|
37
|
+
@dataclasses.dataclass(frozen=True)
|
|
50
38
|
class GridDescription:
|
|
51
39
|
name: str
|
|
52
40
|
description: str
|
|
@@ -163,32 +151,23 @@ class Grids:
|
|
|
163
151
|
)
|
|
164
152
|
|
|
165
153
|
|
|
166
|
-
@dataclasses.dataclass
|
|
154
|
+
@dataclasses.dataclass(frozen=True)
|
|
167
155
|
class ExperimentDescription:
|
|
168
156
|
name: str
|
|
169
157
|
long_name: str
|
|
170
158
|
grid: GridDescription
|
|
171
|
-
version: int =
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
@dataclasses.dataclass
|
|
175
|
-
class ExperimentConfig:
|
|
176
|
-
driver: driver_config.DriverConfig
|
|
177
|
-
vertical_grid: v_grid.VerticalGridConfig
|
|
178
|
-
nonhydrostatic: solve_nh.NonHydrostaticConfig
|
|
179
|
-
diffusion: diffusion.DiffusionConfig
|
|
180
|
-
metrics: metrics_factory.MetricsConfig
|
|
181
|
-
interpolation: interpolation_factory.InterpolationConfig
|
|
182
|
-
graupel: graupel.SingleMomentSixClassIconGraupelConfig
|
|
159
|
+
version: int = 5
|
|
183
160
|
|
|
184
161
|
|
|
185
162
|
@dataclasses.dataclass
|
|
186
163
|
class Experiment:
|
|
187
164
|
description: ExperimentDescription
|
|
188
|
-
_config: ExperimentConfig
|
|
165
|
+
_config: driver_config.ExperimentConfig
|
|
189
166
|
|
|
190
167
|
def __init__(
|
|
191
|
-
self,
|
|
168
|
+
self,
|
|
169
|
+
experiment_description: ExperimentDescription,
|
|
170
|
+
experiment_config: driver_config.ExperimentConfig,
|
|
192
171
|
) -> None:
|
|
193
172
|
self.description = experiment_description
|
|
194
173
|
self._config = experiment_config
|
|
@@ -202,7 +181,7 @@ class Experiment:
|
|
|
202
181
|
return self.description.grid
|
|
203
182
|
|
|
204
183
|
@property
|
|
205
|
-
def config(self) -> ExperimentConfig:
|
|
184
|
+
def config(self) -> driver_config.ExperimentConfig:
|
|
206
185
|
# Return a deep copy so that tests cannot mutate the shared cached config.
|
|
207
186
|
return copy.deepcopy(self._config)
|
|
208
187
|
|
|
@@ -213,6 +192,11 @@ class Experiments:
|
|
|
213
192
|
long_name="EXCLAIM Aquaplanet experiment",
|
|
214
193
|
grid=Grids.R02B04_GLOBAL,
|
|
215
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
|
+
)
|
|
216
200
|
MCH_CH_R04B09: Final = ExperimentDescription(
|
|
217
201
|
name="exclaim_ch_r04b09_dsl",
|
|
218
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.0 → 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,14 +97,22 @@ 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
|
)
|
|
@@ -114,6 +123,8 @@ def get_grid_geometry(
|
|
|
114
123
|
coordinates=gm.coordinates,
|
|
115
124
|
extra_fields=gm.geometry_fields,
|
|
116
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
|
|