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

Update cmake config to support new NCEP libraries (imported targets) on Tier-2 platforms #177

Merged

Conversation

climbfuji
Copy link
Collaborator

Description

This PR is a follow-up and clean-up for #172.

  • updates the modulefiles and cmake configurations for Tier-2 platforms in order to work with the new NCEP libraries (imported targets)
  • cleans up cmake configurations (AVX2 flags, DEBUG and REPRO mode) and declares SIMDMULTIARCH flags as a real alternative to the AVX2 flags
  • removes old build targets cheyenne.intel-mpi and supermuc-phase2.intel
  • clean up of build.sh

Noting that for some platforms the responsibility for maintaining it may be handed off to somebody else and the directory layout/naming for the thirdparty and NCEP libraries may change as a result of it.

Issue(s) addressed

n/a

Testing

  • compiles and runs on macosx.gnu, gaea.intel, jet.intel, stampede.intel, cheyenne.gnu, cheyenne.intel
  • currently creating new baselines on cheyenne.gnu and cheyenne.intel using rt.sh
  • need to run regression tests on tier-1 platforms and cheyenne.gnu and cheyenne.intel once these PRs are at the top of the commit queue

Dependencies

Waiting on:
NOAA-EMC/fv3atm#150
NOAA-EMC/NEMS#74

@climbfuji
Copy link
Collaborator Author

Ready from my side.

@climbfuji
Copy link
Collaborator Author

Regression testing on cheyenne.intel and cheyenne.gnu: first create new baselines (Cheyenne did not yet have a 2020724 baseline), then verify against it: all tests pass, regression test logs updated in PR.

rt_cheyenne_gnu_create.log
rt_cheyenne_gnu_verify.log
rt_cheyenne_intel_create.log
rt_cheyenne_intel_verify.log

@climbfuji
Copy link
Collaborator Author

Regression testing on hera.intel and hera.gnu against existing baseline: all tests pass, logs updated in the PR.

rt_hera_gnu.log
rt_hera_intel.log

@climbfuji
Copy link
Collaborator Author

Regression testing on orion.intel, wcoss_cray, wcoss_dell_p3 against existing baseline: all tests pass, logs updated in the PR.

Copy link
Contributor

@aerorahul aerorahul left a comment

Choose a reason for hiding this comment

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

There is incorrect use of defining compiler flags.
CMAKE_<lang>_FLAGS_<BUILDTYPE> should be defined for the appropriate CMAKE_BUILD_TYPE.
One should not "jam" those flags into the CMAKE_<lang>_FLAGS variable.
CMake knows what the BUILD TYPE is and will append the appropriate flags.

See:
https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_FLAGS.html
https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html#variable:CMAKE_BUILD_TYPE

Comment on lines +43 to +44
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
Copy link
Contributor

Choose a reason for hiding this comment

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

What the the purpose of this?
A=A?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I didn't write this code.

Copy link
Contributor

Choose a reason for hiding this comment

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

Understood.
Since there is cleaning e.g. AVX2 etc. and adding flags, it is appropriate to comment.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is an addition. GREEN.

@@ -1,24 +1,23 @@

set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fcray-pointer -ffree-line-length-none -fno-range-check -fbacktrace")


if(DEBUG)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -Wall -O0 -ggdb -fno-unsafe-math-optimizations -frounding-math -fsignaling-nans -ffpe-trap=invalid,zero,overflow -fbounds-check")
Copy link
Contributor

Choose a reason for hiding this comment

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

This is not the correct way of adding DEBUG flags.
Please add DEBUG flags in CMAKE variable for e.g.

set(CMAKE_Fortran_FLAGS_DEBUG "-Wall -O0 -ggdb -fno-unsafe-math-optimizations -frounding-math -fsignaling-nans -ffpe-trap=invalid,zero,overflow -fbounds-check" )

Cmake will automatically add these flags when the build_type is DEBUG.
See
https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html#variable:CMAKE_BUILD_TYPE

Please do this where DEBUG flags are set.

set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -O0 -ggdb")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0")
add_definitions(-DDEBUG)
elseif(REPRO)
Copy link
Contributor

Choose a reason for hiding this comment

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

REPRO a CMAKE_BUILD_TYPE? If not, it should be defined as such.
Flags specific to REPRO should be defined as
CMAKE_<lang>_FLAGS_REPRO

