Skip to content

Commit

Permalink
Updated SW cloud optics data, finalization routines for RRTMGP, overh…
Browse files Browse the repository at this point in the history
…auled CI (#204)

Spectral ordering of SW cloud optics data is corrected leading to differences in fluxes as large as a few W/m2. New inquiry and finalization routines are added for ty_gas_optics_rrtmgp. Continuous integration is overhauled to be more compact and lightweight by @skosukhin. 

Co-authored-by: Sergey Kosukhin <[email protected]>
  • Loading branch information
RobertPincus and skosukhin authored Jan 10, 2023
1 parent 83ff9b3 commit 74a0e09
Show file tree
Hide file tree
Showing 16 changed files with 554 additions and 329 deletions.
142 changes: 80 additions & 62 deletions .github/workflows/containerized-ci.yml
Original file line number Diff line number Diff line change
@@ -1,84 +1,102 @@
name: Continuous integration in a box
on:
push:
branches-ignore:
- documentation
pull_request:
branches-ignore:
- documentation
on:
push:
branches-ignore:
- documentation
pull_request:
branches-ignore:
- documentation

jobs:
Containerized-CI:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
fortran-compiler: [ifort, ifx, nvfortran]
rte-kernels: [default, openacc]
container: ["earthsystemradiation/rte-rrtmgp-ci:ifort","earthsystemradiation/rte-rrtmgp-ci:nvfortran"]
include:
- fortran-compiler: ifort
fcflags: "-m64 -g -traceback -heap-arrays -assume realloc_lhs -extend-source 132 -check bounds,uninit,pointers,stack -stand f08"
image: "earthsystemradiation/rte-rrtmgp-ci:ifort"
- fortran-compiler: ifx
fcflags: "-m64 -g -traceback -heap-arrays -assume realloc_lhs -extend-source 132 -check bounds,uninit,pointers,stack -stand f08"
image: "earthsystemradiation/rte-rrtmgp-ci:ifort"
- fortran-compiler: nvfortran
fcflags: "-Mallocatable=03 -Mstandard -Mbounds -Mchkptr -Kieee -Mchkstk"
image: "earthsystemradiation/rte-rrtmgp-ci:nvfortran"
container:
image: ${{ matrix.container }}
image: ${{ matrix.image }}
env:
NCHOME: /home/runner/netcdf-c
NFHOME: /home/runner/netcdf-fortran
RFMIP_DIR: /home/runner/rfmip-files
# Core variables:
FC: ${{ matrix.fortran-compiler }}
FCFLAGS: ${{ matrix.fcflags }}
# Make variables:
NCHOME: /dummy
NFHOME: /opt/netcdf-fortran
RRTMGP_ROOT: ${{ github.workspace }}
RTE_KERNELS: ${{ matrix.rte-kernels }}
RUN_CMD:
# Auxiliary variables:
RFMIP_CACHEDIR: /home/runner/rfmip-files
steps:
############################################################################
# Checks out repository under $GITHUB_WORKSPACE
- name: Check out code
uses: actions/checkout@v3
- name: Environmental variables
# This might be able to be set in the ENV section above
run: echo "RRTMGP_ROOT=${GITHUB_WORKSPACE}" >> $GITHUB_ENV
- name: Environmental variables - ifort
if: contains(matrix.container, 'ifort')
run: echo "FCFLAGS=-m64 -g -traceback -heap-arrays -assume realloc_lhs -extend-source 132 -check bounds,uninit,pointers,stack -stand f08" >> $GITHUB_ENV
- name: Environmental variables - nvfortran
if: contains(matrix.container, 'nvfortran')
run: echo "FCFLAGS=-Mallocatable=03 -Mstandard -Mbounds -Mchkptr -Kieee -Mchkstk" >> $GITHUB_ENV

- name: Make library, examples, tests
shell: bash
env:
RTE_KERNELS: ${{ matrix.rte-kernels }}
run: |
source /opt/intel/oneapi/setvars.sh || true
cd ${RRTMGP_ROOT}
${FC} --version
make libs
make -C build separate-libs
############################################################################
#
# Checks-out repository under $GITHUB_WORKSPACE
#
- uses: actions/checkout@v3
#
# Cache RFMIP files
#
- name: Cache RFMIP files
id: cache-rfmip-files
uses: actions/cache@v3
with:
path: /home/runner/rfmip-files # Same as #{RFMIP_DIR}
path: ${{ env.RFMIP_CACHEDIR }}
key: rfmip-files

#
# Stage RFMIP files
#
- name: Stage RFMIP files
if: steps.cache-rfmip-files.outputs.cache-hit != 'true'
run: |
mkdir -p ${RFMIP_DIR}
cd ${RFMIP_DIR}
python ${RRTMGP_ROOT}/examples/rfmip-clear-sky/stage_files.py
############################################################################
- name: Run examples, tests
shell: bash
env:
LD_LIBRARY_PATH: /home/runner/netcdf-c/lib
if test ! -d "${RFMIP_CACHEDIR}"; then
mkdir -p "${RFMIP_CACHEDIR}" && cd "${RFMIP_CACHEDIR}"
python "${GITHUB_WORKSPACE}/examples/rfmip-clear-sky/stage_files.py"
fi
for file in "${RFMIP_CACHEDIR}"/*; do
if test ! -d "${file}"; then
echo "copying '${file}'..."
cp "${file}" "${GITHUB_WORKSPACE}/examples/rfmip-clear-sky/"
fi
done
#
# Build libraries, examples and tests
#
- name: Build libraries, examples and tests
run: |
source /opt/intel/oneapi/setvars.sh || true
export LD_LIBRARY_PATH=${NFHOME}/lib:${LD_LIBRARY_PATH}
make tests
- name: Comparison
$FC --version
make libs
make -C build separate-libs
#
# Run examples and tests
#
- name: Run examples and tests
run: make tests
#
# Compare the results
#
- name: Compare the results
run: make check
############################################################################
- name: Validation plots
if: contains(matrix.container, 'ifort') && contains(matrix.rte-kernels, 'default')
run: |
cd ${RRTMGP_ROOT}/tests
python validation-plots.py
- name: Upload plots
if: contains(matrix.container, 'ifort') && contains(matrix.rte-kernels, 'default')
#
# Generate validation plots
#
- name: Generate validation plots
if: matrix.fortran-compiler == 'ifort' && matrix.rte-kernels == 'default'
working-directory: tests
run: python validation-plots.py
#
# Upload validation plots
#
- name: Upload validation plots
if: matrix.fortran-compiler == 'ifort' && matrix.rte-kernels == 'default'
uses: actions/upload-artifact@v3
with:
name: valdiation-plot
Expand Down
197 changes: 79 additions & 118 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
@@ -1,150 +1,111 @@
name: Continuous Integration
on:
push:
branches-ignore:
- documentation
pull_request:
branches-ignore:
- documentation
on:
push:
branches-ignore:
- documentation
pull_request:
branches-ignore:
- documentation

defaults:
run:
# Enable Conda environment by using the login shell:
shell: bash -leo pipefail {0}

jobs:
CI:
runs-on: ubuntu-20.04
defaults:
run:
shell: bash -l {0}
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
fortran-compiler: [gfortran-9, gfortran-10]
fortran-compiler: [gfortran-10, gfortran-11, gfortran-12]
rte-kernels: [default, openacc]
env:
# Core variables:
FC: ${{ matrix.fortran-compiler }}
FCFLAGS: "-ffree-line-length-none -m64 -std=f2008 -march=native -fbounds-check -finit-real=nan -g -DRTE_USE_CBOOL"
CC: gcc
NCHOME: /home/runner/netcdf-c
NFHOME: /home/runner/netcdf-fortran
RFMIP_DIR: /home/runner/rfmip-files
# Make variables:
NCHOME: /dummy
NFHOME: /usr
RRTMGP_ROOT: ${{ github.workspace }}
RTE_KERNELS: ${{ matrix.rte-kernels }}
RUN_CMD:
# Auxiliary variables:
RFMIP_CACHEDIR: /home/runner/rfmip-files
steps:
- name: Update system packages
run: sudo apt-get update
############################################################################
#
# Compilers....
# Checks-out repository under $GITHUB_WORKSPACE
#
# Gfortran 10 not available in Github CI stack, so install
- uses: actions/checkout@v3
#
- name: gfortran-10 setup compiler
if: contains(matrix.fortran-compiler, 'gfortran-10')
run: |
sudo apt-get install gfortran-10 gcc-10
echo "CC=gcc-10" >> $GITHUB_ENV
############################################################################
# Synchronize the package index
#
# Netcdf C and Fortran
- name: Synchronize the package index
run: sudo apt-get update
#
- name: Install HDF5 library
run: |
sudo apt-get install libhdf5-dev libcurl4-gnutls-dev hdf5-helpers
dpkg -L libhdf5-dev
# Skipping this for now - netCDF configure doesn't see the HDF libararies
- name: cache-netcdf-c
id: cache-netcdf-c
uses: actions/cache@v3
with:
path: /home/runner/netcdf-c
key: netcdf-c-4.7.4a-${{ runner.os }}-${{ matrix.fortran-compiler }}

- name: Install netcdf C library from source
if: steps.cache-netcdf-c.outputs.cache-hit != 'true'
env:
CPPFLAGS: -I/usr/include/hdf5/serial
LDFLAGS: -L/usr/lib/x86_64-linux-gnu/hdf5/serial/
run: |
${CC} --version
git clone https://github.com/Unidata/netcdf-c.git --branch v4.7.4
cd netcdf-c
ls /usr/include
./configure --prefix=${NCHOME}
make -j
sudo make install
# Would be great to encode version info
- name: cache-netcdf-fortran
id: cache-netcdf-fortran
# Install NetCDF-Fortran (compatible with all compilers)
#
- name: Install NetCDF-Fortran
run: sudo apt-get install libnetcdff-dev
#
# Cache Conda packages
#
- name: Cache Conda packages
uses: actions/cache@v3
with:
path: /home/runner/netcdf-fortran
key: netcdf-fortran-4.5.3-${{ runner.os }}-${{ matrix.fortran-compiler }}

- name: Build NetCDF Fortran library
# Here too it would be nice to use the environment to specify netcdf-c location
env:
CPPFLAGS: -I/home/runner/netcdf-c/include
LDFLAGS: -L/home/runner/netcdf-c/lib
LD_LIBRARY_PATH: /home/runner/netcdf-c/lib
FCFLAGS: -fPIC
if: steps.cache-netcdf-fortran.outputs.cache-hit != 'true'
run: |
echo ${TEST}
${FC} --version
git clone https://github.com/Unidata/netcdf-fortran.git --branch v4.5.3
cd netcdf-fortran
echo ${CPPFLAGS}
./configure --prefix=${NFHOME}
make -j
sudo make install
############################################################################
# Checks out repository under $GITHUB_WORKSPACE
- name: Check out code
uses: actions/checkout@v3

- name: Environmental variables
run: echo "RRTMGP_ROOT=${GITHUB_WORKSPACE}" >> $GITHUB_ENV

- name: Make library, examples, tests
env:
RTE_KERNELS: ${{ matrix.rte-kernels }}
run: |
cd ${RRTMGP_ROOT}
${FC} --version
make libs
make -C build separate-libs
############################################################################
# Set up Python and packages
path: ~/conda_pkgs_dir
key: conda-pkgs
#
# Set up Conda
#
- name: Setup conda
- name: Set up Conda
uses: conda-incubator/setup-miniconda@v2
with:
miniforge-version: latest
activate-environment: rte_rrtmgp_test
environment-file: environment.yml
environment-file: environment-noplots.yml
python-version: 3.9
auto-activate-base: false
############################################################################
# Use the cache properly:
use-only-tar-bz2: true
#
# Cache RFMIP files
#
- name: Cache RFMIP files
id: cache-rfmip-files
uses: actions/cache@v3
with:
path: /home/runner/rfmip-files # Same as #{RFMIP_DIR}
path: ${{ env.RFMIP_CACHEDIR }}
key: rfmip-files

#
# Stage RFMIP files
#
- name: Stage RFMIP files
if: steps.cache-rfmip-files.outputs.cache-hit != 'true'
run: |
mkdir -p ${RFMIP_DIR}
cd ${RFMIP_DIR}
python ${RRTMGP_ROOT}/examples/rfmip-clear-sky/stage_files.py
############################################################################
# Would be great to encode version info
- name: Run examples, tests
env:
LD_LIBRARY_PATH: /home/runner/netcdf-c/lib
run: |
export LD_LIBRARY_PATH=${NFHOME}/lib:${LD_LIBRARY_PATH}
make tests
- name: Comparison
if test ! -d "${RFMIP_CACHEDIR}"; then
mkdir -p "${RFMIP_CACHEDIR}" && cd "${RFMIP_CACHEDIR}"
python "${GITHUB_WORKSPACE}/examples/rfmip-clear-sky/stage_files.py"
fi
for file in "${RFMIP_CACHEDIR}"/*; do
if test ! -d "${file}"; then
echo "copying '${file}'..."
cp "${file}" "${GITHUB_WORKSPACE}/examples/rfmip-clear-sky/"
fi
done
#
# Build libraries, examples and tests
#
- name: Build libraries, examples and tests
run: |
make check
$FC --version
make libs
make -C build separate-libs
#
# Run examples and tests
#
- name: Run examples and tests
run: make tests
#
# Compare the results
#
- name: Compare the results
run: make check
Loading

0 comments on commit 74a0e09

Please sign in to comment.