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 NUOPC cap to the model to support external land component under UFS #1

Merged
merged 94 commits into from
Oct 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
94 commits
Select commit Hold shift + click to select a range
cbbf9ff
Merge pull request #22 from NCAR/develop
cenlinhe Nov 30, 2021
2e8ab9d
Merge pull request #23 from NCAR/develop
cenlinhe Dec 1, 2021
ab71a06
Update README.md
cenlinhe Dec 1, 2021
5abb3e7
re-structure driver directory
cenlinhe Dec 7, 2021
7396027
Merge pull request #26 from NCAR/develop
cenlinhe Jan 8, 2022
5eeddb8
Merge pull request #27 from NCAR/develop
cenlinhe Jan 10, 2022
3d82c45
Merge pull request #28 from NCAR/develop
cenlinhe Jan 13, 2022
aed82e1
Merge pull request #29 from NCAR/develop
cenlinhe Jan 14, 2022
f80b216
Merge pull request #31 from NCAR/develop
cenlinhe Jan 28, 2022
638df94
update noahmp code from ccpp physics and and support for nuopc cap
uturuncoglu Mar 2, 2022
8fe9da1
move ccpp related files
uturuncoglu Mar 3, 2022
a1b4901
add support to read in initial condition from sfc files
uturuncoglu Mar 4, 2022
69c24e2
update documentation
uturuncoglu Mar 10, 2022
dda6f9b
update noahmp
uturuncoglu Apr 12, 2022
880e2d4
add comments
uturuncoglu Apr 12, 2022
6fd44a3
update noahmp source code
uturuncoglu Apr 25, 2022
8680fd6
update to support 32bit FMS library
uturuncoglu Apr 29, 2022
4ae165c
enable standalone build and fix issues under GNU compilers
uturuncoglu Jun 16, 2022
61fbe53
minor fix
uturuncoglu Jun 23, 2022
20c6328
Merge branch 'feature/nuopc_cap' of https://github.com/NOAA-EMC/noahm…
uturuncoglu Jun 23, 2022
02fab58
clean build and fix issues
uturuncoglu Jun 27, 2022
c542eca
add find mpi to build
uturuncoglu Jul 9, 2022
b5f003d
update build
uturuncoglu Jul 18, 2022
3bc6618
update build
uturuncoglu Jul 18, 2022
3515a17
update build
uturuncoglu Jul 18, 2022
b30de91
update build
uturuncoglu Jul 18, 2022
e2285f3
Update CMakeLists.txt
uturuncoglu Jul 19, 2022
a37f450
update build to work on under CI
uturuncoglu Jul 19, 2022
5c368af
add openmp support to build for fms
uturuncoglu Jul 19, 2022
cd80c98
update cap to allow running under CI
uturuncoglu Jul 20, 2022
434afac
minor fixes
uturuncoglu Aug 5, 2022
ba359bc
update noahmp code
uturuncoglu Aug 11, 2022
e3ddc6c
update pressure field and add new variables to output
uturuncoglu Aug 18, 2022
12a807b
fix to write 3d fileds under gnu
uturuncoglu Aug 19, 2022
11e112b
minor fix for gnu
uturuncoglu Aug 19, 2022
07f7aad
update for side-by-side configuration
uturuncoglu Sep 15, 2022
862f179
fix for gnu compiler
uturuncoglu Sep 15, 2022
b4bc6b4
Update lnd_comp_nuopc.F90
theurich Sep 16, 2022
1653d92
fix log issue
uturuncoglu Sep 18, 2022
ee5e6e5
Merge branch 'feature/nuopc_cap_new' of https://github.com/esmf-org/n…
uturuncoglu Sep 18, 2022
9aabff1
sync with ccpp noahmp
uturuncoglu Sep 20, 2022
4de3f12
remove debug print statement
uturuncoglu Sep 20, 2022
29a5853
fix for updated model
uturuncoglu Sep 27, 2022
27d8861
fix minor issues
uturuncoglu Sep 27, 2022
3e92fe8
add github action for comp testing
uturuncoglu Sep 27, 2022
0662ba8
update spack.yaml
uturuncoglu Sep 27, 2022
7bc585b
fix for GNU
uturuncoglu Sep 28, 2022
16718e9
Merge branch 'feature/nuopc_cap_new' of https://github.com/esmf-org/n…
uturuncoglu Sep 28, 2022
ac541d0
update build to support ESMX driver
uturuncoglu Sep 29, 2022
9ab1d46
create executable using ESMX
uturuncoglu Sep 29, 2022
2af4224
remove old content
uturuncoglu Sep 29, 2022
e0bdfeb
update spack.yaml file
uturuncoglu Sep 29, 2022
8024d04
add test scripts
uturuncoglu Sep 29, 2022
24623a5
Merge branch 'feature/nuopc_cap_new' of https://github.com/esmf-org/n…
uturuncoglu Sep 29, 2022
2279ec5
add support for input files
uturuncoglu Sep 29, 2022
b3de69c
add space
uturuncoglu Sep 29, 2022
8518772
add debug code
uturuncoglu Sep 29, 2022
ce0ee02
add support to generate namelist files
uturuncoglu Sep 29, 2022
fe994ac
add script to generate namelist files
uturuncoglu Sep 29, 2022
55eea78
Merge branch 'feature/nuopc_cap_new' of https://github.com/esmf-org/n…
uturuncoglu Sep 29, 2022
6fe0b0a
restructure testing
uturuncoglu Sep 29, 2022
a85d9b0
update test configuration
uturuncoglu Sep 29, 2022
5fb2e51
fix land component yaml
uturuncoglu Sep 29, 2022
602fffa
add support for baseline check
uturuncoglu Sep 30, 2022
3af1da6
update ci test
uturuncoglu Sep 30, 2022
b7faf66
fix ci test for input files
uturuncoglu Sep 30, 2022
1fa0d13
fix hash file format and add debug code
uturuncoglu Sep 30, 2022
e5b1a10
fix configuration files
uturuncoglu Sep 30, 2022
d79edf5
minor fix for ci
uturuncoglu Sep 30, 2022
823fe5f
minor fix for baseline under ci
uturuncoglu Sep 30, 2022
1776d20
add logs also to artifacts
uturuncoglu Sep 30, 2022
5336b4e
add some debug command
uturuncoglu Sep 30, 2022
22bd123
minor fix to catch stdout and err
uturuncoglu Sep 30, 2022
1e45742
add metadata file for driver
uturuncoglu Oct 3, 2022
a3cf9ec
fix meta file to make noahmp as a submodule under CCPP
uturuncoglu Oct 4, 2022
5c12ac5
add debug code
uturuncoglu Oct 4, 2022
246570c
fix location of spack.lock file
uturuncoglu Oct 4, 2022
0804727
update interpolation parameters to get bit-to-bit results
uturuncoglu Oct 6, 2022
f542e84
debug for cache
uturuncoglu Oct 6, 2022
07af776
add debug code
uturuncoglu Oct 10, 2022
1786b19
more debug to ci
uturuncoglu Oct 10, 2022
62c391c
update documentation
uturuncoglu Oct 12, 2022
7e659de
Merge branch 'feature/nuopc_cap_new' of https://github.com/esmf-org/n…
uturuncoglu Oct 12, 2022
9f094af
update doc
uturuncoglu Oct 12, 2022
dd03f92
fix action
uturuncoglu Oct 12, 2022
b6f5921
update action
uturuncoglu Oct 12, 2022
e7fd1dd
upload spack.lock to artifacts
uturuncoglu Oct 12, 2022
d972bf9
set target explicitly to fix caching with different runners
uturuncoglu Oct 16, 2022
2afda25
set target as x86_64_v4
uturuncoglu Oct 16, 2022
8295698
remove debug code
uturuncoglu Oct 16, 2022
c8a1b94
add status badge
uturuncoglu Oct 17, 2022
99e449d
fix issue with ort dbg test
Oct 20, 2022
de0a150
fix for inconsistent masking in input files
Oct 20, 2022
4b580ea
set-output is replaced with environment
uturuncoglu Oct 20, 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
Binary file added .github/workflows/data/C96.initial.tile1.nc
Binary file not shown.
Binary file added .github/workflows/data/C96.initial.tile2.nc
Binary file not shown.
Binary file added .github/workflows/data/C96.initial.tile3.nc
Binary file not shown.
Binary file added .github/workflows/data/C96.initial.tile4.nc
Binary file not shown.
Binary file added .github/workflows/data/C96.initial.tile5.nc
Binary file not shown.
Binary file added .github/workflows/data/C96.initial.tile6.nc
Binary file not shown.
Binary file added .github/workflows/data/oro_data.tile1.nc
Binary file not shown.
Binary file added .github/workflows/data/oro_data.tile2.nc
Binary file not shown.
Binary file added .github/workflows/data/oro_data.tile3.nc
Binary file not shown.
Binary file added .github/workflows/data/oro_data.tile4.nc
Binary file not shown.
Binary file added .github/workflows/data/oro_data.tile5.nc
Binary file not shown.
Binary file added .github/workflows/data/oro_data.tile6.nc
Binary file not shown.
287 changes: 287 additions & 0 deletions .github/workflows/datm_noahmp.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,287 @@
name: test_datm_lnd

