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

Loki: Always inline stmt functions from C-headers #105

Merged
merged 4 commits into from
Dec 19, 2024

Conversation

mlange05
Copy link
Collaborator

This PR removes the use of the re-written one-line elemental functions that where used to facilitate inlining of the historical "commdeck" functions. This was a hard requirement for all flavours of C-transpilation. However, Loki can now also inline raw statement functions, if they have been internalised to the kernel via preprocessing. In this PR we now switch this on in the Loki config and remove the special treatment from the CMake config.

Note, I've also piggy-backed an update to the latest Loki version and the removal or a rogue import, that can cause problems.

Another note, I've also left the module-based elemental functions in the source, for reference, and because there are CUF-specific versions in the same place. I've only cleaned up the raw C-transpilation, but not yet any of CUF modes.

@mlange05 mlange05 force-pushed the naml-loki-stmt-func-inline branch from 57a665d to 418e0c0 Compare December 19, 2024 06:28
@mlange05
Copy link
Collaborator Author

Integration note: This requires a very recent Loki commit, which has not been tagged yet:
ecmwf-ifs/loki@ad1e2bc

@mlange05 mlange05 marked this pull request as ready for review December 19, 2024 07:48
Copy link
Contributor

@MichaelSt98 MichaelSt98 left a comment

Choose a reason for hiding this comment

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

Nice! I agree, there is no need to keep the re-written one-line elemental functions.

Copy link
Collaborator

@reuterbal reuterbal left a comment

Choose a reason for hiding this comment

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

Very nice! Are the fcttre_mod.F90 and fccld_mod.F90 files still used anywhere? Otherwise I would suggest removing them.

Comment on lines -33 to -38
# OFP frontend cannot deal with statement functions, so we toggle them here
set( CLOUDSC_DEFINE_STMT_FUNC "" )
if(NOT "${LOKI_FRONTEND}" STREQUAL "ofp")
set( CLOUDSC_DEFINE_STMT_FUNC CLOUDSC_STMT_FUNC )
endif()

Copy link
Collaborator

Choose a reason for hiding this comment

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

❤️

@reuterbal
Copy link
Collaborator

Oh, the Loki upgrade in #100 has incurred a conflict, this branch needs a rebase now

This removes a lot of the handholding needed for the C-specific
transpile variant, where the utility functions where previously
inlined from re-written elemental functions. Instead we now configure
the Loki `InlineTransformation` to inline those, and force the CLOUDSC
kernel to be preprocessed, so that we may find the comdeck functions.

Note, I've left the source for the re-written elemental functions in
the common directory for reference. If that becomes annoying, these
can now be removed.
@mlange05 mlange05 force-pushed the naml-loki-stmt-func-inline branch from 418e0c0 to a0983f2 Compare December 19, 2024 14:24
@mlange05
Copy link
Collaborator Author

Very nice! Are the fcttre_mod.F90 and fccld_mod.F90 files still used anywhere? Otherwise I would suggest removing them.

No they are not used anymore. Their equivalents in CUF-land are tho, so I left them in. I'll remove the original now, we can remove the CUD ones once the pipeline is adjusted there (sorry, did this one quickly).

@mlange05 mlange05 force-pushed the naml-loki-stmt-func-inline branch from 43431a7 to fa1391b Compare December 19, 2024 14:37
@reuterbal reuterbal merged commit 842c1b8 into develop Dec 19, 2024
32 checks passed
@reuterbal reuterbal deleted the naml-loki-stmt-func-inline branch December 19, 2024 20:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants