-
Notifications
You must be signed in to change notification settings - Fork 258
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
Update cmake config to support new NCEP libraries (imported targets) on Tier-2 platforms #177
Conversation
…ake/Intel.cmake and cmake/GNU.cmake
…e review and testing
Ready from my side. |
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 |
Regression testing on hera.intel and hera.gnu against existing baseline: all tests pass, logs updated in the PR. |
Regression testing on orion.intel, wcoss_cray, wcoss_dell_p3 against existing baseline: all tests pass, logs updated in the PR. |
There was a problem hiding this 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
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS}") | ||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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") |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS}") | ||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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") |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
@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. |
@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 ... |
There was a problem hiding this 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.
There was a problem hiding this 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
Thanks, everyone! |
@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. |
Description
This PR is a follow-up and clean-up for #172.
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
rt.sh
Dependencies
Waiting on:
NOAA-EMC/fv3atm#150
NOAA-EMC/NEMS#74