on:
push:
branches: [ feature/nuopc_cap_new ]
pull_request:
branches: [ feature/nuopc_cap_new ]
# following is required to prevent auto-removing cache entries after 7-days
# this only works on default branch
schedule:
- cron: '0 0 * * MON'
- cron: '0 0 * * FRI'
# following is required to run action manually
workflow_dispatch:

jobs:
latest-stable:
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
os:
- ubuntu-22.04

env:
# installation location for spack and other components
INSTALL_DIR: ${{ github.workspace }}/install
# option for baseline generation
REGENERATE_BASELINE: 'false'
# option for retention period for artifacts, default is 90 days
ARTIFACTS_RETENTION_PERIOD: 2

steps:
# checkout base repository
- name: Checkout NoahMP Repository
uses: actions/checkout@v3
with:
ref: feature/nuopc_cap_new

# prepare core environment
- name: Install Core Development Tools
run: |
sudo apt-get update
sudo apt-get install unzip file gringo
sudo apt-get install build-essential binutils-dev gfortran
sudo apt-get install python3-dev python3-boto3 python3-yaml
sudo apt-get install wget awscli ca-certificates

# checkout spack to create build environment
- name: Checkout Spack
uses: actions/checkout@v3
with:
repository: uturuncoglu/spack
path: spack
ref: feature/esmx_version

