From 9d386029b759fd8ab2d49bf01d001d63d0671a6d Mon Sep 17 00:00:00 2001 From: Balthasar Reuter Date: Thu, 19 Feb 2026 18:23:31 +0200 Subject: [PATCH 1/3] Fixes for CCE 18 and 19 compatibility --- cmake/compiler_flags/Cray_Fortran.cmake | 31 +++++++++++++++++++++---- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/cmake/compiler_flags/Cray_Fortran.cmake b/cmake/compiler_flags/Cray_Fortran.cmake index 95f15230..1a4865d4 100644 --- a/cmake/compiler_flags/Cray_Fortran.cmake +++ b/cmake/compiler_flags/Cray_Fortran.cmake @@ -8,8 +8,29 @@ # -emf activates .mods and uses lower case # -rmoid produces a listing file -set( CMAKE_Fortran_FLAGS_RELEASE "-emf -rmoid -N 1023 -O3 -hfp3 -hscalar3 -hvector3 -DNDEBUG" CACHE STRING "Release Fortran flags" FORCE ) -set( CMAKE_Fortran_FLAGS_RELWITHDEBINFO "-emf -rmoid -N 1023 -O2 -hfp1 -g -DNDEBUG" CACHE STRING "Release-with-debug-info Fortran flags" FORCE ) -set( CMAKE_Fortran_FLAGS_PRODUCTION "-emf -rmoid -N 1023 -O2 -hfp1 -g" CACHE STRING "Production Fortran flags" FORCE ) -set( CMAKE_Fortran_FLAGS_BIT "-emf -rmoid -N 1023 -O2 -hfp1 -g -hflex_mp=conservative -hadd_paren -DNDEBUG" CACHE STRING "Bit-reproducible Fortran flags" FORCE ) -set( CMAKE_Fortran_FLAGS_DEBUG "-emf -rmoid -N 1023 -O0 -g" CACHE STRING "Debug Fortran flags" FORCE ) + +if( CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER_EQUAL 18.0.1 ) + # From CCE 18.0.1 onwards, HPE/Cray renamed mod files for Fortran submodules + # from .mod to ..smod + # CMake does not yet (as of v4.2.3) handle this correctly, thus we have to + # manually inject the correct behaviour here by + set( CMAKE_Fortran_SUBMODULE_SEP "." ) + 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 ) + # Unfortunately, CCE 18 and 19 incurred a bug in the lower-casing of + # 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. + set( _crayftn_mod_options "-em" ) +else() + set( _crayftn_mod_options "-emf" ) +endif() + +set( CMAKE_Fortran_FLAGS_RELEASE "${_crayftn_mod_options} -rmoid -N 1023 -O3 -hfp3 -hscalar3 -hvector3 -DNDEBUG" CACHE STRING "Release Fortran flags" FORCE ) +set( CMAKE_Fortran_FLAGS_RELWITHDEBINFO "${_crayftn_mod_options} -rmoid -N 1023 -O2 -hfp1 -g -DNDEBUG" CACHE STRING "Release-with-debug-info Fortran flags" FORCE ) +set( CMAKE_Fortran_FLAGS_PRODUCTION "${_crayftn_mod_options} -rmoid -N 1023 -O2 -hfp1 -g" CACHE STRING "Production Fortran flags" FORCE ) +set( CMAKE_Fortran_FLAGS_BIT "${_crayftn_mod_options} -rmoid -N 1023 -O2 -hfp1 -g -hflex_mp=conservative -hadd_paren -DNDEBUG" CACHE STRING "Bit-reproducible Fortran flags" FORCE ) +set( CMAKE_Fortran_FLAGS_DEBUG "${_crayftn_mod_options} -rmoid -N 1023 -O0 -g" CACHE STRING "Debug Fortran flags" FORCE ) From 36c355ce2d4a3a580b527cb6d237225f401c9d8a Mon Sep 17 00:00:00 2001 From: Balthasar Reuter Date: Mon, 23 Feb 2026 12:26:40 +0200 Subject: [PATCH 2/3] Fix typo in variable name --- cmake/compiler_flags/Cray_Fortran.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/compiler_flags/Cray_Fortran.cmake b/cmake/compiler_flags/Cray_Fortran.cmake index 1a4865d4..591c9933 100644 --- a/cmake/compiler_flags/Cray_Fortran.cmake +++ b/cmake/compiler_flags/Cray_Fortran.cmake @@ -18,7 +18,7 @@ if( CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER_EQUAL 18.0.1 ) 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 ) +if( CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER_EQUAL 18.0.0 AND CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 20.0.0 ) # Unfortunately, CCE 18 and 19 incurred a bug in the lower-casing of # submodule .smod files with the above change, leading to incomplete # lower-casing of the output file name, e.g., `parent_mod.sUB_MOD.smod`. From bbc52c86115773a02956de558d6c7902dfdd30f8 Mon Sep 17 00:00:00 2001 From: Balthasar Reuter Date: Thu, 26 Feb 2026 16:37:02 +0200 Subject: [PATCH 3/3] Skip ineffective SUBMODULE settings --- cmake/compiler_flags/Cray_Fortran.cmake | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/cmake/compiler_flags/Cray_Fortran.cmake b/cmake/compiler_flags/Cray_Fortran.cmake index 591c9933..65c0d44d 100644 --- a/cmake/compiler_flags/Cray_Fortran.cmake +++ b/cmake/compiler_flags/Cray_Fortran.cmake @@ -9,21 +9,12 @@ # -emf activates .mods and uses lower case # -rmoid produces a listing file -if( CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER_EQUAL 18.0.1 ) - # From CCE 18.0.1 onwards, HPE/Cray renamed mod files for Fortran submodules - # from .mod to ..smod - # CMake does not yet (as of v4.2.3) handle this correctly, thus we have to - # manually inject the correct behaviour here by - set( CMAKE_Fortran_SUBMODULE_SEP "." ) - set( CMAKE_Fortran_SUBMODULE_EXT ".smod" ) -endif() - if( CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER_EQUAL 18.0.0 AND CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 20.0.0 ) # Unfortunately, CCE 18 and 19 incurred a bug in the lower-casing of - # submodule .smod files with the above change, leading to incomplete - # lower-casing of the output file name, e.g., `parent_mod.sUB_MOD.smod`. + # submodule .smod files, 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. + # lowr-casing, thus only using the `-em` option for versions in-between. set( _crayftn_mod_options "-em" ) else() set( _crayftn_mod_options "-emf" )