forked from ESCOMP/CTSM
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into feature/bug_fixes
- Loading branch information
Showing
26 changed files
with
779 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
# This is a basic workflow to help you get started with Actions | ||
name: extbuild | ||
# Controls when the action will run. Triggers the workflow on push or pull request | ||
# events but only for the master branch | ||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
|
||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | ||
jobs: | ||
# Build the ESMF library, if the cache contains a previous build it will be used instead | ||
build-cdeps: | ||
runs-on: ubuntu-latest | ||
env: | ||
CC: mpicc | ||
FC: mpifort | ||
CXX: mpicxx | ||
CPPFLAGS: "-I/usr/include -I/usr/local/include" | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- id: cache-esmf | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/ESMF | ||
key: ${{ runner.os }}-ESMF | ||
- id: load-env | ||
run: sudo apt-get install gfortran wget openmpi-bin netcdf-bin libopenmpi-dev | ||
|
||
- id: build-ESMF | ||
if: steps.cache-esmf.outputs.cache-hit != 'true' | ||
run: | | ||
wget https://github.com/esmf-org/esmf/archive/ESMF_8_1_0_beta_snapshot_25.tar.gz | ||
tar -xzvf ESMF_8_1_0_beta_snapshot_25.tar.gz | ||
pushd esmf-ESMF_8_1_0_beta_snapshot_25 | ||
export ESMF_DIR=`pwd` | ||
export ESMF_COMM=openmpi | ||
export ESMF_YAMLCPP="internal" | ||
export ESMF_INSTALL_PREFIX=$HOME/ESMF | ||
export ESMF_BOPT=g | ||
make | ||
make install | ||
popd | ||
- id: cache-pnetcdf | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/pnetcdf | ||
key: ${{ runner.os }}-pnetcdf | ||
- name: pnetcdf build | ||
if: steps.cache-pnetcdf.outputs.cache-hit != 'true' | ||
run: | | ||
wget https://parallel-netcdf.github.io/Release/pnetcdf-1.12.1.tar.gz | ||
tar -xzvf pnetcdf-1.12.1.tar.gz | ||
ls -l | ||
pushd pnetcdf-1.12.1 | ||
./configure --prefix=$HOME/pnetcdf --enable-shared --disable-cxx | ||
make | ||
make install | ||
popd | ||
- name: Cache netcdf-fortran | ||
id: cache-netcdf-fortran | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/netcdf-fortran | ||
key: ${{ runner.os }}-netcdf-fortran | ||
- name: netcdf fortran build | ||
if: steps.cache-netcdf-fortran.outputs.cache-hit != 'true' | ||
run: | | ||
sudo apt-get install libnetcdf-dev | ||
wget https://github.com/Unidata/netcdf-fortran/archive/v4.5.2.tar.gz | ||
tar -xzvf v4.5.2.tar.gz | ||
ls -l | ||
pushd netcdf-fortran-4.5.2 | ||
./configure --prefix=$HOME/netcdf-fortran | ||
make | ||
make install | ||
- name: Cache PIO | ||
id: cache-PIO | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/pio | ||
key: ${{ runner.os }}-pio | ||
restore-keys: | | ||
${{ runner.os }}-netcdf-fortran | ||
${{ runner.os }}-pnetcdf | ||
- name: Build PIO | ||
if: steps.cache-PIO.outputs.cache-hit != 'true' | ||
run: | | ||
wget https://github.com/NCAR/ParallelIO/releases/download/pio_2_5_1/pio-2.5.1.tar.gz | ||
tar -xzvf pio-2.5.1.tar.gz | ||
mkdir build-pio | ||
pushd build-pio | ||
cmake -Wno-dev -DNetCDF_C_LIBRARY=/usr/lib/x86_64-linux-gnu/libnetcdf.so -DNetCDF_C_INCLUDE_DIR=/usr/include -DCMAKE_PREFIX_PATH=/usr -DCMAKE_INSTALL_PREFIX=$HOME/pio -DPIO_HDF5_LOGGING=On -DPIO_USE_MALLOC=On -DPIO_ENABLE_LOGGING=On -DPIO_ENABLE_TIMING=Off -DNetCDF_Fortran_PATH=$HOME/netcdf-fortran -DPnetCDF_PATH=$HOME/pnetcdf ../pio-2.5.1 | ||
make VERBOSE=1 | ||
make install | ||
popd | ||
- name: Build CDEPS | ||
run: | | ||
export ESMFMKFILE=$HOME/ESMF/lib/libg/Linux.gfortran.64.openmpi.default/esmf.mk | ||
export PIO=$HOME/pio | ||
git submodule init | ||
git submodule update | ||
mkdir build-cdeps | ||
pushd build-cdeps | ||
cmake -DCMAKE_BUILD_TYPE=DEBUG -DCMAKE_Fortran_FLAGS="-g -Wall -ffree-form -ffree-line-length-none" ../ | ||
make VERBOSE=1 | ||
popd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "fox"] | ||
path = fox | ||
url = https://github.com/ESMCI/fox.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
# - Try to find PIO | ||
# | ||
# This can be controled by setting PIO_PATH or PIO_<lang>_PATH Cmake variables, | ||
# where <lang> is the COMPONENT language one needs. | ||
# | ||
# Once done, this will define: | ||
# | ||
# PIO_<lang>_FOUND (BOOL) - system has PIO | ||
# PIO_<lang>_IS_SHARED (BOOL) - whether the library is shared/dynamic | ||
# PIO_<lang>_INCLUDE_DIR (PATH) - Location of the header files and modules | ||
# PIO_<lang>_LIBRARY (File) - Path to the <lang> library files | ||
# PIO_<lang>_LIBRARIES (List) - link these to use PIO | ||
# | ||
# Available COMPONENTS are: C Fortran | ||
# If no components are specified only C is assumed | ||
include (LibFind) | ||
include (LibCheck) | ||
|
||
# Define PIO C Component | ||
define_package_component(PIO DEFAULT | ||
COMPONENT C | ||
INCLUDE_NAMES pio.h | ||
LIBRARY_NAMES pioc) | ||
|
||
# Define PIO Fortran Component | ||
define_package_component(PIO | ||
COMPONENT Fortran | ||
INCLUDE_NAMES pio.mod pio.inc | ||
LIBRARY_NAMES piof) | ||
|
||
# Search for list of valid components requested | ||
find_valid_components(PIO) | ||
|
||
#============================================================================== | ||
# SEARCH FOR VALIDATED COMPONENTS | ||
foreach (pcomp IN LISTS PIO_FIND_VALID_COMPONENTS) | ||
|
||
# If not found already, search... | ||
if (NOT PIO_${pcomp}_FOUND) | ||
|
||
# Manually add the MPI include and library dirs to search paths | ||
# and search for the package component | ||
if (MPI_${pcomp}_FOUND) | ||
initialize_paths (PIO_${pcomp}_PATHS | ||
INCLUDE_DIRECTORIES ${MPI_${pcomp}_INCLUDE_PATH} | ||
LIBRARIES ${MPI_${pcomp}_LIBRARIES}) | ||
find_package_component(PIO COMPONENT ${pcomp} | ||
PATHS ${PIO_${pcomp}_PATHS}) | ||
else () | ||
find_package_component(PIO COMPONENT ${pcomp} HINT PIO_${pcomp}_PATH=${PIO_PATH}) | ||
endif () | ||
|
||
# Continue only if component found | ||
if (PIO_${pcomp}_FOUND) | ||
|
||
# Checks | ||
if (pcomp STREQUAL C) | ||
|
||
# Check version | ||
check_version (PIO | ||
NAME "pio_meta.h" | ||
HINTS ${PIO_C_INCLUDE_DIRS} | ||
MACRO_REGEX "PIO_VERSION_") | ||
|
||
endif () | ||
|
||
# Dependencies | ||
if (pcomp STREQUAL C AND NOT PIO_C_IS_SHARED) | ||
|
||
# DEPENDENCY: PnetCDF (if PnetCDF enabled) | ||
check_macro (PIO_HAS_PNETCDF | ||
NAME TryPIO_PNETCDF.c | ||
HINTS ${CMAKE_MODULE_PATH} | ||
DEFINITIONS -I${PIO_C_INCLUDE_DIR} | ||
COMMENT "whether PIO has PnetCDF support") | ||
if (PIO_HAS_PNETCDF) | ||
find_package (PnetCDF COMPONENTS C) | ||
endif () | ||
|
||
|
||
elseif (pcomp STREQUAL Fortran AND NOT PIO_Fortran_IS_SHARED) | ||
|
||
# DEPENDENCY: PIO | ||
set (orig_comp ${pcomp}) | ||
set (orig_comps ${PIO_FIND_VALID_COMPONENTS}) | ||
find_package (PIO COMPONENTS C) | ||
set (PIO_FIND_VALID_COMPONENTS ${orig_comps}) | ||
set (pcomp ${orig_comp}) | ||
if (PIO_C_FOUND) | ||
list (APPEND PIO_Fortran_INCLUDE_DIRS ${PIO_C_INCLUDE_DIRS}) | ||
list (APPEND PIO_Fortran_LIBRARIES ${PIO_C_LIBRARIES}) | ||
endif () | ||
|
||
endif () | ||
|
||
endif () | ||
|
||
endif () | ||
|
||
endforeach () | ||
message("PIO_C_FOUND ${PIO_C_FOUND}") | ||
message("PIO_Fortran_FOUND ${PIO_Fortran_FOUND}") | ||
message("PIO_Fortran_INCLUDE_DIR ${PIO_Fortran_INCLUDE_DIR}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
include (CMakeParseArguments) | ||
include (CheckFunctionExists) | ||
#============================================================================== | ||
# | ||
# FUNCTIONS TO HELP WITH Check* MODULES | ||
# | ||
#============================================================================== | ||
|
||
#______________________________________________________________________________ | ||
# - Basic function to check a property of a package using a try_compile step | ||
# | ||
# SYNTAX: check_macro (<return_variable> | ||
# NAME <filename> | ||
# HINTS <path> <path> ... | ||
# DEFINITIONS <definition1> <definition> ... | ||
# COMMENT <string_comment>) | ||
# | ||
function (check_macro VARIABLE) | ||
|
||
# Parse the input arguments | ||
set (oneValueArgs COMMENT NAME) | ||
set (multiValueArgs HINTS DEFINITIONS) | ||
cmake_parse_arguments (${VARIABLE} "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) | ||
|
||
# If the return variable is defined, already, don't continue | ||
if (NOT DEFINED ${VARIABLE}) | ||
|
||
message (STATUS "Checking ${${VARIABLE}_COMMENT}") | ||
find_file (${VARIABLE}_TRY_FILE | ||
NAMES ${${VARIABLE}_NAME} | ||
HINTS ${${VARIABLE}_HINTS}) | ||
if (${VARIABLE}_TRY_FILE) | ||
try_compile (COMPILE_RESULT | ||
${CMAKE_CURRENT_BINARY_DIR}/try${VARIABLE} | ||
SOURCES ${${VARIABLE}_TRY_FILE} | ||
COMPILE_DEFINITIONS ${${VARIABLE}_DEFINITIONS} | ||
OUTPUT_VARIABLE TryOUT) | ||
if (COMPILE_RESULT) | ||
message (STATUS "Checking ${${VARIABLE}_COMMENT} - yes") | ||
else () | ||
message (STATUS "Checking ${${VARIABLE}_COMMENT} - no") | ||
endif () | ||
|
||
set (${VARIABLE} ${COMPILE_RESULT} | ||
CACHE BOOL "${${VARIABLE}_COMMENT}") | ||
|
||
else () | ||
message (STATUS "Checking ${${VARIABLE}_COMMENT} - failed") | ||
endif () | ||
|
||
unset (${VARIABLE}_TRY_FILE CACHE) | ||
endif () | ||
|
||
endfunction () | ||
|
||
#______________________________________________________________________________ | ||
# - Basic function to check the version of a package using a try_run step | ||
# | ||
# SYNTAX: check_version (<pkg> | ||
# NAME <try_version_file> | ||
# HINTS <path> <path> ... | ||
# DEFINITIONS <definition1> <definition> ...) | ||
# | ||
function (check_version PKG) | ||
|
||
# Parse the input arguments | ||
set (oneValueArgs NAME MACRO_REGEX) | ||
set (multiValueArgs HINTS) | ||
cmake_parse_arguments (${PKG} "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) | ||
|
||
# If the return variable is defined, already, don't continue | ||
if (NOT DEFINED ${PKG}_VERSION) | ||
|
||
message (STATUS "Checking ${PKG} version") | ||
find_file (${PKG}_VERSION_HEADER | ||
NAMES ${${PKG}_NAME} | ||
HINTS ${${PKG}_HINTS}) | ||
if (${PKG}_VERSION_HEADER) | ||
set (def) | ||
file (STRINGS ${${PKG}_VERSION_HEADER} deflines | ||
REGEX "^#define[ \\t]+${${PKG}_MACRO_REGEX}") | ||
foreach (defline IN LISTS deflines) | ||
string (REPLACE "\"" "" defline "${defline}") | ||
string (REPLACE "." "" defline "${defline}") | ||
string (REGEX REPLACE "[ \\t]+" ";" deflist "${defline}") | ||
list (GET deflist 2 arg) | ||
list (APPEND def ${arg}) | ||
endforeach () | ||
string (REPLACE ";" "." vers "${def}") | ||
message (STATUS "Checking ${PKG} version - ${vers}") | ||
set (${PKG}_VERSION ${vers} | ||
CACHE STRING "${PKG} version string") | ||
if (${PKG}_VERSION VERSION_LESS ${PKG}_FIND_VERSION}) | ||
message (FATAL_ERROR "${PKG} version insufficient") | ||
endif () | ||
else () | ||
message (STATUS "Checking ${PKG} version - failed") | ||
endif () | ||
|
||
unset (${PKG}_VERSION_HEADER CACHE) | ||
|
||
endif () | ||
|
||
endfunction () |
Oops, something went wrong.