From 146f4d118878d7db1b2ab0bae47b9edd40ecf803 Mon Sep 17 00:00:00 2001 From: samkellerhals Date: Thu, 14 Dec 2023 13:03:01 +0100 Subject: [PATCH 01/17] Add serialised data path --- ci/cscs.yml | 155 +++++++++--------- .../src/icon4py/model/common/grid/icon.py | 2 +- .../common/test_utils/datatest_fixtures.py | 4 +- .../model/common/test_utils/datatest_utils.py | 20 ++- .../model/common/test_utils/grid_utils.py | 4 +- model/common/tests/grid_tests/conftest.py | 4 +- 6 files changed, 102 insertions(+), 87 deletions(-) diff --git a/ci/cscs.yml b/ci/cscs.yml index bab0af8700..f5a5308137 100644 --- a/ci/cscs.yml +++ b/ci/cscs.yml @@ -14,6 +14,7 @@ variables: DACE_VERSION: "0.15.1" PERSIST_IMAGE_NAME: $CSCS_REGISTRY_PATH/icon4py:$CI_COMMIT_SHORT_SHA PYTHON_VERSION: "3.10" + SERIALIZED_DATA_PATH: "/apps/daint/UES/jenkssl/ciext/icon4py" .build_template: stage: build @@ -45,78 +46,84 @@ variables: build_job: extends: .build_template -test_model_job_roundtrip_simple_grid: - extends: .test_template - stage: test +test job: script: - - tox -r -c model/ --verbose -- --benchmark-skip -n auto - -test_model_job_dace_cpu_simple_grid: - extends: .test_template - stage: test - script: - - pip install dace==$DACE_VERSION - - tox -r -e stencil_tests -c model/ --verbose -- --benchmark-skip -n auto --backend=dace_cpu - only: - - main - allow_failure: true - -test_model_job_dace_gpu_simple_grid: - extends: .test_template - stage: test - script: - - pip install dace==$DACE_VERSION - - tox -r -e stencil_tests -c model/ --verbose -- --benchmark-skip -n auto --backend=dace_gpu - only: - - main - allow_failure: true - -test_model_job_gtfn_cpu_simple_grid: - extends: .test_template - stage: test - script: - - tox -r -e stencil_tests -c model/ --verbose -- --benchmark-skip -n auto --backend=gtfn_cpu - -test_model_job_gtfn_gpu_simple_grid: - extends: .test_template - stage: test - script: - - tox -r -e stencil_tests -c model/ --verbose -- --benchmark-skip -n auto --backend=gtfn_gpu - -test_tools_job: - extends: .test_template - stage: test - script: - - tox -r -c tools/ --verbose - -benchmark_model_dace_cpu_simple_grid: - extends: .test_template - stage: benchmark - script: - - pip install dace==$DACE_VERSION - - tox -r -e stencil_tests -c model/ --verbose -- --benchmark-only --backend=dace_cpu --grid=simple_grid - only: - - main - when: manual - -benchmark_model_dace_gpu_simple_grid: - extends: .test_template - stage: benchmark - script: - - pip install dace==$DACE_VERSION - - tox -r -e stencil_tests -c model/ --verbose -- --benchmark-only --backend=dace_gpu --grid=simple_grid - only: - - main - when: manual - -benchmark_model_gtfn_cpu_simple_grid: - extends: .test_template - stage: benchmark - script: - - tox -r -e stencil_tests -c model/ --verbose -- --benchmark-only --backend=gtfn_cpu --grid=simple_grid - -benchmark_model_gtfn_gpu_simple_grid: - extends: .test_template - stage: benchmark - script: - - tox -r -e stencil_tests -c model/ --verbose -- --benchmark-only --backend=gtfn_gpu --grid=simple_grid + ls /apps/daint/UES/jenkssl/ciext/icon4py + variables: + CSCS_NEEDED_DATA: icon4py + +#test_model_job_roundtrip_simple_grid: +# extends: .test_template +# stage: test +# script: +# - tox -r -c model/ --verbose -- --benchmark-skip -n auto +# +#test_model_job_dace_cpu_simple_grid: +# extends: .test_template +# stage: test +# script: +# - pip install dace==$DACE_VERSION +# - tox -r -e stencil_tests -c model/ --verbose -- --benchmark-skip -n auto --backend=dace_cpu +# only: +# - main +# allow_failure: true +# +#test_model_job_dace_gpu_simple_grid: +# extends: .test_template +# stage: test +# script: +# - pip install dace==$DACE_VERSION +# - tox -r -e stencil_tests -c model/ --verbose -- --benchmark-skip -n auto --backend=dace_gpu +# only: +# - main +# allow_failure: true +# +#test_model_job_gtfn_cpu_simple_grid: +# extends: .test_template +# stage: test +# script: +# - tox -r -e stencil_tests -c model/ --verbose -- --benchmark-skip -n auto --backend=gtfn_cpu +# +#test_model_job_gtfn_gpu_simple_grid: +# extends: .test_template +# stage: test +# script: +# - tox -r -e stencil_tests -c model/ --verbose -- --benchmark-skip -n auto --backend=gtfn_gpu +# +#test_tools_job: +# extends: .test_template +# stage: test +# script: +# - tox -r -c tools/ --verbose +# +#benchmark_model_dace_cpu_simple_grid: +# extends: .test_template +# stage: benchmark +# script: +# - pip install dace==$DACE_VERSION +# - tox -r -e stencil_tests -c model/ --verbose -- --benchmark-only --backend=dace_cpu --grid=simple_grid +# only: +# - main +# when: manual +# +#benchmark_model_dace_gpu_simple_grid: +# extends: .test_template +# stage: benchmark +# script: +# - pip install dace==$DACE_VERSION +# - tox -r -e stencil_tests -c model/ --verbose -- --benchmark-only --backend=dace_gpu --grid=simple_grid +# only: +# - main +# when: manual +# +#benchmark_model_gtfn_cpu_simple_grid: +# extends: .test_template +# stage: benchmark +# script: +# - tox -r -e stencil_tests -c model/ --verbose -- --benchmark-only --backend=gtfn_cpu --grid=simple_grid +# +#benchmark_model_gtfn_gpu_simple_grid: +# extends: .test_template +# stage: benchmark +# script: +# - tox -r -e stencil_tests -c model/ --verbose -- --benchmark-only --backend=gtfn_gpu --grid=simple_grid diff --git a/model/common/src/icon4py/model/common/grid/icon.py b/model/common/src/icon4py/model/common/grid/icon.py index 5c0d462545..e4b59cce4c 100644 --- a/model/common/src/icon4py/model/common/grid/icon.py +++ b/model/common/src/icon4py/model/common/grid/icon.py @@ -56,7 +56,7 @@ def __init__(self): "E2C2V": (self._get_offset_provider, E2C2VDim, EdgeDim, VertexDim), "V2E": (self._get_offset_provider, V2EDim, VertexDim, EdgeDim), "V2C": (self._get_offset_provider, V2CDim, VertexDim, CellDim), - "C2V": (self._get_offset_provider, C2VDim, CellDim, VertexDim), + # "C2V": (self._get_offset_provider, C2VDim, CellDim, VertexDim), "E2ECV": (self._get_offset_provider_for_sparse_fields, E2C2VDim, EdgeDim, ECVDim), "C2CEC": (self._get_offset_provider_for_sparse_fields, C2E2CDim, CellDim, CECDim), "C2CE": (self._get_offset_provider_for_sparse_fields, C2EDim, CellDim, CEDim), diff --git a/model/common/src/icon4py/model/common/test_utils/datatest_fixtures.py b/model/common/src/icon4py/model/common/test_utils/datatest_fixtures.py index 0297e3c442..9e3775092c 100644 --- a/model/common/src/icon4py/model/common/test_utils/datatest_fixtures.py +++ b/model/common/src/icon4py/model/common/test_utils/datatest_fixtures.py @@ -17,7 +17,7 @@ from .data_handling import download_and_extract from .datatest_utils import ( DATA_URIS, - SER_DATA_BASEPATH, + SERIALIZED_DATA_BASEPATH, create_icon_serial_data_provider, get_datapath_for_ranked_data, get_processor_properties_for_run, @@ -35,7 +35,7 @@ def processor_props(request): @pytest.fixture(scope="session") def ranked_data_path(processor_props): - return get_ranked_data_path(SER_DATA_BASEPATH, processor_props) + return get_ranked_data_path(SERIALIZED_DATA_BASEPATH, processor_props) @pytest.fixture(scope="session") diff --git a/model/common/src/icon4py/model/common/test_utils/datatest_utils.py b/model/common/src/icon4py/model/common/test_utils/datatest_utils.py index 46709e51b5..3e1ded7c96 100644 --- a/model/common/src/icon4py/model/common/test_utils/datatest_utils.py +++ b/model/common/src/icon4py/model/common/test_utils/datatest_utils.py @@ -10,17 +10,26 @@ # distribution for a copy of the license or check . # # SPDX-License-Identifier: GPL-3.0-or-later - +import os from pathlib import Path from icon4py.model.common.decomposition.definitions import get_processor_properties -TEST_UTILS_PATH = Path(__file__).parent -MODEL_PATH = TEST_UTILS_PATH.parent.parent -COMMON_PATH = MODEL_PATH.parent.parent.parent.parent -BASE_PATH = COMMON_PATH.parent.joinpath("testdata") +def get_serialized_data_path() -> Path: + test_utils_path = Path(__file__).parent + model_path = test_utils_path.parent.parent + common_path = model_path.parent.parent.parent.parent + env_base_path = os.getenv('SERIALIZED_DATA_PATH') + + if env_base_path: + return Path(env_base_path) + else: + return common_path.parent.joinpath("serialized_data") + +SERIALIZED_DATA_PATH = get_serialized_data_path() +SERIALIZED_DATA_BASEPATH = SERIALIZED_DATA_PATH.joinpath("ser_icondata") # TODO: a run that contains all the fields needed for dycore, diffusion, interpolation fields needs to be consolidated DATA_URIS = { @@ -28,7 +37,6 @@ 2: "https://polybox.ethz.ch/index.php/s/YyC5qDJWyC39y7u/download", 4: "https://polybox.ethz.ch/index.php/s/UIHOVJs6FVPpz9V/download", } -SER_DATA_BASEPATH = BASE_PATH.joinpath("ser_icondata") def get_processor_properties_for_run(run_instance): diff --git a/model/common/src/icon4py/model/common/test_utils/grid_utils.py b/model/common/src/icon4py/model/common/test_utils/grid_utils.py index 3b4a9bbd96..434d473164 100644 --- a/model/common/src/icon4py/model/common/test_utils/grid_utils.py +++ b/model/common/src/icon4py/model/common/test_utils/grid_utils.py @@ -15,7 +15,7 @@ from icon4py.model.common.decomposition.definitions import SingleNodeRun from icon4py.model.common.test_utils.datatest_utils import ( - SER_DATA_BASEPATH, + SERIALIZED_DATA_BASEPATH, create_icon_serial_data_provider, get_datapath_for_ranked_data, get_processor_properties_for_run, @@ -25,7 +25,7 @@ def get_icon_grid(): processor_properties = get_processor_properties_for_run(SingleNodeRun()) - ranked_path = get_ranked_data_path(SER_DATA_BASEPATH, processor_properties) + ranked_path = get_ranked_data_path(SERIALIZED_DATA_BASEPATH, processor_properties) data_path = get_datapath_for_ranked_data(ranked_path) icon_data_provider = create_icon_serial_data_provider(data_path, processor_properties) grid_savepoint = icon_data_provider.from_savepoint_grid() diff --git a/model/common/tests/grid_tests/conftest.py b/model/common/tests/grid_tests/conftest.py index 9c99791eef..230faed8d4 100644 --- a/model/common/tests/grid_tests/conftest.py +++ b/model/common/tests/grid_tests/conftest.py @@ -25,10 +25,10 @@ processor_props, ranked_data_path, ) -from icon4py.model.common.test_utils.datatest_utils import BASE_PATH +from icon4py.model.common.test_utils.datatest_utils import SERIALIZED_DATA_PATH -grids_path = BASE_PATH.joinpath("grids") +grids_path = SERIALIZED_DATA_PATH.joinpath("grids") r04b09_dsl_grid_path = grids_path.joinpath("mch_ch_r04b09_dsl") r04b09_dsl_data_file = r04b09_dsl_grid_path.joinpath("mch_ch_r04b09_dsl_grids_v1.tar.gz").name r02b04_global_grid_path = grids_path.joinpath("r02b04_global") From efdcb6c188369f7aca8141285e9349a986099cfa Mon Sep 17 00:00:00 2001 From: samkellerhals Date: Thu, 14 Dec 2023 13:05:31 +0100 Subject: [PATCH 02/17] test job --- ci/cscs.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/ci/cscs.yml b/ci/cscs.yml index f5a5308137..76ab0a1286 100644 --- a/ci/cscs.yml +++ b/ci/cscs.yml @@ -47,6 +47,7 @@ build_job: extends: .build_template test job: + extends: .test_template script: ls /apps/daint/UES/jenkssl/ciext/icon4py variables: From a449d62bd6b31c7d724800636c9545ed249ec784 Mon Sep 17 00:00:00 2001 From: samkellerhals Date: Thu, 14 Dec 2023 13:14:32 +0100 Subject: [PATCH 03/17] test using serialised data --- ci/cscs.yml | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/ci/cscs.yml b/ci/cscs.yml index 76ab0a1286..b88847c0c1 100644 --- a/ci/cscs.yml +++ b/ci/cscs.yml @@ -35,6 +35,7 @@ variables: - pyversion_no_dot="${PYTHON_VERSION//./}" - pip install tox clang-format - python -c "import cupy" + - ls /apps/daint/UES/jenkssl/ciext/icon4py variables: SLURM_JOB_NUM_NODES: 1 SLURM_NTASKS: 1 @@ -42,17 +43,11 @@ variables: CRAY_CUDA_MPS: 1 NUM_PROCESSES: auto VIRTUALENV_SYSTEM_SITE_PACKAGES: 1 + CSCS_NEEDED_DATA: icon4py build_job: extends: .build_template -test job: - extends: .test_template - script: - ls /apps/daint/UES/jenkssl/ciext/icon4py - variables: - CSCS_NEEDED_DATA: icon4py - #test_model_job_roundtrip_simple_grid: # extends: .test_template # stage: test @@ -79,12 +74,12 @@ test job: # - main # allow_failure: true # -#test_model_job_gtfn_cpu_simple_grid: -# extends: .test_template -# stage: test -# script: -# - tox -r -e stencil_tests -c model/ --verbose -- --benchmark-skip -n auto --backend=gtfn_cpu -# +test_model_job_gtfn_cpu_simple_grid: + extends: .test_template + stage: test + script: + - tox -r -e stencil_tests -c model/ --verbose -- --benchmark-skip -n auto --backend=gtfn_cpu --grid=icon_grid + #test_model_job_gtfn_gpu_simple_grid: # extends: .test_template # stage: test From 95d4533254d65cf19bf030a4747d220753b6e87e Mon Sep 17 00:00:00 2001 From: samkellerhals Date: Thu, 14 Dec 2023 13:39:22 +0100 Subject: [PATCH 04/17] export data path --- ci/cscs.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci/cscs.yml b/ci/cscs.yml index b88847c0c1..260f035bfb 100644 --- a/ci/cscs.yml +++ b/ci/cscs.yml @@ -14,7 +14,6 @@ variables: DACE_VERSION: "0.15.1" PERSIST_IMAGE_NAME: $CSCS_REGISTRY_PATH/icon4py:$CI_COMMIT_SHORT_SHA PYTHON_VERSION: "3.10" - SERIALIZED_DATA_PATH: "/apps/daint/UES/jenkssl/ciext/icon4py" .build_template: stage: build @@ -35,7 +34,8 @@ variables: - pyversion_no_dot="${PYTHON_VERSION//./}" - pip install tox clang-format - python -c "import cupy" - - ls /apps/daint/UES/jenkssl/ciext/icon4py + - ls ${SERIALIZED_DATA_PATH} + - export SERIALIZED_DATA_PATH=${SERIALIZED_DATA_PATH} variables: SLURM_JOB_NUM_NODES: 1 SLURM_NTASKS: 1 From 32d8eca8bf6e8c805fdbf338bad2584340fccc9a Mon Sep 17 00:00:00 2001 From: samkellerhals Date: Thu, 14 Dec 2023 13:43:16 +0100 Subject: [PATCH 05/17] Try exporting in variables test_template --- ci/cscs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/cscs.yml b/ci/cscs.yml index 260f035bfb..d345207ce6 100644 --- a/ci/cscs.yml +++ b/ci/cscs.yml @@ -35,7 +35,6 @@ variables: - pip install tox clang-format - python -c "import cupy" - ls ${SERIALIZED_DATA_PATH} - - export SERIALIZED_DATA_PATH=${SERIALIZED_DATA_PATH} variables: SLURM_JOB_NUM_NODES: 1 SLURM_NTASKS: 1 @@ -44,6 +43,7 @@ variables: NUM_PROCESSES: auto VIRTUALENV_SYSTEM_SITE_PACKAGES: 1 CSCS_NEEDED_DATA: icon4py + SERIALIZED_DATA_PATH: "/apps/daint/UES/jenkssl/ciext/icon4py" build_job: extends: .build_template From 2af5052e8c60f51d3c1e912f716a4bed6e90a920 Mon Sep 17 00:00:00 2001 From: samkellerhals Date: Thu, 14 Dec 2023 14:00:22 +0100 Subject: [PATCH 06/17] Modify passenv --- model/tox.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/model/tox.ini b/model/tox.ini index 0783f3343e..24a05c24c4 100644 --- a/model/tox.ini +++ b/model/tox.ini @@ -11,6 +11,7 @@ skipsdist = true passenv = PIP_USER PYTHONUSERBASE + SERIALIZED_DATA_PATH deps = -r {toxinidir}/requirements-dev.txt commands = From 7872ae35396da25e723520d0b06a8ae3bb6d89af Mon Sep 17 00:00:00 2001 From: samkellerhals Date: Thu, 14 Dec 2023 15:34:26 +0100 Subject: [PATCH 07/17] Fix one test --- .../test_calculate_nabla2_for_z.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/model/atmosphere/diffusion/tests/diffusion_stencil_tests/test_calculate_nabla2_for_z.py b/model/atmosphere/diffusion/tests/diffusion_stencil_tests/test_calculate_nabla2_for_z.py index b44cd8a26c..6f30ff385a 100644 --- a/model/atmosphere/diffusion/tests/diffusion_stencil_tests/test_calculate_nabla2_for_z.py +++ b/model/atmosphere/diffusion/tests/diffusion_stencil_tests/test_calculate_nabla2_for_z.py @@ -56,10 +56,11 @@ def reference( @pytest.fixture def input_data(self, grid, backend): - if isinstance(backend, OTFCompileExecutor): - pytest.skip( - "Execution domain needs to be restricted or boundary taken into account in stencil." - ) + if hasattr(backend, 'executor'): + if isinstance(backend.executor, OTFCompileExecutor): + pytest.skip( + "Execution domain needs to be restricted or boundary taken into account in stencil." + ) kh_smag_e = random_field(grid, EdgeDim, KDim, dtype=vpfloat) inv_dual_edge_length = random_field(grid, EdgeDim, dtype=wpfloat) theta_v = random_field(grid, CellDim, KDim, dtype=wpfloat) From 390721c0f194940b52b7ef58910d603b083f3bba Mon Sep 17 00:00:00 2001 From: samkellerhals Date: Thu, 14 Dec 2023 16:24:10 +0100 Subject: [PATCH 08/17] Add icon_grid benchmarks --- ci/cscs.yml | 142 +++++++++--------- ...test_apply_diffusion_to_theta_and_exner.py | 6 +- .../test_apply_diffusion_to_vn.py | 10 +- .../test_calculate_nabla2_for_z.py | 15 +- ...sed_velocity_advection_stencil_19_to_20.py | 6 +- ...fused_velocity_advection_stencil_1_to_7.py | 7 +- .../model/common/test_utils/helpers.py | 14 +- 7 files changed, 111 insertions(+), 89 deletions(-) diff --git a/ci/cscs.yml b/ci/cscs.yml index d345207ce6..5095556bed 100644 --- a/ci/cscs.yml +++ b/ci/cscs.yml @@ -48,78 +48,78 @@ variables: build_job: extends: .build_template -#test_model_job_roundtrip_simple_grid: -# extends: .test_template -# stage: test -# script: -# - tox -r -c model/ --verbose -- --benchmark-skip -n auto -# -#test_model_job_dace_cpu_simple_grid: -# extends: .test_template -# stage: test -# script: -# - pip install dace==$DACE_VERSION -# - tox -r -e stencil_tests -c model/ --verbose -- --benchmark-skip -n auto --backend=dace_cpu -# only: -# - main -# allow_failure: true -# -#test_model_job_dace_gpu_simple_grid: -# extends: .test_template -# stage: test -# script: -# - pip install dace==$DACE_VERSION -# - tox -r -e stencil_tests -c model/ --verbose -- --benchmark-skip -n auto --backend=dace_gpu -# only: -# - main -# allow_failure: true -# +test_model_job_roundtrip_simple_grid: + extends: .test_template + stage: test + script: + - tox -r -c model/ --verbose -- --benchmark-skip -n auto + +test_model_job_dace_cpu_simple_grid: + extends: .test_template + stage: test + script: + - pip install dace==$DACE_VERSION + - tox -r -e stencil_tests -c model/ --verbose -- --benchmark-skip -n auto --backend=dace_cpu + only: + - main + allow_failure: true + +test_model_job_dace_gpu_simple_grid: + extends: .test_template + stage: test + script: + - pip install dace==$DACE_VERSION + - tox -r -e stencil_tests -c model/ --verbose -- --benchmark-skip -n auto --backend=dace_gpu + only: + - main + allow_failure: true + test_model_job_gtfn_cpu_simple_grid: extends: .test_template stage: test script: - - tox -r -e stencil_tests -c model/ --verbose -- --benchmark-skip -n auto --backend=gtfn_cpu --grid=icon_grid - -#test_model_job_gtfn_gpu_simple_grid: -# extends: .test_template -# stage: test -# script: -# - tox -r -e stencil_tests -c model/ --verbose -- --benchmark-skip -n auto --backend=gtfn_gpu -# -#test_tools_job: -# extends: .test_template -# stage: test -# script: -# - tox -r -c tools/ --verbose -# -#benchmark_model_dace_cpu_simple_grid: -# extends: .test_template -# stage: benchmark -# script: -# - pip install dace==$DACE_VERSION -# - tox -r -e stencil_tests -c model/ --verbose -- --benchmark-only --backend=dace_cpu --grid=simple_grid -# only: -# - main -# when: manual -# -#benchmark_model_dace_gpu_simple_grid: -# extends: .test_template -# stage: benchmark -# script: -# - pip install dace==$DACE_VERSION -# - tox -r -e stencil_tests -c model/ --verbose -- --benchmark-only --backend=dace_gpu --grid=simple_grid -# only: -# - main -# when: manual -# -#benchmark_model_gtfn_cpu_simple_grid: -# extends: .test_template -# stage: benchmark -# script: -# - tox -r -e stencil_tests -c model/ --verbose -- --benchmark-only --backend=gtfn_cpu --grid=simple_grid -# -#benchmark_model_gtfn_gpu_simple_grid: -# extends: .test_template -# stage: benchmark -# script: -# - tox -r -e stencil_tests -c model/ --verbose -- --benchmark-only --backend=gtfn_gpu --grid=simple_grid + - tox -r -e stencil_tests -c model/ --verbose -- --benchmark-skip -n auto --backend=gtfn_cpu + +test_model_job_gtfn_gpu_simple_grid: + extends: .test_template + stage: test + script: + - tox -r -e stencil_tests -c model/ --verbose -- --benchmark-skip -n auto --backend=gtfn_gpu + +test_tools_job: + extends: .test_template + stage: test + script: + - tox -r -c tools/ --verbose + +benchmark_model_dace_cpu_icon_grid: + extends: .test_template + stage: benchmark + script: + - pip install dace==$DACE_VERSION + - tox -r -e stencil_tests -c model/ --verbose -- --benchmark-only --backend=dace_cpu --grid=icon_grid + only: + - main + when: manual + +benchmark_model_dace_gpu_icon_grid: + extends: .test_template + stage: benchmark + script: + - pip install dace==$DACE_VERSION + - tox -r -e stencil_tests -c model/ --verbose -- --benchmark-only --backend=dace_gpu --grid=icon_grid + only: + - main + when: manual + +benchmark_model_gtfn_cpu_icon_grid: + extends: .test_template + stage: benchmark + script: + - tox -r -e stencil_tests -c model/ --verbose -- --benchmark-only --backend=gtfn_cpu --grid=icon_grid + +benchmark_model_gtfn_gpu_icon_grid: + extends: .test_template + stage: benchmark + script: + - tox -r -e stencil_tests -c model/ --verbose -- --benchmark-only --backend=gtfn_gpu --grid=icon_grid diff --git a/model/atmosphere/diffusion/tests/diffusion_stencil_tests/test_apply_diffusion_to_theta_and_exner.py b/model/atmosphere/diffusion/tests/diffusion_stencil_tests/test_apply_diffusion_to_theta_and_exner.py index fa1e392aa0..a11faf0be6 100644 --- a/model/atmosphere/diffusion/tests/diffusion_stencil_tests/test_apply_diffusion_to_theta_and_exner.py +++ b/model/atmosphere/diffusion/tests/diffusion_stencil_tests/test_apply_diffusion_to_theta_and_exner.py @@ -26,6 +26,7 @@ random_mask, unflatten_first_two_dims, zero_field, + uses_icon_grid_with_otf ) from .test_calculate_nabla2_for_z import calculate_nabla2_for_z_numpy @@ -81,7 +82,10 @@ def reference( return dict(theta_v=theta_v, exner=exner) @pytest.fixture - def input_data(self, grid): + def input_data(self, grid, uses_icon_grid_with_otf): + if uses_icon_grid_with_otf: + pytest.skip("Execution domain needs to be restricted or boundary taken into account in stencil.") + kh_smag_e = random_field(grid, EdgeDim, KDim) inv_dual_edge_length = random_field(grid, EdgeDim) theta_v_in = random_field(grid, CellDim, KDim) diff --git a/model/atmosphere/diffusion/tests/diffusion_stencil_tests/test_apply_diffusion_to_vn.py b/model/atmosphere/diffusion/tests/diffusion_stencil_tests/test_apply_diffusion_to_vn.py index e121b428c8..0793ff4462 100644 --- a/model/atmosphere/diffusion/tests/diffusion_stencil_tests/test_apply_diffusion_to_vn.py +++ b/model/atmosphere/diffusion/tests/diffusion_stencil_tests/test_apply_diffusion_to_vn.py @@ -13,13 +13,12 @@ import numpy as np import pytest -from gt4py.next.ffront.fbuiltins import int32 +from gt4py.next.ffront.fbuiltins import int32 from icon4py.model.atmosphere.diffusion.stencils.apply_diffusion_to_vn import apply_diffusion_to_vn from icon4py.model.atmosphere.dycore.state_utils.utils import indices_field from icon4py.model.common.dimension import E2C2VDim, ECVDim, EdgeDim, KDim, VertexDim -from icon4py.model.common.test_utils.helpers import StencilTest, as_1D_sparse_field, random_field - +from icon4py.model.common.test_utils.helpers import StencilTest, as_1D_sparse_field, random_field, uses_icon_grid_with_otf from .test_apply_nabla2_and_nabla4_global_to_vn import apply_nabla2_and_nabla4_global_to_vn_numpy from .test_apply_nabla2_and_nabla4_to_vn import apply_nabla2_and_nabla4_to_vn_numpy from .test_apply_nabla2_to_vn_in_lateral_boundary import ( @@ -98,7 +97,10 @@ def reference( return dict(vn=vn) @pytest.fixture - def input_data(self, grid): + def input_data(self, grid, uses_icon_grid_with_otf): + if uses_icon_grid_with_otf: + pytest.skip("Execution domain needs to be restricted or boundary taken into account in stencil.") + edge = indices_field(EdgeDim, grid, is_halfdim=False, dtype=int32) u_vert = random_field(grid, VertexDim, KDim) diff --git a/model/atmosphere/diffusion/tests/diffusion_stencil_tests/test_calculate_nabla2_for_z.py b/model/atmosphere/diffusion/tests/diffusion_stencil_tests/test_calculate_nabla2_for_z.py index 6f30ff385a..be13010923 100644 --- a/model/atmosphere/diffusion/tests/diffusion_stencil_tests/test_calculate_nabla2_for_z.py +++ b/model/atmosphere/diffusion/tests/diffusion_stencil_tests/test_calculate_nabla2_for_z.py @@ -13,14 +13,13 @@ import numpy as np import pytest -from gt4py.next.ffront.fbuiltins import int32 -from gt4py.next.program_processors.otf_compile_executor import OTFCompileExecutor +from gt4py.next.ffront.fbuiltins import int32 from icon4py.model.atmosphere.diffusion.stencils.calculate_nabla2_for_z import ( calculate_nabla2_for_z, ) from icon4py.model.common.dimension import CellDim, E2CDim, EdgeDim, KDim -from icon4py.model.common.test_utils.helpers import StencilTest, random_field +from icon4py.model.common.test_utils.helpers import StencilTest, random_field, uses_icon_grid_with_otf from icon4py.model.common.type_alias import vpfloat, wpfloat @@ -55,12 +54,10 @@ def reference( return dict(z_nabla2_e=z_nabla2_e) @pytest.fixture - def input_data(self, grid, backend): - if hasattr(backend, 'executor'): - if isinstance(backend.executor, OTFCompileExecutor): - pytest.skip( - "Execution domain needs to be restricted or boundary taken into account in stencil." - ) + def input_data(self, grid, uses_icon_grid_with_otf): + if uses_icon_grid_with_otf: + pytest.skip("Execution domain needs to be restricted or boundary taken into account in stencil.") + kh_smag_e = random_field(grid, EdgeDim, KDim, dtype=vpfloat) inv_dual_edge_length = random_field(grid, EdgeDim, dtype=wpfloat) theta_v = random_field(grid, CellDim, KDim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/dycore_stencil_tests/test_fused_velocity_advection_stencil_19_to_20.py b/model/atmosphere/dycore/tests/dycore_stencil_tests/test_fused_velocity_advection_stencil_19_to_20.py index eaf3571d2a..726741996b 100644 --- a/model/atmosphere/dycore/tests/dycore_stencil_tests/test_fused_velocity_advection_stencil_19_to_20.py +++ b/model/atmosphere/dycore/tests/dycore_stencil_tests/test_fused_velocity_advection_stencil_19_to_20.py @@ -34,6 +34,7 @@ random_field, random_mask, zero_field, + uses_icon_grid_with_otf ) from .test_mo_math_divrot_rot_vertex_ri_dsl import mo_math_divrot_rot_vertex_ri_dsl_numpy @@ -116,7 +117,10 @@ def reference( return dict(ddt_vn_apc=ddt_vn_apc) @pytest.fixture - def input_data(self, grid): + def input_data(self, grid, uses_icon_grid_with_otf): + if uses_icon_grid_with_otf: + pytest.skip("Execution domain needs to be restricted or boundary taken into account in stencil.") + z_kin_hor_e = random_field(grid, EdgeDim, KDim) coeff_gradekin = random_field(grid, EdgeDim, E2CDim) coeff_gradekin_new = as_1D_sparse_field(coeff_gradekin, ECDim) diff --git a/model/atmosphere/dycore/tests/dycore_stencil_tests/test_fused_velocity_advection_stencil_1_to_7.py b/model/atmosphere/dycore/tests/dycore_stencil_tests/test_fused_velocity_advection_stencil_1_to_7.py index 0b4f40aab7..7b19ecb791 100644 --- a/model/atmosphere/dycore/tests/dycore_stencil_tests/test_fused_velocity_advection_stencil_1_to_7.py +++ b/model/atmosphere/dycore/tests/dycore_stencil_tests/test_fused_velocity_advection_stencil_1_to_7.py @@ -20,7 +20,7 @@ ) from icon4py.model.atmosphere.dycore.state_utils.utils import indices_field from icon4py.model.common.dimension import CellDim, E2C2EDim, EdgeDim, KDim, V2CDim, VertexDim -from icon4py.model.common.test_utils.helpers import StencilTest, random_field, zero_field +from icon4py.model.common.test_utils.helpers import StencilTest, random_field, zero_field, uses_icon_grid_with_otf from .test_mo_icon_interpolation_scalar_cells2verts_scalar_ri_dsl import ( mo_icon_interpolation_scalar_cells2verts_scalar_ri_dsl_numpy, @@ -192,7 +192,10 @@ def reference( ) @pytest.fixture - def input_data(self, grid): + def input_data(self, grid, uses_icon_grid_with_otf): + if uses_icon_grid_with_otf: + pytest.skip("Execution domain needs to be restricted or boundary taken into account in stencil.") + c_intp = random_field(grid, VertexDim, V2CDim) vn = random_field(grid, EdgeDim, KDim) rbf_vec_coeff_e = random_field(grid, EdgeDim, E2C2EDim) diff --git a/model/common/src/icon4py/model/common/test_utils/helpers.py b/model/common/src/icon4py/model/common/test_utils/helpers.py index 883a0aa75e..3beecd6038 100644 --- a/model/common/src/icon4py/model/common/test_utils/helpers.py +++ b/model/common/src/icon4py/model/common/test_utils/helpers.py @@ -21,9 +21,10 @@ from gt4py.next import common as gt_common from gt4py.next import constructors from gt4py.next.ffront.decorator import Program +from gt4py.next.program_processors.otf_compile_executor import OTFCompileExecutor from ..grid.base import BaseGrid - +from ..grid.icon import IconGrid try: import pytest_benchmark @@ -219,3 +220,14 @@ def __init_subclass__(cls, **kwargs): super().__init_subclass__(**kwargs) setattr(cls, f"test_{cls.__name__}", _test_validation) setattr(cls, f"test_{cls.__name__}_benchmark", _test_execution_benchmark) + + +@pytest.fixture +def uses_icon_grid_with_otf(backend, grid): + """Checks whether we are using a compiled backend with the icon_grid. + Is needed to skip certain stencils where the execution domain needs to be restricted or boundary taken into account. + """ + if hasattr(backend, 'executor') and isinstance(grid, IconGrid): + if isinstance(backend.executor, OTFCompileExecutor): + return True + return False From f1fb468fee222e4d8d129618a87fc09e3610f50c Mon Sep 17 00:00:00 2001 From: samkellerhals Date: Thu, 14 Dec 2023 17:54:14 +0100 Subject: [PATCH 09/17] precommit fixes --- model/atmosphere/diffusion/tests/conftest.py | 1 + .../test_apply_diffusion_to_theta_and_exner.py | 5 +++-- .../test_apply_diffusion_to_vn.py | 9 ++++++--- .../test_calculate_nabla2_for_z.py | 8 +++++--- model/atmosphere/dycore/tests/conftest.py | 1 + .../test_fused_velocity_advection_stencil_19_to_20.py | 5 +++-- .../test_fused_velocity_advection_stencil_1_to_7.py | 6 ++++-- model/common/src/icon4py/model/common/grid/icon.py | 1 - .../icon4py/model/common/test_utils/datatest_utils.py | 2 +- .../src/icon4py/model/common/test_utils/helpers.py | 6 ++++-- 10 files changed, 28 insertions(+), 16 deletions(-) diff --git a/model/atmosphere/diffusion/tests/conftest.py b/model/atmosphere/diffusion/tests/conftest.py index 117381f373..73877456fa 100644 --- a/model/atmosphere/diffusion/tests/conftest.py +++ b/model/atmosphere/diffusion/tests/conftest.py @@ -16,4 +16,5 @@ ) from icon4py.model.common.test_utils.helpers import ( # noqa : F401 # fixtures from test_utils backend, + uses_icon_grid_with_otf, ) diff --git a/model/atmosphere/diffusion/tests/diffusion_stencil_tests/test_apply_diffusion_to_theta_and_exner.py b/model/atmosphere/diffusion/tests/diffusion_stencil_tests/test_apply_diffusion_to_theta_and_exner.py index a11faf0be6..228af398a5 100644 --- a/model/atmosphere/diffusion/tests/diffusion_stencil_tests/test_apply_diffusion_to_theta_and_exner.py +++ b/model/atmosphere/diffusion/tests/diffusion_stencil_tests/test_apply_diffusion_to_theta_and_exner.py @@ -26,7 +26,6 @@ random_mask, unflatten_first_two_dims, zero_field, - uses_icon_grid_with_otf ) from .test_calculate_nabla2_for_z import calculate_nabla2_for_z_numpy @@ -84,7 +83,9 @@ def reference( @pytest.fixture def input_data(self, grid, uses_icon_grid_with_otf): if uses_icon_grid_with_otf: - pytest.skip("Execution domain needs to be restricted or boundary taken into account in stencil.") + pytest.skip( + "Execution domain needs to be restricted or boundary taken into account in stencil." + ) kh_smag_e = random_field(grid, EdgeDim, KDim) inv_dual_edge_length = random_field(grid, EdgeDim) diff --git a/model/atmosphere/diffusion/tests/diffusion_stencil_tests/test_apply_diffusion_to_vn.py b/model/atmosphere/diffusion/tests/diffusion_stencil_tests/test_apply_diffusion_to_vn.py index 0793ff4462..31784bfa6a 100644 --- a/model/atmosphere/diffusion/tests/diffusion_stencil_tests/test_apply_diffusion_to_vn.py +++ b/model/atmosphere/diffusion/tests/diffusion_stencil_tests/test_apply_diffusion_to_vn.py @@ -13,12 +13,13 @@ import numpy as np import pytest - from gt4py.next.ffront.fbuiltins import int32 + from icon4py.model.atmosphere.diffusion.stencils.apply_diffusion_to_vn import apply_diffusion_to_vn from icon4py.model.atmosphere.dycore.state_utils.utils import indices_field from icon4py.model.common.dimension import E2C2VDim, ECVDim, EdgeDim, KDim, VertexDim -from icon4py.model.common.test_utils.helpers import StencilTest, as_1D_sparse_field, random_field, uses_icon_grid_with_otf +from icon4py.model.common.test_utils.helpers import StencilTest, as_1D_sparse_field, random_field + from .test_apply_nabla2_and_nabla4_global_to_vn import apply_nabla2_and_nabla4_global_to_vn_numpy from .test_apply_nabla2_and_nabla4_to_vn import apply_nabla2_and_nabla4_to_vn_numpy from .test_apply_nabla2_to_vn_in_lateral_boundary import ( @@ -99,7 +100,9 @@ def reference( @pytest.fixture def input_data(self, grid, uses_icon_grid_with_otf): if uses_icon_grid_with_otf: - pytest.skip("Execution domain needs to be restricted or boundary taken into account in stencil.") + pytest.skip( + "Execution domain needs to be restricted or boundary taken into account in stencil." + ) edge = indices_field(EdgeDim, grid, is_halfdim=False, dtype=int32) diff --git a/model/atmosphere/diffusion/tests/diffusion_stencil_tests/test_calculate_nabla2_for_z.py b/model/atmosphere/diffusion/tests/diffusion_stencil_tests/test_calculate_nabla2_for_z.py index be13010923..d166bac1bc 100644 --- a/model/atmosphere/diffusion/tests/diffusion_stencil_tests/test_calculate_nabla2_for_z.py +++ b/model/atmosphere/diffusion/tests/diffusion_stencil_tests/test_calculate_nabla2_for_z.py @@ -13,13 +13,13 @@ import numpy as np import pytest - from gt4py.next.ffront.fbuiltins import int32 + from icon4py.model.atmosphere.diffusion.stencils.calculate_nabla2_for_z import ( calculate_nabla2_for_z, ) from icon4py.model.common.dimension import CellDim, E2CDim, EdgeDim, KDim -from icon4py.model.common.test_utils.helpers import StencilTest, random_field, uses_icon_grid_with_otf +from icon4py.model.common.test_utils.helpers import StencilTest, random_field from icon4py.model.common.type_alias import vpfloat, wpfloat @@ -56,7 +56,9 @@ def reference( @pytest.fixture def input_data(self, grid, uses_icon_grid_with_otf): if uses_icon_grid_with_otf: - pytest.skip("Execution domain needs to be restricted or boundary taken into account in stencil.") + pytest.skip( + "Execution domain needs to be restricted or boundary taken into account in stencil." + ) kh_smag_e = random_field(grid, EdgeDim, KDim, dtype=vpfloat) inv_dual_edge_length = random_field(grid, EdgeDim, dtype=wpfloat) diff --git a/model/atmosphere/dycore/tests/conftest.py b/model/atmosphere/dycore/tests/conftest.py index 117381f373..73877456fa 100644 --- a/model/atmosphere/dycore/tests/conftest.py +++ b/model/atmosphere/dycore/tests/conftest.py @@ -16,4 +16,5 @@ ) from icon4py.model.common.test_utils.helpers import ( # noqa : F401 # fixtures from test_utils backend, + uses_icon_grid_with_otf, ) diff --git a/model/atmosphere/dycore/tests/dycore_stencil_tests/test_fused_velocity_advection_stencil_19_to_20.py b/model/atmosphere/dycore/tests/dycore_stencil_tests/test_fused_velocity_advection_stencil_19_to_20.py index 726741996b..23955d7fce 100644 --- a/model/atmosphere/dycore/tests/dycore_stencil_tests/test_fused_velocity_advection_stencil_19_to_20.py +++ b/model/atmosphere/dycore/tests/dycore_stencil_tests/test_fused_velocity_advection_stencil_19_to_20.py @@ -34,7 +34,6 @@ random_field, random_mask, zero_field, - uses_icon_grid_with_otf ) from .test_mo_math_divrot_rot_vertex_ri_dsl import mo_math_divrot_rot_vertex_ri_dsl_numpy @@ -119,7 +118,9 @@ def reference( @pytest.fixture def input_data(self, grid, uses_icon_grid_with_otf): if uses_icon_grid_with_otf: - pytest.skip("Execution domain needs to be restricted or boundary taken into account in stencil.") + pytest.skip( + "Execution domain needs to be restricted or boundary taken into account in stencil." + ) z_kin_hor_e = random_field(grid, EdgeDim, KDim) coeff_gradekin = random_field(grid, EdgeDim, E2CDim) diff --git a/model/atmosphere/dycore/tests/dycore_stencil_tests/test_fused_velocity_advection_stencil_1_to_7.py b/model/atmosphere/dycore/tests/dycore_stencil_tests/test_fused_velocity_advection_stencil_1_to_7.py index 7b19ecb791..46c76a37c7 100644 --- a/model/atmosphere/dycore/tests/dycore_stencil_tests/test_fused_velocity_advection_stencil_1_to_7.py +++ b/model/atmosphere/dycore/tests/dycore_stencil_tests/test_fused_velocity_advection_stencil_1_to_7.py @@ -20,7 +20,7 @@ ) from icon4py.model.atmosphere.dycore.state_utils.utils import indices_field from icon4py.model.common.dimension import CellDim, E2C2EDim, EdgeDim, KDim, V2CDim, VertexDim -from icon4py.model.common.test_utils.helpers import StencilTest, random_field, zero_field, uses_icon_grid_with_otf +from icon4py.model.common.test_utils.helpers import StencilTest, random_field, zero_field from .test_mo_icon_interpolation_scalar_cells2verts_scalar_ri_dsl import ( mo_icon_interpolation_scalar_cells2verts_scalar_ri_dsl_numpy, @@ -194,7 +194,9 @@ def reference( @pytest.fixture def input_data(self, grid, uses_icon_grid_with_otf): if uses_icon_grid_with_otf: - pytest.skip("Execution domain needs to be restricted or boundary taken into account in stencil.") + pytest.skip( + "Execution domain needs to be restricted or boundary taken into account in stencil." + ) c_intp = random_field(grid, VertexDim, V2CDim) vn = random_field(grid, EdgeDim, KDim) diff --git a/model/common/src/icon4py/model/common/grid/icon.py b/model/common/src/icon4py/model/common/grid/icon.py index e4b59cce4c..5674c0afe4 100644 --- a/model/common/src/icon4py/model/common/grid/icon.py +++ b/model/common/src/icon4py/model/common/grid/icon.py @@ -19,7 +19,6 @@ C2E2CDim, C2E2CODim, C2EDim, - C2VDim, CECDim, CEDim, CellDim, diff --git a/model/common/src/icon4py/model/common/test_utils/datatest_utils.py b/model/common/src/icon4py/model/common/test_utils/datatest_utils.py index 3e1ded7c96..6709033ae6 100644 --- a/model/common/src/icon4py/model/common/test_utils/datatest_utils.py +++ b/model/common/src/icon4py/model/common/test_utils/datatest_utils.py @@ -20,7 +20,7 @@ def get_serialized_data_path() -> Path: test_utils_path = Path(__file__).parent model_path = test_utils_path.parent.parent common_path = model_path.parent.parent.parent.parent - env_base_path = os.getenv('SERIALIZED_DATA_PATH') + env_base_path = os.getenv("SERIALIZED_DATA_PATH") if env_base_path: return Path(env_base_path) diff --git a/model/common/src/icon4py/model/common/test_utils/helpers.py b/model/common/src/icon4py/model/common/test_utils/helpers.py index 3beecd6038..73ad29f2cd 100644 --- a/model/common/src/icon4py/model/common/test_utils/helpers.py +++ b/model/common/src/icon4py/model/common/test_utils/helpers.py @@ -26,6 +26,7 @@ from ..grid.base import BaseGrid from ..grid.icon import IconGrid + try: import pytest_benchmark except ModuleNotFoundError: @@ -224,10 +225,11 @@ def __init_subclass__(cls, **kwargs): @pytest.fixture def uses_icon_grid_with_otf(backend, grid): - """Checks whether we are using a compiled backend with the icon_grid. + """Check whether we are using a compiled backend with the icon_grid. + Is needed to skip certain stencils where the execution domain needs to be restricted or boundary taken into account. """ - if hasattr(backend, 'executor') and isinstance(grid, IconGrid): + if hasattr(backend, "executor") and isinstance(grid, IconGrid): if isinstance(backend.executor, OTFCompileExecutor): return True return False From 38adcce807e5c4254deeafde8b9f1b59f1181ab1 Mon Sep 17 00:00:00 2001 From: samkellerhals Date: Thu, 14 Dec 2023 18:47:46 +0100 Subject: [PATCH 10/17] Remove C2VDim connectivity --- model/common/src/icon4py/model/common/grid/icon.py | 1 - 1 file changed, 1 deletion(-) diff --git a/model/common/src/icon4py/model/common/grid/icon.py b/model/common/src/icon4py/model/common/grid/icon.py index 5674c0afe4..4b37a71a9c 100644 --- a/model/common/src/icon4py/model/common/grid/icon.py +++ b/model/common/src/icon4py/model/common/grid/icon.py @@ -55,7 +55,6 @@ def __init__(self): "E2C2V": (self._get_offset_provider, E2C2VDim, EdgeDim, VertexDim), "V2E": (self._get_offset_provider, V2EDim, VertexDim, EdgeDim), "V2C": (self._get_offset_provider, V2CDim, VertexDim, CellDim), - # "C2V": (self._get_offset_provider, C2VDim, CellDim, VertexDim), "E2ECV": (self._get_offset_provider_for_sparse_fields, E2C2VDim, EdgeDim, ECVDim), "C2CEC": (self._get_offset_provider_for_sparse_fields, C2E2CDim, CellDim, CECDim), "C2CE": (self._get_offset_provider_for_sparse_fields, C2EDim, CellDim, CEDim), From 3520d13908ca81a3999bd3c466c5a26be69771ab Mon Sep 17 00:00:00 2001 From: samkellerhals Date: Wed, 3 Jan 2024 11:59:37 +0100 Subject: [PATCH 11/17] Add run_benchmarks stage and update serialized data references --- .gitignore | 2 +- ci/cscs.yml | 16 ++++++++-------- .../model/common/test_utils/datatest_utils.py | 4 +++- model/driver/README.md | 4 ++-- .../src/icon4py/model/driver/dycore_driver.py | 2 +- model/tox.ini | 8 +++++++- 6 files changed, 22 insertions(+), 14 deletions(-) diff --git a/.gitignore b/.gitignore index e7620d5cf3..f23d20246a 100644 --- a/.gitignore +++ b/.gitignore @@ -4,7 +4,7 @@ _local _external_src _reports tmp -testdata +serialized_data simple_mesh*.nc ### GT4Py #### diff --git a/ci/cscs.yml b/ci/cscs.yml index 5095556bed..6bf6bee0ff 100644 --- a/ci/cscs.yml +++ b/ci/cscs.yml @@ -59,7 +59,7 @@ test_model_job_dace_cpu_simple_grid: stage: test script: - pip install dace==$DACE_VERSION - - tox -r -e stencil_tests -c model/ --verbose -- --benchmark-skip -n auto --backend=dace_cpu + - tox -r -e run_stencil_tests -c model/ --verbose -- --benchmark-skip -n auto --backend=dace_cpu only: - main allow_failure: true @@ -69,7 +69,7 @@ test_model_job_dace_gpu_simple_grid: stage: test script: - pip install dace==$DACE_VERSION - - tox -r -e stencil_tests -c model/ --verbose -- --benchmark-skip -n auto --backend=dace_gpu + - tox -r -e run_stencil_tests -c model/ --verbose -- --benchmark-skip -n auto --backend=dace_gpu only: - main allow_failure: true @@ -78,13 +78,13 @@ test_model_job_gtfn_cpu_simple_grid: extends: .test_template stage: test script: - - tox -r -e stencil_tests -c model/ --verbose -- --benchmark-skip -n auto --backend=gtfn_cpu + - tox -r -e run_stencil_tests -c model/ --verbose -- --benchmark-skip -n auto --backend=gtfn_cpu test_model_job_gtfn_gpu_simple_grid: extends: .test_template stage: test script: - - tox -r -e stencil_tests -c model/ --verbose -- --benchmark-skip -n auto --backend=gtfn_gpu + - tox -r -e run_stencil_tests -c model/ --verbose -- --benchmark-skip -n auto --backend=gtfn_gpu test_tools_job: extends: .test_template @@ -97,7 +97,7 @@ benchmark_model_dace_cpu_icon_grid: stage: benchmark script: - pip install dace==$DACE_VERSION - - tox -r -e stencil_tests -c model/ --verbose -- --benchmark-only --backend=dace_cpu --grid=icon_grid + - tox -r -e run_benchmarks -c model/ -- --benchmark-only --backend=dace_cpu --grid=icon_grid only: - main when: manual @@ -107,7 +107,7 @@ benchmark_model_dace_gpu_icon_grid: stage: benchmark script: - pip install dace==$DACE_VERSION - - tox -r -e stencil_tests -c model/ --verbose -- --benchmark-only --backend=dace_gpu --grid=icon_grid + - tox -r -e run_benchmarks -c model/ -- --benchmark-only --backend=dace_gpu --grid=icon_grid only: - main when: manual @@ -116,10 +116,10 @@ benchmark_model_gtfn_cpu_icon_grid: extends: .test_template stage: benchmark script: - - tox -r -e stencil_tests -c model/ --verbose -- --benchmark-only --backend=gtfn_cpu --grid=icon_grid + - tox -r -e run_benchmarks -c model/ -- --benchmark-only --backend=gtfn_cpu --grid=icon_grid benchmark_model_gtfn_gpu_icon_grid: extends: .test_template stage: benchmark script: - - tox -r -e stencil_tests -c model/ --verbose -- --benchmark-only --backend=gtfn_gpu --grid=icon_grid + - tox -r -e run_benchmarks -c model/ -- --benchmark-only --backend=gtfn_gpu --grid=icon_grid diff --git a/model/common/src/icon4py/model/common/test_utils/datatest_utils.py b/model/common/src/icon4py/model/common/test_utils/datatest_utils.py index 6709033ae6..f7efee9b23 100644 --- a/model/common/src/icon4py/model/common/test_utils/datatest_utils.py +++ b/model/common/src/icon4py/model/common/test_utils/datatest_utils.py @@ -15,6 +15,8 @@ from icon4py.model.common.decomposition.definitions import get_processor_properties +DEFAULT_SERIALIZED_DATA_FOLDER = "serialized_data" + def get_serialized_data_path() -> Path: test_utils_path = Path(__file__).parent @@ -25,7 +27,7 @@ def get_serialized_data_path() -> Path: if env_base_path: return Path(env_base_path) else: - return common_path.parent.joinpath("serialized_data") + return common_path.parent.joinpath(DEFAULT_SERIALIZED_DATA_FOLDER) SERIALIZED_DATA_PATH = get_serialized_data_path() diff --git a/model/driver/README.md b/model/driver/README.md index 8142f9b749..77068bc1c3 100644 --- a/model/driver/README.md +++ b/model/driver/README.md @@ -18,7 +18,7 @@ See the general instructions in the [README.md](../../README.md) in the base fol ```bash export ICON4PY_ROOT= -dycore_driver $ICON4PY_ROOT/testdata/ser_icondata/mpitask1/mch_ch_r04b09_dsl/ser_data --run_path=$ICON4PY_ROOT/output +dycore_driver $ICON4PY_ROOT/serialized_data/ser_icondata/mpitask1/mch_ch_r04b09_dsl/ser_data --run_path=$ICON4PY_ROOT/output ``` The driver code runs in parallel, in order to do this you need to install the optional communication libraries with: @@ -32,7 +32,7 @@ pip install -r requirements-dev-opt.txt then run ```bash -mpirun -np 2 dycore_driver $ICON4PY_ROOT/testdata/ser_icondata/mpitask2/mch_ch_r04b09_dsl/ser_data --mpi=True --run_path=$ICON4PY_ROOT/output +mpirun -np 2 dycore_driver $ICON4PY_ROOT/serialized_data/ser_icondata/mpitask2/mch_ch_r04b09_dsl/ser_data --mpi=True --run_path=$ICON4PY_ROOT/output ``` #### Remarks diff --git a/model/driver/src/icon4py/model/driver/dycore_driver.py b/model/driver/src/icon4py/model/driver/dycore_driver.py index 33ef96cdbc..2efe159e3c 100644 --- a/model/driver/src/icon4py/model/driver/dycore_driver.py +++ b/model/driver/src/icon4py/model/driver/dycore_driver.py @@ -392,7 +392,7 @@ def main(input_path, run_path, mpi): """ Run the driver. - usage: python dycore_driver.py abs_path_to_icon4py/testdata/ser_icondata/mpitask1/mch_ch_r04b09_dsl/ser_data + usage: python dycore_driver.py abs_path_to_icon4py/serialized_data/ser_icondata/mpitask1/mch_ch_r04b09_dsl/ser_data steps: 1. initialize model from serialized data: diff --git a/model/tox.ini b/model/tox.ini index 24a05c24c4..5b55d882c0 100644 --- a/model/tox.ini +++ b/model/tox.ini @@ -26,11 +26,17 @@ allowlist_externals = /bin/bash rm -[testenv:stencil_tests] +[testenv:run_stencil_tests] commands = pytest -v -s -m "not slow_tests" --cov --cov-append atmosphere/diffusion/tests/diffusion_stencil_tests {posargs} pytest -v -s -m "not slow_tests" --cov --cov-append atmosphere/dycore/tests/dycore_stencil_tests {posargs} +[testenv:run_benchmarks] +commands = + pytest -s -m "not slow_tests" atmosphere/diffusion/tests/diffusion_stencil_tests {posargs} + pytest -s -m "not slow_tests" atmosphere/dycore/tests/dycore_stencil_tests {posargs} + + [testenv:dev] setenv = PIP_SRC = _external_src From 1584e2c8f391bf030be749999076d9fa6dedb648 Mon Sep 17 00:00:00 2001 From: samkellerhals Date: Wed, 3 Jan 2024 12:28:16 +0100 Subject: [PATCH 12/17] Use default benchmark fixture --- .../src/icon4py/model/common/test_utils/helpers.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/model/common/src/icon4py/model/common/test_utils/helpers.py b/model/common/src/icon4py/model/common/test_utils/helpers.py index 73ad29f2cd..db6e6af5ce 100644 --- a/model/common/src/icon4py/model/common/test_utils/helpers.py +++ b/model/common/src/icon4py/model/common/test_utils/helpers.py @@ -178,14 +178,13 @@ def _test_execution_benchmark(self, pytestconfig, grid, backend, input_data, ben pytest.skip("Test skipped due to 'benchmark-disable' option.") else: input_data = allocate_data(backend, input_data) - benchmark.pedantic( + benchmark( self.PROGRAM.with_backend(backend), - args=(), - kwargs={**input_data, "offset_provider": grid.get_all_offset_providers()}, - iterations=1, - rounds=1, + **input_data, + offset_provider=grid.get_all_offset_providers() ) + else: def _test_execution_benchmark(self, pytestconfig): From f576f48412bb162e65b0a4ced07fb6c8f5e9b176 Mon Sep 17 00:00:00 2001 From: samkellerhals Date: Wed, 3 Jan 2024 13:19:40 +0100 Subject: [PATCH 13/17] Add root precommit file --- .github/workflows/icon4py-qa.yml | 19 +------- .pre-commit-config.yaml | 44 +++++++++++++++++++ .../model/common/test_utils/helpers.py | 3 +- 3 files changed, 47 insertions(+), 19 deletions(-) create mode 100644 .pre-commit-config.yaml diff --git a/.github/workflows/icon4py-qa.yml b/.github/workflows/icon4py-qa.yml index 4e97149ca8..e40d32042b 100644 --- a/.github/workflows/icon4py-qa.yml +++ b/.github/workflows/icon4py-qa.yml @@ -35,21 +35,6 @@ jobs: python -m pip install --upgrade pip setuptools wheel python -m pip install -r ./requirements-dev.txt python -m pip list - - name: Run checks in icon4pytools + - name: Run checks run: | - pre-commit run --config tools/.pre-commit-config.yaml --all-files - - name: Run checks icon4py-model-common - run: | - pre-commit run --config model/common/.pre-commit-config.yaml --all-files - - name: Run checks icon4py-model-driver - run: | - pre-commit run --config model/driver/.pre-commit-config.yaml --all-files - - name: Run checks icon4py-model-atmosphere-dycore - run: | - pre-commit run --config model/atmosphere/dycore/.pre-commit-config.yaml --all-files - - name: Run checks icon4py-model-atmosphere-diffusion - run: | - pre-commit run --config model/atmosphere/diffusion/.pre-commit-config.yaml --all-files - - name: Run checks icon4py-model-atmosphere-advection - run: | - pre-commit run --config model/atmosphere/advection/.pre-commit-config.yaml --all-files + pre-commit run diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000000..44d7d4d544 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,44 @@ +repos: + - repo: local + hooks: + - id: run-common-precommit + name: Run Model Common Pre-commit + entry: pre-commit run --config model/common/.pre-commit-config.yaml --all-files + language: system + pass_filenames: false + always_run: true + + - id: run-driver-precommit + name: Run Model Driver Pre-commit + entry: pre-commit run --config model/driver/.pre-commit-config.yaml --all-files + language: system + pass_filenames: false + always_run: true + + - id: run-atmosphere-advection-precommit + name: Run Model Atmosphere Advection Pre-commit + entry: pre-commit run --config model/atmosphere/advection/.pre-commit-config.yaml --all-files + language: system + pass_filenames: false + always_run: true + + - id: run-atmosphere-diffusion-precommit + name: Run Model Atmosphere Diffusion Pre-commit + entry: pre-commit run --config model/atmosphere/diffusion/.pre-commit-config.yaml --all-files + language: system + pass_filenames: false + always_run: true + + - id: run-atmosphere-dycore-precommit + name: Run Model Atmosphere Dycore Pre-commit + entry: pre-commit run --config model/atmosphere/dycore/.pre-commit-config.yaml --all-files + language: system + pass_filenames: false + always_run: true + + - id: run-tools-precommit + name: Run Tools Pre-commit + entry: pre-commit run --config tools/.pre-commit-config.yaml --all-files + language: system + pass_filenames: false + always_run: true diff --git a/model/common/src/icon4py/model/common/test_utils/helpers.py b/model/common/src/icon4py/model/common/test_utils/helpers.py index db6e6af5ce..504fefa1d5 100644 --- a/model/common/src/icon4py/model/common/test_utils/helpers.py +++ b/model/common/src/icon4py/model/common/test_utils/helpers.py @@ -181,10 +181,9 @@ def _test_execution_benchmark(self, pytestconfig, grid, backend, input_data, ben benchmark( self.PROGRAM.with_backend(backend), **input_data, - offset_provider=grid.get_all_offset_providers() + offset_provider=grid.get_all_offset_providers(), ) - else: def _test_execution_benchmark(self, pytestconfig): From 43fa8235710f745964142b3d8895395123c9a836 Mon Sep 17 00:00:00 2001 From: samkellerhals Date: Wed, 3 Jan 2024 13:36:24 +0100 Subject: [PATCH 14/17] Update variable name --- .../src/icon4py/model/common/test_utils/datatest_fixtures.py | 4 ++-- .../src/icon4py/model/common/test_utils/datatest_utils.py | 2 +- .../common/src/icon4py/model/common/test_utils/grid_utils.py | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/model/common/src/icon4py/model/common/test_utils/datatest_fixtures.py b/model/common/src/icon4py/model/common/test_utils/datatest_fixtures.py index e19592aa86..f449e600b6 100644 --- a/model/common/src/icon4py/model/common/test_utils/datatest_fixtures.py +++ b/model/common/src/icon4py/model/common/test_utils/datatest_fixtures.py @@ -20,7 +20,7 @@ DATA_URIS_APE, GLOBAL_EXPERIMENT, REGIONAL_EXPERIMENT, - SERIALIZED_DATA_BASEPATH, + SERIALIZED_DATA_PATH, create_icon_serial_data_provider, get_datapath_for_experiment, get_processor_properties_for_run, @@ -40,7 +40,7 @@ def processor_props(request): @pytest.fixture(scope="session") def ranked_data_path(processor_props): - return get_ranked_data_path(SERIALIZED_DATA_BASEPATH, processor_props) + return get_ranked_data_path(SERIALIZED_DATA_PATH, processor_props) @pytest.fixture diff --git a/model/common/src/icon4py/model/common/test_utils/datatest_utils.py b/model/common/src/icon4py/model/common/test_utils/datatest_utils.py index fb9c508f0a..400c787145 100644 --- a/model/common/src/icon4py/model/common/test_utils/datatest_utils.py +++ b/model/common/src/icon4py/model/common/test_utils/datatest_utils.py @@ -32,7 +32,7 @@ def get_serialized_data_root_path() -> Path: SERIALIZED_DATA_ROOT = get_serialized_data_root_path() -SERIALIZED_DATA_BASEPATH = SERIALIZED_DATA_ROOT.joinpath("ser_icondata") +SERIALIZED_DATA_PATH = SERIALIZED_DATA_ROOT.joinpath("ser_icondata") # TODO: a run that contains all the fields needed for dycore, diffusion, interpolation fields needs to be consolidated DATA_URIS = { diff --git a/model/common/src/icon4py/model/common/test_utils/grid_utils.py b/model/common/src/icon4py/model/common/test_utils/grid_utils.py index 838a815b88..4214d58cae 100644 --- a/model/common/src/icon4py/model/common/test_utils/grid_utils.py +++ b/model/common/src/icon4py/model/common/test_utils/grid_utils.py @@ -15,7 +15,7 @@ from icon4py.model.common.decomposition.definitions import SingleNodeRun from icon4py.model.common.test_utils.datatest_utils import ( - SERIALIZED_DATA_BASEPATH, + SERIALIZED_DATA_PATH, create_icon_serial_data_provider, get_datapath_for_experiment, get_processor_properties_for_run, @@ -25,7 +25,7 @@ def get_icon_grid(): processor_properties = get_processor_properties_for_run(SingleNodeRun()) - ranked_path = get_ranked_data_path(SERIALIZED_DATA_BASEPATH, processor_properties) + ranked_path = get_ranked_data_path(SERIALIZED_DATA_PATH, processor_properties) data_path = get_datapath_for_experiment(ranked_path) icon_data_provider = create_icon_serial_data_provider(data_path, processor_properties) grid_savepoint = icon_data_provider.from_savepoint_grid() From 3b9904f239bca2e45f363159b5ba03a1c4d010c2 Mon Sep 17 00:00:00 2001 From: samkellerhals Date: Wed, 3 Jan 2024 15:00:06 +0100 Subject: [PATCH 15/17] Fix unused kwarg --- model/common/src/icon4py/model/common/test_utils/grid_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/model/common/src/icon4py/model/common/test_utils/grid_utils.py b/model/common/src/icon4py/model/common/test_utils/grid_utils.py index 4214d58cae..bc3b742a5e 100644 --- a/model/common/src/icon4py/model/common/test_utils/grid_utils.py +++ b/model/common/src/icon4py/model/common/test_utils/grid_utils.py @@ -29,7 +29,7 @@ def get_icon_grid(): data_path = get_datapath_for_experiment(ranked_path) icon_data_provider = create_icon_serial_data_provider(data_path, processor_properties) grid_savepoint = icon_data_provider.from_savepoint_grid() - return grid_savepoint.construct_icon_grid(limited_area=True) + return grid_savepoint.construct_icon_grid() @pytest.fixture From a22537dc66f3ac3619d3903e6491e898e6f89798 Mon Sep 17 00:00:00 2001 From: samkellerhals Date: Wed, 3 Jan 2024 15:17:47 +0100 Subject: [PATCH 16/17] Fixes --- .gitignore | 2 +- ci/cscs.yml | 20 +++++++++---------- .../model/common/test_utils/datatest_utils.py | 12 +++++------ model/common/tests/grid_tests/conftest.py | 4 ++-- model/driver/README.md | 4 ++-- .../src/icon4py/model/driver/dycore_driver.py | 2 +- model/tox.ini | 8 ++++---- 7 files changed, 26 insertions(+), 26 deletions(-) diff --git a/.gitignore b/.gitignore index f23d20246a..e7620d5cf3 100644 --- a/.gitignore +++ b/.gitignore @@ -4,7 +4,7 @@ _local _external_src _reports tmp -serialized_data +testdata simple_mesh*.nc ### GT4Py #### diff --git a/ci/cscs.yml b/ci/cscs.yml index 6bf6bee0ff..9a71720925 100644 --- a/ci/cscs.yml +++ b/ci/cscs.yml @@ -43,7 +43,7 @@ variables: NUM_PROCESSES: auto VIRTUALENV_SYSTEM_SITE_PACKAGES: 1 CSCS_NEEDED_DATA: icon4py - SERIALIZED_DATA_PATH: "/apps/daint/UES/jenkssl/ciext/icon4py" + TEST_DATA_PATH: "/apps/daint/UES/jenkssl/ciext/icon4py" build_job: extends: .build_template @@ -52,14 +52,14 @@ test_model_job_roundtrip_simple_grid: extends: .test_template stage: test script: - - tox -r -c model/ --verbose -- --benchmark-skip -n auto + - tox -r -e run_stencil_tests -c model/ --verbose test_model_job_dace_cpu_simple_grid: extends: .test_template stage: test script: - pip install dace==$DACE_VERSION - - tox -r -e run_stencil_tests -c model/ --verbose -- --benchmark-skip -n auto --backend=dace_cpu + - tox -r -e run_stencil_tests -c model/ --verbose -- --backend=dace_cpu only: - main allow_failure: true @@ -69,7 +69,7 @@ test_model_job_dace_gpu_simple_grid: stage: test script: - pip install dace==$DACE_VERSION - - tox -r -e run_stencil_tests -c model/ --verbose -- --benchmark-skip -n auto --backend=dace_gpu + - tox -r -e run_stencil_tests -c model/ --verbose -- --backend=dace_gpu only: - main allow_failure: true @@ -78,13 +78,13 @@ test_model_job_gtfn_cpu_simple_grid: extends: .test_template stage: test script: - - tox -r -e run_stencil_tests -c model/ --verbose -- --benchmark-skip -n auto --backend=gtfn_cpu + - tox -r -e run_stencil_tests -c model/ --verbose -- --backend=gtfn_cpu test_model_job_gtfn_gpu_simple_grid: extends: .test_template stage: test script: - - tox -r -e run_stencil_tests -c model/ --verbose -- --benchmark-skip -n auto --backend=gtfn_gpu + - tox -r -e run_stencil_tests -c model/ --verbose -- --backend=gtfn_gpu test_tools_job: extends: .test_template @@ -97,7 +97,7 @@ benchmark_model_dace_cpu_icon_grid: stage: benchmark script: - pip install dace==$DACE_VERSION - - tox -r -e run_benchmarks -c model/ -- --benchmark-only --backend=dace_cpu --grid=icon_grid + - tox -r -e run_benchmarks -c model/ -- --backend=dace_cpu --grid=icon_grid only: - main when: manual @@ -107,7 +107,7 @@ benchmark_model_dace_gpu_icon_grid: stage: benchmark script: - pip install dace==$DACE_VERSION - - tox -r -e run_benchmarks -c model/ -- --benchmark-only --backend=dace_gpu --grid=icon_grid + - tox -r -e run_benchmarks -c model/ -- --backend=dace_gpu --grid=icon_grid only: - main when: manual @@ -116,10 +116,10 @@ benchmark_model_gtfn_cpu_icon_grid: extends: .test_template stage: benchmark script: - - tox -r -e run_benchmarks -c model/ -- --benchmark-only --backend=gtfn_cpu --grid=icon_grid + - tox -r -e run_benchmarks -c model/ -- --backend=gtfn_cpu --grid=icon_grid benchmark_model_gtfn_gpu_icon_grid: extends: .test_template stage: benchmark script: - - tox -r -e run_benchmarks -c model/ -- --benchmark-only --backend=gtfn_gpu --grid=icon_grid + - tox -r -e run_benchmarks -c model/ -- --backend=gtfn_gpu --grid=icon_grid diff --git a/model/common/src/icon4py/model/common/test_utils/datatest_utils.py b/model/common/src/icon4py/model/common/test_utils/datatest_utils.py index 400c787145..97dff04209 100644 --- a/model/common/src/icon4py/model/common/test_utils/datatest_utils.py +++ b/model/common/src/icon4py/model/common/test_utils/datatest_utils.py @@ -16,23 +16,23 @@ from icon4py.model.common.decomposition.definitions import get_processor_properties -DEFAULT_SERIALIZED_DATA_FOLDER = "serialized_data" +DEFAULT_TEST_DATA_FOLDER = "testdata" -def get_serialized_data_root_path() -> Path: +def get_test_data_root_path() -> Path: test_utils_path = Path(__file__).parent model_path = test_utils_path.parent.parent common_path = model_path.parent.parent.parent.parent - env_base_path = os.getenv("SERIALIZED_DATA_PATH") + env_base_path = os.getenv("TEST_DATA_PATH") if env_base_path: return Path(env_base_path) else: - return common_path.parent.joinpath(DEFAULT_SERIALIZED_DATA_FOLDER) + return common_path.parent.joinpath(DEFAULT_TEST_DATA_FOLDER) -SERIALIZED_DATA_ROOT = get_serialized_data_root_path() -SERIALIZED_DATA_PATH = SERIALIZED_DATA_ROOT.joinpath("ser_icondata") +TEST_DATA_ROOT = get_test_data_root_path() +SERIALIZED_DATA_PATH = TEST_DATA_ROOT.joinpath("ser_icondata") # TODO: a run that contains all the fields needed for dycore, diffusion, interpolation fields needs to be consolidated DATA_URIS = { diff --git a/model/common/tests/grid_tests/conftest.py b/model/common/tests/grid_tests/conftest.py index 3383ed0b80..639e8e1990 100644 --- a/model/common/tests/grid_tests/conftest.py +++ b/model/common/tests/grid_tests/conftest.py @@ -26,10 +26,10 @@ processor_props, ranked_data_path, ) -from icon4py.model.common.test_utils.datatest_utils import SERIALIZED_DATA_PATH +from icon4py.model.common.test_utils.datatest_utils import TEST_DATA_ROOT -grids_path = SERIALIZED_DATA_PATH.joinpath("grids") +grids_path = TEST_DATA_ROOT.joinpath("grids") r04b09_dsl_grid_path = grids_path.joinpath("mch_ch_r04b09_dsl") r04b09_dsl_data_file = r04b09_dsl_grid_path.joinpath("mch_ch_r04b09_dsl_grids_v1.tar.gz").name r02b04_global_grid_path = grids_path.joinpath("r02b04_global") diff --git a/model/driver/README.md b/model/driver/README.md index 77068bc1c3..8142f9b749 100644 --- a/model/driver/README.md +++ b/model/driver/README.md @@ -18,7 +18,7 @@ See the general instructions in the [README.md](../../README.md) in the base fol ```bash export ICON4PY_ROOT= -dycore_driver $ICON4PY_ROOT/serialized_data/ser_icondata/mpitask1/mch_ch_r04b09_dsl/ser_data --run_path=$ICON4PY_ROOT/output +dycore_driver $ICON4PY_ROOT/testdata/ser_icondata/mpitask1/mch_ch_r04b09_dsl/ser_data --run_path=$ICON4PY_ROOT/output ``` The driver code runs in parallel, in order to do this you need to install the optional communication libraries with: @@ -32,7 +32,7 @@ pip install -r requirements-dev-opt.txt then run ```bash -mpirun -np 2 dycore_driver $ICON4PY_ROOT/serialized_data/ser_icondata/mpitask2/mch_ch_r04b09_dsl/ser_data --mpi=True --run_path=$ICON4PY_ROOT/output +mpirun -np 2 dycore_driver $ICON4PY_ROOT/testdata/ser_icondata/mpitask2/mch_ch_r04b09_dsl/ser_data --mpi=True --run_path=$ICON4PY_ROOT/output ``` #### Remarks diff --git a/model/driver/src/icon4py/model/driver/dycore_driver.py b/model/driver/src/icon4py/model/driver/dycore_driver.py index 284ff5cf7d..975598d6a0 100644 --- a/model/driver/src/icon4py/model/driver/dycore_driver.py +++ b/model/driver/src/icon4py/model/driver/dycore_driver.py @@ -383,7 +383,7 @@ def main(input_path, run_path, mpi): """ Run the driver. - usage: python dycore_driver.py abs_path_to_icon4py/serialized_data/ser_icondata/mpitask1/mch_ch_r04b09_dsl/ser_data + usage: python dycore_driver.py abs_path_to_icon4py/testdata/ser_icondata/mpitask1/mch_ch_r04b09_dsl/ser_data steps: 1. initialize model from serialized data: diff --git a/model/tox.ini b/model/tox.ini index 5b55d882c0..61496307b6 100644 --- a/model/tox.ini +++ b/model/tox.ini @@ -28,13 +28,13 @@ allowlist_externals = [testenv:run_stencil_tests] commands = - pytest -v -s -m "not slow_tests" --cov --cov-append atmosphere/diffusion/tests/diffusion_stencil_tests {posargs} - pytest -v -s -m "not slow_tests" --cov --cov-append atmosphere/dycore/tests/dycore_stencil_tests {posargs} + pytest -v -s -m "not slow_tests" --cov --cov-append atmosphere/diffusion/tests/diffusion_stencil_tests --benchmark-skip -n auto {posargs} + pytest -v -s -m "not slow_tests" --cov --cov-append atmosphere/dycore/tests/dycore_stencil_tests --benchmark-skip -n auto {posargs} [testenv:run_benchmarks] commands = - pytest -s -m "not slow_tests" atmosphere/diffusion/tests/diffusion_stencil_tests {posargs} - pytest -s -m "not slow_tests" atmosphere/dycore/tests/dycore_stencil_tests {posargs} + pytest -s -m "not slow_tests" atmosphere/diffusion/tests/diffusion_stencil_tests --benchmark-only {posargs} + pytest -s -m "not slow_tests" atmosphere/dycore/tests/dycore_stencil_tests --benchmark-only {posargs} [testenv:dev] From 3f688537d3030587e6243c8b317ffe22f2fabc23 Mon Sep 17 00:00:00 2001 From: samkellerhals Date: Wed, 3 Jan 2024 16:25:18 +0100 Subject: [PATCH 17/17] Pass TEST_DATA_PATH to tox --- model/tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/model/tox.ini b/model/tox.ini index 61496307b6..7aed4fb051 100644 --- a/model/tox.ini +++ b/model/tox.ini @@ -11,7 +11,7 @@ skipsdist = true passenv = PIP_USER PYTHONUSERBASE - SERIALIZED_DATA_PATH + TEST_DATA_PATH deps = -r {toxinidir}/requirements-dev.txt commands =