Fixes for CCE 18 and 19 compatibility#132
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates Cray Fortran compiler flag configuration to better support CCE 18/19 submodule .smod naming and related lower-casing behavior, working around gaps in CMake’s handling of Cray’s submodule module-file conventions.
Changes:
- Add conditional overrides for
CMAKE_Fortran_SUBMODULE_SEP/CMAKE_Fortran_SUBMODULE_EXTfor CCE ≥ 18.0.1. - Select
-emvs-emfmodule options depending on CCE version range (CCE 18/19 vs others). - Refactor Fortran build-type flags to reuse a common
_crayftn_mod_optionsprefix.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| set( CMAKE_Fortran_SUBMODULE_EXT ".smod" ) | ||
| endif() | ||
|
|
||
| if( CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER_EQUAL 18.0.0 AND CMAKE_Fortran_COMPILER VERSION_LESS 20.0.0 ) |
There was a problem hiding this comment.
The version-range check uses CMAKE_Fortran_COMPILER VERSION_LESS 20.0.0, but CMAKE_Fortran_COMPILER is typically a path to the compiler executable, not a version string. This makes the condition unreliable (and can mis-detect CCE 18/19). Use CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 20.0.0 for the upper-bound comparison (or compare only against CMAKE_Fortran_COMPILER_VERSION on both sides).
| if( CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER_EQUAL 18.0.0 AND CMAKE_Fortran_COMPILER VERSION_LESS 20.0.0 ) | |
| if( CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER_EQUAL 18.0.0 AND CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 20.0.0 ) |
| # submodule .smod files with the above change, leading to incomplete | ||
| # lower-casing of the output file name, e.g., `parent_mod.sUB_MOD.smod`. | ||
| # This is supposedly fixed in CCE20, but we have to switch off the use of | ||
| # the `-ef` option for versions in-between. |
There was a problem hiding this comment.
Comment mentions disabling the -ef option, but the logic is actually toggling between -emf and -em (i.e., dropping the trailing f). To avoid confusion for future maintainers, update the comment to reference the actual flag being changed (e.g., -emf / the f modifier) or confirm -ef is the intended option name.
| # the `-ef` option for versions in-between. | |
| # the `-emf` option (i.e., drop the trailing `f` and use `-em`) for versions in-between. |
|
Unfortunately the SUBMODULE_SEP and SUBMODULE_EXT settings appear to be ineffective when applied here or in a toolchain.cmake. The CMake modules available on LUMI, however, apply a fix locally and I'll suggest a fix to CMake (unfortunately their Gitlab is currently unreachable with a Bad Gateway error). Thus this PR is reduced to not enforcing the module name lower-casing in the compiler versions affected by the bug. |
wdeconinck
left a comment
There was a problem hiding this comment.
That looks good. Thanks @reuterbal !
Description
Rationale is in the comments in the file. Keeping this in draft state until I have completed testing.
Contributor Declaration
By opening this pull request, I affirm the following: