Skip to content

Commit

Permalink
Forced cache component model repos; specified full path to dependenci…
Browse files Browse the repository at this point in the history
…es and component models
  • Loading branch information
kvrigor committed Oct 30, 2024
1 parent e4bf447 commit 30d0d84
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 32 deletions.
84 changes: 57 additions & 27 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ jobs:
FC: mpifort
BUILD_DIR: bld
INSTALL_DIR: install
MODEL_DIR: component-models
MODEL_DIR: ${{ github.workspace }}/component-models
OASIS_TAG: tsmp-patches-v0.1
eCLM_TAG: beta-0.1
PARFLOW_TAG: v3.13.0
HYPRE_TAG: 2.26.0
CMAKE_BUILD_PARALLEL_LEVEL: 4
CMAKE_PREFIX_PATH: dependencies
CMAKE_PREFIX_PATH: ${{ github.workspace }}/dependencies
SYSTEMNAME: ${{ matrix.os }}

steps:
Expand All @@ -44,67 +44,92 @@ jobs:
run: |
mkdir -p ${CMAKE_PREFIX_PATH} ${MODEL_DIR}
#
# OASIS3-MCT
#
- name: Restore cached OASIS3-MCT ${{ env.OASIS_TAG }}
uses: actions/cache@v4
id: cache-oasis
env:
cache-name: cache-oasis
uses: actions/cache/restore@v4
id: cache-oasis-restore
with:
path: ${{ env.MODEL_DIR }}/oasis3-mct
key: cache-${{ matrix.config.name }}-${{ env.OASIS_TAG }}

- if: steps.cache-oasis.outputs.cache-hit != 'true'
- if: steps.cache-oasis-restore.outputs.cache-hit != 'true'
name: Download OASIS3-MCT ${{ env.OASIS_TAG }}
working-directory: ${{ env.MODEL_DIR }}
run: |
git clone -b $OASIS_TAG https://icg4geo.icg.kfa-juelich.de/ExternalReposPublic/oasis3-mct.git
echo "OASIS3-MCT version: $(cd oasis3-mct && git describe --tags --always)"
realpath oasis3-mct
- if: steps.cache-oasis-restore.outputs.cache-hit != 'true'
name: Cache OASIS3-MCT ${{ env.OASIS_TAG }}
uses: actions/cache/save@v4
with:
path: ${{ env.MODEL_DIR }}/oasis3-mct
key: cache-${{ matrix.config.name }}-${{ env.OASIS_TAG }}

#
# eCLM
#
- name: Restore cached eCLM ${{ env.eCLM_TAG }}
uses: actions/cache@v4
id: cache-eclm
env:
cache-name: cache-eclm
uses: actions/cache/restore@v4
id: cache-eclm-restore
with:
path: ${{ env.MODEL_DIR }}/eCLM
key: cache-${{ matrix.config.name }}
key: cache-${{ matrix.config.name }}-${{ env.eCLM_TAG }}

- if: steps.cache-eclm.outputs.cache-hit != 'true'
- if: steps.cache-eclm-restore.outputs.cache-hit != 'true'
name: Download eCLM ${{ env.eCLM_TAG }}
working-directory: ${{ env.MODEL_DIR }}
run: |
git clone -b $eCLM_TAG https://github.com/HPSCTerrSys/eCLM.git
echo "eCLM version: $(cd eCLM && git describe --tags --always)"
realpath eCLM
- if: steps.cache-eclm-restore.outputs.cache-hit != 'true'
name: Cache eCLM ${{ env.eCLM_TAG }}
uses: actions/cache/save@v4
with:
path: ${{ env.MODEL_DIR }}/eCLM
key: cache-${{ matrix.config.name }}-${{ env.eCLM_TAG }}

#
# ParFlow
#
- name: Restore cached ParFlow ${{ env.PARFLOW_TAG }}
uses: actions/cache@v4
id: cache-parflow
env:
cache-name: cache-parflow
uses: actions/cache/restore@v4
id: cache-parflow-restore
with:
path: ${{ env.MODEL_DIR }}/parflow
key: cache-${{ matrix.config.name }}-${{ env.PARFLOW_TAG }}

- if: steps.cache-parflow.outputs.cache-hit != 'true'
- if: steps.cache-parflow-restore.outputs.cache-hit != 'true'
name: Download ParFlow ${{ env.PARFLOW_TAG }}
working-directory: ${{ env.MODEL_DIR }}
run: |
git clone -b $PARFLOW_TAG https://github.com/parflow/parflow.git
echo "ParFlow version: $(cd parflow && git describe --tags --always)"
realpath parflow
- if: steps.cache-parflow-restore.outputs.cache-hit != 'true'
name: Cache ParFlow ${{ env.PARFLOW_TAG }}
uses: actions/cache/save@v4
with:
path: ${{ env.MODEL_DIR }}/parflow
key: cache-${{ matrix.config.name }}-${{ env.PARFLOW_TAG }}

#
# Hypre
#
- name: Restore cached Hypre ${{ env.HYPRE_TAG }}
uses: actions/cache@v4
id: cache-hypre
env:
cache-name: cache-hypre
uses: actions/cache/restore@v4
id: cache-hypre-restore
with:
path: ${{ env.CMAKE_PREFIX_PATH }}
key: cache-${{ matrix.config.name }}-${{ env.HYPRE_TAG }}

