Skip to content

Commit

Permalink
Resolve merge conflict in workflows file for FCOO
Browse files Browse the repository at this point in the history
  • Loading branch information
CarstenHansen committed Jan 15, 2024
2 parents 003e8f9 + d480d68 commit dee5470
Show file tree
Hide file tree
Showing 8 changed files with 389 additions and 5 deletions.
18 changes: 13 additions & 5 deletions .github/workflows/intel.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# This is a GitHub actions workflow for WW3.
#
# This workflow builds with the Intel compilers.
#
# Matt Masarik, Alex Richert, Ed Hartnett
name: Intel Linux Build
on: [push, pull_request, workflow_dispatch]

Expand All @@ -8,7 +13,7 @@ concurrency:

# Set I_MPI_CC/F90 so Intel MPI wrapper uses icc/ifort instead of gcc/gfortran
env:
cache_key: intel10
cache_key: intel10-3
CC: icc
FC: ifort
CXX: icpc
Expand All @@ -21,7 +26,7 @@ env:

jobs:
setup:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest

steps:

Expand Down Expand Up @@ -51,12 +56,13 @@ jobs:
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
sudo apt-get install intel-oneapi-dev-utilities intel-oneapi-mpi-devel intel-oneapi-compiler-fortran-2023.2.1 intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic-2023.2.1 intel-oneapi-openmp
# Build WW3 spack environment
- name: install-dependencies-with-spack
if: steps.cache-env.outputs.cache-hit != 'true'
run: |
sudo mv /usr/local /usr/local_mv
# Install NetCDF, ESMF, g2, etc using Spack
. /opt/intel/oneapi/setvars.sh
git clone -c feature.manyFiles=true https://github.com/JCSDA/spack.git
Expand All @@ -67,7 +73,7 @@ jobs:
spack compiler find
sudo apt install cmake
spack external find
spack add intel-oneapi-mpi
spack config add "packages:mpi:require:'intel-oneapi-mpi'"
spack config add "packages:all:require:['%intel']"
spack concretize
spack install --dirty -v --fail-fast
Expand All @@ -92,7 +98,7 @@ jobs:
strategy:
matrix:
switch: [Ifremer1, NCEP_st2, NCEP_st4, ite_pdlib, NCEP_st4sbs, NCEP_glwu, OASACM, UKMO, MULTI_ESMF, FCOO]
runs-on: ubuntu-20.04
runs-on: ubuntu-latest

steps:
- name: checkout-ww3
Expand All @@ -113,6 +119,8 @@ jobs:

- name: build-ww3
run: |
sudo mv /usr/local /usr/local_mv
sudo apt install cmake
. /opt/intel/oneapi/setvars.sh
source spack/share/spack/setup-env.sh
spack env activate ww3-intel
Expand Down
122 changes: 122 additions & 0 deletions .github/workflows/io_gnu_yml.old
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
name: io_gnu
on: [push, pull_request, workflow_dispatch]

# Cancel in-progress workflows when pushing to a branch
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

env:
cache_key: gnu11-1
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-latest

steps:
- name: checkout-ww3
if: steps.cache-env.outputs.cache-hit != 'true'
uses: actions/checkout@v3
with:
path: ww3
# 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@v3
with:
path: |
spack
~/.spack
work_oasis3-mct
key: spack-${{ runner.os }}-${{ env.cache_key }}-${{ hashFiles('ww3/model/ci/spack_gnu.yaml') }}

# 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
sudo apt install cmake
git clone -c feature.manyFiles=true https://github.com/JCSDA/spack.git
source spack/share/spack/setup-env.sh
spack env create ww3-gnu ww3/model/ci/spack_gnu.yaml
spack env activate ww3-gnu
spack compiler find
spack external find cmake
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
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}

io_gnu:
needs: setup
runs-on: ubuntu-latest

steps:
- name: install-dependencies
run: |
sudo apt-get update
sudo apt-get install doxygen gcovr valgrind

- name: checkout-ww3
uses: actions/checkout@v3
with:
path: ww3

- name: cache-env
id: cache-env
uses: actions/cache@v3
with:
path: |
spack
~/.spack
work_oasis3-mct
key: spack-${{ runner.os }}-${{ env.cache_key }}-${{ hashFiles('ww3/model/ci/spack_gnu.yaml') }}