# create build environment
- name: Concretize Spack Environment Using YAML Specification
run: |
. $GITHUB_WORKSPACE/spack/share/spack/setup-env.sh
spack --color always -e ${{ github.workspace }}/.github/workflows/spack concretize -f

# push spack lock file to the artifcats
#- name: Upload spack.yaml to Artifacts
# uses: actions/upload-artifact@v3
# with:
# name: spack lock
# path: ${{ github.workspace }}/.github/workflows/spack/spack.lock

# restore build environment from cache
- name: Restore Build Environment From Cache
id: cache-spack
uses: actions/cache@v3
with:
# NOTE: the following path needs to be consitent with the path defined in spack.yaml
path: /home/runner/work/noahmp/.spack-ci
key: ${{ matrix.os }}-spack-${{ hashFiles('**/spack.lock') }}
restore-keys: |
${{ matrix.os }}-spack

#- run: |
# echo ${{ hashFiles('**/spack.lock') }}
# cat ${{ github.workspace }}/.github/workflows/spack/spack.lock
# cat ${{ github.workspace }}/.github/workflows/spack/spack.yaml

# install build environment
- name: Install Spack Packages
if: steps.cache-spack.outputs.cache-hit != 'true'
run: |
. $GITHUB_WORKSPACE/spack/share/spack/setup-env.sh
spack --color always -e ${{ github.workspace }}/.github/workflows/spack install -j3

