Using explicit shapes for dummy arguments compared to assumed shapes
Posted by Mikael Stellio 05/16/2023 https://redmine.hammoz.ethz.ch/issues/851
In the majority of the icon-ham code, dummy arguments are declared with explicit shapes, which may lead to unwanted copies when the arrays passed to a subroutine are not contiguous. This is well explained in this Stack Overflow post: https://stackoverflow.com/a/75052091.
Even though these copies are not a visible problem for CPU runs, they cause problems on GPU, since the copied array won't be present on the device, but only on the host. A workaround for this is to differentiate the problematic argument declaration between explicit shape for CPU runs and assumed shape for GPU runs with an #ifdef _OPENACC
. However this quickly renders the code difficult to read and just messy in general.
A final solution would be to switch to assumed shapes in the whole icon-ham code, as it is already the case in other ICON repositories, like icon-nwp.