Updating CICD with the new cmake build system #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Continuous integration in a box | |
on: | |
push: | |
branches: | |
- main | |
- develop | |
pull_request: | |
branches-ignore: | |
- documentation | |
workflow_dispatch: | |
jobs: | |
Containerized-CI: | |
runs-on: ubuntu-22.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
fortran-compiler: [ifort, ifx, nvfortran] | |
rte-kernels: [default, accel] | |
fpmodel: [DP, SP] | |
include: | |
# Set flags for Intel Fortran Compiler Classic | |
- fortran-compiler: ifort | |
fcflags: -m64 -g -traceback -heap-arrays -assume realloc_lhs -extend-source 132 -check bounds,uninit,pointers,stack -stand f08 -diag-disable=10448 | |
# Set flags for Intel Fortran Compiler | |
- fortran-compiler: ifx | |
rte-kernels: default | |
fcflags: -debug -traceback -O0 -heap-arrays -assume realloc_lhs -extend-source 132 -stand f08 | |
- fortran-compiler: ifx | |
rte-kernels: accel | |
fcflags: -debug -traceback -O0 -heap-arrays -assume realloc_lhs -extend-source 132 -stand f08 -fiopenmp -fopenmp-targets=spir64 | |
# Set flags for NVIDIA Fortran compiler | |
- fortran-compiler: nvfortran | |
rte-kernels: default | |
fcflags: -Mallocatable=03 -Mstandard -Mbounds -Mchkptr -Kieee -Mchkstk | |
- fortran-compiler: nvfortran | |
rte-kernels: accel | |
fcflags: -Mallocatable=03 -Mstandard -Mbounds -Mchkptr -Kieee -Mchkstk -acc | |
# Set container images | |
- fortran-compiler: ifort | |
image: ghcr.io/earth-system-radiation/rte-rrtmgp-ci:oneapi | |
- fortran-compiler: ifx | |
image: ghcr.io/earth-system-radiation/rte-rrtmgp-ci:oneapi | |
- fortran-compiler: nvfortran | |
image: ghcr.io/earth-system-radiation/rte-rrtmgp-ci:nvhpc | |
container: | |
image: ${{ matrix.image }} | |
env: | |
# Core variables: | |
FC: ${{ matrix.fortran-compiler }} | |
FCFLAGS: ${{ matrix.fcflags }} | |
# CMake variables: | |
NFHOME: /opt/netcdf-fortran | |
FP_MODEL: ${{ matrix.fpmodel }} | |
RTE_KERNELS: ${{ matrix.rte-kernels }} | |
RRTMGP_DATA_VERSION: v1.8.2 | |
RUN_CMD: | |
# https://github.com/earth-system-radiation/rte-rrtmgp/issues/194 | |
OMP_TARGET_OFFLOAD: DISABLED | |
FAILURE_THRESHOLD: 7.e-4 | |
steps: | |
- name: Synchronize the package index | |
run: sudo apt-get update | |
# | |
# Install NetCDF-Fortran (compatible with all compilers) | |
# | |
- name: Install NetCDF-Fortran | |
run: sudo apt-get install libnetcdff-dev | |
# | |
# Build libraries, examples and tests (expect success) | |
# | |
- name: Build libraries, examples and tests (expect success) | |
id: build-success | |
if: matrix.fortran-compiler != 'ifx' || matrix.rte-kernels != 'accel' | |
run: | | |
$FC --version | |
cmake -S . -B build \ | |
-DCMAKE_Fortran_COMPILER=$FC \ | |
-DCMAKE_Fortran_FLAGS="$FCFLAGS" \ | |
-DRRTMGP_DATA_VERSION=$RRTMGP_DATA_VERSION \ | |
-DFP_MODEL=$FP_MODEL \ | |
-DRTE_KERNEL_MODE=$RTE_KERNELS \ | |
-DENABLE_TESTS=ON \ | |
-DFAILURE_THRESHOLD=$FAILURE_THRESHOLD | |
cmake --build build --config Release -- -j8 | |
# | |
# Run examples and tests | |
# | |
- name: Run examples and tests | |
if: steps.build-success.outcome != 'skipped' | |
run: | | |
ctest -V --test-dir build | |
# | |
# Relax failure thresholds for single precision | |
# | |
- name: Relax failure threshold for single precision | |
if: matrix.fpmodel == 'SP' && steps.build-success.outcome != 'skipped' | |
run: echo "FAILURE_THRESHOLD=3.5e-1" >> $GITHUB_ENV | |
# | |
# Generate validation plots | |
# | |
- name: Generate validation plots | |
if: matrix.fortran-compiler == 'ifort' && matrix.rte-kernels == 'default' && matrix.fpmodel == 'DP' | |
working-directory: tests | |
run: python validation-plots.py | |
# | |
# Upload validation plots | |
# | |
- name: Upload validation plots | |
if: matrix.fortran-compiler == 'ifort' && matrix.rte-kernels == 'default' && matrix.fpmodel == 'DP' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: valdiation-plot | |
path: tests/validation-figures.pdf |