-
Notifications
You must be signed in to change notification settings - Fork 15
349 lines (303 loc) · 11.6 KB
/
build.yml
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
name: build
# Controls when the action will run
on:
# Trigger the workflow on all pushes, except on tag creation
push:
branches:
- '**'
tags-ignore:
- '**'
# Trigger the workflow on all pull requests
pull_request: ~
# Allow workflow to be dispatched on demand
workflow_dispatch: ~
env:
ECWAM_TOOLS: ${{ github.workspace }}/.github/tools
CTEST_PARALLEL_LEVEL: 1
CACHE_SUFFIX: v1 # Increase to force new cache to be created
jobs:
ci:
name: ci
strategy:
fail-fast: false # false: try to complete all jobs
matrix:
#build_type: [Release,Debug] # Debug tests takes too long
build_type: [Release]
prec: ['DP', 'SP']
name:
- linux gnu-10
- linux gnu-14
- linux nvhpc-23.5
- linux intel-classic
- macos
include:
- name: linux gnu-10
os: ubuntu-20.04
compiler: gnu-10
compiler_cc: gcc-10
compiler_cxx: g++-10
compiler_fc: gfortran-10
python-version: '3.8'
caching: true
- name: linux gnu-14
os: ubuntu-24.04
compiler: gnu-14
compiler_cc: gcc-14
compiler_cxx: g++-14
compiler_fc: gfortran-14
python-version: '3.11'
caching: true
- name: linux nvhpc-23.5
os: ubuntu-20.04
compiler: nvhpc-23.5
compiler_cc: nvc
compiler_cxx: nvc++
compiler_fc: nvfortran
cmake_options: -DCMAKE_CXX_FLAGS=--diag_suppress177
python-version: '3.8'
caching: true
- name : linux intel-classic
os: ubuntu-20.04
compiler: intel-classic
compiler_cc: icc
compiler_cxx: icpc
compiler_fc: ifort
python-version: '3.8'
caching: true
- name: macos
# Xcode compiler requires empty environment variables, so we pass null (~) here
os: macos-13
compiler: clang-14
compiler_cc: ~
compiler_cxx: ~
compiler_fc: gfortran-13
python-version: '3.11'
caching: true
runs-on: ${{ matrix.os }}
steps:
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Checkout Repository
uses: actions/checkout@v2
- name: Environment
run: |
echo "DEPS_DIR=${{ runner.temp }}/deps" >> $GITHUB_ENV
echo "CC=${{ matrix.compiler_cc }}" >> $GITHUB_ENV
echo "CXX=${{ matrix.compiler_cxx }}" >> $GITHUB_ENV
echo "FC=${{ matrix.compiler_fc }}" >> $GITHUB_ENV
if [[ "${{ matrix.os }}" =~ macos ]]; then
export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1
export HOMEBREW_NO_AUTO_UPDATE=1
export HOMEBREW_NO_INSTALL_CLEANUP=1
export SDKROOT=$(xcrun --show-sdk-path)
echo "HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1" >> $GITHUB_ENV
echo "HOMEBREW_NO_AUTO_UPDATE=1" >> $GITHUB_ENV
echo "HOMEBREW_NO_INSTALL_CLEANUP=1" >> $GITHUB_ENV
echo "SDKROOT=$(xcrun --show-sdk-path)" >> $GITHUB_ENV
brew install ninja
brew install libomp
brew install libaec
brew install coreutils
else
sudo apt-get update
sudo apt-get install libaec-dev
sudo apt-get install ninja-build
fi
pip3 install numpy
printenv
- name: Cache Dependencies
# There seems to be a problem with cached NVHPC dependencies, leading to SIGILL perhaps due to slightly different architectures
if: matrix.caching
id: deps-cache
uses: pat-s/[email protected]
with:
path: ${{ env.DEPS_DIR }}
key: deps-${{ matrix.os }}-${{ matrix.compiler }}-${{ matrix.build_type }}-${{ env.CACHE_SUFFIX }}
# Free up disk space for nvhpc
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
if: contains( matrix.compiler, 'nvhpc' )
continue-on-error: true
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: false
# all of these default to true, but feel free to set to
# "false" if necessary for your workflow
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true
- name: Install NVHPC compiler
if: contains( matrix.compiler, 'nvhpc' )
shell: bash -eux {0}
run: |
${ECWAM_TOOLS}/install-nvhpc.sh --prefix /opt/nvhpc --version 23.5
source /opt/nvhpc/env.sh
echo "${NVHPC_DIR}/compilers/bin" >> $GITHUB_PATH
[ -z ${MPI_HOME+x} ] || echo "MPI_HOME=${MPI_HOME}" >> $GITHUB_ENV
echo "localhost slots=72" >> ${MPI_HOME}/etc/openmpi-default-hostfile
echo "ECWAM_LAUNCH_SERIAL_MPI=1" >> $GITHUB_ENV
- name: Install Intel oneAPI compiler
if: contains( matrix.compiler, 'intel' )
run: |
${ECWAM_TOOLS}/install-intel-oneapi.sh
source /opt/intel/oneapi/setvars.sh
printenv >> $GITHUB_ENV
echo "CACHE_SUFFIX=$CC-$($CC -dumpversion)" >> $GITHUB_ENV
- name: Install MPI
shell: bash -eux {0}
run: |
FCFLAGS=-fPIC CFLAGS=-fPIC FFLAGS=-fPIC ${ECWAM_TOOLS}/install-mpi.sh --mpi openmpi --prefix ${DEPS_DIR}/openmpi
[ -f ${DEPS_DIR}/openmpi/env.sh ] && source ${DEPS_DIR}/openmpi/env.sh
[ -z ${MPI_HOME+x} ] || echo "MPI_HOME=${MPI_HOME}" >> $GITHUB_ENV
- name: Set Build & Test Environment
run: |
# Add mpirun to path for testing
[ -z ${MPI_HOME+x} ] || echo "${MPI_HOME}/bin" >> $GITHUB_PATH
- name: Build & Test
id: build-test
uses: ecmwf-actions/build-package@v2
with:
self_coverage: false
force_build: true
cache_suffix: "${{ matrix.build_type }}-${{ env.CACHE_SUFFIX }}"
recreate_cache: ${{ matrix.caching == false }}
dependencies: |
ecmwf/ecbuild
ecmwf/eccodes
ecmwf/fckit@refs/tags/0.13.0
ecmwf-ifs/fiat@refs/tags/1.4.1
ecmwf-ifs/field_api@refs/tags/v0.3.1
ecmwf-ifs/loki@refs/tags/v0.2.9
dependency_branch: develop
dependency_cmake_options: |
ecmwf/fckit: "-G Ninja -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DENABLE_TESTS=OFF -DENABLE_FCKIT_VENV=ON"
ecmwf-ifs/fiat: "-G Ninja -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DENABLE_TESTS=OFF -DENABLE_SINGLE_PRECISION=${{ matrix.prec == 'SP' }} -DENABLE_DOUBLE_PRECISION=${{ matrix.prec == 'DP' }}"
ecmwf/eccodes: "-G Ninja -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DENABLE_MEMFS=ON -DENABLE_JPG=OFF -DENABLE_PNG=OFF"
ecmwf-ifs/field_api: "-G Ninja -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DENABLE_TESTS=OFF -DENABLE_ACC=OFF -DENABLE_SINGLE_PRECISION=${{ matrix.prec == 'SP' }} -DENABLE_DOUBLE_PRECISION=${{ matrix.prec == 'DP' }}"
ecmwf-ifs/loki: "-G Ninja -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DENABLE_TESTS=OFF"
cmake_options: "-G Ninja -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ${{ matrix.cmake_options }} -DENABLE_MPI=ON -DENABLE_LOKI=ON -DLOKI_MODE=idem-stack -DENABLE_SINGLE_PRECISION=${{ matrix.prec == 'SP' }}"
ctest_options: "${{ matrix.ctest_options }}"
- name: Verify tools
run: |
export PATH=${{ steps.build-test.outputs.bin_path }}:$PATH
echo "+ ecwam --info"
ecwam --info
# - name: Codecov Upload
# if: steps.build-test.outputs.coverage_file
# uses: codecov/codecov-action@v2
# with:
# files: ${{ steps.build-test.outputs.coverage_file }}
ci-hpc:
name: ci-hpc
strategy:
fail-fast: false # false: try to complete all jobs
matrix:
name:
- ac-gpu nvhpc sp
include:
- name: ac-gpu nvhpc sp
site: ac-batch
sbatch_options: |
#SBATCH --time=00:20:00
#SBATCH --nodes=1
#SBATCH --ntasks=2
#SBATCH --cpus-per-task=32
#SBATCH --gpus-per-task=1
#SBATCH --mem=200G
#SBATCH --qos=dg
runs-on: [self-hosted, linux, hpc]
env:
GH_TOKEN: ${{ github.token }}
steps:
- uses: ecmwf-actions/reusable-workflows/ci-hpc-generic@v2
with:
site: ${{ matrix.site }}
troika_user: ${{ secrets.HPC_CI_SSH_USER }}
sbatch_options: ${{ matrix.sbatch_options }}
template_data: |
modules:
- cmake
- ninja
- ecbuild
- prgenv/nvidia
- hpcx-openmpi/2.14.0-cuda
- python3
cmake_options:
- -DENABLE_MPI=ON
- -DENABLE_ACC=ON
- -DENABLE_GPU=ON
- -DENABLE_LOKI=ON
- -DENABLE_GPU_AWARE_MPI=ON
dependencies:
ecmwf/eccodes:
version: develop
cmake_options:
- -DENABLE_MEMFS=ON
- -DENABLE_JPG=OFF
- -DENABLE_PNG=OFF
ecmwf/fckit:
version: 0.13.0
cmake_options:
- -DENABLE_TESTS=OFF
- -DENABLE_FCKIT_VENV=ON
ecmwf-ifs/fiat:
version: 1.4.1
cmake_options:
- -DENABLE_MPI=ON
- -DENABLE_SINGLE_PRECISION=ON
- -DENABLE_DOUBLE_PRECISION=OFF
ecmwf-ifs/field_api:
version: v0.3.1
cmake_options:
- -DENABLE_TESTS=OFF
- -DENABLE_ACC=ON
- -DENABLE_CUDA=ON
- -DENABLE_SINGLE_PRECISION=ON
- -DENABLE_DOUBLE_PRECISION=OFF
ecmwf-ifs/loki:
version: v0.2.9
cmake_options:
- -DENABLE_TESTS=OFF
template: |
{% for module in modules %}
module load {{module}}
{% endfor %}
BASEDIR=$PWD
{% for name, options in dependencies.items() %}
mkdir -p {{name}}
pushd {{name}}
git init
git remote add origin ${{ github.server_url }}/{{name}}
git fetch origin {{options['version']}}
git reset --hard FETCH_HEAD
cmake -G Ninja -S . -B build \
{% for name in dependencies %}
{% set org, proj = name.split('/') %}
-D{{proj}}_ROOT=$BASEDIR/{{name}}/installation \
{% endfor %}
{{ options['cmake_options']|join(' ') }}
cmake --build build
cmake --install build --prefix installation
popd
{% endfor %}
mkdir -p ${{ github.repository }}
pushd ${{ github.repository }}
git init
git remote add origin ${{ github.server_url }}/${{ github.repository }}
git fetch origin ${{ github.sha }}
git reset --hard FETCH_HEAD
popd
cmake -G Ninja -S ${{ github.repository }} -B build \
{% for name in dependencies %}
{% set org, proj = name.split('/') %}
-D{{proj}}_ROOT=$BASEDIR/{{name}}/installation \
{% endfor %}
{{ cmake_options|join(' ') }}
cmake --build build
ctest --test-dir build