Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 104 additions & 0 deletions .github/workflows/gnu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
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]
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 .. -DMULTI_ESMF=ON -DSWITCH=multi_esmf
else
cmake .. -DSWITCH=${{ matrix.switch }}
fi
make -j2 VERBOSE=1


129 changes: 129 additions & 0 deletions .github/workflows/intel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
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]
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 .. -DMULTI_ESMF=ON -DSWITCH=multi_esmf
else
cmake .. -DSWITCH=${{ matrix.switch }}
fi
make -j2


34 changes: 34 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,38 @@ regtests/ww3_tp2.14/input*/*.nc.OAS*CM*
regtests/ww3_tp2.14/input*/*/*.nc.OAS*CM*
regtests/ww3_tp2.14/input/toy/*.o
regtests/ww3_tp2.14/input/oasis3-mct/util/make_dir/cmplr
regtests/ww3_tp2.14/input/oasis3-mct/lib/mct/mct/*.mod
regtests/ww3_tp2.14/input/oasis3-mct/lib/mct/mct/*_scratch.f
regtests/ww3_tp2.14/input/oasis3-mct/lib/mct/mct/Makefile.conf
regtests/ww3_tp2.14/input/oasis3-mct/lib/mct/mct/*.lst
regtests/ww3_tp2.14/input/oasis3-mct/lib/mct/mpeu/*.mod
regtests/ww3_tp2.14/input/oasis3-mct/lib/mct/mpeu/mpeu
regtests/ww3_tp2.14/input/oasis3-mct/lib/mct/mpeu/Makefile.conf
regtests/ww3_tp2.14/input/oasis3-mct/lib/mct/mpeu/*.lst
regtests/ww3_tp2.14/input/oasis3-mct/lib/mct/doc/texsrc/*.F90
regtests/ww3_tp2.14/input/oasis3-mct/lib/mct/doc/texsrc/*.tex
regtests/ww3_tp2.14/input/oasis3-mct/lib/mct/doc/*.toc
regtests/ww3_tp2.14/input/oasis3-mct/lib/mct/doc/*.log
regtests/ww3_tp2.14/input/oasis3-mct/lib/mct/doc/*.dvi
regtests/ww3_tp2.14/input/oasis3-mct/lib/mct/doc/*.aux
regtests/ww3_tp2.14/input/oasis3-mct/lib/mct/doc/*.blg
regtests/ww3_tp2.14/input/oasis3-mct/lib/mct/doc/*.bbl
regtests/ww3_tp2.14/input/oasis3-mct/lib/mct/doc/*.pdf
regtests/ww3_tp2.14/input/oasis3-mct/lib/mct/examples/climate_concur1/climate
regtests/ww3_tp2.14/input/oasis3-mct/lib/mct/examples/climate_concur1/*.mod
regtests/ww3_tp2.14/input/oasis3-mct/lib/mct/examples/climate_concur1/poe.*
regtests/ww3_tp2.14/input/oasis3-mct/lib/mct/examples/simple/twocon
regtests/ww3_tp2.14/input/oasis3-mct/lib/mct/examples/simple/twoseq
regtests/ww3_tp2.14/input/oasis3-mct/lib/mct/examples/simple/twosequn
regtests/ww3_tp2.14/input/oasis3-mct/lib/mct/examples/simple/twoseqNB
regtests/ww3_tp2.14/input/oasis3-mct/lib/mct/examples/climate_sequen1/MCT.*
regtests/ww3_tp2.14/input/oasis3-mct/lib/mct/examples/climate_sequen1/*.mod
regtests/ww3_tp2.14/input/oasis3-mct/lib/mct/examples/climate_sequen1/climate
regtests/ww3_tp2.14/input/oasis3-mct/lib/mct/Makefile.conf
regtests/ww3_tp2.14/input/oasis3-mct/lib/mct/config.log
regtests/ww3_tp2.14/input/oasis3-mct/lib/mct/config.status
regtests/ww3_tp2.14/input/oasis3-mct/lib/mct/config.h
regtests/ww3_tp2.14/input/oasis3-mct/lib/mct/autom4te.cache
regtests/ww3_tp2.14/input/toy/toy_model
regtests/ww3_tp2.14/input/ww3_shel.inp
regtests/ww3_tp2.14/input/ww3_shel.nml
Expand Down Expand Up @@ -137,3 +169,5 @@ model/bin/wwatch3.env
*/.*.swp
*/*/.*.swp
*/*/*/.*.swp
.DS_Store
build
54 changes: 54 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# 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 UFS because they (-r8/-r4) conflict
# with Ww3
set(CMAKE_Fortran_FLAGS "")
set(CMAKE_C_FLAGS "")
endif()

set(MULTI_ESMF OFF CACHE BOOL "Build ww3_multi_esmf library")
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()

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)
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7.14
Loading