- name: build-ww3
run: |
source spack/share/spack/setup-env.sh
spack env activate ww3-gnu
set -x
cd ww3
export CC=mpicc
export FC=mpif90
export OASISDIR=${GITHUB_WORKSPACE}/work_oasis3-mct
mkdir build && cd build
export LD_LIBRARY_PATH="/home/runner/work/WW3/WW3/spack/var/spack/environments/ww3-gnu/.spack-env/view/:$LD_LIBRARY_PATH"
cmake -DSWITCH=${GITHUB_WORKSPACE}/ww3/regtests/unittests/data/switch.io -DCMAKE_BUILD_TYPE=Debug -DCMAKE_Fortran_FLAGS="-g -fprofile-abs-path -fprofile-arcs -ftest-coverage -O0 -Wall -fno-omit-frame-pointer -fsanitize=address" -DCMAKE_C_FLAGS="-g -fprofile-abs-path -fprofile-arcs -ftest-coverage -O0 -Wall -fno-omit-frame-pointer -fsanitize=address" ..
make -j2 VERBOSE=1
./bin/ww3_grid
mv mod_def.ww3 regtests/unittests
ctest --verbose --output-on-failure --rerun-failed
gcovr --root .. -v --html-details --exclude ../regtests/unittests --exclude CMakeFiles --print-summary -o test-coverage.html &> /dev/null

- name: upload-test-coverage
uses: actions/upload-artifact@v3
with:
name: ww3-test-coverage
path: |
ww3/build/*.html
ww3/build/*.css


6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,9 @@ if(NOT CMAKE_BUILD_TYPE MATCHES "^(Debug|Release|RelWithDebInfo|MinSizeRel)$")
endif()

add_subdirectory(model)

# Turn on unit testing.
include(CTest)
if(BUILD_TESTING)
add_subdirectory(regtests/unittests)
endif()
39 changes: 39 additions & 0 deletions regtests/unittests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# This is the CMake file for the model/tests directory in the WW3
# project.
#
# Ed Hartnett, 10/14/23

# Some very small test files may be committed to the repo. This
# function copies such a data file to the build directory.
function(copy_test_data name)
message(STATUS "Copying ${name} to ${CMAKE_CURRENT_BINARY_DIR}")
file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/data/${name}"
DESTINATION ${CMAKE_CURRENT_BINARY_DIR}
FILE_PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
endfunction()

# Some very small test files may be committed to the repo. This
# function copies such a data file to the build directory.
function(copy_test_data_2 srcname destname)
message(STATUS "Copying ${srcname} to ${CMAKE_CURRENT_BINARY_DIR}/${destname}")
file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/data/${srcname}"
DESTINATION "${CMAKE_BINARY_DIR}"
FILE_PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
file(RENAME "${CMAKE_BINARY_DIR}/${srcname}" "${CMAKE_BINARY_DIR}/${destname}")
endfunction()

# Function to build and run a test.
function(unit_test name)
add_executable(${name} ${name}.F90)
target_link_libraries(${name} PRIVATE ww3_lib)
add_test(NAME ${name} COMMAND ${name})
endfunction()

# Copy test data files that are in the repo to the build directory.
copy_test_data(switch.io)
copy_test_data_2(ww3_grid.inp ww3_grid.inp)

# Build and run the tests.
unit_test(test_io_points_bin)


1 change: 1 addition & 0 deletions regtests/unittests/data/switch.io
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
NOGRB SHRD PR1 FLX2 LN0 ST0 NL0 BT0 DB0 TR0 BS0 IC0 IS0 REF0 WNT1 WNX1 CRT1 CRX1 O0 O1 O2 O3 O4 O5 O6 O7 O10 O11
48 changes: 48 additions & 0 deletions regtests/unittests/data/ww3_grid.inp
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
$ WAVEWATCH III Grid preprocessor input file
$ ------------------------------------------
'1-D REFRACTION X '
$
1.25 0.08 3 24 0.
$
F T F T F F
300. 300. 150. 300.
$
&PRO1 CFLTM = 0.75 /
&PRO2 CFLTM = 0.75 /
&PRO3 CFLTM = 0.75, WDTHCG = 0., WDTHTH = 0. /
&PRO4 CFLTM = 0.75, RNFAC = 0., RSFAC = 0. /
END OF NAMELISTS
$
'RECT' F 'NONE'
13 3
5.E3 5.E3 1.
-5.E3 -5.E3 1.
$
-1. 1. 10 -1. 2 1 '(....)' 'UNIT' 'input'
$
$ First grid
$
50 50 50 45 40 35 30 25 20 15 10 5 0
50 50 50 45 40 35 30 25 20 15 10 5 0
50 50 50 45 40 35 30 25 20 15 10 5 0
$
$ Second grid
$
$ 0 5 10 15 20 25 30 35 40 45 50 50 50
$ 0 5 10 15 20 25 30 35 40 45 50 50 50
$ 0 5 10 15 20 25 30 35 40 45 50 50 50
$
10 1 1 '(....)' 'PART' 'input'
$
$ First grid
$
2 2 F
$
$ Second grid
$
$ 12 2 F
0 0 F
0 0 F
0 0
$
0. 0. 0. 0. 0
8 changes: 8 additions & 0 deletions regtests/unittests/data/ww3_outp.inp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
$
20100101 000000 3600 1
$
1
-1
$
4
2 30 20100101 000000 'UTC'
Loading

0 comments on commit dee5470

Please sign in to comment.