Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into rm_code_duplication
Browse files Browse the repository at this point in the history
  • Loading branch information
huppd committed Jan 8, 2024
2 parents 2d3a313 + c879a10 commit 008d1fc
Show file tree
Hide file tree
Showing 23 changed files with 218 additions and 175 deletions.
19 changes: 2 additions & 17 deletions .github/workflows/icon4py-qa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 5 additions & 1 deletion .github/workflows/mandatory_and_optional_test_reminder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,15 @@ jobs:
Please make sure you run these tests via comment before you merge!
* `cscs-ci run`
* `cscs-ci run default`
* `launch jenkins spack`
**Optional Tests**
To run benchmarks you can use:
* `cscs-ci run benchmark`
In case your change might affect downstream [icon-exclaim](https://github.com/C2SM/icon-exclaim), please consider running
* `launch jenkins icon`
Expand Down
44 changes: 44 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -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
45 changes: 45 additions & 0 deletions ci/base.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
include:
- remote: 'https://gitlab.com/cscs-ci/recipes/-/raw/master/templates/v2/.ci-ext.yml'

stages:
- build
- test
- benchmark

.py310: &py310
PYVERSION_PREFIX: py310
PYVERSION: 3.10.9

variables:
PYTHON_VERSION: "3.10"
PERSIST_IMAGE_NAME: $CSCS_REGISTRY_PATH/icon4py:$CI_COMMIT_SHORT_SHA

.build_template:
stage: build
extends: .container-builder
variables:
DOCKERFILE: ci/docker/Dockerfile.build
DOCKER_BUILD_ARGS: '["PYVERSION=$PYVERSION"]'
<<: *py310

.test_template:
extends: .container-runner-daint-gpu
timeout: 8h
image: $PERSIST_IMAGE_NAME
before_script:
- apt-get update
- python3 -m pip install --upgrade pip setuptools wheel
- cd /icon4py
- pyversion_no_dot="${PYTHON_VERSION//./}"
- pip install tox clang-format
- python -c "import cupy"
- ls ${TEST_DATA_PATH}
variables:
SLURM_JOB_NUM_NODES: 1
SLURM_NTASKS: 1
SLURM_TIMELIMIT: '06:00:00'
CRAY_CUDA_MPS: 1
NUM_PROCESSES: auto
VIRTUALENV_SYSTEM_SITE_PACKAGES: 1
CSCS_NEEDED_DATA: icon4py
TEST_DATA_PATH: "/apps/daint/UES/jenkssl/ciext/icon4py"
18 changes: 18 additions & 0 deletions ci/benchmark.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
include:
- local: 'ci/base.yml'

variables:
DACE_VERSION: "0.14.4"

build:
extends: .build_template

benchmark_model_icon_grid:
extends: .test_template
stage: benchmark
script:
- if [ "$BACKEND" = "dace_cpu" ] || [ "$BACKEND" = "dace_gpu" ]; then pip install dace==$DACE_VERSION; fi
- tox -r -e run_benchmarks -c model/ -- --backend=$BACKEND --grid=icon_grid --disable-warnings
parallel:
matrix:
- BACKEND: [dace_cpu, gtfn_cpu, gtfn_gpu]
122 changes: 0 additions & 122 deletions ci/cscs.yml

This file was deleted.

20 changes: 20 additions & 0 deletions ci/default.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
include:
- local: 'ci/base.yml'

build:
extends: .build_template

test_model_simple_grid:
extends: .test_template
stage: test
script:
- tox -r -e run_stencil_tests -c model/ --verbose -- --backend=$BACKEND
parallel:
matrix:
- BACKEND: [gtfn_cpu, gtfn_gpu, roundtrip]

test_tools:
extends: .test_template
stage: test
script:
- tox -r -c tools/ --verbose
1 change: 1 addition & 0 deletions model/atmosphere/diffusion/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@
)
from icon4py.model.common.test_utils.helpers import ( # noqa : F401 # fixtures from test_utils
backend,
uses_icon_grid_with_otf,
)
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,12 @@ 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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,12 @@ 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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import numpy as np
import pytest
from gt4py.next.ffront.fbuiltins import int32
from gt4py.next.program_processors.otf_compile_executor import OTFCompileExecutor

from icon4py.model.atmosphere.diffusion.stencils.calculate_nabla2_for_z import (
calculate_nabla2_for_z,
Expand Down Expand Up @@ -55,11 +54,12 @@ def reference(
return dict(z_nabla2_e=z_nabla2_e)

@pytest.fixture
def input_data(self, grid, backend):
if isinstance(backend, OTFCompileExecutor):
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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ def _verify_init_values_against_savepoint(
(REGIONAL_EXPERIMENT, "2021-06-20T12:00:10.000", 12500.0),
(REGIONAL_EXPERIMENT, "2021-06-20T12:00:20.000", 12500.0),
(GLOBAL_EXPERIMENT, "2000-01-01T00:00:02.000", 50000.0),
(GLOBAL_EXPERIMENT, "2000-01-01T00:00:08.000", 50000.0),
(GLOBAL_EXPERIMENT, "2000-01-01T00:00:04.000", 50000.0),
],
)
@pytest.mark.parametrize("ndyn_substeps", (2,))
Expand Down
1 change: 1 addition & 0 deletions model/atmosphere/dycore/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@
)
from icon4py.model.common.test_utils.helpers import ( # noqa : F401 # fixtures from test_utils
backend,
uses_icon_grid_with_otf,
)
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,12 @@ 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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,12 @@ 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)
Expand Down
Loading

0 comments on commit 008d1fc

Please sign in to comment.