-
Notifications
You must be signed in to change notification settings - Fork 53
183 lines (161 loc) · 7.16 KB
/
run_scm_rts.yml
File metadata and controls
183 lines (161 loc) · 7.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
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}}