-
Notifications
You must be signed in to change notification settings - Fork 0
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
Run icon4py on gpu #579
base: main
Are you sure you want to change the base?
Run icon4py on gpu #579
Changes from 13 commits
9f8e582
e16ed4f
9c01cce
f55530f
5af4186
0b71083
fdca0f9
aeeac65
27b5062
77543da
6104159
ef9a00d
a415e4f
2d8328e
ca1fcb0
32c1cf4
c49cabc
045f820
9a21467
d98b497
7cffcfc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,9 @@ | |
from icon4py.model.atmosphere.dycore.interpolate_to_half_levels_vp import ( | ||
_interpolate_to_half_levels_vp, | ||
) | ||
from icon4py.model.atmosphere.dycore.interpolate_to_half_levels_wp import ( | ||
_interpolate_to_half_levels_wp, | ||
) | ||
from icon4py.model.common import dimension as dims, field_type_aliases as fa | ||
from icon4py.model.common.dimension import Koff | ||
from icon4py.model.common.settings import backend | ||
|
@@ -37,7 +40,7 @@ def _compute_virtual_potential_temperatures_and_pressure_gradient( | |
wgtfac_c_wp, ddqz_z_half_wp = astype((wgtfac_c, ddqz_z_half), wpfloat) | ||
|
||
z_theta_v_pr_ic_vp = _interpolate_to_half_levels_vp(wgtfac_c=wgtfac_c, interpolant=z_rth_pr_2) | ||
theta_v_ic_wp = wgtfac_c_wp * theta_v + (wpfloat("1.0") - wgtfac_c_wp) * theta_v(Koff[-1]) | ||
theta_v_ic_wp = _interpolate_to_half_levels_wp(wgtfac_c=wgtfac_c_wp, interpolant=theta_v) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what again was the problem with the inline version? (I have nothing against the stencil, I think it is even better in terms of readability, but I am still wondering why it changes anything.) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I always faced cuda illegal memory access error with the inline version when running with resolutions greater than R2B6. I still do not understand why. I am not sure whether it is due to some deep reasons or bugs else where. At least so far for R2B7, everything is okay and results are verified with the new functional call. (As I also indeed like the functional call for interpolation) I tend to keep it this way. |
||
z_th_ddz_exner_c_wp = vwind_expl_wgt * theta_v_ic_wp * ( | ||
exner_pr(Koff[-1]) - exner_pr | ||
) / ddqz_z_half_wp + astype(z_theta_v_pr_ic_vp * d_exner_dz_ref_ic, wpfloat) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# ICON4Py - ICON inspired code in Python and GT4Py | ||
# | ||
# Copyright (c) 2022-2024, ETH Zurich and MeteoSwiss | ||
# All rights reserved. | ||
# | ||
# Please, refer to the LICENSE file in the root directory. | ||
# SPDX-License-Identifier: BSD-3-Clause | ||
import gt4py.next as gtx | ||
from gt4py.next.common import GridType | ||
from gt4py.next.ffront.decorator import field_operator, program | ||
|
||
from icon4py.model.common import dimension as dims, field_type_aliases as fa | ||
from icon4py.model.common.dimension import Koff | ||
from icon4py.model.common.settings import backend | ||
from icon4py.model.common.type_alias import wpfloat | ||
|
||
|
||
@field_operator | ||
def _interpolate_to_half_levels_wp( | ||
wgtfac_c: fa.CellKField[wpfloat], | ||
interpolant: fa.CellKField[wpfloat], | ||
) -> fa.CellKField[wpfloat]: | ||
"""Formerly known mo_velocity_advection_stencil_10 and as _mo_solve_nonhydro_stencil_05.""" | ||
OngChia marked this conversation as resolved.
Show resolved
Hide resolved
|
||
interpolation_to_half_levels_wp = wgtfac_c * interpolant + ( | ||
wpfloat("1.0") - wgtfac_c | ||
) * interpolant(Koff[-1]) | ||
return interpolation_to_half_levels_wp | ||
|
||
|
||
@program(grid_type=GridType.UNSTRUCTURED, backend=backend) | ||
def interpolate_to_half_levels_wp( | ||
wgtfac_c: fa.CellKField[wpfloat], | ||
interpolant: fa.CellKField[wpfloat], | ||
interpolation_to_half_levels_wp: fa.CellKField[wpfloat], | ||
horizontal_start: gtx.int32, | ||
horizontal_end: gtx.int32, | ||
vertical_start: gtx.int32, | ||
vertical_end: gtx.int32, | ||
): | ||
_interpolate_to_half_levels_wp( | ||
wgtfac_c, | ||
interpolant, | ||
out=interpolation_to_half_levels_wp, | ||
domain={ | ||
dims.CellDim: (horizontal_start, horizontal_end), | ||
dims.KDim: (vertical_start, vertical_end), | ||
}, | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So that stencil should be inside the
if
and it was not before? We never catch these kind of bugs because we allways run the same configuration. So we only ever test on branch of ifs... :-( From this point of view it is very bad that the configuration of EXCLAIM.APE is similar to MCH_CH_R04B09_DSL. We had a discussion on this yesterday. We really should come up with a list of configurations that we want to support and then test all of them and delete what we don't want and test. @anuragdipankar @lxavier @muellchThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, those stencils are inside the
if
statement. The temperature diffusion should be turned off in the standard Jablonowski Williamson test.