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

Decide on FMS compile flags #1

Open
harshula opened this issue Aug 23, 2024 · 3 comments
Open

Decide on FMS compile flags #1

harshula opened this issue Aug 23, 2024 · 3 comments
Assignees

Comments

@harshula
Copy link
Collaborator

The existing CMakeLists.txt contains the following compile flags:

FMS/CMakeLists.txt

Lines 40 to 64 in 38c7dbe

if(CMAKE_Fortran_COMPILER_ID STREQUAL "Intel")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fno-alias -stack-temps -safe-cray-ptr -ftz -assume byterecl -i4 -r8 -nowarn -sox -traceback")
set(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE} -O2 -fp-model source")
set(CMAKE_Fortran_FLAGS_RELWITHDEBINFO "${CMAKE_Fortran_FLAGS_RELWITHDEBINFO} -g")
set(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} -g -O0 -check -check noarg_temp_created -check nopointer -warn -warn noerrors -fpe0 -ftrapuv")
elseif(CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -no-pie -fcray-pointer -fdefault-real-8 -ffree-line-length-none -fno-range-check")
set(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE} -O2")
set(CMAKE_Fortran_FLAGS_RELWITHDEBINFO "${CMAKE_Fortran_FLAGS_RELWITHDEBINFO} -g")
set(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} -O0 -g -Wuninitialized -fcheck=bounds -Werror -ffpe-trap=invalid,zero,overflow")
else ()
message ("Unknown FORTRAN compiler default flags only...")
endif()
if(CMAKE_C_COMPILER_ID STREQUAL "Intel")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -sox -traceback")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0 -debug")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O2 -debug minimal")
elseif(CMAKE_C_COMPILER_ID STREQUAL "GNU")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -frecord-gcc-switches")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0 -Werror -Wuninitialized -Wno-stringop-overflow")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O2")
else ()
message ("Unknown C compiler default flags only...")
endif()

The upstream FMS compile flags are: 02bdd2f

The MOM5 compile flags are: https://github.com/ACCESS-NRI/MOM5/blob/6d8768648ffa2326b4817c3de9ccb25e9d808585/bin/mkmf.template.nci#L39-L51

Which of them should we use?

@harshula
Copy link
Collaborator Author

Example of compilation flags from MOM5 with git subtree FMS (spack install mom5@master %[email protected] target=x86_64): mpifort -Duse_netCDF -Duse_libMPI -DACCESS_OM -DUSE_OCEAN_BGC -fpp -Wp,-w -I/opt/release/linux-rocky8-x86_64/intel-2021.2.0/oasis3-mct-master-df2rx2hjfd2xmwfu34nzfkdugo34voew/include/psmile.MPI1 -I/opt/release/linux-rocky8-x86_64/intel-2021.2.0/oasis3-mct-master-df2rx2hjfd2xmwfu34nzfkdugo34voew/include -I/opt/release/linux-rocky8-x86_64/intel-2021.2.0/libaccessom2-master-ss24s7pyzzhbzck5dsqjd2z4ca3lavkw/include -I/opt/release/linux-rocky8-x86_64/intel-2021.2.0/netcdf-fortran-4.6.1-dutskkuweiulkdk3vmdzvmshgc4wtuo2/include -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 -align all -fp-model precise -fp-model source -align all -g3 -O2 -xCORE-AVX2 -debug all -check none -traceback -c -I/tmp/root/spack-stage/spack-stage-mom5-master-vgak75luzyoz6ietfh46jpj2laox6xxf/spack-src/src/shared/include /tmp/root/spack-stage/spack-stage-mom5-master-vgak75luzyoz6ietfh46jpj2laox6xxf/spack-src/src/shared/fms/fms.F90

@harshula
Copy link
Collaborator Author

Looks like src/shared/fms/fms.F90 is currently compiled with MOM5 compile flags. So, if we want to be consistent with existing MOM5 compilations, I guess we have to build FMS with MOM5 compile flags?

@dougiesquire
Copy link

I guess we have to build FMS with MOM5 compile flags?

Agreed - I think we want to consistent with what was being done before

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress
Development

No branches or pull requests

4 participants