forked from NOAA-EMC/WW3
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from ESCOMP/merge_cmake_meshcapbuild
Merge mesh cap changes from (PR NOAA-EMC#641)
- Loading branch information
Showing
190 changed files
with
11,432 additions
and
1,576 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,106 @@ | ||
name: GNU Linux Build | ||
on: [push, pull_request] | ||
|
||
env: | ||
cache_key: gnu4 | ||
CC: gcc-10 | ||
FC: gfortran-10 | ||
CXX: g++-10 | ||
|
||
# Split into a steup step, and a WW3 build step which | ||
# builds multiple switches in a matrix. The setup is run once and | ||
# the environment is cached so each build of WW3 can share the dependencies. | ||
|
||
jobs: | ||
setup: | ||
runs-on: ubuntu-20.04 | ||
|
||
steps: | ||
# Cache spack, OASIS, and compiler | ||
# No way to flush Action cache, so key may have # appended | ||
- name: cache-env | ||
id: cache-env | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
spack | ||
~/.spack | ||
work_oasis3-mct | ||
key: spack-${{ runner.os }}-${{ env.cache_key }} | ||
|
||
- name: checkout-ww3 | ||
if: steps.cache-env.outputs.cache-hit != 'true' | ||
uses: actions/checkout@v2 | ||
with: | ||
path: ww3 | ||
|
||
# Build WW3 spack environment | ||
- name: install-dependencies-with-spack | ||
if: steps.cache-env.outputs.cache-hit != 'true' | ||
run: | | ||
# Install NetCDF, ESMF, g2, etc using Spack | ||
git clone -c feature.manyFiles=true https://github.com/spack/spack.git | ||
source spack/share/spack/setup-env.sh | ||
spack env create ww3-gnu ww3/model/ci/spack.yaml | ||
spack env activate ww3-gnu | ||
spack compiler find | ||
spack external find | ||
spack add mpich@3.4.2 | ||
spack concretize | ||
spack install --dirty -v | ||
- name: build-oasis | ||
if: steps.cache-env.outputs.cache-hit != 'true' | ||
run: | | ||
source spack/share/spack/setup-env.sh | ||
spack env activate ww3-gnu | ||
export WWATCH3_DIR=${GITHUB_WORKSPACE}/ww3/model | ||
export OASIS_INPUT_PATH=${GITHUB_WORKSPACE}/ww3/regtests/ww3_tp2.14/input/oasis3-mct | ||
export OASIS_WORK_PATH=${GITHUB_WORKSPACE}/ww3/regtests/ww3_tp2.14/input/work_oasis3-mct | ||
cd ww3/regtests/ww3_tp2.14/input/oasis3-mct/util/make_dir | ||
cmake . | ||
make VERBOSE=1 | ||
cp -r ${GITHUB_WORKSPACE}/ww3/regtests/ww3_tp2.14/input/work_oasis3-mct ${GITHUB_WORKSPACE} | ||
build: | ||
needs: setup | ||
strategy: | ||
matrix: | ||
switch: [Ifremer1, NCEP_st2, NCEP_st4, ite_pdlib, NCEP_st4sbs, NCEP_glwu, OASACM, UKMO, MULTI_ESMF, NUOPC_MESH] | ||
runs-on: ubuntu-20.04 | ||
|
||
steps: | ||
- name: checkout-ww3 | ||
uses: actions/checkout@v2 | ||
with: | ||
path: ww3 | ||
|
||
- name: cache-env | ||
id: cache-env | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
spack | ||
~/.spack | ||
work_oasis3-mct | ||
key: spack-${{ runner.os }}-${{ env.cache_key }} | ||
|
||
- name: build-ww3 | ||
run: | | ||
source spack/share/spack/setup-env.sh | ||
spack env activate ww3-gnu | ||
cd ww3 | ||
export CC=mpicc | ||
export FC=mpif90 | ||
export OASISDIR=${GITHUB_WORKSPACE}/work_oasis3-mct | ||
mkdir build && cd build | ||
if [[ ${{ matrix.switch }} == "MULTI_ESMF" ]]; then | ||
cmake .. -DUFS_CAP=MULTI_ESMF -DSWITCH=multi_esmf | ||
elif [[ ${{ matrix.switch }} == "NUOPC_MESH" ]]; then | ||
cmake .. -DUFS_CAP=NUOPC_MESH -DSWITCH=meshcap | ||
else | ||
cmake .. -DSWITCH=${{ matrix.switch }} | ||
fi | ||
make -j2 VERBOSE=1 | ||
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,131 @@ | ||
name: Intel Linux Build | ||
on: [push, pull_request] | ||
|
||
# Use custom shell with -l so .bash_profile is sourced which loads intel/oneapi/setvars.sh | ||
# without having to do it in manually every step | ||
defaults: | ||
run: | ||
shell: bash -leo pipefail {0} | ||
|
||
# Set I_MPI_CC/F90 so Intel MPI wrapper uses icc/ifort instead of gcc/gfortran | ||
env: | ||
cache_key: intel5 | ||
CC: icc | ||
FC: ifort | ||
CXX: icpc | ||
I_MPI_CC: icc | ||
I_MPI_F90: ifort | ||
|
||
# Split into a dependency build step, and a WW3 build step which | ||
# builds multiple switches in a matrix. The setup is run once and | ||
# the environment is cached so each build of WW3 can share the dependencies. | ||
|
||
jobs: | ||
setup: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
# Cache spack, OASIS, and compiler | ||
# No way to flush Action cache, so key may have # appended | ||
- name: cache-env | ||
id: cache-env | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
spack | ||
~/.spack | ||
work_oasis3-mct | ||
/opt/intel | ||
key: spack-${{ runner.os }}-${{ env.cache_key }} | ||
|
||
- name: install-intel-compilers | ||
if: steps.cache-env.outputs.cache-hit != 'true' | ||
run: | | ||
wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | ||
sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | ||
echo "deb https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list | ||
sudo apt-get update | ||
sudo apt-get install intel-oneapi-dev-utilities intel-oneapi-mpi-devel intel-oneapi-openmp intel-oneapi-compiler-fortran intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic | ||
echo "source /opt/intel/oneapi/setvars.sh" >> ~/.bash_profile | ||
- name: checkout-ww3 | ||
if: steps.cache-env.outputs.cache-hit != 'true' | ||
uses: actions/checkout@v2 | ||
with: | ||
path: ww3 | ||
|
||
# Build WW3 spack environment | ||
- name: install-dependencies-with-spack | ||
if: steps.cache-env.outputs.cache-hit != 'true' | ||
run: | | ||
# Install NetCDF, ESMF, g2, etc using Spack | ||
git clone -c feature.manyFiles=true https://github.com/spack/spack.git | ||
source spack/share/spack/setup-env.sh | ||
spack env create ww3-intel ww3/model/ci/spack.yaml | ||
spack env activate ww3-intel | ||
spack compiler find | ||
spack external find | ||
spack add intel-oneapi-mpi | ||
spack concretize | ||
spack install --dirty -v | ||
- name: build-oasis | ||
if: steps.cache-env.outputs.cache-hit != 'true' | ||
run: | | ||
source spack/share/spack/setup-env.sh | ||
spack env activate ww3-intel | ||
export WWATCH3_DIR=${GITHUB_WORKSPACE}/ww3/model | ||
export OASIS_INPUT_PATH=${GITHUB_WORKSPACE}/ww3/regtests/ww3_tp2.14/input/oasis3-mct | ||
export OASIS_WORK_PATH=${GITHUB_WORKSPACE}/ww3/regtests/ww3_tp2.14/input/work_oasis3-mct | ||
cd ww3/regtests/ww3_tp2.14/input/oasis3-mct/util/make_dir | ||
cmake . | ||
make | ||
cp -r ${GITHUB_WORKSPACE}/ww3/regtests/ww3_tp2.14/input/work_oasis3-mct ${GITHUB_WORKSPACE} | ||
build: | ||
needs: setup | ||
strategy: | ||
matrix: | ||
switch: [Ifremer1, NCEP_st2, NCEP_st4, ite_pdlib, NCEP_st4sbs, NCEP_glwu, OASACM, UKMO, MULTI_ESMF, NUOPC_MESH] | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: checkout-ww3 | ||
uses: actions/checkout@v2 | ||
with: | ||
path: ww3 | ||
|
||
- name: install-intel | ||
run: | | ||
echo "source /opt/intel/oneapi/setvars.sh" >> ~/.bash_profile | ||
- name: cache-env | ||
id: cache-env | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
spack | ||
~/.spack | ||
work_oasis3-mct | ||
/opt/intel | ||
key: spack-${{ runner.os }}-${{ env.cache_key }} | ||
|
||
- name: build-ww3 | ||
run: | | ||
source spack/share/spack/setup-env.sh | ||
spack env activate ww3-intel | ||
cd ww3 | ||
export CC=mpicc | ||
export FC=mpif90 | ||
export OASISDIR=${GITHUB_WORKSPACE}/work_oasis3-mct | ||
mkdir build && cd build | ||
if [[ ${{ matrix.switch }} == "MULTI_ESMF" ]]; then | ||
cmake .. -DUFS_CAP=MULTI_ESMF -DSWITCH=multi_esmf | ||
elif [[ ${{ matrix.switch }} == "NUOPC_MESH" ]]; then | ||
cmake .. -DUFS_CAP=NUOPC_MESH -DSWITCH=meshcap | ||
else | ||
cmake .. -DSWITCH=${{ matrix.switch }} | ||
fi | ||
make -j2 VERBOSE=1 | ||
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,63 @@ | ||
# CMake build written by Kyle Gerheiser | ||
|
||
# Requires CMake 3.19 for JSON strings | ||
cmake_minimum_required(VERSION 3.19) | ||
|
||
# Get VERSION from VERSION file | ||
file(STRINGS "VERSION" pVersion) | ||
|
||
project( | ||
WW3 | ||
VERSION ${pVersion} | ||
LANGUAGES C Fortran) | ||
|
||
get_directory_property(hasParent PARENT_DIRECTORY) | ||
if(hasParent) | ||
# Unset flags that come from Parent (ie UFS or other coupled build) | ||
# for potential (-r8/-r4) conflict | ||
set(CMAKE_Fortran_FLAGS "") | ||
set(CMAKE_C_FLAGS "") | ||
remove_definitions(-DDEBUG) | ||
endif() | ||
|
||
set(valid_caps "MULTI_ESMF" "NUOPC_MESH") | ||
|
||
set(UFS_CAP "" CACHE STRING "Valid options are ${valid_caps}") | ||
set(NETCDF ON CACHE BOOL "Build NetCDF programs (requires NetCDF)") | ||
|
||
# Make Find modules visible to CMake | ||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") | ||
|
||
# Set switch file on command line when running CMake | ||
set(SWITCH "" CACHE STRING "Switch file, either full path, relative path from location of top-level WW3/ dir, or a switch in model/bin") | ||
|
||
# Search for switch file as a full path or in model/bin | ||
if(EXISTS ${SWITCH}) | ||
set(switch_file ${SWITCH}) | ||
else() | ||
set(switch_file ${CMAKE_CURRENT_SOURCE_DIR}/model/bin/switch_${SWITCH}) | ||
if(NOT EXISTS ${switch_file}) | ||
message(FATAL_ERROR "Switch file '${switch_file}' does not exist, set switch with -DSWITCH=<switch>") | ||
endif() | ||
endif() | ||
|
||
if(UFS_CAP) | ||
if(NOT UFS_CAP IN_LIST valid_caps) | ||
message(FATAL_ERROR "Invalid UFS_CAP selection. Valids options are ${valid_caps}") | ||
endif() | ||
endif() | ||
|
||
message(STATUS "Build with switch: ${switch_file}") | ||
# Copy switch file to build dir | ||
configure_file(${switch_file} ${CMAKE_BINARY_DIR}/switch COPYONLY) | ||
|
||
# Re-configure CMake when switch changes | ||
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${CMAKE_BINARY_DIR}/switch) | ||
|
||
if(NOT CMAKE_BUILD_TYPE MATCHES "^(Debug|Release|RelWithDebInfo|MinSizeRel)$") | ||
message(STATUS "Setting build type to 'Release' as none was specified.") | ||
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build type" FORCE) | ||
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo") | ||
endif() | ||
|
||
add_subdirectory(model) |
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 @@ | ||
7.14 |
Oops, something went wrong.