Some reductions in the ICON code that have the same start and end location include the center value in the reduction. This can not really be emulated with a trailing (or leading) additional operation if sparse dimensions are involved. That is, the entry for the central location in the sparse dimension would need to be extracted, involving manipulation of the memory of the sparse dimension, which we want to avoid. Hence, this PR:
adds an option to include the center to the reduction expression
adds an option to include the center to the loop statement
adds a field to sparse dimensions to indicate whether they are intended to be used in the reductions/loop statements including or excluding the center. This is type checked in the UnstructuredDimensionsChecker.
Resolves / Enhances
Fixes issue #1000
Example
An example where this is needed can for example be found in mo_math_gradients.f90 in the function grad_green_gauss_cell_dycore
Testing
Quite a few tests have been added:
dawn4py test
integration tests using the IIRBuilder with output verification
tests ensuring proper de/serialization of the newly introduced properties
tests exercising the UnstructuredDimensionsChecker
Unfortunately some things like the ico-cuda code generation have been tested manually only. The only way to inject this into the current CI would be icondusk-e2e, but dusk is currently not able to generate fields/reductions/loop statements including the center.
Technical Description
Some reductions in the ICON code that have the same start and end location include the center value in the reduction. This can not really be emulated with a trailing (or leading) additional operation if sparse dimensions are involved. That is, the entry for the central location in the sparse dimension would need to be extracted, involving manipulation of the memory of the sparse dimension, which we want to avoid. Hence, this PR:
UnstructuredDimensionsChecker
.Resolves / Enhances
Fixes issue #1000
Example
An example where this is needed can for example be found in
mo_math_gradients.f90
in the functiongrad_green_gauss_cell_dycore
Testing
Quite a few tests have been added:
IIRBuilder
with output verificationUnstructuredDimensionsChecker
Unfortunately some things like the ico-cuda code generation have been tested manually only. The only way to inject this into the current CI would be
icondusk-e2e
, but dusk is currently not able to generate fields/reductions/loop statements including the center.Dependencies
This PR is independent.