-
Notifications
You must be signed in to change notification settings - Fork 6
481 lines (427 loc) · 17.8 KB
/
Copy pathCI.yml
File metadata and controls
481 lines (427 loc) · 17.8 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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
name: TSMP2 Build
# Controls when the action will run.
on:
push:
branches: [ master, dev-pdaf-* ]
pull_request:
branches: [ master ]
jobs:
eclm_build_job:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-24.04 ]
config:
- {
name: "ICON-eCLM-ParFlow",
use_oasis: "True",
parflow_dir: "parflow",
model_opts: "ICON eCLM ParFlow"
}
- {
name: "eCLM-ParFlowGPU",
use_oasis: "True",
parflow_dir: "parflow",
model_opts: "eCLM ParFlowGPU"
}
- {
name: "ICON standalone",
use_oasis: "False",
model_opts: "ICON"
}
# - {
# name: "CLM3.5-PDAF",
# use_oasis: "False",
# model_opts: "CLM3.5 PDAF"
# }
- {
name: "eCLM-PDAF",
use_oasis: "False",
model_opts: "eCLM PDAF"
}
- {
name: "CLM3.5-ParFlow-PDAF",
use_oasis: "True",
parflow_dir: "parflow_pdaf",
model_opts: "CLM3.5 ParFlow PDAF"
}
- {
name: "eCLM-ParFlow-PDAF",
use_oasis: "True",
parflow_dir: "parflow_pdaf",
model_opts: "eCLM ParFlow PDAF"
}
env:
SYSTEMNAME: UBUNTU
STAGE: 24.04
CC: mpicc
CXX: mpic++
FC: mpifort
F77: mpif77
MPI_HOME: /usr/lib/x86_64-linux-gnu/openmpi
VER_NETCDF_C: 4.9.2
VER_NETCDF_F90: 4.6.1
VER_HYPRE: 2.33.0
VER_ECCODES: 2.40.0
VER_OASIS: tsmp-patches-v0.1
VER_ICON_UPSTREAM: release-2026.04-public
steps:
- uses: actions/checkout@v4
#
# Install required TSMP2 dependencies
#
- name: Install TSMP2 dependencies on Ubuntu
run: |
sudo apt-get update
sudo apt-get install gfortran openmpi-bin libopenmpi-dev libhdf5-openmpi-dev libhdf5-openmpi-hl-fortran-100t64 hdf5-helpers liblapack-dev libblas-dev
- name: Install extra TSMP2 dependencies on Ubuntu
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: libxml++2.6-dev pylint wget cmake libpnetcdf-dev tcl-dev tk-dev liblzma-dev
version: 1.0
execute_install_scripts: true
#
# Install CUDA dependencies on Ubuntu
#
- if: contains(matrix.config.name, 'ParFlowGPU')
name: Install CUDA compiler and libraries
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: nvidia-cuda-toolkit nvidia-cuda-dev
version: 1.0
execute_install_scripts: true
- name: Initialize dependency directory and variables
run: |
TSMP2_ROOT=$(git rev-parse --show-toplevel)
DEPENDENCIES_ROOT=${TSMP2_ROOT}/dependencies
mkdir -v ${DEPENDENCIES_ROOT}
tree -L 1 ${TSMP2_ROOT}
echo "TSMP2_ROOT=${TSMP2_ROOT}" >> $GITHUB_ENV
echo "DEPENDENCIES_ROOT=${DEPENDENCIES_ROOT}" >> $GITHUB_ENV
#
# NetCDF C
#
- name: Restore cached netcdf-c-${{ env.VER_NETCDF_C }}
uses: actions/cache/restore@v4
id: cache-netcdf-c-restore
with:
path: ${{ env.DEPENDENCIES_ROOT }}/netcdf-c-${{ env.VER_NETCDF_C }}
key: ${{ matrix.config.name }}_netcdf-c-${{ env.VER_NETCDF_C }}
- if: steps.cache-netcdf-c-restore.outputs.cache-hit != 'true'
name: Install netcdf-c-${{ env.VER_NETCDF_C }}
working-directory: /tmp
run: |
# Download
wget https://github.com/Unidata/netcdf-c/archive/v${VER_NETCDF_C}.tar.gz
tar xf v${VER_NETCDF_C}.tar.gz
cd netcdf-c-${VER_NETCDF_C}
# Install
export CPPFLAGS=-I/usr/include/hdf5/openmpi
export LDFLAGS=-L/usr/lib/x86_64-linux-gnu/hdf5/openmpi
./configure --prefix=${DEPENDENCIES_ROOT}/netcdf-c-${VER_NETCDF_C}
make -j4 install
# Verify
tree -L 2 ${DEPENDENCIES_ROOT}/netcdf-c-${VER_NETCDF_C}
- if: steps.cache-netcdf-c-restore.outputs.cache-hit != 'true'
name: Cache netcdf-c-${{ env.VER_NETCDF_C }}
uses: actions/cache/save@v4
with:
path: ${{ env.DEPENDENCIES_ROOT }}/netcdf-c-${{ env.VER_NETCDF_C }}
key: ${{ matrix.config.name }}_netcdf-c-${{ env.VER_NETCDF_C }}
#
# NetCDF Fortran
#
- name: Restore cached netcdf-f90-${{ env.VER_NETCDF_F90 }}
uses: actions/cache/restore@v4
id: cache-netcdf-f90-restore
with:
path: ${{ env.DEPENDENCIES_ROOT }}/netcdf-f90-${{ env.VER_NETCDF_F90 }}
key: ${{ matrix.config.name }}_netcdf-f90-${{ env.VER_NETCDF_F90 }}
- if: steps.cache-netcdf-f90-restore.outputs.cache-hit != 'true'
name: Install netcdf-f90-${{ env.VER_NETCDF_F90 }}
working-directory: /tmp
run: |
# Download
wget https://github.com/Unidata/netcdf-fortran/archive/v${VER_NETCDF_F90}.tar.gz
tar xf v${VER_NETCDF_F90}.tar.gz
cd netcdf-fortran-${VER_NETCDF_F90}
# Install
export CPPFLAGS=-I${DEPENDENCIES_ROOT}/netcdf-c-${VER_NETCDF_C}/include
export LDFLAGS=-L${DEPENDENCIES_ROOT}/netcdf-c-${VER_NETCDF_C}/lib
./configure --prefix=${DEPENDENCIES_ROOT}/netcdf-f90-${VER_NETCDF_F90}
make -j4 install
# Verify
tree -L 2 ${DEPENDENCIES_ROOT}/netcdf-f90-${VER_NETCDF_F90}
- if: steps.cache-netcdf-f90-restore.outputs.cache-hit != 'true'
name: Cache netcdf-f90-${{ env.VER_NETCDF_F90 }}
uses: actions/cache/save@v4
with:
path: ${{ env.DEPENDENCIES_ROOT }}/netcdf-f90-${{ env.VER_NETCDF_F90 }}
key: ${{ matrix.config.name }}_netcdf-f90-${{ env.VER_NETCDF_F90 }}
#
# Hypre (OpenMP backend)
#
- if: contains(matrix.config.name, 'ParFlow') && !contains(matrix.config.name, 'GPU')
name: Restore cached hypre-${{ env.VER_HYPRE }} (OpenMP backend)
uses: actions/cache/restore@v4
id: cache-hypre-openmp-restore
with:
path: ${{ env.DEPENDENCIES_ROOT }}/hypre-${{ env.VER_HYPRE }}-openmp
key: hypre-${{ env.VER_HYPRE }}-openmp
- if: contains(matrix.config.name, 'ParFlow') && !contains(matrix.config.name, 'GPU') && steps.cache-hypre-openmp-restore.outputs.cache-hit != 'true'
name: Install hypre-${{ env.VER_HYPRE }} (OpenMP backend)
working-directory: /tmp
run: |
# Download
wget https://github.com/hypre-space/hypre/archive/v${VER_HYPRE}.tar.gz
tar xf v${VER_HYPRE}.tar.gz
cd hypre-${VER_HYPRE}
# Install
INSTALL_DIR="${DEPENDENCIES_ROOT}/hypre-${VER_HYPRE}-openmp"
cmake -S src -B bld \
-DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
-DMPI_INCLUDE_DIR="${MPI_HOME}/include" \
-DHYPRE_ENABLE_OPENMP="ON"
cmake --build bld --parallel 4
cmake --install bld
# Verify
tree -L 2 ${INSTALL_DIR}
- if: contains(matrix.config.name, 'ParFlow') && !contains(matrix.config.name, 'GPU') && steps.cache-hypre-openmp-restore.outputs.cache-hit != 'true'
name: Cache hypre-${{ env.VER_HYPRE }} (OpenMP backend)
uses: actions/cache/save@v4
with:
path: ${{ env.DEPENDENCIES_ROOT }}/hypre-${{ env.VER_HYPRE }}-openmp
key: hypre-${{ env.VER_HYPRE }}-openmp
#
# Hypre (CUDA backend)
#
- if: contains(matrix.config.name, 'ParFlowGPU')
name: Restore cached hypre-${{ env.VER_HYPRE }} (CUDA backend)
uses: actions/cache/restore@v4
id: cache-hypre-cuda-restore
with:
path: ${{ env.DEPENDENCIES_ROOT }}/hypre-${{ env.VER_HYPRE }}-cuda
key: hypre-${{ env.VER_HYPRE }}-cuda
- if: contains(matrix.config.name, 'ParFlowGPU') && steps.cache-hypre-cuda-restore.outputs.cache-hit != 'true'
name: Install hypre-${{ env.VER_HYPRE }} (CUDA backend)
working-directory: /tmp
run: |
# Download
wget https://github.com/hypre-space/hypre/archive/v${VER_HYPRE}.tar.gz
tar xf v${VER_HYPRE}.tar.gz
cd hypre-${VER_HYPRE}
# Install
INSTALL_DIR="${DEPENDENCIES_ROOT}/hypre-${VER_HYPRE}-cuda"
cmake -S src -B bld \
-DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
-DMPI_INCLUDE_DIR="${MPI_HOME}/include" \
-DHYPRE_ENABLE_CUDA="ON"
cmake --build bld --parallel 4
cmake --install bld
# Verify
tree -L 2 ${INSTALL_DIR}
- if: contains(matrix.config.name, 'ParFlowGPU') && steps.cache-hypre-cuda-restore.outputs.cache-hit != 'true'
name: Cache hypre-${{ env.VER_HYPRE }} (CUDA backend)
uses: actions/cache/save@v4
with:
path: ${{ env.DEPENDENCIES_ROOT }}/hypre-${{ env.VER_HYPRE }}-cuda
key: hypre-${{ env.VER_HYPRE }}-cuda
#
# ecCodes
#
- if: contains(matrix.config.name, 'ICON')
name: Restore cached eccodes-${{ env.VER_ECCODES }}
uses: actions/cache/restore@v4
id: cache-eccodes-restore
with:
path: ${{ env.DEPENDENCIES_ROOT }}/eccodes-${{ env.VER_ECCODES }}
key: ${{ matrix.config.name }}_eccodes-${{ env.VER_ECCODES }}
- if: contains(matrix.config.name, 'ICON') && steps.cache-eccodes-restore.outputs.cache-hit != 'true'
name: Install eccodes-${{ env.VER_ECCODES }}
working-directory: /tmp
run: |
# Download
wget https://github.com/ecmwf/eccodes/archive/refs/tags/${VER_ECCODES}.tar.gz
tar xf ${VER_ECCODES}.tar.gz
cd eccodes-${VER_ECCODES}
# Install
cmake -S . -B bld -DCMAKE_INSTALL_PREFIX=${DEPENDENCIES_ROOT}/eccodes-${VER_ECCODES}
cmake --build bld --parallel 4
cmake --install bld
# Verify
tree -L 2 ${DEPENDENCIES_ROOT}/eccodes-${VER_ECCODES}
- if: contains(matrix.config.name, 'ICON') && steps.cache-eccodes-restore.outputs.cache-hit != 'true'
name: Cache eccodes-${{ env.VER_ECCODES }}
uses: actions/cache/save@v4
with:
path: ${{ env.DEPENDENCIES_ROOT }}/eccodes-${{ env.VER_ECCODES }}
key: ${{ matrix.config.name }}_eccodes-${{ env.VER_ECCODES }}
#
# Check component model versions
#
- name: Extract required component model versions
id: model-versions
working-directory: ${{ env.TSMP2_ROOT }}/models
run: |
pwd
echo ""
git submodule status | cut -c2- | cut -d' ' -f1-2 | tee model_versions
echo ""
if [[ "${{ matrix.config.use_oasis }}" == "True" ]]; then
VER_OASIS=$(cat model_versions | grep -w "oasis3-mct" | cut -d' ' -f1)
echo "${VER_OASIS} => VER_OASIS"
echo "VER_OASIS=${VER_OASIS}" >> $GITHUB_OUTPUT
fi
if [[ "${{ matrix.config.name }}" == *"eCLM"* ]]; then
VER_eCLM=$(cat model_versions | grep -w "eCLM" | cut -d' ' -f1)
echo "${VER_eCLM} => VER_eCLM"
echo "VER_eCLM=${VER_eCLM}" >> $GITHUB_OUTPUT
fi
if [[ "${{ matrix.config.name }}" == *"CLM3.5"* ]]; then
VER_CLM35=$(cat model_versions | grep -w "CLM3.5" | cut -d' ' -f1)
echo "${VER_CLM35} => VER_CLM35"
echo "VER_CLM35=${VER_CLM35}" >> $GITHUB_OUTPUT
fi
if [[ "${{ matrix.config.name }}" == *"ParFlow"* ]]; then
VER_ParFlow=$(cat model_versions | grep -w "${{ matrix.config.parflow_dir }}" | cut -d' ' -f1)
echo "${VER_ParFlow} => VER_ParFlow"
echo "VER_ParFlow=${VER_ParFlow}" >> $GITHUB_OUTPUT
fi
if [[ "${{ matrix.config.name }}" == "ICON standalone" ]]; then
echo "${{ env.VER_ICON_UPSTREAM }} => VER_ICON_UPSTREAM"
elif [[ "${{ matrix.config.name }}" == *"ICON"* ]]; then
VER_ICON=$(cat model_versions | grep -w "icon" | cut -d' ' -f1)
echo "${VER_ICON} => VER_ICON"
echo "VER_ICON=${VER_ICON}" >> $GITHUB_OUTPUT
fi
if [[ "${{ matrix.config.name }}" == *"PDAF"* ]]; then
VER_PDAF=$(cat model_versions | grep -w "pdaf" | cut -d' ' -f1)
echo "${VER_PDAF} => VER_PDAF"
echo "VER_PDAF=${VER_PDAF}" >> $GITHUB_OUTPUT
fi
#
# OASIS3-MCT
#
- if: matrix.config.use_oasis == 'True'
name: Restore cached OASIS3-MCT ${{ env.VER_OASIS }}
uses: actions/cache/restore@v4
id: cache-oasis-restore
with:
path: ${{ env.TSMP2_ROOT }}/oasis3-mct
key: ${{ matrix.config.name }}_oasis-${{ env.VER_OASIS }}
- if: matrix.config.use_oasis == 'True' && steps.cache-oasis-restore.outputs.cache-hit != 'true'
name: Update OASIS3-MCT submodule ${{ steps.model-versions.outputs.VER_OASIS }}
working-directory: ${{ env.TSMP2_ROOT }}
run: |
pwd && git clone -b $VER_OASIS https://icg4geo.icg.kfa-juelich.de/ExternalReposPublic/oasis3-mct.git
- if: matrix.config.use_oasis == 'True' && steps.cache-oasis-restore.outputs.cache-hit != 'true'
name: Cache OASIS3-MCT ${{ env.VER_OASIS }}
uses: actions/cache/save@v4
with:
path: ${{ env.TSMP2_ROOT }}/oasis3-mct
key: ${{ matrix.config.name }}_oasis-${{ env.VER_OASIS }}
#
# eCLM
#
- if: contains(matrix.config.name, 'eCLM')
name: Update eCLM submodule ${{ steps.model-versions.outputs.VER_eCLM }}
working-directory: ${{ env.TSMP2_ROOT }}/models/eCLM
run: |
pwd && git submodule update --init --force .
#
# CLM3.5
#
- if: contains(matrix.config.name, 'CLM3.5')
name: Update CLM3.5 submodule ${{ steps.model-versions.outputs.VER_CLM35 }}
working-directory: ${{ env.TSMP2_ROOT }}/models/CLM3.5
run: |
pwd && git submodule update --init --force .
#
# ParFlow
#
- if: contains(matrix.config.name, 'ParFlow')
name: Update ${{ matrix.config.parflow_dir }} submodule ${{ steps.model-versions.outputs.VER_ParFlow }}
working-directory: ${{ env.TSMP2_ROOT }}/models/${{ matrix.config.parflow_dir }}
run: |
pwd && git submodule update --init --force .
#
# ICON
#
- if: contains(matrix.config.name, 'ICON')
name: Update ICON submodule ${{ steps.model-versions.outputs.VER_ICON }}
working-directory: ${{ env.TSMP2_ROOT }}/models/icon
run: |
pwd && git submodule update --init --force .
#
# PDAF
#
- if: contains(matrix.config.name, 'PDAF')
name: Update PDAF submodule ${{ steps.model-versions.outputs.VER_PDAF }}
working-directory: ${{ env.TSMP2_ROOT }}/models/pdaf
run: |
pwd && git submodule update --init --force .
#
# ICON Standalone
#
- if: matrix.config.name == 'ICON standalone'
name: Restore cached ICON standalone ${{ env.VER_ICON_UPSTREAM }}
uses: actions/cache/restore@v4
id: cache-icon-standalone-restore
with:
path: ${{ env.TSMP2_ROOT }}/models/icon-model
key: ${{ matrix.config.name }}_icon-${{ env.VER_ICON_UPSTREAM }}
- if: matrix.config.name == 'ICON standalone' && steps.cache-icon-standalone-restore.outputs.cache-hit != 'true'
name: Update ICON standalone ${{ env.VER_ICON_UPSTREAM }}
working-directory: ${{ env.TSMP2_ROOT }}/models
run: |
pwd && git clone -b ${{ env.VER_ICON_UPSTREAM }} --recursive https://gitlab.dkrz.de/icon/icon-model.git
- if: matrix.config.name == 'ICON standalone' && steps.cache-icon-standalone-restore.outputs.cache-hit != 'true'
name: Cache ICON standalone ${{ env.VER_ICON_UPSTREAM }}
uses: actions/cache/save@v4
with:
path: ${{ env.TSMP2_ROOT }}/models/icon-model
key: ${{ matrix.config.name }}_icon-${{ env.VER_ICON_UPSTREAM }}
#
# Pre-build checks
#
- name: Check component model versions
working-directory: ${{ env.TSMP2_ROOT }}
run: |
git submodule foreach 'git describe --tags --always && echo ""'
if [[ "${{ matrix.config.use_oasis }}" == "True" ]]; then
echo "Entering 'oasis3-mct'"
echo "$(git -C oasis3-mct describe --tags --always)"
fi
if [[ "${{ matrix.config.name }}" == "ICON standalone" ]]; then
echo "Entering 'models/icon-model'"
echo "$(git -C models/icon-model describe --tags --always)"
fi
- name: Check TSMP2 dependencies
working-directory: ${{ env.DEPENDENCIES_ROOT }}
run: |
tree -FUCh --du -L 2 $(pwd)
CMAKE_PREFIX_PATH=$(ls -1 | xargs realpath | paste -sd ":" -)
CMAKE_PREFIX_PATH="${CMAKE_PREFIX_PATH}:${MPI_HOME}"
echo "" && echo "CMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}"
echo "CMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}" >> $GITHUB_ENV
#
# Build TSMP2
#
- name: Build ${{ matrix.config.name }}
run: |
MODEL_OPTS="${{ matrix.config.model_opts }}"
if [[ "${{ matrix.config.use_oasis }}" == "True" ]]; then
MODEL_OPTS="${MODEL_OPTS} --OASIS_SRC ${TSMP2_ROOT}/oasis3-mct"
fi
if [[ "${{ matrix.config.name }}" == "ICON standalone" ]]; then
MODEL_OPTS="${MODEL_OPTS} --ICON_SRC ${TSMP2_ROOT}/models/icon-model"
fi
BUILD_TSMP2_CMD="./build_tsmp2.sh ${MODEL_OPTS} --no_update"
echo $BUILD_TSMP2_CMD && echo ""
eval $BUILD_TSMP2_CMD
- name: Check installed binaries
working-directory: ${{ env.TSMP2_ROOT }}/bin
run: |
tree -FUCh --du -L 3 $(pwd)