Skip to content

Update compiler flags for consistency with FMS - #91

Draft
dougiesquire wants to merge 5 commits into
masterfrom
fms-flag-consolidate
Draft

dougiesquire wants to merge 5 commits into
masterfrom
fms-flag-consolidate

Conversation

@dougiesquire

Copy link
Copy Markdown
Collaborator

This PR updates the compiler flags in the CMakeLists for consistency with what is used in FMS - see discussion here.

This is a temporary measure until we have a organisational recommendations for compiler flags. This change should not change any answers (will test)

@dougiesquire dougiesquire self-assigned this Aug 21, 2026
@dougiesquire

Copy link
Copy Markdown
Collaborator Author

Note, I removed -check noarg_temp_created from CMAKE_Fortran_FLAGS. This was doing nothing due to the -check none in the RELEASE and RELWITHDEBINFO set. It is still included in the DEBUG set.

@dougiesquire

Copy link
Copy Markdown
Collaborator Author

This is ready for review together with ACCESS-NRI/FMS#27 @harshula, @manodeep

No answer changes with oneapi in ACCESS-OM2 or ACCESS-ESM1.6 (tested here and here)

@manodeep manodeep left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The standardisation of compiler flags looks good!

I made a note about MOM5_DETERMINISTIC and build-types

Comment thread cmake/CMakeLists.txt
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fno-alias -safe-cray-ptr -fpe0 -ftz -assume byterecl -i4 -r8 -nowarn -check noarg_temp_created -assume nobuffered_io -convert big_endian -grecord-gcc-switches -fp-model precise -fp-model source -align all")
if(CMAKE_Fortran_COMPILER_ID STREQUAL "Intel")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fno-alias -safe-cray-ptr -fpe0 -ftz -assume byterecl -integer-size 32 -real-size 64 -nowarn -assume nobuffered_io -convert big_endian -fp-model precise -fp-model source -align all")
if (MOM5_DETERMINISTIC)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Almost certainly a separate issue, but if MOM5_DETERMINISTIC is set, then is the build-type also set to Release? Without a specified build-type, it will default to RelWithDebInfo and those flags do not have a corresponding MOM5_DETERMINISTIC branch

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@dougiesquire What do you think about this one ☝🏾?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The RelWithDebInfo flags are appended to the Release flags so in theory this is okay. But without testing that I don't want to do, I'm not confident that the additional flags added by RelWithDebInfo don't break the determinism (e.g. add a timestamp to the exe). So to be safe, I'll prevent setting MOM5_DETERMINISTIC with anything other than Release.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I've also updated the spack package accordingly

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.

2 participants