Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
166 commits
Select commit Hold shift + click to select a range
a460d50
add first batch of program tests to continuous benchmarking
DropD Sep 4, 2025
84abc04
fix static params for apply_diffusion_to_vn
DropD Sep 4, 2025
50e8365
improve static params for apply_diffusion_to_w_... test
DropD Sep 5, 2025
ad8d449
Merge branch 'main' into expand-continuous-benchmarking
DropD Sep 5, 2025
aacd35b
add static params and remove indirectly used prog from benchmarking
DropD Sep 5, 2025
d042c98
update dockerfile to trigger a rebuild with newer bencher CLI
DropD Sep 5, 2025
ba94c10
add compute_derived_horizontal_winds_... to benchmarking
DropD Sep 12, 2025
4571a34
Merge branch 'main' into expand-continuous-benchmarking
DropD Sep 12, 2025
3dcdd34
temporarily remove failing parametrization case.
DropD Sep 16, 2025
367ba1f
add compute_advection_in_vertical... program
DropD Sep 16, 2025
c4b33c3
add benchmarking for advection_in_horizontal... program
DropD Sep 16, 2025
bdc3296
add benchmarking for compute_perturbed... program
DropD Sep 16, 2025
5836fbf
add benchmarking for 'compute_hydrostatic...' program
DropD Sep 16, 2025
7d041d5
fix precommit messages
DropD Sep 16, 2025
a30e5da
fix a bug in grid-savepoint reading during driver initialization (#866)
OngChia Sep 12, 2025
ca2f4f2
Fix cupy cfl reduction performance by raveling the array (#872)
havogt Sep 12, 2025
36f5583
Update to GT4Py v1.0.9 (dace fix) (#840)
philip-paul-mueller Sep 12, 2025
510dfae
delete outdated top level README.md from tools (#870)
halungge Sep 12, 2025
3824293
Bump actions/setup-python from 5 to 6 (#863)
dependabot[bot] Sep 15, 2025
1c899eb
Clean up 41_to_60 for better performance (#784)
iomaganaris Sep 15, 2025
937128b
Fix memory allocator for zero fields in velocity advection tests (#874)
edopao Sep 15, 2025
c1bfd1c
Add dace backend to default CI pipeline (#822)
edopao Sep 15, 2025
02d031f
Merge branch 'main' into expand-continuous-benchmarking
DropD Sep 18, 2025
bddb09d
add benchmarking for 'vertically_implicit_solver...' program
DropD Sep 18, 2025
48c9b08
avoid dace backend corner cases in stencil tests
DropD Sep 19, 2025
4ea9499
Merge branch 'main' into expand-continuous-benchmarking
DropD Sep 19, 2025
70e1720
add benchmarking for 'interpolate_rho_theta...' program
DropD Sep 19, 2025
1479e80
fix typing for static variants in stencil tests
DropD Sep 19, 2025
cf730e8
add benchmarking for 'apply_divergence_damping...' program
DropD Sep 19, 2025
47d647a
add benchmarking for 'vertically_implicit...corrector...' program
DropD Sep 19, 2025
07a740f
add option 'single'
starkphi Sep 15, 2025
5af2118
dace type switch as for mixed
starkphi Sep 18, 2025
b7f8282
vpflaot/wpfloat conversion bug
starkphi Sep 19, 2025
3289b38
add benchmarking for 'init_cell...' program
DropD Sep 19, 2025
f3921e7
add benchmarking for 'update_mass_flux_weighted' program
DropD Sep 19, 2025
6368b76
Merge branch 'main' into expand-continuous-benchmarking
iomaganaris Sep 22, 2025
f4adcee
first fixes
OngChia Sep 22, 2025
387e06b
Merge branch 'main' into fix_mixed_precision
OngChia Sep 22, 2025
99ed9a7
revert change from last week - instead change type in fct args
starkphi Sep 22, 2025
2605b19
use wpfloat/vpfloat directly instead of ta.wpfloat/ta.vpfloat (unifie…
starkphi Sep 24, 2025
ce03366
let '--enable_profiling' also take a path for storing the profiling data
starkphi Sep 24, 2025
731e685
prepare for single precision option
starkphi Sep 24, 2025
8e81915
Merge remote-tracking branch 'origin/fix_mixed_precision' into add_si…
starkphi Sep 24, 2025
a2bbfc2
use wpfloat/vpfloat directly instead of ta.wpfloat/ta.vpfloat (unifie…
starkphi Sep 24, 2025
8f9752b
explicitly make wpfloats
starkphi Sep 25, 2025
a8894f9
missing global mark for wpfloat
starkphi Sep 26, 2025
9aedb7d
set remaining gtx types and get wp/vp epsilons
starkphi Sep 26, 2025
c29221c
type python floats as wp/vp floats plus add some casts
starkphi Sep 26, 2025
abafabb
use wpfloat instead of ta.float
starkphi Sep 26, 2025
cc178e2
Merge branch 'main' into add_single_precision_dycore
starkphi Sep 29, 2025
9fd8a3f
Make fixture names readable
iomaganaris Sep 29, 2025
1f88e8f
Make variable options usable with pytest -k
iomaganaris Sep 29, 2025
123b25b
Print gt4py timers in a nice way (along with pytest timers)
iomaganaris Sep 30, 2025
ab89a17
Merge remote-tracking branch 'origin/main' into expand-continuous-ben…
iomaganaris Sep 30, 2025
66855eb
Disable verification if --benchmark_only is set
iomaganaris Oct 1, 2025
d39c9f1
Clean gtx_metrics after the verification
iomaganaris Oct 1, 2025
4d3a6d6
Get rid of the first slow iterations
iomaganaris Oct 1, 2025
8ad81e4
Merge remote-tracking branch 'origin/main' into expand-continuous-ben…
iomaganaris Oct 1, 2025
1129847
Added a few fixture ids
iomaganaris Oct 1, 2025
86fe74e
auto formating
starkphi Oct 2, 2025
b4bdd6f
use wpfloats instead of native Python floats
starkphi Oct 2, 2025
dba54f5
(temporarily?) add stencil_61_62 back in
starkphi Oct 2, 2025
549e4cd
autoformating + use WP_EPS constant
starkphi Oct 2, 2025
a370c4a
use WP_EPS constant
starkphi Oct 2, 2025
a5fd0e2
use WP_EPS (+ reflect in derived variable naming)
starkphi Oct 2, 2025
3d3583c
use wp_eps naming make the strict wpfloat use visible by only importi…
starkphi Oct 2, 2025
e98c491
use WP_EPS
starkphi Oct 2, 2025
c5dd9bd
auto formating
starkphi Oct 2, 2025
fc0f2a7
also make wpfloat
starkphi Oct 2, 2025
234eca0
use wpfloat directly and add casting to numeric literals (python floa…
starkphi Oct 2, 2025
aa1c840
rm comment and autoformatting
starkphi Oct 2, 2025
be4ec0e
add more explicit typing
starkphi Oct 2, 2025
f59e73d
add a few casts to wpfloat and use wpfloat directly (instead of ta.w…
starkphi Oct 2, 2025
16a5efe
correct two instances of vp/wp swaps
starkphi Oct 2, 2025
cc327f7
make zero_field vp
Oct 2, 2025
2571f3a
adjust tolerances in single precision case
starkphi Oct 2, 2025
fcba196
Switch to using tolerances dependent on precision (?)
starkphi Oct 2, 2025
2d28745
make default rtol eps dependant
starkphi Oct 2, 2025
9331a45
Hack: Get dtime directly in wp (via IconSavepoint member fct)
starkphi Oct 2, 2025
fb42a5c
apply automated formating
starkphi Sep 29, 2025
c3a67e1
max_vertical_cfl in vpfloat
starkphi Oct 6, 2025
c6de2d1
Add at_first_substep to compile-time constants in vertically_implicit…
iomaganaris Oct 7, 2025
9f0b319
use shorter test case to be also able to run on cpu
starkphi Oct 7, 2025
20e589e
Merge branch 'main' into add_single_precision_dycore
starkphi Oct 8, 2025
171ffd7
Remove debug print of gt4py timers
iomaganaris Oct 8, 2025
2728bfd
Fix metrics with new gt4py
iomaganaris Oct 8, 2025
131ad47
rm comment (stencils_61_62 still needed)
starkphi Oct 9, 2025
e094668
(optional) add a minimal single precision test to default.yml
starkphi Oct 9, 2025
64c01d6
rm config options: --enable-mixed-precision / --enable-single-precisi…
starkphi Oct 9, 2025
7c65dfb
(optional2) add a more modular version for single precision testing v…
starkphi Oct 9, 2025
9ad21b2
add missing wp typing
starkphi Oct 9, 2025
58434fb
wrong arg name
starkphi Oct 10, 2025
d0046d4
use wp_eps
starkphi Oct 10, 2025
18e3817
Find a way to inherit from existing StencilTests
iomaganaris Oct 10, 2025
7b86edf
rm fct call in default arg
starkphi Oct 13, 2025
c525572
Enable inheritance from classes of benchmarks and apply to TestApplyD…
iomaganaris Oct 13, 2025
d6f788e
auto formatting
starkphi Oct 13, 2025
534d31d
Use subclasses for continuous_benchmarking
iomaganaris Oct 13, 2025
6ee0419
Replace UUID of test with class
iomaganaris Oct 13, 2025
442555b
Merge branch 'main' into expand-continuous-benchmarking
iomaganaris Oct 13, 2025
da6c9eb
Remove TODO
iomaganaris Oct 13, 2025
33149f3
Replace skip_verification with benchmark_only
iomaganaris Oct 13, 2025
01d87c3
Modifications in TestComputeThetaRhoPressureGradientAndUpdateVn
kotsaloscv Oct 14, 2025
62ff36c
Modifications in TestComputeThetaRhoPressureGradientAndUpdateVn
kotsaloscv Oct 14, 2025
152b30e
temp sqrt without gtx nor np
starkphi Oct 13, 2025
fe4d883
more wp/vp typing
starkphi Oct 14, 2025
52c77ec
rm wp/vp dependency in dace type mapping
starkphi Oct 14, 2025
f49b74b
Avoid warning: PytestCollectionWarning: cannot collect 'test_*' becau…
iomaganaris Oct 15, 2025
c755cd8
Fix formatting
iomaganaris Oct 15, 2025
f1a627d
Skip continuous benchmarking tests if grid is not icon_benchmark
iomaganaris Oct 15, 2025
1e092ba
Fixing tests
iomaganaris Oct 15, 2025
28d695a
Fix TestFusedVelocityAdvectionStencilVMomentumAndContravariant
iomaganaris Oct 15, 2025
9cd760a
Skip validation of TestComputeThetaRhoPressureGradientAndUpdateVn
iomaganaris Oct 15, 2025
ad34020
Remove unrelated changes
iomaganaris Oct 15, 2025
2481f55
Merge remote-tracking branch 'origin/main' into expand-continuous-ben…
iomaganaris Oct 15, 2025
efa6df4
Trying to fix test_TestComputeDerivedHorizontalWindsAndKEAndHorizonta…
iomaganaris Oct 15, 2025
217333f
Remove unnecessary UUID
iomaganaris Oct 15, 2025
3dc8b0e
Merge branch 'main' into expand-continuous-benchmarking
DropD Oct 16, 2025
5c1b4fe
type float is also accepted for NonhydrostaticConfig __init__ (everyt…
starkphi Oct 16, 2025
07c8ca5
wrong argument to _calculate_divdamp_fields?
starkphi Oct 16, 2025
4397028
silence mypy 'is not valid as a type' (in precommit checks)
starkphi Oct 16, 2025
d09c26e
rm comment-out code
starkphi Oct 16, 2025
76683f7
temporary fix for _calculate_divdamp_fields with single precision (go…
starkphi Oct 16, 2025
dd801c0
Changes of commit 07c8ca5 where correct (according to OngChia)
starkphi Oct 17, 2025
5bf8f4b
missing wpfloat typing
starkphi Oct 21, 2025
9d14243
temporarily set default precision to single
starkphi Oct 21, 2025
193685f
Merge branch 'main' into add_single_precision_dycore
starkphi Oct 21, 2025
97d67d0
more explicit use of dtype argument
starkphi Oct 22, 2025
420fe3a
Merge branch 'main' into expand-continuous-benchmarking
iomaganaris Oct 22, 2025
d018cae
Merge branch 'main' into expand-continuous-benchmarking
edopao Oct 23, 2025
d1d2419
try to run test_apply_diffusion_to_vn
starkphi Oct 27, 2025
2b8f01a
temporary fix for newest gt4py main
starkphi Oct 27, 2025
8a2fdce
make random fields in respective dtype
starkphi Oct 29, 2025
05968bb
renaming: TestCBApplyDiffusionToVn to TestApplyDiffusionToVnContinuou…
kotsaloscv Oct 30, 2025
eb720fe
Merge branch 'main' into expand-continuous-benchmarking
DropD Nov 4, 2025
f0e6f53
Merge remote-tracking branch 'origin/main' into expand-continuous-ben…
iomaganaris Nov 5, 2025
36f54e8
Fix issue with test_grid
iomaganaris Nov 5, 2025
94021c0
Fix data_allocations import in test_calculate_horizontal_gradients_fo…
iomaganaris Nov 6, 2025
4407d5c
Increase DaCe bencher time limit
iomaganaris Nov 6, 2025
0e26652
Only run none and compile_time_domain in bencher
iomaganaris Nov 6, 2025
a0c188f
Use RemoveAccessNodeCopies gt4py transformation in vertically_implici…
iomaganaris Nov 6, 2025
565e350
Revert changes in slurm timeout
iomaganaris Nov 6, 2025
b3d97b5
Merge branch 'main' into vert_impl_solve_backend_special
iomaganaris Nov 6, 2025
05a7fbe
Allow TestComputeThetaRhoPressureGradientAndUpdateVnContinuousBenchma…
iomaganaris Nov 6, 2025
e96911c
Merge remote-tracking branch 'origin/main' into expand-continuous-ben…
iomaganaris Nov 6, 2025
11959e1
Fix test_custom_backend_options by avoid adding extra keys if the dic…
iomaganaris Nov 6, 2025
6c3eccb
Profile only compile_time_domain in bencher
iomaganaris Nov 7, 2025
38dc5e7
set some types right
starkphi Nov 7, 2025
c676ad5
Use explicit variable name instead of "out"
starkphi Nov 7, 2025
73b3f4c
more types
starkphi Nov 7, 2025
6c3af59
make StencilTest always pass for single precision
starkphi Nov 7, 2025
d1c6a9e
Use proper values for TestComputeThetaRhoPressureGradientAndUpdateVnC…
iomaganaris Nov 7, 2025
f0bdf7a
add two variables as static params
starkphi Nov 7, 2025
d5a2b6f
add get_random_fields to data_allocation for more compact dict genera…
starkphi Nov 7, 2025
9cbdf91
Enable RemoveAccessNodeCopies DaCe transformation only on GPU due to …
iomaganaris Nov 10, 2025
9d62b78
Update model/common/src/icon4py/model/common/model_options.py
iomaganaris Nov 10, 2025
4d6e2d0
Fix ComputeThetaRhoPressureGradientAndUpdateVn stencil test
iomaganaris Nov 10, 2025
6e60f81
Remove irrelevant comment
iomaganaris Nov 10, 2025
af6c380
autoformatting and ruff suggestions
starkphi Nov 10, 2025
edd7e4f
Fix TestApplyDiffusionToWAndComputeHorizontalGradientsForTurbulence
iomaganaris Nov 10, 2025
4fb654c
Merge branch 'main' into add_single_precision_dycore
starkphi Nov 10, 2025
4239768
Use the test functions of StencilTest only and replace static_variant…
iomaganaris Nov 10, 2025
ed41bd0
Merge branch 'vert_impl_solve_backend_special' into add_single_precis…
starkphi Nov 10, 2025
9db0973
temporarily add old input_data for merge with expand-continuous-bench…
starkphi Nov 10, 2025
45a0097
Merge branch 'expand-continuous-benchmarking' into add_single_precisi…
starkphi Nov 10, 2025
bafa93b
pre-compiled program still not single compatible
starkphi Nov 11, 2025
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
2 changes: 1 addition & 1 deletion ci/benchmark_bencher.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ include:
stage: benchmark
script:
- !reference [.bencher_setup_env, setup]
- nox -s __bencher_feature_branch_CI-3.10 -- --backend=$BACKEND --grid=$GRID
- nox -s __bencher_feature_branch_CI-3.10 -- --backend=$BACKEND --grid=$GRID -k "compile_time_domain"
parallel:
matrix:
- BACKEND: [dace_cpu, dace_gpu, gtfn_cpu, gtfn_gpu]
Expand Down
44 changes: 44 additions & 0 deletions ci/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,47 @@ test_tools_datatests_aarch64:
# extends: [.test_model_datatests, .test_template_x86_64]
test_model_datatests_aarch64:
extends: [.test_model_datatests, .test_template_aarch64]


.test_single_precision:
stage: test
allow_failure: true
script:
- nox -s "__test_file-3.10" -- --testfile=model/atmosphere/dycore/tests/dycore/integration_tests/test_velocity_advection.py --backend=$BACKEND -k "test_compute_advection_in_horizontal_momentum_equation or test_compute_advection_in_vertical_momentum_equation"
variables:
FLOAT_PRECISION: single
SLURM_TIMELIMIT: '00:20:00'
parallel:
matrix:
- BACKEND: [embedded, dace_gpu, gtfn_cpu, gtfn_gpu]

test_single_precision_aarch64:
extends: [.test_single_precision, .test_template_aarch64]

# TODO(pstark): remove one version of the single precision tests
.test_single_precision_v2:
stage: test
script:
- nox -s "test_model-3.10(datatest, $COMPONENT)" -- --single-precision --backend=$BACKEND --level=$LEVEL
rules:
- if: $BACKEND == 'dace_gpu' && $COMPONENT != 'dycore'
when: never # run only in daily CI, to save compute resources
- if: $COMPONENT == 'common' && $LEVEL == 'integration'
variables:
NUM_PROCESSES: 1
SLURM_TIMELIMIT: '00:45:00'
- if: $BACKEND == 'dace_gpu'
variables:
NUM_PROCESSES: 8
SLURM_TIMELIMIT: '01:00:00'
- if: $BACKEND == 'embedded'
variables:
SLURM_TIMELIMIT: '00:15:00'
- when: on_success
variables:
SLURM_TIMELIMIT: '00:30:00'
parallel:
matrix:
- COMPONENT: [dycore]
BACKEND: [embedded, dace_gpu, gtfn_cpu, gtfn_gpu]
LEVEL: [integration]
4 changes: 4 additions & 0 deletions ci/docker/base.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ ENV PATH="/root/.cargo/bin:${PATH}"
RUN rustc --version && which rustc && cargo --version && which cargo

# Install Bencher for performance monitoring
# Update the following comment to trigger a rebuild to update the CLI:
# last update: 2025-09-05
# This is necessary because the cloud version and the CLI version have to match
# but obviously, version changes do not register in the Dockerfile hash.
RUN curl --proto '=https' --tlsv1.2 -sSfL https://bencher.dev/download/install-cli.sh | sh
RUN bencher --version && which bencher

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def apply_flux_limiter(
p_mflx_tracer_h=p_mflx_tracer_h,
r_m=self._r_m,
p_dtime=dtime,
dbl_eps=constants.DBL_EPS,
wp_eps=constants.WP_EPS,
horizontal_start=self._start_cell_lateral_boundary_level_2, # originally i_rlstart_c = get_startrow_c(startrow_e=5) = 2
horizontal_end=self._end_cell_local,
vertical_start=0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,7 @@ def _compute_numerical_flux(
k=self._k_field,
slevp1_ti=self._slevp1_ti,
nlev=self._nlev,
dbl_eps=constants.DBL_EPS,
wp_eps=constants.WP_EPS,
p_dtime=dtime,
horizontal_start=horizontal_start,
horizontal_end=horizontal_end,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ def _compute_monotone_horizontal_multiplicative_flux_factors_p_m(
z_tracer_new_low: fa.CellKField[ta.wpfloat],
z_max: fa.CellKField[ta.vpfloat],
z_min: fa.CellKField[ta.vpfloat],
dbl_eps: ta.wpfloat,
wp_eps: ta.wpfloat,
) -> tuple[fa.CellKField[ta.wpfloat], fa.CellKField[ta.wpfloat]]:
r_p = (astype(z_max, wpfloat) - z_tracer_new_low) / (astype(z_mflx_anti_in, wpfloat) + dbl_eps)
r_m = (z_tracer_new_low - astype(z_min, wpfloat)) / (astype(z_mflx_anti_out, wpfloat) + dbl_eps)
r_p = (astype(z_max, wpfloat) - z_tracer_new_low) / (astype(z_mflx_anti_in, wpfloat) + wp_eps)
r_m = (z_tracer_new_low - astype(z_min, wpfloat)) / (astype(z_mflx_anti_out, wpfloat) + wp_eps)

return r_p, r_m

Expand All @@ -57,7 +57,7 @@ def _compute_monotone_horizontal_multiplicative_flux_factors(
z_tracer_new_low: fa.CellKField[ta.wpfloat],
beta_fct: ta.wpfloat,
r_beta_fct: ta.wpfloat,
dbl_eps: ta.wpfloat,
wp_eps: ta.wpfloat,
) -> tuple[fa.CellKField[ta.wpfloat], fa.CellKField[ta.wpfloat]]:
z_max, z_min = _compute_monotone_horizontal_multiplicative_flux_factors_min_max(
z_tracer_max, z_tracer_min, beta_fct, r_beta_fct
Expand All @@ -69,7 +69,7 @@ def _compute_monotone_horizontal_multiplicative_flux_factors(
z_tracer_new_low,
z_max,
z_min,
dbl_eps,
wp_eps,
)
return r_p, r_m

Expand All @@ -85,7 +85,7 @@ def compute_monotone_horizontal_multiplicative_flux_factors(
r_m: fa.CellKField[ta.wpfloat],
beta_fct: ta.wpfloat,
r_beta_fct: ta.wpfloat,
dbl_eps: ta.wpfloat,
wp_eps: ta.wpfloat,
horizontal_start: gtx.int32,
horizontal_end: gtx.int32,
vertical_start: gtx.int32,
Expand All @@ -99,7 +99,7 @@ def compute_monotone_horizontal_multiplicative_flux_factors(
z_tracer_new_low,
beta_fct,
r_beta_fct,
dbl_eps,
wp_eps,
out=(r_p, r_m),
domain={
dims.CellDim: (horizontal_start, horizontal_end),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ def _compute_positive_definite_horizontal_multiplicative_flux_factor(
p_rhodz_now: fa.CellKField[ta.wpfloat],
p_mflx_tracer_h: fa.EdgeKField[ta.wpfloat],
p_dtime: ta.wpfloat,
dbl_eps: ta.wpfloat,
wp_eps: ta.wpfloat,
) -> fa.CellKField[ta.wpfloat]:
p_m = neighbor_sum(maximum(0.0, p_mflx_tracer_h(C2E) * geofac_div * p_dtime), axis=C2EDim)
r_m = minimum(1.0, (p_cc * p_rhodz_now) / (p_m + dbl_eps))
r_m = minimum(1.0, (p_cc * p_rhodz_now) / (p_m + wp_eps))
return r_m


Expand All @@ -35,7 +35,7 @@ def compute_positive_definite_horizontal_multiplicative_flux_factor(
p_mflx_tracer_h: fa.EdgeKField[ta.wpfloat],
r_m: fa.CellKField[ta.wpfloat],
p_dtime: ta.wpfloat,
dbl_eps: ta.wpfloat,
wp_eps: ta.wpfloat,
horizontal_start: gtx.int32,
horizontal_end: gtx.int32,
vertical_start: gtx.int32,
Expand All @@ -47,7 +47,7 @@ def compute_positive_definite_horizontal_multiplicative_flux_factor(
p_rhodz_now,
p_mflx_tracer_h,
p_dtime,
dbl_eps,
wp_eps,
out=r_m,
domain={
dims.CellDim: (horizontal_start, horizontal_end),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
import gt4py.next as gtx
from gt4py.next import abs, where # noqa: A004

from icon4py.model.common import dimension as dims, field_type_aliases as fa, type_alias as ta
from icon4py.model.common import dimension as dims, field_type_aliases as fa
from icon4py.model.common.dimension import Koff
from icon4py.model.common.type_alias import wpfloat


# TODO(dastrm): this stencil has no test
Expand All @@ -19,13 +20,13 @@

@gtx.field_operator
def _compute_courant_number_below(
p_cellmass_now: fa.CellKField[ta.wpfloat],
z_mass: fa.CellKField[ta.wpfloat],
z_cfl: fa.CellKField[ta.wpfloat],
p_cellmass_now: fa.CellKField[wpfloat],
z_mass: fa.CellKField[wpfloat],
z_cfl: fa.CellKField[wpfloat],
k: fa.KField[gtx.int32],
nlev: gtx.int32,
dbl_eps: ta.wpfloat,
) -> fa.CellKField[ta.wpfloat]:
wp_eps: wpfloat,
) -> fa.CellKField[wpfloat]:
z_mass_pos = z_mass > 0.0

in_bounds_p0 = k <= nlev - 1
Expand Down Expand Up @@ -63,20 +64,20 @@ def _compute_courant_number_below(
p_cellmass_now_jks = where(mass_gt_cellmass_p3, p_cellmass_now(Koff[4]), p_cellmass_now_jks)

z_cflfrac = where(z_mass_pos, z_mass / p_cellmass_now_jks, 0.0)
z_cfl = z_cfl + where(z_cflfrac < 1.0, z_cflfrac, 1.0 - dbl_eps)
z_cfl = z_cfl + where(z_cflfrac < 1.0, z_cflfrac, 1.0 - wp_eps)

return z_cfl


@gtx.field_operator
def _compute_courant_number_above(
p_cellmass_now: fa.CellKField[ta.wpfloat],
z_mass: fa.CellKField[ta.wpfloat],
z_cfl: fa.CellKField[ta.wpfloat],
p_cellmass_now: fa.CellKField[wpfloat],
z_mass: fa.CellKField[wpfloat],
z_cfl: fa.CellKField[wpfloat],
k: fa.KField[gtx.int32],
slevp1_ti: gtx.int32,
dbl_eps: ta.wpfloat,
) -> fa.CellKField[ta.wpfloat]:
wp_eps: wpfloat,
) -> fa.CellKField[wpfloat]:
z_mass_neg = z_mass <= 0.0

in_bounds_m0 = k >= slevp1_ti + 1
Expand Down Expand Up @@ -116,26 +117,26 @@ def _compute_courant_number_above(
z_cfl = z_cfl - where(mass_gt_cellmass_m3, 1.0, 0.0)

z_cflfrac = where(z_mass_neg, z_mass / p_cellmass_now_jks, 0.0)
z_cfl = z_cfl + where(abs(z_cflfrac) < 1.0, z_cflfrac, dbl_eps - 1.0)
z_cfl = z_cfl + where(abs(z_cflfrac) < 1.0, z_cflfrac, wp_eps - 1.0)

return z_cfl


@gtx.field_operator
def _compute_ppm4gpu_courant_number(
p_mflx_contra_v: fa.CellKField[ta.wpfloat],
p_cellmass_now: fa.CellKField[ta.wpfloat],
z_cfl: fa.CellKField[ta.wpfloat],
p_mflx_contra_v: fa.CellKField[wpfloat],
p_cellmass_now: fa.CellKField[wpfloat],
z_cfl: fa.CellKField[wpfloat],
k: fa.KField[gtx.int32],
slevp1_ti: gtx.int32,
nlev: gtx.int32,
dbl_eps: ta.wpfloat,
p_dtime: ta.wpfloat,
) -> fa.CellKField[ta.wpfloat]:
wp_eps: wpfloat,
p_dtime: wpfloat,
) -> fa.CellKField[wpfloat]:
z_mass = p_dtime * p_mflx_contra_v

cfl_below = _compute_courant_number_below(p_cellmass_now, z_mass, z_cfl, k, nlev, dbl_eps)
cfl_above = _compute_courant_number_above(p_cellmass_now, z_mass, z_cfl, k, slevp1_ti, dbl_eps)
cfl_below = _compute_courant_number_below(p_cellmass_now, z_mass, z_cfl, k, nlev, wp_eps)
cfl_above = _compute_courant_number_above(p_cellmass_now, z_mass, z_cfl, k, slevp1_ti, wp_eps)

z_cfl = cfl_below + cfl_above

Expand All @@ -144,14 +145,14 @@ def _compute_ppm4gpu_courant_number(

@gtx.program(grid_type=gtx.GridType.UNSTRUCTURED)
def compute_ppm4gpu_courant_number(
p_mflx_contra_v: fa.CellKField[ta.wpfloat],
p_cellmass_now: fa.CellKField[ta.wpfloat],
z_cfl: fa.CellKField[ta.wpfloat],
p_mflx_contra_v: fa.CellKField[wpfloat],
p_cellmass_now: fa.CellKField[wpfloat],
z_cfl: fa.CellKField[wpfloat],
k: fa.KField[gtx.int32],
slevp1_ti: gtx.int32,
nlev: gtx.int32,
dbl_eps: ta.wpfloat,
p_dtime: ta.wpfloat,
wp_eps: wpfloat,
p_dtime: wpfloat,
horizontal_start: gtx.int32,
horizontal_end: gtx.int32,
vertical_start: gtx.int32,
Expand All @@ -164,7 +165,7 @@ def compute_ppm4gpu_courant_number(
k,
slevp1_ti,
nlev,
dbl_eps,
wp_eps,
p_dtime,
out=z_cfl,
domain={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def _prepare_numerical_quadrature_for_cubic_reconstruction(
wgt_zeta_2: ta.wpfloat,
wgt_eta_1: ta.wpfloat,
wgt_eta_2: ta.wpfloat,
dbl_eps: ta.wpfloat,
wp_eps: ta.wpfloat,
eps: ta.wpfloat,
) -> tuple[
fa.EdgeKField[ta.vpfloat],
Expand Down Expand Up @@ -97,7 +97,7 @@ def _prepare_numerical_quadrature_for_cubic_reconstruction(
p_coords_dreg_v_3_y_wp = astype(p_coords_dreg_v_3_y, wpfloat)
p_coords_dreg_v_4_y_wp = astype(p_coords_dreg_v_4_y, wpfloat)

wgt_t_detjac_1 = dbl_eps + z_wgt_1 * (
wgt_t_detjac_1 = wp_eps + z_wgt_1 * (
(
z_eta_1_1 * (p_coords_dreg_v_2_x_wp - p_coords_dreg_v_1_x_wp)
+ z_eta_1_2 * (p_coords_dreg_v_3_x_wp - p_coords_dreg_v_4_x_wp)
Expand All @@ -115,7 +115,7 @@ def _prepare_numerical_quadrature_for_cubic_reconstruction(
- z_eta_1_4 * (p_coords_dreg_v_2_x_wp - p_coords_dreg_v_3_x_wp)
)
)
wgt_t_detjac_2 = dbl_eps + z_wgt_2 * (
wgt_t_detjac_2 = wp_eps + z_wgt_2 * (
(
z_eta_2_1 * (p_coords_dreg_v_2_x_wp - p_coords_dreg_v_1_x_wp)
+ z_eta_2_2 * (p_coords_dreg_v_3_x_wp - p_coords_dreg_v_4_x_wp)
Expand All @@ -133,7 +133,7 @@ def _prepare_numerical_quadrature_for_cubic_reconstruction(
- z_eta_2_4 * (p_coords_dreg_v_2_x_wp - p_coords_dreg_v_3_x_wp)
)
)
wgt_t_detjac_3 = dbl_eps + z_wgt_3 * (
wgt_t_detjac_3 = wp_eps + z_wgt_3 * (
(
z_eta_3_1 * (p_coords_dreg_v_2_x_wp - p_coords_dreg_v_1_x_wp)
+ z_eta_3_2 * (p_coords_dreg_v_3_x_wp - p_coords_dreg_v_4_x_wp)
Expand All @@ -151,7 +151,7 @@ def _prepare_numerical_quadrature_for_cubic_reconstruction(
- z_eta_3_4 * (p_coords_dreg_v_2_x_wp - p_coords_dreg_v_3_x_wp)
)
)
wgt_t_detjac_4 = dbl_eps + z_wgt_4 * (
wgt_t_detjac_4 = wp_eps + z_wgt_4 * (
(
z_eta_4_1 * (p_coords_dreg_v_2_x_wp - p_coords_dreg_v_1_x_wp)
+ z_eta_4_2 * (p_coords_dreg_v_3_x_wp - p_coords_dreg_v_4_x_wp)
Expand Down Expand Up @@ -342,7 +342,7 @@ def prepare_numerical_quadrature_for_cubic_reconstruction(
wgt_zeta_2: ta.wpfloat,
wgt_eta_1: ta.wpfloat,
wgt_eta_2: ta.wpfloat,
dbl_eps: ta.wpfloat,
wp_eps: ta.wpfloat,
eps: ta.wpfloat,
horizontal_start: gtx.int32,
horizontal_end: gtx.int32,
Expand Down Expand Up @@ -386,7 +386,7 @@ def prepare_numerical_quadrature_for_cubic_reconstruction(
wgt_zeta_2,
wgt_eta_1,
wgt_eta_2,
dbl_eps,
wp_eps,
eps,
out=(
p_quad_vector_sum_1,
Expand Down
Loading