Skip to content

Update: spack stack 2.0.0 (for Intel) and 2.1.0 (for GNU) and ip library #74

Update: spack stack 2.0.0 (for Intel) and 2.1.0 (for GNU) and ip library

Update: spack stack 2.0.0 (for Intel) and 2.1.0 (for GNU) and ip library #74

Workflow file for this run

name: Build/run the CCPP-SCM, compare to existing baselines (GitHub artifact)
on:
push:
branches:
# Only build and run when pushing to main
- main
pull_request:
workflow_dispatch:
jobs:
run_scm_rts:
runs-on: ubuntu-24.04
if: github.repository == 'NCAR/ccpp-scm'
strategy:
fail-fast: false
matrix:
fortran-compiler: [ifx, gfortran]#, nvfortran]
build-type: [Release, Debug]
run_lists: [supported, legacy, dev, sp]#, nvhpc]
exclude:
- build-type: Debug
run_lists: sp
include:
# Set container images for each compiler
- fortran-compiler: ifx
image: dustinswales/ccpp-scm-ci:oneapi
- fortran-compiler: gfortran
image: dustinswales/ccpp-scm-ci:gnu
# - fortran-compiler: nvfortran
# image: dustinswales/ccpp-scm-ci:nvhpc
container:
image: ${{ matrix.image }}
# Environmental variables
env:
SCM_ROOT: /__w/ccpp-scm/ccpp-scm
dir_rt: /__w/ccpp-scm/ccpp-scm/test/artifact-${{matrix.build-type}}-${{matrix.fortran-compiler}}-${{matrix.run_lists}}
dir_bl: /__w/ccpp-scm/ccpp-scm/test/BL-${{matrix.build-type}}-${{matrix.fortran-compiler}}-${{matrix.run_lists}}
artifact_origin: ${{ github.event_name == 'pull_request' && 'PR' || ('main' == 'main' && 'main' || 'PR') }}
GH_TOKEN: ${{ github.token }}
# Workflow steps
steps:
#######################################################################################
# Initial
#######################################################################################
- name: Checkout SCM code (/__w/ccpp-scm/ccpp-scm)
uses: actions/checkout@v6
- name: Install Required Tools
run: |
apt-get update
- name: Initialize Submodules
run: |
git config --global --add safe.directory ${SCM_ROOT}
cd ${SCM_ROOT}
git submodule update --init --recursive
- name: Setup MPI (GNU)
if: matrix.fortran-compiler == 'gfortran'
run: |
echo "MPI_COMM=mpirun --allow-run-as-root -np 1" >> $GITHUB_ENV
echo "CC=mpicc" >> $GITHUB_ENV
echo "CXX=mpicxx" >> $GITHUB_ENV
echo "FC=mpif90" >> $GITHUB_ENV
- name: Setup MPI (Intel OneAPI)
if: matrix.fortran-compiler == 'ifx'
run: |
echo "PATH=/opt/intel/oneapi/mpi/latest/bin:${PATH}" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=/opt/intel/oneapi/mpi/latest/lib:${LD_LIBRARY_PATH}" >> $GITHUB_ENV
echo "MPI_COMM=mpirun -np 1" >> $GITHUB_ENV
echo "CC=mpiicx" >> $GITHUB_ENV
echo "CXX=mpiicpx" >> $GITHUB_ENV
echo "FC=mpiifx" >> $GITHUB_ENV
- name: Setup MPI (Nvidia)
if: matrix.fortran-compiler == 'nvfortran'
run: |
echo "MPI_COMM=mpirun --allow-run-as-root -np 1" >> $GITHUB_ENV
echo "CC=mpicc" >> $GITHUB_ENV
echo "CXX=mpic++" >> $GITHUB_ENV
echo "FC=mpifort" >> $GITHUB_ENV
#######################################################################################
# Build SCM.
#######################################################################################
- name: Get SDF names for this run_list
id: set_sdfs
run: |
cd ${SCM_ROOT}/test
suites=$(./get_sdfs_for_run_list.py --sdf_list suites_${{matrix.run_lists}}_${{matrix.fortran-compiler}})
echo "suites=${suites}" >> $GITHUB_OUTPUT
- name: Print SDF names
run: |
echo ${{steps.set_sdfs.outputs.suites}}
- name: Download data for SCM
run: |
cd ${SCM_ROOT}
./contrib/get_all_static_data.sh
./contrib/get_thompson_tables.sh
./contrib/get_tempo_data.sh
./contrib/get_aerosol_climo.sh
./contrib/get_rrtmgp_data.sh
- name: Configure Build with CMake (64-bit)
if: matrix.run_lists != 'sp'
run: |
cd ${SCM_ROOT}/scm
mkdir bin && cd bin
cmake -DCCPP_SUITES=${{steps.set_sdfs.outputs.suites}} -DCMAKE_BUILD_TYPE=${{matrix.build-type}} ../src
- name: Configure Build with CMake (32-bit)
if: matrix.run_lists == 'sp'
run: |
cd ${SCM_ROOT}/scm
mkdir bin && cd bin
cmake -DCCPP_SUITES=${{steps.set_sdfs.outputs.suites}} -DCMAKE_BUILD_TYPE=${{matrix.build-type}} -D32BIT=1 ../src
- name: Build SCM
run: |
cd ${SCM_ROOT}/scm/bin
make -j4
#######################################################################################
# Run regression tests.
#######################################################################################
- name: Run SCM RTs
run: |
cd ${SCM_ROOT}/scm/bin
./run_scm.py --file /__w/ccpp-scm/ccpp-scm/test/rt_test_cases.py --run_list ${{matrix.run_lists}}_${{matrix.fortran-compiler}} --runtime_mult 0.1 --mpi_command "${MPI_COMM}"
- name: Gather SCM RT output
run: |
cd ${SCM_ROOT}/test
mkdir /__w/ccpp-scm/ccpp-scm/test/artifact-${{matrix.build-type}}-${{matrix.fortran-compiler}}-${{matrix.run_lists}}
./ci_util.py -b ${{matrix.build-type}}-${{matrix.fortran-compiler}}-${{matrix.run_lists}} --run_list run_list_${{matrix.run_lists}}_${{matrix.fortran-compiler}}
- name: Save Artifact Id Numbers and Create Directory for SCM RT baselines
run: |
mkdir -p ${dir_bl}
ARTIFACT_ID=$(gh api --paginate \
repos/NCAR/ccpp-scm/actions/artifacts | \
jq -s '[ .[] | .artifacts[] | select(.name == "rt-baselines-${{matrix.build-type}}-${{matrix.fortran-compiler}}-${{matrix.run_lists}}-main" and (.expired | not))] | sort_by(.created_at) | last | .workflow_run | .id ')
echo "artifact_id=${ARTIFACT_ID}"
echo "artifact_id=${ARTIFACT_ID}" >> "$GITHUB_ENV"
- name: Download SCM RT baselines
uses: actions/download-artifact@v8
with:
name: rt-baselines-${{matrix.build-type}}-${{matrix.fortran-compiler}}-${{matrix.run_lists}}-main
path: ${{ env.dir_bl }}
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ env.artifact_id }}
- name: Compare SCM RT output to baselines
run: |
cd ${SCM_ROOT}/test
./cmp_rt2bl.py --dir_rt ${dir_rt} --dir_bl ${dir_bl} --run_list run_list_${{matrix.run_lists}}_${{matrix.fortran-compiler}}
- name: Check if SCM RT plots exist
id: check_files
run: |
if [ -n "$(ls -A /__w/ccpp-scm/ccpp-scm/test/scm_rt_out 2>/dev/null)" ]; then
echo "files_exist=true" >> "$GITHUB_ENV"
else
echo "files_exist=false" >> "$GITHUB_ENV"
fi
- name: Upload plots of SCM Baselines/RTs as GitHub Artifact
uses: actions/upload-artifact@v7
with:
name: rt-plots-${{matrix.build-type}}-${{matrix.fortran-compiler}}-${{matrix.run_lists}}-${{ env.artifact_origin }}
path: /__w/ccpp-scm/ccpp-scm/test/scm_rt_out
- name: Upload SCM RTs as GitHub Artifact
uses: actions/upload-artifact@v7
with:
name: rt-baselines-${{matrix.build-type}}-${{matrix.fortran-compiler}}-${{matrix.run_lists}}-${{ env.artifact_origin }}
path: /__w/ccpp-scm/ccpp-scm/test/artifact-${{matrix.build-type}}-${{matrix.fortran-compiler}}-${{matrix.run_lists}}