- if: steps.cache-hypre.outputs.cache-hit != 'true'
- if: steps.cache-hypre-restore.outputs.cache-hit != 'true'
name: Install Hypre ${{ env.HYPRE_TAG }}
run: |
wget https://github.com/hypre-space/hypre/archive/v${HYPRE_TAG}.tar.gz
Expand All @@ -113,11 +138,16 @@ jobs:
./configure --prefix=$(realpath $CMAKE_PREFIX_PATH)
make -j${CMAKE_BUILD_PARALLEL_LEVEL} install
- name: Check for component model and dependency directories
run: |
tree ${CMAKE_PREFIX_PATH}
tree ${MODEL_DIR}
- if: steps.cache-hypre-restore.outputs.cache-hit != 'true'
name: Cache Hypre ${{ env.HYPRE_TAG }}
uses: actions/cache/save@v4
with:
path: ${{ env.CMAKE_PREFIX_PATH }}
key: cache-${{ matrix.config.name }}-${{ env.HYPRE_TAG }}

#
# TSMP2
#
- name: Configure TSMP2
run: >-
cmake -S . -B ${BUILD_DIR}
Expand Down
2 changes: 1 addition & 1 deletion cmake/BuildPDAFMODEL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ set(TSMPPDAFLIBDIR "${CMAKE_INSTALL_PREFIX}/lib")
# Include directories
# -------------------
# General include dirs
list(APPEND PDAF_INCLUDES "-I${NetCDF_ROOT}/include")
list(APPEND PDAF_INCLUDES "-I${NetCDF_F90_ROOT}/include")

# DA include dirs
list(APPEND PDAF_INCLUDES "-I${PDAF_SRC}/interface/model")
Expand Down
2 changes: 1 addition & 1 deletion cmake/BuildParFlow.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ ExternalProject_Add(ParFlow
-DCMAKE_Fortran_COMPILER=${CMAKE_Fortran_COMPILER}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
-DNETCDF_DIR=${NetCDF_ROOT}
-DNETCDF_DIR=${NetCDF_C_ROOT}
-DPARFLOW_AMPS_SEQUENTIAL_IO=on
-DHYPRE_ROOT=${HYPRE_ROOT}
-DPARFLOW_ENABLE_TIMING=TRUE
Expand Down
26 changes: 23 additions & 3 deletions cmake/FindNetCDF.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,40 @@ include(FindPackageHandleStandardArgs)

find_package(NetCDF_C QUIET NAMES netCDF)
if(NetCDF_C_FOUND)
# Set default NetCDF C paths to the first found NetCDF C library.
set(NetCDF_C_LIB_DIR "${netCDF_LIB_DIR}")
set(NetCDF_C_ROOT "${netCDF_INSTALL_PREFIX}")

# However, if the default NetCDF C library doesn't have parallel support, try searching for another one.
if(NOT ${netCDF_HAS_PARALLEL})
# Option 1 (Ubuntu-specific): `sudo apt-get install libnetcdf-mpi-dev` provides NetCDF with parallel support.
pkg_check_modules(NetCDF_C_MPI QUIET netcdf-mpi)
if (NetCDF_C_MPI_FOUND)
pkg_get_variable(NetCDF_C_ROOT netcdf-mpi prefix)
set(NetCDF_C_LIB_DIR "${NetCDF_C_ROOT}/lib")
set(netCDF_HAS_PARALLEL "ON")
endif()
endif()
endif()

pkg_check_modules(NetCDF_F90 REQUIRED netcdf-fortran)
if (NetCDF_F90_FOUND)
pkg_get_variable(NetCDF_F90_LIB_DIR netcdf-fortran libdir)
pkg_get_variable(NetCDF_F90_ROOT netcdf-fortran prefix)
pkg_get_variable(NetCDF_F90_LIB_DIR netcdf-fortran libdir)
pkg_get_variable(NetCDF_F90_INCLUDEDIR netcdf-fortran fmoddir)
endif()

find_package_handle_standard_args(NetCDF
REQUIRED_VARS NetCDF_C_LIB_DIR NetCDF_F90_LIB_DIR
REQUIRED_VARS NetCDF_C_ROOT NetCDF_F90_ROOT NetCDF_C_LIB_DIR NetCDF_F90_LIB_DIR NetCDF_F90_INCLUDEDIR
VERSION_VAR NetCDF_F90_VERSION)

if(NetCDF_FOUND)
set(NetCDF_LIBRARIES "-L${NetCDF_C_LIB_DIR} -L${NetCDF_F90_LIB_DIR} -lnetcdff -lnetcdf" CACHE STRING "NetCDF linker options")
set(NetCDF_ROOT ${NetCDF_F90_ROOT} CACHE PATH "Full path to the root directory containing NetCDF include files and libraries.")
set(NetCDF_F90_ROOT ${NetCDF_F90_ROOT} CACHE PATH "Path to NetCDF-Fortran directory which contains its include header files and libraries.")
set(NetCDF_C_ROOT ${NetCDF_C_ROOT} CACHE PATH "Path to NetCDF-C directory which contains its include header files and libraries.")
if (netCDF_HAS_PARALLEL)
message(STATUS "TSMP2 found NetCDF C built with parallel I/O support.")
else()
message(WARNING "TSMP2 is using NetCDF C without parallel I/O support.")
endif()
endif()

0 comments on commit 30d0d84

Please sign in to comment.