Comment on lines 40 to 41
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the purpose of this? A=A.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I didn't write this code.

@@ -18,29 +18,33 @@ if(REPRO)
add_definitions(-DREPRO)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -qno-opt-dynamic-align")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -qno-opt-dynamic-align")
elseif(DEBUG)
add_definitions(-DDEBUG)
Copy link
Contributor

Choose a reason for hiding this comment

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

CMAKE_BUILD_TYPE is DEBUG.
Use appropriate CMAKE_<lang>_FLAGS_DEBUG

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Please submit a follow-up PR to clean up the entire cmake build system. I am only making minimal changes to an existing cmake build system that already has DEBUG and REPRO defined. I don't think we want to make these changes now and rerun all the regression tests, but I may be mistaken.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is new code added.
If you want to add something, adding it correctly won't impact older issues.
But, just building on older issues will make future clean-up harder.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If I make the changes as you suggested, I'll break the existing builds. You'll see why in a minute when I walk you throuh the legacy code.

endif()
endif()

if(REPRO)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -O2 -debug minimal -fp-model consistent -qoverride-limits -g -traceback")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2 -debug minimal")
elseif(DEBUG)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -g -O0 -check -check noarg_temp_created -check nopointer -warn -warn noerrors -fp-stack-check -fstack-protector-all -fpe0 -debug -traceback -ftrapuv")
Copy link
Contributor

Choose a reason for hiding this comment

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

DEBUG flags are inappropriate in this CMAKE variable.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is an addition. GREEN.

@DusanJovic-NOAA
Copy link
Collaborator

@aerorahul This needs to be cleaned up. For example DEBUG flags was used (instead of CMAKE_BUILD_TYPE) because that flag is used in GNU make build, so we wanted to maintain that during the transition and make maintenance of compile.sh scripts as similar as possible. There are many other redundant flags in both GNU and Intel configs (-qno-opt-dynamic-align for example). The original version of these files was just a rewrite of gnu make configuration files (ex. conf/configure.fv3.hera.intel).

We keep postponing this cleanup until we fully transition to cmake (ie. remove GNU build entirely).

@climbfuji
Copy link
Collaborator Author

@aerorahul This needs to be cleaned up. For example DEBUG flags was used (instead of CMAKE_BUILD_TYPE) because that flag is used in GNU make build, so we wanted to maintain that during the transition and make maintenance of compile.sh scripts as similar as possible. There are many other redundant flags in both GNU and Intel configs (-qno-opt-dynamic-align for example). The original version of these files was just a rewrite of gnu make configuration files (ex. conf/configure.fv3.hera.intel).

We keep postponing this cleanup until we fully transition to cmake (ie. remove GNU build entirely).

I'll have a quick chat with @aerorahul at 8.30 am MT to explain the origin for all this "build code". I'll invite you, too, in case you have time to attend.

@climbfuji
Copy link
Collaborator Author

@aerorahul Could you please approve the PR based on our earlier discussion, noting that we will fix the issues you raised as part of our grand cleanup work? Thanks ...

Copy link
Contributor

@aerorahul aerorahul left a comment

Choose a reason for hiding this comment

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

Following enlightening offline conversation with @climbfuji and @DusanJovic-NOAA and recognizing the details and need for keeping the flags until a later time when the GNU build is decommissioned, I approve this PR.

I am leaving the comments here for reference.

Copy link
Collaborator

@junwang-noaa junwang-noaa left a comment

Choose a reason for hiding this comment

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

I did not closely follow the cmake development, it looks to me the changes shows no impact on the results. Maybe you can give some presentation on cmake build in ufs-weather-model once the cmake is able to replace the gnu build, thanks

@DusanJovic-NOAA DusanJovic-NOAA merged commit 0d3b5ce into ufs-community:develop Jul 30, 2020
@climbfuji
Copy link
Collaborator Author

Thanks, everyone!

@MinsukJi-NOAA
Copy link
Contributor

@climbfuji, I see that in modulefiles/linux.gnu/fv3, library paths for NETCDF, ESMF, NCEPLIBS, and etc. have been removed. Where should I specify them? -- I am using this fv3 file in my github actions workflow currently.

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.

5 participants