# build and install component
# need to install with openmp support since fms build with it
# TODO: update fms in spack.yaml as fms~openmp to build it without openmp support
- name: Build and Install NoahMP
run: |
export PATH=${{ github.workspace }}/../.spack-ci/view/bin:$PATH
export ESMFMKFILE=${{ github.workspace }}/../.spack-ci/view/lib/esmf.mk
export NetCDF_ROOT=`nc-config --prefix`
export FC=gfortran
cd ${{ github.workspace }}
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=${{ env.INSTALL_DIR }} -DOPENMP=ON ../
make
make install

# checkout data models
- name: Checkout CDEPS
uses: actions/checkout@v3
with:
repository: uturuncoglu/CDEPS
path: cdeps
ref: hotfix/std_build

# build and install data models
- name: Build and Install CDEPS
run: |
export PATH=${{ github.workspace }}/../.spack-ci/view/bin:$PATH
export ESMFMKFILE=${{ github.workspace }}/../.spack-ci/view/lib/esmf.mk
export FC=gfortran
cd ${{ github.workspace }}/cdeps
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=${{ env.INSTALL_DIR }} \
-DPIO_C_LIBRARY=${{ github.workspace }}/../.spack-ci/view/lib \
-DPIO_C_INCLUDE_DIR=${{ github.workspace }}/../.spack-ci/view/include \
-DPIO_Fortran_LIBRARY=${{ github.workspace }}/../.spack-ci/view/lib \
-DPIO_Fortran_INCLUDE_DIR=${{ github.workspace }}/../.spack-ci/view/include \
-DCMAKE_Fortran_FLAGS="-ffree-line-length-none -fallow-argument-mismatch -fallow-invalid-boz" \
-DDISABLE_FoX=ON ../
make
make install

# use ESMX generic driver and create executable
- name: Use ESMX to create executable
run: |
# set required environment variables
export PATH=${{ github.workspace }}/../.spack-ci/view/bin:$PATH
export ESMFMKFILE=${{ github.workspace }}/../.spack-ci/view/lib/esmf.mk
export ESMF_ESMXDIR=${{ github.workspace }}/../.spack-ci/view/include/ESMX
# create run directory
mkdir ${{ github.workspace }}/app
cd ${{ github.workspace }}/app
# create ESMX build file
echo "components:" >> esmxBuild.yaml
echo " datm:" >> esmxBuild.yaml
echo " cmake_config: ${{ env.INSTALL_DIR }}/lib/cmake/datm-esmx.cmake" >> esmxBuild.yaml
echo " fort_module: cdeps_datm_comp" >> esmxBuild.yaml
echo " noahmp:" >> esmxBuild.yaml
echo " cmake_config: ${{ env.INSTALL_DIR }}/lib/cmake/noahmp-esmx.cmake" >> esmxBuild.yaml
echo " fort_module: lnd_comp_nuopc" >> esmxBuild.yaml
# create build directory
cmake -H$ESMF_ESMXDIR -Bbuild
# compile and create executable
cd ${{ github.workspace }}/app/build
make

# restore input files from cache
- name: Restore Input Files From Cache
id: cache-input
uses: actions/cache@v3
with:
path: ${{ github.workspace }}/app/build/INPUT
key: input-${{ hashFiles('**/file_checksum.lock') }}
restore-keys: |
input

# download input files for components
- name: Download Input Files
if: steps.cache-input.outputs.cache-hit != 'true'
run: |
export PATH=${{ github.workspace }}/../.spack-ci/view/bin:$PATH
mkdir -p ${{ github.workspace }}/app/build/INPUT
cd ${{ github.workspace }}/app/build/INPUT
# get rest of the data from servers
python3 ${{ github.workspace }}/.github/workflows/scripts/get_input.py --ifile ${{ github.workspace }}/.github/workflows/tests/test_datm_lnd.yaml
# some data for land is not correct in S3 bucket and need to be copied from workflow directory
rm -rf oro_data.tile*.nc
cp ${{ github.workspace }}/.github/workflows/data/oro_data.tile*.nc .
# copy initial conditions
cp ${{ github.workspace }}/.github/workflows/data/C96.initial.tile*.nc .
# add them to checksum file
lst=`ls -al oro_data.tile*.nc C96.initial.tile*.nc | awk '{print $9}'`
for i in $lst; do
md5sum $i >> file_checksum.lock
done
cat file_checksum.lock
# create link for grid spec file
ln -sf grid_spec.nc C96_mosaic.nc

