Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Py2F]: add profiling support & optimisations #449

Merged
merged 60 commits into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
6284fab
Add cProfile to wrapper
samkellerhals Apr 12, 2024
ec54515
Add CachedProgram
samkellerhals Apr 17, 2024
8bcca18
Conditionally generate host_data
samkellerhals Apr 17, 2024
a5241bf
more acc fixes
samkellerhals Apr 17, 2024
03e4045
Use CachedProgram in diffusion
samkellerhals Apr 17, 2024
7e21089
remove cached program
samkellerhals Apr 18, 2024
e6b453f
Add cached programs and duplicate one program
samkellerhals Apr 18, 2024
47be422
Load connectivities on device in Grid
samkellerhals Apr 22, 2024
a55c509
use math.prod in unpacking functions
samkellerhals Apr 23, 2024
0b7afb5
Merge branch 'main' of github.com:C2SM/icon4py into py2f-with-optimis…
samkellerhals Apr 23, 2024
17fc611
Py2f cachedprogram fixes (#452)
samkellerhals Apr 24, 2024
ae733b1
Merge branch 'py2f-with-optimisations' of github.com:C2SM/icon4py int…
samkellerhals Apr 24, 2024
b06ee35
Add multi_return profiling test
samkellerhals Apr 24, 2024
53dda46
fix import of roundtrip
halungge Apr 24, 2024
d0995e5
temporarily removing sudo apt update
halungge Apr 24, 2024
e133e75
temporarily removing sudo apt update
halungge Apr 24, 2024
6c81409
cleanup diffusion.py
samkellerhals Apr 25, 2024
18fab84
cleanup diffusion.py
samkellerhals Apr 25, 2024
fbdcd07
remove conflict
samkellerhals Apr 25, 2024
bfe3b19
udno - temporarily removing sudo apt update
halungge Apr 25, 2024
f105880
Update model/common/src/icon4py/model/common/config.py
halungge Apr 25, 2024
2a1345d
fix import
halungge Apr 25, 2024
c8660c5
fix import
halungge Apr 25, 2024
dffdbc3
fix import
halungge Apr 26, 2024
eb40203
fix import in template.py
samkellerhals Apr 29, 2024
c272075
Merge branch 'fix_roundtrip_import' of github.com:C2SM/icon4py into f…
samkellerhals Apr 29, 2024
6be6136
Merge branch 'fix_roundtrip_import' of github.com:C2SM/icon4py into p…
samkellerhals Apr 29, 2024
82515de
Merge branch 'main' of github.com:C2SM/icon4py into py2f-with-optimis…
samkellerhals Apr 29, 2024
06d2a04
Pass cached connectivities
samkellerhals Apr 29, 2024
ffb27c6
Remove isinstance checks from size passing
samkellerhals Apr 29, 2024
9ea0689
Remove commented out code
samkellerhals Apr 30, 2024
7900cec
Merge branch 'py2f-with-optimisations' of github.com:C2SM/icon4py int…
samkellerhals Apr 30, 2024
07751ec
Remove gridfile
samkellerhals Apr 30, 2024
92e08fc
Adapt CachedProgram to use new workflow interface and don't pass cach…
samkellerhals Apr 30, 2024
8619487
Fix test which uses connecitivities on gpu
samkellerhals Apr 30, 2024
aaa39eb
Move connectivity from device to host in test
samkellerhals May 2, 2024
44cf44e
More connectivity handling from gpu
samkellerhals May 2, 2024
e14ac59
Formatting
samkellerhals May 2, 2024
7ee29e7
rename fixtures
samkellerhals May 2, 2024
e0aca5e
Fix call to extract_connectivities
samkellerhals May 2, 2024
0e596fa
add device arg back temporarily
samkellerhals May 3, 2024
f3c49b9
remove comment
samkellerhals May 6, 2024
0fd5f10
Merge branch 'main' into py2f-with-optimisations
samkellerhals May 6, 2024
b3bc385
Merge branch 'main' of github.com:C2SM/icon4py into py2f-with-optimis…
samkellerhals May 17, 2024
b4bc10a
Add defaults for CellParams
samkellerhals May 21, 2024
f133da5
[Py2F]: Enable support for APE experiment (#459)
samkellerhals May 22, 2024
fd44acd
fix workflow interface
samkellerhals May 22, 2024
1de4962
Merge branch 'py2f-with-optimisations' of github.com:C2SM/icon4py int…
samkellerhals May 22, 2024
639727a
Add docstring for CachedProgram
samkellerhals May 22, 2024
30726b2
fix formatting
samkellerhals May 22, 2024
389ea83
fix codegen test
samkellerhals May 23, 2024
12f2dab
Centralise CachedProgram for use elsewhere
samkellerhals May 24, 2024
8e45e06
Merge branch 'main' of github.com:C2SM/icon4py into py2f-with-optimis…
samkellerhals May 27, 2024
fa98986
Remove on_gpu checks in stencil tests
samkellerhals May 27, 2024
833f7be
use from settings import xp
samkellerhals May 27, 2024
08906f1
adapt ICON_GRID_LOC
samkellerhals May 27, 2024
b4211d8
Remove from_integer
samkellerhals May 27, 2024
622c64a
More modifications for APE (#469)
samkellerhals May 28, 2024
b5086a9
Update ICON_GRID_LOC in CI
samkellerhals May 28, 2024
6f7d074
Rename function
samkellerhals May 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ci/base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,4 @@ variables:
VIRTUALENV_SYSTEM_SITE_PACKAGES: 1
CSCS_NEEDED_DATA: icon4py
TEST_DATA_PATH: "/project/d121/icon4py/ci/testdata"
ICON_GRID_LOC: "/project/d121/icon4py/ci/testdata/grids/mch_ch_r04b09_dsl"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wouldn't it be more future proof if you had here the ICON_GRID_PATH = "/project/d121/icon4py/ci/testdata/grids and then extended the path in your test case? Then we could switch between grids more easily.

Copy link
Contributor Author

@samkellerhals samkellerhals May 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extending the path will currently not always work in ICON since the grids are not all in one root folder. For it to work we'd have to move all grids into one folder. For now I propose to keep it as is, which is the user can define ICON_GRID_LOC which is the path to the root folder of the grid, and then can define ICON_GRID_NAME which is the name of the grid (in each runscript), so already there is some flexibility here. Regarding the CI tests, I can improve that in my next PR which will be about py2fgen CI improvements.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was only thinking about CI actually here... For me is fine to do this in a next PR.

Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# ICON4Py - ICON inspired code in Python and GT4Py
#
# Copyright (c) 2022, ETH Zurich and MeteoSwiss
# All rights reserved.
#
# This file is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the
# Free Software Foundation, either version 3 of the License, or any later
# version. See the LICENSE.txt file at the top-level directory of this
# distribution for a copy of the license or check <https://www.gnu.org/licenses/>.
#
# SPDX-License-Identifier: GPL-3.0-or-later

from icon4py.model.atmosphere.diffusion.diffusion_utils import (
copy_field as copy_field_orig,
init_diffusion_local_fields_for_regular_timestep as init_diffusion_local_fields_for_regular_timestep_orig,
scale_k as scale_k_orig,
setup_fields_for_initial_step as setup_fields_for_initial_step_orig,
)
from icon4py.model.atmosphere.diffusion.stencils.apply_diffusion_to_vn import (
apply_diffusion_to_vn as apply_diffusion_to_vn_orig,
)
from icon4py.model.atmosphere.diffusion.stencils.apply_diffusion_to_w_and_compute_horizontal_gradients_for_turbulence import (
apply_diffusion_to_w_and_compute_horizontal_gradients_for_turbulence as apply_diffusion_to_w_and_compute_horizontal_gradients_for_turbulence_orig,
)
from icon4py.model.atmosphere.diffusion.stencils.calculate_diagnostic_quantities_for_turbulence import (
calculate_diagnostic_quantities_for_turbulence as calculate_diagnostic_quantities_for_turbulence_orig,
)
from icon4py.model.atmosphere.diffusion.stencils.calculate_enhanced_diffusion_coefficients_for_grid_point_cold_pools import (
calculate_enhanced_diffusion_coefficients_for_grid_point_cold_pools as calculate_enhanced_diffusion_coefficients_for_grid_point_cold_pools_orig,
)
from icon4py.model.atmosphere.diffusion.stencils.calculate_nabla2_and_smag_coefficients_for_vn import (
calculate_nabla2_and_smag_coefficients_for_vn as calculate_nabla2_and_smag_coefficients_for_vn_orig,
)
from icon4py.model.atmosphere.diffusion.stencils.calculate_nabla2_for_theta import (
calculate_nabla2_for_theta as calculate_nabla2_for_theta_orig,
)
from icon4py.model.atmosphere.diffusion.stencils.truly_horizontal_diffusion_nabla_of_theta_over_steep_points import (
truly_horizontal_diffusion_nabla_of_theta_over_steep_points as truly_horizontal_diffusion_nabla_of_theta_over_steep_points_orig,
)
from icon4py.model.atmosphere.diffusion.stencils.update_theta_and_exner import (
update_theta_and_exner as update_theta_and_exner_orig,
)
from icon4py.model.common.caching import CachedProgram
from icon4py.model.common.interpolation.stencils.mo_intp_rbf_rbf_vec_interpol_vertex import (
mo_intp_rbf_rbf_vec_interpol_vertex as mo_intp_rbf_rbf_vec_interpol_vertex_orig,
)


# diffusion run stencils
apply_diffusion_to_vn = CachedProgram(apply_diffusion_to_vn_orig)
apply_diffusion_to_w_and_compute_horizontal_gradients_for_turbulence = CachedProgram(
apply_diffusion_to_w_and_compute_horizontal_gradients_for_turbulence_orig
)
calculate_diagnostic_quantities_for_turbulence = CachedProgram(
calculate_diagnostic_quantities_for_turbulence_orig
)
calculate_enhanced_diffusion_coefficients_for_grid_point_cold_pools = CachedProgram(
calculate_enhanced_diffusion_coefficients_for_grid_point_cold_pools_orig
)
calculate_nabla2_and_smag_coefficients_for_vn = CachedProgram(
calculate_nabla2_and_smag_coefficients_for_vn_orig
)
calculate_nabla2_for_theta = CachedProgram(calculate_nabla2_for_theta_orig)
truly_horizontal_diffusion_nabla_of_theta_over_steep_points = CachedProgram(
truly_horizontal_diffusion_nabla_of_theta_over_steep_points_orig
)
update_theta_and_exner = CachedProgram(update_theta_and_exner_orig)

mo_intp_rbf_rbf_vec_interpol_vertex = CachedProgram(mo_intp_rbf_rbf_vec_interpol_vertex_orig)


# model init stencils
setup_fields_for_initial_step = CachedProgram(setup_fields_for_initial_step_orig, with_domain=False)
copy_field = CachedProgram(copy_field_orig, with_domain=False)
init_diffusion_local_fields_for_regular_timestep = CachedProgram(
init_diffusion_local_fields_for_regular_timestep_orig, with_domain=False
)
scale_k = CachedProgram(scale_k_orig, with_domain=False)
Original file line number Diff line number Diff line change
Expand Up @@ -28,35 +28,27 @@
DiffusionMetricState,
)
from icon4py.model.atmosphere.diffusion.diffusion_utils import (
copy_field,
init_diffusion_local_fields_for_regular_timestep,
init_nabla2_factor_in_upper_damping_zone,
scale_k,
setup_fields_for_initial_step,
zero_field,
)
from icon4py.model.atmosphere.diffusion.stencils.apply_diffusion_to_vn import apply_diffusion_to_vn
from icon4py.model.atmosphere.diffusion.stencils.apply_diffusion_to_w_and_compute_horizontal_gradients_for_turbulence import (
apply_diffusion_to_w_and_compute_horizontal_gradients_for_turbulence,
)
from icon4py.model.atmosphere.diffusion.stencils.calculate_diagnostic_quantities_for_turbulence import (
calculate_diagnostic_quantities_for_turbulence,
)
from icon4py.model.atmosphere.diffusion.stencils.calculate_enhanced_diffusion_coefficients_for_grid_point_cold_pools import (
calculate_enhanced_diffusion_coefficients_for_grid_point_cold_pools,
)
from icon4py.model.atmosphere.diffusion.stencils.calculate_nabla2_and_smag_coefficients_for_vn import (

# cached program import
from icon4py.model.atmosphere.diffusion.cached import (
init_diffusion_local_fields_for_regular_timestep,
setup_fields_for_initial_step,
scale_k,
calculate_nabla2_and_smag_coefficients_for_vn,
)
from icon4py.model.atmosphere.diffusion.stencils.calculate_nabla2_for_theta import (
calculate_nabla2_for_theta,
)
from icon4py.model.atmosphere.diffusion.stencils.truly_horizontal_diffusion_nabla_of_theta_over_steep_points import (
truly_horizontal_diffusion_nabla_of_theta_over_steep_points,
)
from icon4py.model.atmosphere.diffusion.stencils.update_theta_and_exner import (
apply_diffusion_to_w_and_compute_horizontal_gradients_for_turbulence,
apply_diffusion_to_vn,
calculate_diagnostic_quantities_for_turbulence,
calculate_enhanced_diffusion_coefficients_for_grid_point_cold_pools,
update_theta_and_exner,
copy_field,
mo_intp_rbf_rbf_vec_interpol_vertex,
)

from icon4py.model.common.constants import (
CPD,
DEFAULT_PHYSICS_DYNAMICS_TIMESTEP_RATIO,
Expand All @@ -68,9 +60,6 @@
from icon4py.model.common.grid.horizontal import CellParams, EdgeParams, HorizontalMarkerIndex
from icon4py.model.common.grid.icon import IconGrid
from icon4py.model.common.grid.vertical import VerticalModelParams
from icon4py.model.common.interpolation.stencils.mo_intp_rbf_rbf_vec_interpol_vertex import (
mo_intp_rbf_rbf_vec_interpol_vertex,
)
from icon4py.model.common.states.prognostic_state import PrognosticState
from icon4py.model.common.settings import xp

Expand Down Expand Up @@ -752,6 +741,7 @@ def _do_diffusion_step(
)
# TODO (magdalena) get rid of this copying. So far passing an empty buffer instead did not verify?
copy_field(prognostic_state.w, self.w_tmp, offset_provider={})

apply_diffusion_to_w_and_compute_horizontal_gradients_for_turbulence(
area=self.cell_params.area,
geofac_n2s=self.interpolation_state.geofac_n2s,
Expand Down Expand Up @@ -784,6 +774,7 @@ def _do_diffusion_step(
log.debug(
"running fused stencils 11 12 (calculate_enhanced_diffusion_coefficients_for_grid_point_cold_pools): start"
)

calculate_enhanced_diffusion_coefficients_for_grid_point_cold_pools(
theta_v=prognostic_state.theta_v,
theta_ref_mc=self.metric_state.theta_ref_mc,
Expand All @@ -799,6 +790,7 @@ def _do_diffusion_step(
log.debug(
"running stencils 11 12 (calculate_enhanced_diffusion_coefficients_for_grid_point_cold_pools): end"
)

log.debug("running stencils 13 14 (calculate_nabla2_for_theta): start")
calculate_nabla2_for_theta(
kh_smag_e=self.kh_smag_e,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,15 @@ def reference(
**kwargs,
) -> dict:
c2e = grid.connectivities[C2EDim]
c2ce = grid.get_offset_provider("C2CE").table

geofac_div = np.expand_dims(geofac_div, axis=-1)
vn_geofac = vn[c2e] * geofac_div[grid.get_offset_provider("C2CE").table]
div = np.sum(vn_geofac, axis=1)
e_bln_c_s = np.expand_dims(e_bln_c_s, axis=-1)
diff_multfac_smag = np.expand_dims(diff_multfac_smag, axis=0)
mul = kh_smag_ec[c2e] * e_bln_c_s[grid.get_offset_provider("C2CE").table]

vn_geofac = vn[c2e] * geofac_div[c2ce]
div = np.sum(vn_geofac, axis=1)
mul = kh_smag_ec[c2e] * e_bln_c_s[c2ce]
summed = np.sum(mul, axis=1)
kh_c = summed / diff_multfac_smag

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ def add_interpolated_horizontal_advection_of_w_numpy(
grid, e_bln_c_s: np.array, z_v_grad_w: np.array, ddt_w_adv: np.array, **kwargs
) -> np.array:
e_bln_c_s = np.expand_dims(e_bln_c_s, axis=-1)
c2ce = grid.get_offset_provider("C2CE").table

ddt_w_adv = ddt_w_adv + np.sum(
z_v_grad_w[grid.connectivities[C2EDim]] * e_bln_c_s[grid.get_offset_provider("C2CE").table],
z_v_grad_w[grid.connectivities[C2EDim]] * e_bln_c_s[c2ce],
axis=1,
)
return ddt_w_adv
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@ def interpolate_to_cell_center_numpy(
grid, interpolant: np.array, e_bln_c_s: np.array, **kwargs
) -> np.array:
e_bln_c_s = np.expand_dims(e_bln_c_s, axis=-1)
c2ce = grid.get_offset_provider("C2CE").table

interpolation = np.sum(
interpolant[grid.connectivities[C2EDim]]
* e_bln_c_s[grid.get_offset_provider("C2CE").table],
interpolant[grid.connectivities[C2EDim]] * e_bln_c_s[c2ce],
axis=1,
)
return interpolation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
from icon4py.model.common.type_alias import vpfloat, wpfloat


class TestComputeDivergenceOfFluxesOfRhoAndTheta(StencilTest):
class TestComputeDivergenconnectivityceOfFluxesOfRhoAndTheta(StencilTest):
PROGRAM = compute_divergence_of_fluxes_of_rho_and_theta
OUTPUTS = ("z_flxdiv_mass", "z_flxdiv_theta")

Expand All @@ -42,12 +42,14 @@ def reference(
) -> tuple[np.array]:
c2e = grid.connectivities[C2EDim]
geofac_div = np.expand_dims(geofac_div, axis=-1)
c2ce = grid.get_offset_provider("C2CE").table

z_flxdiv_mass = np.sum(
geofac_div[grid.get_offset_provider("C2CE").table] * mass_fl_e[c2e],
geofac_div[c2ce] * mass_fl_e[c2e],
axis=1,
)
z_flxdiv_theta = np.sum(
geofac_div[grid.get_offset_provider("C2CE").table] * z_theta_v_fl_e[c2e],
geofac_div[c2ce] * z_theta_v_fl_e[c2e],
axis=1,
)
return dict(z_flxdiv_mass=z_flxdiv_mass, z_flxdiv_theta=z_flxdiv_theta)
Expand Down
135 changes: 135 additions & 0 deletions model/common/src/icon4py/model/common/caching.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
# ICON4Py - ICON inspired code in Python and GT4Py
#
# Copyright (c) 2022, ETH Zurich and MeteoSwiss
# All rights reserved.
#
# This file is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the
# Free Software Foundation, either version 3 of the License, or any later
# version. See the LICENSE.txt file at the top-level directory of this
# distribution for a copy of the license or check <https://www.gnu.org/licenses/>.
#
# SPDX-License-Identifier: GPL-3.0-or-later

import dataclasses
from typing import Any, Callable, Optional

import numpy as np
from gt4py import next as gtx
from gt4py.next.otf import workflow
from gt4py.next.program_processors.runners.gtfn import extract_connectivity_args

from icon4py.model.common.settings import device


try:
import cupy as cp
from gt4py.next.embedded.nd_array_field import CuPyArrayField
except ImportError:
cp: Optional = None # type:ignore[no-redef]

from gt4py.next.embedded.nd_array_field import NumPyArrayField


def handle_numpy_integer(value):
return int(value)


def handle_common_field(value, sizes):
sizes.extend(value.shape)
return value # Return the value unmodified, but side-effect on sizes


def handle_default(value):
return value # Return the value unchanged


if cp:
type_handlers = {
np.integer: handle_numpy_integer,
NumPyArrayField: handle_common_field,
CuPyArrayField: handle_common_field,
}
else:
type_handlers = {
np.integer: handle_numpy_integer,
NumPyArrayField: handle_common_field,
}


def process_arg(value, sizes):
handler = type_handlers.get(type(value), handle_default)
return handler(value, sizes) if handler == handle_common_field else handler(value)


@dataclasses.dataclass
class CachedProgram:
"""Class to handle caching and compilation of GT4Py programs.

This class is responsible for caching and compiling GT4Py programs
with optional domain information. The compiled program and its
connectivity arguments are stored for efficient execution.

Attributes:
program (gtx.ffront.decorator.Program): The GT4Py program to be cached and compiled.
with_domain (bool): Flag to indicate if the program should be compiled with domain information. Defaults to True.
_compiled_program (Optional[Callable]): The compiled GT4Py program.
_conn_args (Any): Connectivity arguments extracted from the offset provider.
_compiled_args (tuple): Arguments used during the compilation of the program.

Properties:
compiled_program (Callable): Returns the compiled GT4Py program.
conn_args (Any): Returns the connectivity arguments.

Note:
This functionality will be provided by GT4Py in the future.
"""

program: gtx.ffront.decorator.Program
with_domain: bool = True
_compiled_program: Optional[Callable] = None
_conn_args: Any = None
_compiled_args: tuple = dataclasses.field(default_factory=tuple)

@property
def compiled_program(self) -> Callable:
return self._compiled_program

@property
def conn_args(self) -> Callable:
return self._conn_args

def compile_the_program(
self, *args, offset_provider: dict[str, gtx.Dimension], **kwargs: Any
) -> Callable:
backend = self.program.backend
program_call = backend.transforms_prog(
workflow.InputWithArgs(
data=self.program.definition_stage,
args=args,
kwargs=kwargs | {"offset_provider": offset_provider},
)
)
self._compiled_args = program_call.args
return backend.executor.otf_workflow(program_call)

def __call__(self, *args, offset_provider: dict[str, gtx.Dimension], **kwargs: Any) -> None:
if not self.compiled_program:
self._compiled_program = self.compile_the_program(
*args, offset_provider=offset_provider, **kwargs
)
self._conn_args = extract_connectivity_args(offset_provider, device)

kwargs_as_tuples = tuple(kwargs.values())
program_args = list(args) + list(kwargs_as_tuples)
sizes = []

# Convert numpy integers in args to int and handle gtx.common.Field
for i in range(len(program_args)):
program_args[i] = process_arg(program_args[i], sizes)

if not self.with_domain:
program_args.extend(sizes)

# todo(samkellerhals): if we merge gt4py PR we can also pass connectivity args here conn_args=self.conn_args
return self.compiled_program(*program_args, offset_provider=offset_provider)
4 changes: 4 additions & 0 deletions model/common/src/icon4py/model/common/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,7 @@ def device(self):
}
device = device_map[self.icon4py_backend]
return device

@cached_property
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately ICON has a seperate namelist parameter for this, where I think that should be determined in the gridfile. In fact in the MCH grid file there is a global_grid = 0 property which might mean this... but it does not exist in the grid files provided by MPI-M, (for example the one we use for the Aquaplanet).

Copy link
Contributor Author

@samkellerhals samkellerhals May 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it is not provided by MPI-M then there is no consistent way of passing it into the wrapper from ICON across experiments (MCH, APE). Therefore I would rather keep this environment variable for now, it is very easy to set in the run script, and doesn't require further changes on the ICON side.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really care about the ICON side, what I am always a bit worried is that we constrain the pure python greenline runs to do awkward things because of ICON or the ICON integration. And all this grid file related things should eventually come from the model configuration file (same as ICON) and not from the environment. (This is different for the backend, I think it makes sense to run the exact same experiment (without changes in config) on different backends. ) Anyhow, since we don't have a consolidated configuration yet in icon4Py we leave it as is and rework it in due time. That might mean then that we would maybe also need to change things on how the py2fgen or the wrapper works...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense, I agree we postpone it until we think about how to configure icon4py.

def limited_area(self):
return os.environ.get("ICON4PY_LAM", False)
Loading
Loading