Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CMake build to WW3 #533

Merged
merged 199 commits into from
Feb 24, 2022
Merged
Show file tree
Hide file tree
Changes from 174 commits
Commits
Show all changes
199 commits
Select commit Hold shift + click to select a range
233175e
Ignore .DS_Store
kgerheiser Oct 21, 2021
573fbb6
Create first CMakeLists.txt and associated files
kgerheiser Oct 21, 2021
ce6b375
Create JSON file to hold switch information
kgerheiser Nov 9, 2021
21902e7
Merge branch 'develop' of https://github.com/NOAA-EMC/WW3 into featur…
kgerheiser Nov 9, 2021
b1c2dd9
Convert to array of objects
kgerheiser Nov 9, 2021
b74de4e
Finish filling out and make valid-options an array
kgerheiser Nov 9, 2021
ddf6851
Formatting
kgerheiser Nov 10, 2021
4800678
Move switches.json into bin
kgerheiser Nov 10, 2021
14f254c
Open and read switches.json from CMake
kgerheiser Nov 10, 2021
4b5962a
Ignore build directory
kgerheiser Nov 10, 2021
c377818
Fix some switches
kgerheiser Nov 13, 2021
32be750
Add FindMETIS/FindParMETIS modules
kgerheiser Nov 14, 2021
47f003c
Add CMake functionality
kgerheiser Nov 14, 2021
652bc7d
Handle NCEP2, PDLIB, and SCRIP switch libraries
kgerheiser Nov 14, 2021
2248199
Fix typo in filename
kgerheiser Nov 14, 2021
ed5c4b3
Add switch dependencies and conflicts through requires_any, requires_…
kgerheiser Nov 14, 2021
5775465
Use generic routine nint instead of Intel extension knint
kgerheiser Nov 14, 2021
eb4fd5d
Add checks for conflicting and required dependent switches
kgerheiser Nov 15, 2021
186a0d1
Add CMake package config
kgerheiser Nov 15, 2021
bc42b4a
Document CMake build
kgerheiser Nov 15, 2021
2d3501d
Move FindESMF into SCRIP block
kgerheiser Nov 15, 2021
025d685
Comment out list switches string in w3initmd while I figure out how t…
kgerheiser Nov 15, 2021
a70b317
Cleanup switches.json
kgerheiser Nov 15, 2021
023e030
Revert changes to w3_setup
kgerheiser Nov 15, 2021
4cf9d3b
Add comments to CMakeLists
kgerheiser Nov 15, 2021
7d3913b
Update to correct VERSION
kgerheiser Nov 15, 2021
587b820
Add newline at end of .gitignore to satisfy Gtihub
kgerheiser Nov 15, 2021
16bf040
Add checks for number of switches per category
kgerheiser Nov 15, 2021
49747fe
Cleanup switches.json
kgerheiser Nov 15, 2021
b67d433
Search for and link to ParMETIS when PDLIB is enabled
kgerheiser Nov 15, 2021
bae8d3c
Find and link to OpenMP when OMPG is enabled
kgerheiser Nov 15, 2021
8bc34ba
Use target_compile_options for flags
kgerheiser Nov 15, 2021
4a29d5b
Fix compile options with spaces in them
kgerheiser Nov 15, 2021
209c028
Move Apple common symbol check into Intel compiler
kgerheiser Nov 15, 2021
92ce56d
Make check_switches a function to reduce verbosity in main CMakeLists…
kgerheiser Nov 15, 2021
03971c2
Fix NetCDF executable logic
kgerheiser Nov 16, 2021
042669e
Put executables in CMAKE_BINARY_DIR/bin
kgerheiser Nov 16, 2021
8007e46
Change ww3 library name to be different than target name
kgerheiser Nov 16, 2021
d6b06e7
Cleanup NetCDF logic
kgerheiser Nov 16, 2021
88f5daf
Fix PDLIB build
kgerheiser Nov 16, 2021
f599b91
Make Release default build type
kgerheiser Nov 16, 2021
7833fdd
Create Github Action
kgerheiser Nov 16, 2021
45c56f2
Move spack.yaml
kgerheiser Nov 16, 2021
d584ceb
Move spack.yaml into repo
kgerheiser Nov 16, 2021
a701b7b
Fix spack.yaml
kgerheiser Nov 16, 2021
2a35016
Allow switch file to be a full path
kgerheiser Nov 16, 2021
1e923ab
Add Intel compiler to environment
kgerheiser Nov 16, 2021
02ffac3
Find external packages
kgerheiser Nov 16, 2021
8f3bf7d
Find compilers
kgerheiser Nov 16, 2021
61154d1
test ifort
kgerheiser Nov 16, 2021
909fbf8
Fix name
kgerheiser Nov 16, 2021
330f078
Install Intel OneAPI using Spack
kgerheiser Nov 17, 2021
79beab1
Cache Spack
kgerheiser Nov 17, 2021
f22261c
Fix typo
kgerheiser Nov 17, 2021
3958115
use Spack again with --dirty so Intel compilers work
kgerheiser Nov 17, 2021
81e9507
Spack compiler find
kgerheiser Nov 17, 2021
ba2f012
Test build cache
kgerheiser Nov 17, 2021
a13ab25
Add ci-build through Github Actions
kgerheiser Nov 17, 2021
218bd4f
updates to regtest to test cmake
JessicaMeixner-NOAA Nov 22, 2021
977aa77
Merge remote-tracking branch 'origin/feature/cmake' into feature/cmak…
JessicaMeixner-NOAA Nov 22, 2021
aef91a3
Build ww3_multi
kgerheiser Nov 22, 2021
0dc79bf
Merge remote-tracking branch 'EMC/develop' into feature/cmakeregtests
JessicaMeixner-NOAA Nov 23, 2021
9a548f4
Merge remote-tracking branch 'KG/feature/cmake' into feature/cmakereg…
JessicaMeixner-NOAA Nov 23, 2021
a078598
updates to regtests for cmake
JessicaMeixner-NOAA Nov 29, 2021
39caaab
Add build_files for SMC
kgerheiser Dec 1, 2021
4e856f8
Build ww3_systrk
kgerheiser Dec 1, 2021
3639257
Fix ww3_prnc and tide build
kgerheiser Dec 1, 2021
7176a51
Merge remote-tracking branch 'KG/feature/cmake' into feature/cmakereg…
JessicaMeixner-NOAA Dec 1, 2021
58fc120
Merge remote-tracking branch 'EMC/develop' into feature/cmakeregtests
JessicaMeixner-NOAA Dec 1, 2021
305c89a
Merge branch 'develop' of https://github.com/NOAA-EMC/WW3 into featur…
kgerheiser Dec 2, 2021
d2f7359
code changes needed for cmake to pass
JessicaMeixner-NOAA Dec 2, 2021
cbbcb33
run_cmake_test updates
JessicaMeixner-NOAA Dec 2, 2021
27d57fe
changes to cmake file lists and updates to include full file with ext…
JessicaMeixner-NOAA Dec 2, 2021
d43a421
Merge pull request #2 from JessicaMeixner-NOAA/feature/cmakeregtests
kgerheiser Dec 2, 2021
41ccfde
Fix target_link_libraries signature
kgerheiser Dec 2, 2021
81774cc
removing BT2 which is not used
JessicaMeixner-NOAA Dec 2, 2021
0b0e0cb
updates to cmake -- cleanup of file lists and adding prtide to prog list
JessicaMeixner-NOAA Dec 2, 2021
7da3579
updates to regtests
JessicaMeixner-NOAA Dec 2, 2021
2831a8a
update to have prtide added to program list only
JessicaMeixner-NOAA Dec 2, 2021
bf80b83
Merge branch 'NOAA-EMC:develop' into feature/cmake
kgerheiser Dec 7, 2021
c8452c4
Find and link to OASIS
kgerheiser Dec 8, 2021
4bfc176
Copy switch file to build directory
kgerheiser Dec 9, 2021
cef91d4
Fix switch string in w3initmd
kgerheiser Dec 9, 2021
c39ea6e
Set WW3_SWITCHES just for w3initmd
kgerheiser Dec 9, 2021
b664a80
Install switch file
kgerheiser Dec 9, 2021
6bf6a8a
Merge branch 'NOAA-EMC:develop' into feature/cmakeregtests
JessicaMeixner-NOAA Dec 13, 2021
1e5684b
Merge remote-tracking branch 'KG/feature/cmake' into feature/cmakereg…
JessicaMeixner-NOAA Dec 13, 2021
ca775be
Cleanup switch handling
kgerheiser Dec 14, 2021
7083fd5
Add PGI compiler flags
kgerheiser Dec 14, 2021
7b1d908
Merge remote-tracking branch 'KG/feature/cmake' into feature/cmakereg…
JessicaMeixner-NOAA Dec 15, 2021
66fa836
Merge remote-tracking branch 'EMC/develop' into feature/cmakeregtests
JessicaMeixner-NOAA Dec 15, 2021
7dcfb1c
run prnc with no mpi
JessicaMeixner-NOAA Dec 15, 2021
6e8d4bc
Merge branch 'NOAA-EMC:develop' into feature/cmake
kgerheiser Dec 15, 2021
fbb2c85
Merge pull request #3 from JessicaMeixner-NOAA/feature/cmakeregtests
kgerheiser Dec 15, 2021
388d5c7
Merge branch 'NOAA-EMC:develop' into feature/cmake
kgerheiser Dec 20, 2021
8eae040
Create CMake wrapper for OASIS build and update FindOASIS.cmake
kgerheiser Dec 20, 2021
943250f
Remove extra -I for NetCDF include
kgerheiser Dec 21, 2021
72c71af
Separate dependency build and model build in CI
kgerheiser Dec 21, 2021
88cbdf2
Update cache key
kgerheiser Dec 21, 2021
a6e064c
Fix CI
kgerheiser Dec 21, 2021
98633cc
Have CMake message the switch its building with
kgerheiser Dec 21, 2021
d4f0e3a
Fix cache name
kgerheiser Dec 21, 2021
18a8623
Workflow fixes
kgerheiser Dec 21, 2021
7f3f23c
Add some test switches
kgerheiser Dec 21, 2021
a23a573
Fix cache name
kgerheiser Dec 21, 2021
21eefae
Don't checkout Intel compiler in setup step if nothing to build
kgerheiser Dec 21, 2021
85c17a7
Run using matrix os
kgerheiser Dec 21, 2021
2b32f6a
Build OASIS
kgerheiser Dec 21, 2021
8dd6d3c
Create README for CI dir
kgerheiser Dec 21, 2021
2c86c8b
Fix syntax
kgerheiser Dec 21, 2021
a43b39c
Fix build order
kgerheiser Dec 21, 2021
a1cdf59
Add WWATCH3_DIR env variable for OASIS build
kgerheiser Dec 21, 2021
9c544d6
Remove custom command and custom target
kgerheiser Dec 21, 2021
9717ccd
Use make instead of gmake
kgerheiser Dec 21, 2021
92331a6
Enable fail fast
kgerheiser Dec 21, 2021
cf68f8d
Add description to SWITCH option
kgerheiser Dec 21, 2021
aa62a25
Debug oasis build
kgerheiser Dec 21, 2021
10ff2ab
Disable spack
kgerheiser Dec 21, 2021
ff26f90
Build with Spack
kgerheiser Dec 21, 2021
8b1095e
Disable ESMF
kgerheiser Dec 21, 2021
71c236e
Add debug commands
kgerheiser Dec 21, 2021
0edf779
Fix whitespace in Makefile
kgerheiser Dec 21, 2021
cd71c7f
Ignore OASIS build artifacts
kgerheiser Dec 22, 2021
92a03d9
Change how NetCDF is included
kgerheiser Dec 22, 2021
e54a381
Revert Makefile to original form
kgerheiser Dec 22, 2021
cf5fd9e
Fix switch name
kgerheiser Dec 22, 2021
0925d4f
Remove add_dependencies
kgerheiser Dec 22, 2021
eccab34
Fix name again
kgerheiser Dec 22, 2021
6808be4
Re-enable ESMF
kgerheiser Dec 22, 2021
88559ed
Cleanup workflow file
kgerheiser Dec 22, 2021
ee6a025
Add GNU CI build
kgerheiser Dec 22, 2021
731498c
Cleanup Action code
kgerheiser Dec 22, 2021
ff45494
Use runner.os
kgerheiser Dec 22, 2021
6df4cb0
Make verbose
kgerheiser Dec 22, 2021
bdde8f2
make verbose
kgerheiser Dec 22, 2021
e03b8fd
Debug GNU build
kgerheiser Dec 22, 2021
9b2c6e9
Use gcc-10
kgerheiser Dec 22, 2021
241e01f
Pass FCFLAGS to MCT build for gfortran-10 compatability flags
kgerheiser Dec 22, 2021
bd44a63
Remove unnecessary flags for GCC-10
kgerheiser Dec 22, 2021
185d46d
Enable libraries
kgerheiser Dec 23, 2021
a25aa6f
Start with a fresh cache
kgerheiser Dec 23, 2021
bbdcfe5
Make verbose
kgerheiser Dec 23, 2021
7ff226b
Change OASIS/NetCDF link order
kgerheiser Dec 23, 2021
6f0309b
Include FindPackageHandleStandardArgs
kgerheiser Dec 23, 2021
31369b3
Add MULTI_ESMF option to build libww3_multi_esmf
kgerheiser Dec 23, 2021
2c7efff
CI switches dir
kgerheiser Dec 23, 2021
24ab910
Add MULTI_ESMF build test in CI
kgerheiser Dec 23, 2021
106699e
Fix switch format
kgerheiser Dec 23, 2021
4d8be57
New cache key
kgerheiser Dec 23, 2021
2ff0d13
Merge branch 'NOAA-EMC:develop' into feature/cmake
kgerheiser Dec 28, 2021
2161b42
Create CMake README
kgerheiser Jan 5, 2022
115c58e
Merge branch 'feature/cmake' of github.com:kgerheiser/WW3 into featur…
kgerheiser Jan 5, 2022
923a24d
Cleanup documentation
kgerheiser Jan 5, 2022
9ebc054
Update README.md
kgerheiser Jan 5, 2022
98f7839
Update README.md
kgerheiser Jan 5, 2022
9216100
Explain CMake command path
kgerheiser Jan 5, 2022
5ac810b
Add comments
kgerheiser Jan 5, 2022
82836e3
Merge branch 'develop' of https://github.com/NOAA-EMC/WW3 into featur…
kgerheiser Jan 12, 2022
9aad563
Update docs
kgerheiser Jan 12, 2022
4652896
Update README.md
kgerheiser Jan 12, 2022
146023e
Update README.md
kgerheiser Jan 12, 2022
65a5505
Build OASIS before running CMake for regtests
kgerheiser Jan 12, 2022
457ccee
Merge branch 'feature/cmake' of github.com:kgerheiser/WW3 into featur…
kgerheiser Jan 12, 2022
30efff5
Update README.md
kgerheiser Jan 13, 2022
0469c38
Fix FindNetCDF in OASIS build
kgerheiser Jan 18, 2022
8aced96
Merge branch 'feature/cmake' of github.com:kgerheiser/WW3 into featur…
kgerheiser Jan 18, 2022
77a3c94
Create work dir before building OASIS
kgerheiser Jan 18, 2022
f9d0a06
Build OASIS in source
kgerheiser Jan 18, 2022
d9d9efc
Fix GNU flag being used for ifort
Jan 18, 2022
1a99cec
Fix NetCDF flags
Jan 19, 2022
4d58e1c
Merge branch 'develop' of https://github.com/NOAA-EMC/WW3 into featur…
kgerheiser Jan 19, 2022
fdd6817
Remove old cmake in esmf folder and update for grib (#4)
JessicaMeixner-NOAA Jan 19, 2022
9219a7d
Add ability to build WW3 as UFS submodule
kgerheiser Jan 20, 2022
72b710f
Merge branch 'feature/cmake' of github.com:kgerheiser/WW3 into featur…
kgerheiser Jan 20, 2022
72a6edf
Merge branch 'NOAA-EMC:develop' into feature/cmake
kgerheiser Feb 2, 2022
4c1e509
Refer to official WW3 repo in CMake docs
kgerheiser Feb 3, 2022
98a3c44
Add NetCDF option to CMake build
kgerheiser Feb 4, 2022
7fb02e9
Merge branch 'feature/cmake' of github.com:kgerheiser/WW3 into featur…
kgerheiser Feb 4, 2022
674291e
Document NetCDF option
kgerheiser Feb 4, 2022
83370a9
non interactive ww3_from_ftp.sh #603
mickaelaccensi Feb 9, 2022
27f3479
uniformize regtests output by setting a global output type in the mat…
mickaelaccensi Feb 9, 2022
600b952
ww3_doxy_tmpl.md: clarify MODULE markup (#606)
MatthewMasarik-NOAA Feb 9, 2022
afc4ccc
update cmake module files and a little clean up
JessicaMeixner-NOAA Feb 13, 2022
9aec81a
update run_cmake_test with update from run_test
JessicaMeixner-NOAA Feb 13, 2022
0f30457
namelist feature for program ww3_bound (#610)
mickaelaccensi Feb 16, 2022
349ad98
doxygen: remove existing doxygen errors prior to markup (#611)
MatthewMasarik-NOAA Feb 16, 2022
d1a343c
update cmake file list for new bound namelist
JessicaMeixner-NOAA Feb 16, 2022
2ef6f9a
add matrix cmake for datarmor hpc
mickaelaccensi Feb 16, 2022
19e4fbb
Create matrix_cmake_datarmor
kgerheiser Feb 16, 2022
75f5ad4
Add -ffree-line-length-none to OASIS build for GNU
kgerheiser Feb 16, 2022
dfb5e00
fix grib build (#7)
JessicaMeixner-NOAA Feb 17, 2022
f4de739
Merge branch 'develop' into cmake
mickaelaccensi Feb 18, 2022
ddcbb13
update prep_env and CMakeLists.txt for cmake compilation
mickaelaccensi Feb 18, 2022
f1a7239
update run_cmake_test
JessicaMeixner-NOAA Feb 18, 2022
a2f0bf0
make matrix.comp work
JessicaMeixner-NOAA Feb 22, 2022
538dfad
Merge branch 'feature/cmake' of https://github.com/kgerheiser/WW3 int…
mickaelaccensi Feb 22, 2022
facd263
Merge pull request #9 from JessicaMeixner-NOAA/feature/cmake
kgerheiser Feb 22, 2022
c6f2906
fix matrix.comp
JessicaMeixner-NOAA Feb 23, 2022
df7a663
Merge pull request #10 from JessicaMeixner-NOAA/feature/cmake
kgerheiser Feb 24, 2022
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
103 changes: 103 additions & 0 deletions .github/workflows/gnu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
name: GNU Linux Build
on: [push, pull_request]

env:
cache_key: gnu3
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 m4 cmake pkgconf openssl
spack add [email protected]
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
cd ww3/regtests/ww3_tp2.14/input/oasis3-mct/util/make_dir
mkdir build && cd build
cmake ..
make VERBOSE=1
cp -r ${GITHUB_WORKSPACE}/ww3/regtests/ww3_tp2.14/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


128 changes: 128 additions & 0 deletions .github/workflows/intel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
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: intel4
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 m4 cmake pkgconf openssl
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
cd ww3/regtests/ww3_tp2.14/input/oasis3-mct/util/make_dir
mkdir build && cd build
cmake ..
make
cp -r ${GITHUB_WORKSPACE}/ww3/regtests/ww3_tp2.14/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


2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -137,3 +137,5 @@ model/bin/wwatch3.env
*/.*.swp
*/*/.*.swp
*/*/*/.*.swp
.DS_Store
build
45 changes: 45 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# 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)

set(MULTI_ESMF OFF CACHE BOOL "Build ww3_multi_esmf library")

# 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