# checkout paramgen to create configuration files
- name: Checkout ParamGen
uses: actions/checkout@v3
with:
repository: uturuncoglu/ParamGen
path: paramgen
ref: main

# generate configuration files
- name: Generate Configuration Files
run: |
export PYTHONPATH=$GITHUB_WORKSPACE/paramgen:$PYTHONPATH
export INPUT_DIR='INPUT'
export DATAMODE='CLMNCEP'
export MODEL_MESHFILE='INPUT/fv1.9x2.5_141008_ESMFmesh.nc'
export MODEL_MASKFILE='INPUT/fv1.9x2.5_141008_ESMFmesh.nc'
export NX_GLOBAL=144
export NY_GLOBAL=96
cd ${{ github.workspace }}/app/build
python3 ${{ github.workspace }}/.github/workflows/scripts/gen_config.py --ifile ${{ github.workspace }}/.github/workflows/tests/test_datm_lnd.yaml
# get field dictionary from UFS weather model fork
wget https://raw.githubusercontent.com/uturuncoglu/ufs-weather-model/feature/lnd_noahmp_new/tests/parm/fd_nems.yaml

# run application
- name: Run Application
run: |
export PATH=${{ github.workspace }}/../.spack-ci/view/bin:$PATH
cd ${{ github.workspace }}/app/build
mpirun --oversubscribe -np 6 --allow-run-as-root ${{ github.workspace }}/app/build/esmx 2>&1 | tee out_err.txt
tar -czvf log_files.tar.gz PET* out_err.txt datm.log

# upload model results to artifacts to check it later
- name: Upload Output to Artifacts
uses: actions/upload-artifact@v3
with:
name: model output
path: ${{ github.workspace }}/app/build/comp.test.lnd*.nc
retention-days: ${{ env.ARTIFACTS_RETENTION_PERIOD }}

# upload log files to artifacts for further examination
- name: Upload Logs to Artifacts
uses: actions/upload-artifact@v3
with:
name: log files
path: ${{ github.workspace }}/app/build/log_files.tar.gz
retention-days: ${{ env.ARTIFACTS_RETENTION_PERIOD }}

# calculate hashes
- name: Calculate Hashes of Output Files
run: |
cd ${{ github.workspace }}/app/build
lst=`ls -al comp.test.lnd.out.*.nc | awk '{print $9}'`
for i in $lst; do
md5sum $i >> output_hash.txt
done
cat output_hash.txt

# restore baseline hash file from cache
- name: Restore Baseline Hash File From Cache
uses: actions/cache@v3
if: ${{ env.REGENERATE_BASELINE }} != 'true'
with:
path: ${{ github.workspace }}/app/build/output_hash_baseline.txt
key: baseline-${{ hashFiles('output_hash_baseline.txt') }}
restore-keys: |
baseline-

# compare with the baseline
- name: Compare with Baseline
id: compare-baseline
run: |
cd ${{ github.workspace }}/app/build
# compare against the baseline
if test -f "output_hash_baseline.txt"; then
echo "Baseline:"
cat output_hash_baseline.txt
echo "Current Run:"
cat output_hash.txt
echo "CHECK_RESULT=$(cmp --silent output_hash_baseline.txt output_hash.txt && echo 'true' || echo 'false' )" >> $GITHUB_OUTPUT
# there is no baseline, just copy current one as baseline
else
echo "No baseline found! Current run will be catched as baseline."
cat output_hash.txt
cp output_hash.txt output_hash_baseline.txt
echo "CHECK_RESULT=$(echo 'true')" >> $GITHUB_OUTPUT
fi

# Force to fail if the results are not matched with the baseline
- name: Result of Baseline Check
if: steps.compare-baseline.outputs.CHECK_RESULT == 'false'
uses: actions/github-script@v3
with:
script: |
core.setFailed('The results do not match with the baseline!')
Loading