Skip to content

Remove local copy of FindESMF.cmake and rename esmf target to ESMF::ESMF#73

Closed
DusanJovic-NOAA wants to merge 9 commits into
NOAA-EMC:developfrom
DusanJovic-NOAA:remove_findesmf
Closed

Remove local copy of FindESMF.cmake and rename esmf target to ESMF::ESMF#73
DusanJovic-NOAA wants to merge 9 commits into
NOAA-EMC:developfrom
DusanJovic-NOAA:remove_findesmf

Conversation

@DusanJovic-NOAA
Copy link
Copy Markdown

Description of changes

This PR removes local copy of FindESMF.cmake and renames esmf target to ESMF::ESMF. ufs-weather-model now uses the FindESMF.cmake module provided by the ESMF library. No change in the baselines is expected.

Specific notes

Contributors other than yourself, if any:

CDEPS Issues Fixed (include github issue #):

Are there dependencies on other component PRs (if so list):

Are changes expected to change answers (bfb, different to roundoff, more substantial):

Any User Interface Changes (namelist or namelist defaults changes):

Testing performed (e.g. aux_cdeps, CESM prealpha, etc):

Hashes used for testing:

@NickSzapiro-NOAA
Copy link
Copy Markdown
Collaborator

Hi @DusanJovic-NOAA . These may be used outside of UFS.
Have we checked with authoritative ESCOMP (for CMEPS too, I imagine)?

@DusanJovic-NOAA
Copy link
Copy Markdown
Author

Hi @DusanJovic-NOAA . These may be used outside of UFS. Have we checked with authoritative ESCOMP (for CMEPS too, I imagine)?

I only ran ufs-weather-model regression test. I do not know how to test CDEPS or CMEPS outside UFS.

@NickSzapiro-NOAA
Copy link
Copy Markdown
Collaborator

@DusanJovic-NOAA ESCOMP/CDEPS has nice github actions. Your current PR fails in build CDEPS step:

Prepare all required actions
Run ./.github/actions/buildcdeps
Run mkdir build-cdeps
~/work/CDEPS/CDEPS/build-cdeps ~/work/CDEPS/CDEPS
DISABLE_FoX = OFF
-- The Fortran compiler identification is GNU 13.3.0
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Check for working Fortran compiler: /usr/bin/mpifort - skipped
CMAKE_MODULE_PATH is /home/runner/work/CDEPS/CDEPS/cmake, CMAKE_Fortran_COMPILER is /usr/bin/mpifort
CMake Error at CMakeLists.txt:42 (find_package):
  By not providing "FindESMF.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "ESMF", but
  CMake did not find one.

  Could not find a package configuration file provided by "ESMF" with any of
  the following names:

    ESMFConfig.cmake
    esmf-config.cmake

  Add the installation prefix of "ESMF" to CMAKE_PREFIX_PATH or set
  "ESMF_DIR" to a directory containing one of the above files.  If "ESMF"
  provides a separate development package or SDK, be sure it has been
  installed.


-- Configuring incomplete, errors occurred!
Error: Process completed with exit code 1.

https://github.com/ESCOMP/CDEPS/actions/runs/16812285008/job/47620363966#step:7:68

@DusanJovic-NOAA
Copy link
Copy Markdown
Author

@DusanJovic-NOAA ESCOMP/CDEPS has nice github actions. Your current PR fails in build CDEPS step:

Prepare all required actions
Run ./.github/actions/buildcdeps
Run mkdir build-cdeps
~/work/CDEPS/CDEPS/build-cdeps ~/work/CDEPS/CDEPS
DISABLE_FoX = OFF
-- The Fortran compiler identification is GNU 13.3.0
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Check for working Fortran compiler: /usr/bin/mpifort - skipped
CMAKE_MODULE_PATH is /home/runner/work/CDEPS/CDEPS/cmake, CMAKE_Fortran_COMPILER is /usr/bin/mpifort
CMake Error at CMakeLists.txt:42 (find_package):
  By not providing "FindESMF.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "ESMF", but
  CMake did not find one.

  Could not find a package configuration file provided by "ESMF" with any of
  the following names:

    ESMFConfig.cmake
    esmf-config.cmake

  Add the installation prefix of "ESMF" to CMAKE_PREFIX_PATH or set
  "ESMF_DIR" to a directory containing one of the above files.  If "ESMF"
  provides a separate development package or SDK, be sure it has been
  installed.


-- Configuring incomplete, errors occurred!
Error: Process completed with exit code 1.

https://github.com/ESCOMP/CDEPS/actions/runs/16812285008/job/47620363966#step:7:68

I think github actions should set ESMF_ROOT to point to the install path of the esmf library, and that path should be appended to CMAKE_MODULE_PATH in CMakeLists.txt before find_package. Can you try to add these changes to your branch:

diff --git a/.github/actions/buildcdeps/action.yaml b/.github/actions/buildcdeps/action.yaml
index 9d775dd..a06a55a 100644
--- a/.github/actions/buildcdeps/action.yaml
+++ b/.github/actions/buildcdeps/action.yaml
@@ -16,6 +16,11 @@ inputs:
     default: $HOME/ESMF/lib/libg/Linux.gfortran.64.openmpi.default/esmf.mk
     required: False
     type: string
+  esmf_root:
+    description: 'Path to the installed ESMF library'
+    default: $HOME/ESMF
+    required: False
+    type: string
   src_root:
     description: 'Path to cdeps source'
     default: $GITHUB_WORKSPACE
@@ -40,6 +45,7 @@ runs:
         mkdir build-cdeps
         pushd build-cdeps
         export ESMFMKFILE=${{ inputs.esmfmkfile }}
+        export ESMF_ROOT=${{ inputs.esmf_root }}
         export PIO=${{ inputs.pio_path }}
         cmake ${{ inputs.cmake_flags }} ${{ inputs.src_root }}
         make VERBOSE=1
diff --git a/.github/workflows/extbuild.yml b/.github/workflows/extbuild.yml
index 185f6d8..0ad1e3c 100644
--- a/.github/workflows/extbuild.yml
+++ b/.github/workflows/extbuild.yml
@@ -69,6 +69,7 @@ jobs:
         uses: ./.github/actions/buildcdeps
         with:
           esmfmkfile: $ESMFMKFILE
+          esmf_root: ${GITHUB_WORKSPACE}/ESMF
           pio_path: ${GITHUB_WORKSPACE}/pio
           src_root: ${GITHUB_WORKSPACE}
           cmake_flags: " -Wno-dev -DCMAKE_BUILD_TYPE=DEBUG -DWERROR=ON  -DCMAKE_Fortran_FLAGS=\"-DCPRGNU -g -Wall \
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7176988..0217d83 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -39,6 +39,7 @@ enable_language(Fortran)
 if (TARGET ESMF::ESMF)
   message("Target ESMF::ESMF is already found. Skip find_package ...")
 else()
+  list(APPEND CMAKE_MODULE_PATH $ENV{ESMF_ROOT}/cmake)
   find_package(ESMF REQUIRED)
 endif()

@NickSzapiro-NOAA
Copy link
Copy Markdown
Collaborator

@DusanJovic-NOAA Not yet. I'm not so familiar with this but happy to help if I can. Or can ask...maybe Ufuk?

@DusanJovic-NOAA
Copy link
Copy Markdown
Author

@DusanJovic-NOAA Not yet. I'm not so familiar with this but happy to help if I can. Or can ask...maybe Ufuk?

@NickSzapiro-NOAA I just pushed these changes to my branch, can you pull them to your branch to see if they fix github actions upstream

@NickSzapiro-NOAA
Copy link
Copy Markdown
Collaborator

@DusanJovic-NOAA If those are the same as the changes you commented above, it's still same error

Gemini AI advised to use cmake -D instead of export...I'm trying a few iterations with AI out of curiosity, if it helps

Please let me know if you'd like me to try anything in particular

@DusanJovic-NOAA
Copy link
Copy Markdown
Author

I think in .github/actions/buildcdeps/action.yaml you replaced esmfmkfile section with esmf_root, instead of just adding esmf_root. Did you pull/merge code from my branch?

@NickSzapiro-NOAA
Copy link
Copy Markdown
Collaborator

Yes, I tried that last night (ESCOMP@c62f676)

@DusanJovic-NOAA
Copy link
Copy Markdown
Author

DusanJovic-NOAA commented Aug 8, 2025

I enabled the github actions in my branch and I see that, for some reason, the esmf installation does not contain FindESMF.cmake in the expected location (<prefix>/cmake), as we have in our spack stack installations.

@DusanJovic-NOAA
Copy link
Copy Markdown
Author

After I updated esmf to 8.8.0, cmake successfully finds FindESMF.cmake in ESMF_ROOT/cmake, and the finds esmf library. However, it fails at finding FoX. https://github.com/DusanJovic-NOAA/CDEPS/actions/runs/16838470381/job/47703643415

This happens because in develop branch there's no fox submodule which is present in the main branch, and it looks like github actions are set to run on main branch only.

@DusanJovic-NOAA
Copy link
Copy Markdown
Author

I just realized that ufs-weather-model does not even use the cmake build system from this repository. ufs-weather-model uses CMakeLists.txt from CDEPS-interface.

I will revert the CDEPS submodule, rerun full regression tests, and if all tests pass I will close this PR.

@DusanJovic-NOAA
Copy link
Copy Markdown
Author

Changes in the PR are actually not needed since ufs-weather-model does not use the build system from this repository. Closing.

@DusanJovic-NOAA DusanJovic-NOAA deleted the remove_findesmf branch December 5, 2025 13:18
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