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

CMake Build Improvements #680

Merged
merged 4 commits into from
Feb 9, 2023
Merged

CMake Build Improvements #680

merged 4 commits into from
Feb 9, 2023

Conversation

rcabell
Copy link
Collaborator

@rcabell rcabell commented Feb 9, 2023

TYPE: bugfix/enhancement

KEYWORDS: build, CMake, PGI, gfortran9

SOURCE: WRF-Hydro Team @ NCAR

DESCRIPTION OF CHANGES:

  • In the classic build system, don't report success if the underlying Make process failed.

  • In CMake build system, remove -fallow-argument-mismatch from gfortran flags, since this breaks compatibiilty with older GNU suites (< v10) and not needed anymore with use netcdf

  • Update the CMake build system to use FIND_MPI() and not override the compiler variables with static mpif90 wrapper scripts. This also explicitly links MPI libaries to modules that require it.

  • Support PGI (> v20) and NVHPC in CMake:

    • added compiler flags from arc/macros.mpp.linux
    • added use ieee_arithmetic, only: isnan => ieee_is_nan to CROCUS since PGI doesn't support isnan() intrinsic (this may help on other compilers too)

ISSUES:

Fixes #640, #677

TESTS CONDUCTED: pending

Checklist

Merging the PR depends on following checklist being completed. Add X between each of the square
brackets if they are completed in the PR itself. If a bullet is not relevant to you, please comment
on why below the bullet.

The `make; make install` command will report success even if the first
Make process failed. The result of this compound expression is passed to
the code that prints success/failure to the user.

Fixed by switching to `make && make install` to chain the result codes.
Use IEEE_ARITHMETIC's ieee_is_nan() instead of compiler-specific
intrinsics for broader compatibility.
* Use find_package(MPI required) instead of overriding compiler binaries
* Add support for PGI (and NVHPC) in CMake build system
* Update minimum CMake to 3.0
@rcabell rcabell requested a review from scrasmussen February 9, 2023 17:10
@scrasmussen
Copy link
Member

These changes look good to me. The only thing I would recommend, if you want to, is to remove the cmake_minimum_required (VERSION 3.0) from the top of every CMakeLists.txt file other than the one in the top directory. It is my understanding it is only needed once at the top of the project and in the future would make it easier to update the version number.

@rcabell
Copy link
Collaborator Author

rcabell commented Feb 9, 2023

It would be nice to remove the minimum version from each file -- I did a grep to change it out thinking that it wasn't inherited from the upstream CMakeLists.txt. I'll make that change.

@rcabell rcabell force-pushed the build-improvements branch from 8b236f0 to d7ffafa Compare February 9, 2023 18:44
Copy link
Member

@scrasmussen scrasmussen left a comment

Choose a reason for hiding this comment

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

Looks good to me! Built successfully with Intel and GNU modules

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