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

Fixes for non-Baselibs (spack) build #2682

Merged
merged 17 commits into from
May 2, 2024
Merged

Conversation

mathomp4
Copy link
Member

@mathomp4 mathomp4 commented Mar 27, 2024

NOTE

A note to @tclune This branch is called hotfix/mathomp4/fix-spack-build only because a previous attempt (see #2599) when I thought it was a simple fix was a hotfix. But since this will require a newer ESMF, we are sort of stuck not making it a hotfix. But keeping the branch name the same lets CI be happy in testing.

Description

As found by @AlexanderRichert-NOAA in spack/spack#42619 I was a bit too heavy-handed with the sed and changed too many things to ESMF::ESMF. As such, I broke the Spack build of MAPL 2.44

For spack install mapl to work, this will require ESMF 8.6.1. In this case we will be moving to ESMA Baselibs 7.24.0 which has ESMF 8.6.1b04 (which is functionally identical to ESMF 8.6.1).

So, this updates the internal components to ESMA_env v4.29.0 (Baselibs 7.24.0) and ESMA_cmake v3.45.0 (Update FindESMF.cmake and more).

Related:

Related Issue

Motivation and Context

Fixes the spack build of MAPL!

How Has This Been Tested?

This builds in GEOSgcm and is zero-diff and spack install mapl works as well.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Trivial change (affects only documentation or cleanup)

Checklist:

  • I have tested this change with a run of GEOSgcm (if non-trivial)
  • I have added one of the required labels (0 diff, 0 diff trivial, 0 diff structural, non 0-diff)
  • I have updated the CHANGELOG.md accordingly following the style of Keep a Changelog

@mathomp4 mathomp4 added the 0 Diff The changes in this pull request have verified to be zero-diff with the target branch. label Mar 27, 2024
@mathomp4 mathomp4 self-assigned this Mar 27, 2024
@tclune
Copy link
Collaborator

tclune commented Mar 27, 2024

A note to @tclune This branch is called hotfix/mathomp4/fix-spack-build only because a previous attempt (see #2599) when I thought it was a simple fix was a hotfix. But since this will require a newer ESMF, we are sort of stuck not making it a hotfix. But keeping the branch name the same lets CI be happy in testing.

Thank you for the clarification.

@mathomp4 mathomp4 closed this Apr 11, 2024
@mathomp4 mathomp4 deleted the hotfix/mathomp4/fix-spack-build branch April 11, 2024 14:55
@mathomp4 mathomp4 restored the hotfix/mathomp4/fix-spack-build branch April 11, 2024 15:01
@mathomp4 mathomp4 reopened this Apr 11, 2024
@DusanJovic-NOAA
Copy link

@mathomp4 I'm trying to compile this version using ESMF 8.6.1b04 in order to test it in the ufs-weather-model and the build fails in cmake configure with:

CMake Error at CMakeLists.txt:152 (target_link_libraries):
  target_link_libraries can not be used on an ALIAS target.

Line 152 in CMakeLists.txt is:

150   if (NOT TARGET ESMF::ESMF)
151     find_package(ESMF 8.6.1 MODULE REQUIRED)
152     target_link_libraries(ESMF::ESMF INTERFACE MPI::MPI_Fortran)                         
153   endif ()

If I comment out line 152 the configure step finishes successfully and the build proceeds. Alias targets are read-only and can not be changed.

@mathomp4
Copy link
Member Author

@DusanJovic-NOAA You should not see that if you are using ESMF 8.6.1b04 and you have the same FindESMF.cmake file everywhere. The new FindESMF.cmake file makes ESMF::ESMF the primary target.

You'll want to check and see. I propagated that file to ESMA_cmake and @DanRosen of ESMF said that it needs to go in more places too:

The issue is related to changing one of these three modules, which are already outdated.

My guess is that these modules previously defaulted to the static library and the newer FindESMF module will find any ESMF library unless USE_ESMF_STATIC_LIBS is set.
I was able to build the ufs-weather-model with this newer version of the FindESMF module.

You might want to make sure

@mathomp4
Copy link
Member Author

Note, though, that spack install mapl seems to find the ESMF FindESMF.cmake and ignores any I carry around. Must be some spack thing.

@DusanJovic-NOAA
Copy link

I'm building ESMF and MAPL manually, without spack. However in my libraries build directory I find these FindESMF.cmake files:

$ find . -name FindESMF.cmake | xargs md5sum
afd849c7e7542fc467bbfba23cdaf582  ./esmf-prefix/src/esmf/cmake/FindESMF.cmake
afd849c7e7542fc467bbfba23cdaf582  ./esmf-prefix/src/esmf/src/addon/ESMX/Comps/ESMX_Data/cmake/FindESMF.cmake
afd849c7e7542fc467bbfba23cdaf582  ./esmf-prefix/src/esmf/src/addon/ESMX/Driver/cmake/FindESMF.cmake
9b7760b2775c459376ad0bc3731c2daf  ./esma_cmake-prefix/src/esma_cmake/external_libraries/FindESMF.cmake
afd849c7e7542fc467bbfba23cdaf582  ./mapl-prefix/src/mapl/cmake/FindESMF.cmake

esmf's and mapl's versions are identical, but esma_cmake's is different.

@DusanJovic-NOAA
Copy link

Let me see if I can somehow make mapl 'find' esmf's FindESMF.cmake. Sounds weird, to tell mapl where to 'find' esmf's FindESMF.cmake only to find ESMF.

@DusanJovic-NOAA
Copy link

The version of FindESMF.cmake from esma_cmake/external_libraries/FindESMF.cmake is used, instead of the version from mapl itself because mapl's cmake directory in APPENDed to CMAKE_MODULE_PATH:

list (APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")

after ESMA_cmake's diretory is already appended to CMAKE_MODULE_PATH, so esma's version take precedent. If I change APPEND to PREPEND then the version from mapl/cmake directory is used.

@mathomp4
Copy link
Member Author

The version of FindESMF.cmake from esma_cmake/external_libraries/FindESMF.cmake is used, instead of the version from mapl itself because mapl's cmake directory in APPENDed to CMAKE_MODULE_PATH:

list (APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")

after ESMA_cmake's diretory is already appended to CMAKE_MODULE_PATH, so esma's version take precedent. If I change APPEND to PREPEND then the version from mapl/cmake directory is used.

@DusanJovic-NOAA Ahhh. I see. Smart. I'll test that. If that works, then we'll do that.

@mathomp4 mathomp4 changed the title WIP: Fix non-Baselibs build Fixes for non-Baselibs (spack) build May 1, 2024
@mathomp4 mathomp4 marked this pull request as ready for review May 2, 2024 18:11
@mathomp4 mathomp4 requested review from a team as code owners May 2, 2024 18:11
@mathomp4 mathomp4 merged commit 3daedd0 into develop May 2, 2024
43 checks passed
@mathomp4 mathomp4 deleted the hotfix/mathomp4/fix-spack-build branch May 2, 2024 18:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0 Diff The changes in this pull request have verified to be zero-diff with the target branch.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants