-
Notifications
You must be signed in to change notification settings - Fork 5
483 lines (412 loc) · 14.5 KB
/
gfortran.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
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
482
483
name: GFortran CI
# WARNING: When updating the OS version of the Github Actions runner,
# e.g. from Ubuntu 20.04 to 22.04, you need to manually update the cache keys!
# This is because there's no easy way to get the OS version from within this workflow file.
on:
push:
branches: [ master ]
pull_request:
env:
# FFLAGS for building ABIN, applicable for most jobs
ABIN_FFLAGS: -O0 -fopenmp --coverage -fprofile-abs-path -ffpe-trap=invalid,zero,overflow,denormal -fimplicit-none -Wall -Wno-integer-division -Wno-maybe-uninitialized
ABIN_LDLIBS: --coverage
OPTIMIZED_FFLAGS: -O3 -fopenmp -fimplicit-none -Wall -Wno-integer-division
# NOTE: It would be safer to only pass the secret token to the codecov-upload action,
# but the impact of this token leaking is small anyway.
# NOTE: It appears that even with this token there are issues,
# so for now we let the CI succeed even if the upload fails.
# Reported by many people also at:
# https://github.com/codecov/codecov-action/issues/926
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
jobs:
format:
name: Code format check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install fprettify dependencies
run: pip install configargparse
- name: Run fprettify
run: |
./autoformat.py
f=`git ls-files -m`; if [[ -n $f ]];then echo -e "ERROR: Detected unformatted files:\n$f";exit 1;fi
basic_build:
name: Basic build
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
gcc_v: [7, 9, 10]
env:
FC: gfortran
GCC_V: ${{ matrix.gcc_v}}
CODECOV_NAME: ${{format('{0} GCC-{1}', github.job, matrix.gcc_v)}}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Install GCC-7
if: matrix.gcc_v == 7
run: |
sudo apt install gcc-7 gfortran-7 g++-7
echo "ABIN_FFLAGS=${ABIN_FFLAGS/-fprofile-abs-path/}" >> $GITHUB_ENV
- name: Enable runtime checks
# It looks like this messes up the code coverage, so enabling only some builds
if: matrix.gcc_v != 7
run: |
echo "ABIN_FFLAGS=${ABIN_FFLAGS} -fcheck=all -fsanitize=address,undefined,leak" >> $GITHUB_ENV
echo "ABIN_LDLIBS=${ABIN_LDLIBS} -fsanitize=address,undefined,leak" >> $GITHUB_ENV
- name: Set GFortran version
run: |
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${GCC_V} 100 \
--slave /usr/bin/gfortran gfortran /usr/bin/gfortran-${GCC_V} \
--slave /usr/bin/gcov gcov /usr/bin/gcov-${GCC_V}
# pFUnit library is used to build and run unit tests
- name: pFUnit build Cache
id: pfunit-cache
uses: actions/cache@v4
with:
path: ~/pfunit/build/installed
# To force a pFUnit rebuild (bust the cache), make a change to install_pfunit.sh
key: ${{ runner.os }}-ubuntu20.04-pfunit-gfortran${{ env.GCC_V }}-${{ hashFiles('dev_scripts/install_pfunit.sh') }}
save-always: true
- name: Download and build pFUnit
if: steps.pfunit-cache.outputs.cache-hit != 'true'
run: ./dev_scripts/install_pfunit.sh ${HOME}/pfunit
- name: Build ABIN
run: ./configure --pfunit ${HOME}/pfunit/build/installed/ && make
env:
FFLAGS: ${{ env.ABIN_FFLAGS }}
LDLIBS: ${{ env.ABIN_LDLIBS }}
- name: Run Unit tests
run: make unittest
- name: Codecov upload unit tests
uses: codecov/codecov-action@v4
with:
name: ${{env.CODECOV_NAME}}
flags: unittests
fail_ci_if_error: true
- name: Run End-to-End tests
if: always()
run: make e2etest
- name: Codecov upload
uses: codecov/codecov-action@v4
with:
name: ${{env.CODECOV_NAME}}
fail_ci_if_error: true
intel_build:
name: Intel OneAPI build
runs-on: ubuntu-20.04
env:
FC: mpiifort
# Use GCC for C++ code to speed up the build
#CC: icc
#CXX: icpc
APT_PACKAGES: >-
intel-oneapi-compiler-fortran
intel-oneapi-mpi
intel-oneapi-mpi-devel
# intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Add Intel repository
run: |
wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
rm GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
echo "deb https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list
sudo apt-get update
- name: Install Intel oneAPI compiler
run: |
sudo apt-get install ${{ env.APT_PACKAGES }}
source /opt/intel/oneapi/setvars.sh
printenv >> $GITHUB_ENV
- name: Build ABIN
run: ./configure --mpi "" && make
env:
FFLAGS: -O0 -fopenmp -warn all,noextern
- name: Run End-to-End tests
run: make e2etest
tcpb_build:
name: TCPB build
runs-on: ubuntu-20.04
needs: basic_build
env:
FC: gfortran
CODECOV_NAME: ${{format('{0}', github.job)}}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Install protocol buffers library
run: sudo apt install protobuf-compiler
- name: TCBP build cache
id: tcpb-cache
uses: actions/cache@v4
with:
path: ~/tcpb-cpp/lib
# To force a rebuild (bust the cache), make a change to install_tcpb.sh
key: ${{ runner.os }}-ubuntu20.04-tcpb-gfortran-default-${{ hashFiles('dev_scripts/install_tcpb.sh') }}
- name: Download and build tcpb_cpp
if: steps.tcpb-cache.outputs.cache-hit != 'true'
run: ./dev_scripts/install_tcpb.sh ${HOME}/tcpb-cpp
- name: Build ABIN
run: ./configure --tcpb ${HOME}/tcpb-cpp/lib && make
env:
FFLAGS: ${{ env.ABIN_FFLAGS }}
LDLIBS: ${{ env.ABIN_LDLIBS }}
- name: Run End-to-End tests
run: make e2etest
- name: Codecov upload
uses: codecov/codecov-action@v4
with:
name: tcpb
fail_ci_if_error: true
optimized_build:
name: Optimized build
# NOTE: We use a more recent Ubuntu version here
# so we can test more recent GCC versions.
runs-on: ubuntu-22.04
needs: basic_build
strategy:
fail-fast: false
matrix:
gcc_v: [9, 11, 12]
env:
FC: gfortran
GCC_V: ${{ matrix.gcc_v}}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Set GFortran version
run: |
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${GCC_V} 100 \
--slave /usr/bin/gfortran gfortran /usr/bin/gfortran-${GCC_V}
- name: pFUnit build Cache
id: pfunit-cache
uses: actions/cache@v4
with:
path: ~/pfunit/build/installed
key: ${{ runner.os }}-ubuntu22.04-pfunit-gfortran${{ env.GCC_V }}-${{ hashFiles('dev_scripts/install_pfunit.sh') }}
save-always: true
- name: Download and build pFUnit
if: steps.pfunit-cache.outputs.cache-hit != 'true'
run: ./dev_scripts/install_pfunit.sh ${HOME}/pfunit
- name: build ABIN
run: ./configure --pfunit ${HOME}/pfunit/build/installed/ && make
env:
FFLAGS: ${{ env.OPTIMIZED_FFLAGS }}
- name: Run Unit tests
run: make unittest
- name: Run End-to-End tests
run: make e2etest
# Here we just take the defaults everywhere, except installing libfftw via apt
# To use FFTW with other Gfortran versions, we would need to build it.
fftw_build:
runs-on: ubuntu-22.04
name: FFTW build
needs: basic_build
env:
CODECOV_NAME: ${{format('{0}', github.job)}}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Install FFTW libraries
run: sudo apt-get install libfftw3-dev
- name: pFUnit build Cache
id: pfunit-cache
uses: actions/cache@v4
with:
path: ~/pfunit/build/installed
key: ${{ runner.os }}-ubuntu22.04-pfunit-gfortran-default-${{ hashFiles('dev_scripts/install_pfunit.sh') }}
save-always: true
- name: Download and build pFUnit
if: steps.pfunit-cache.outputs.cache-hit != 'true'
run: ./dev_scripts/install_pfunit.sh ${HOME}/pfunit
- name: Build ABIN
run: ./configure --pfunit ${HOME}/pfunit/build/installed/ --fftw && make
env:
FFLAGS: ${{ env.ABIN_FFLAGS }}
LDLIBS: ${{ env.ABIN_LDLIBS }}
- name: Run Unit tests
run: make unittest
- name: Codecov upload unit tests
uses: codecov/codecov-action@v4
with:
name: ${{env.CODECOV_NAME}}
flags: unittests
- name: Run End-to-End tests
run: make e2etest
- name: Codecov upload
uses: codecov/codecov-action@v4
with:
name: ${{env.CODECOV_NAME}}
fail_ci_if_error: true
mpich_build:
name: MPICH build
runs-on: ubuntu-20.04
timeout-minutes: 25
needs: basic_build
strategy:
fail-fast: false
matrix:
gcc_v: [7, 10]
mpich_v: ["3.4.3", "4.0.2"]
env:
# To speed-up MPICH build
CFLAGS: -O0
GCC_V: ${{ matrix.gcc_v}}
MPICH_V: ${{matrix.mpich_v}}
CODECOV_NAME: ${{format('{0} GCC-{1} MPICH-{2}', github.job, matrix.gcc_v, matrix.mpich_v)}}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Install GCC-7
if: matrix.gcc_v == 7
run: |
sudo apt install gcc-7 gfortran-7 g++-7
echo "ABIN_FFLAGS=${ABIN_FFLAGS/-fprofile-abs-path/}" >> $GITHUB_ENV
- name: Set GFortran version
run: |
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${GCC_V} 100 \
--slave /usr/bin/gfortran gfortran /usr/bin/gfortran-${GCC_V} \
--slave /usr/bin/gcov gcov /usr/bin/gcov-${GCC_V}
- name: MPICH build Cache
id: mpich-cache
uses: actions/cache@v4
with:
path: ~/mpich/${{ env.MPICH_V }}/install
key: ${{runner.os}}-ubuntu20.04-mpich${{ env.MPICH_V }}-gfortran${{ env.GCC_V }}-${{hashFiles('dev_scripts/install_mpich.sh')}}
save-always: true
- name: Build and Install MPICH
if: steps.mpich-cache.outputs.cache-hit != 'true'
# Without the extra "-fallow-argument-mismatch" FFLAG, configure with GFortran-10 fails with:
# "The Fortran compiler gfortran does not accept programs
# that call the same routine with arguments of different types"
# Unfortunately, previous GCC versions do not have this flag
# so we need to set it conditionally.
# MPICH 4.0 also needs FCFLAGS set.
# We also need to set it for ABIN compilation below.
run: |
if [ $GCC_V -ge 10 ];then export FFLAGS="-fallow-argument-mismatch";export FCFLAGS="-fallow-argument-mismatch";fi && \
./dev_scripts/install_mpich.sh ${HOME}/mpich ${MPICH_V}
- name: build ABIN
run: |
if [ $GCC_V -ge 10 ];then export FFLAGS="-fallow-argument-mismatch $FFLAGS";fi && \
./configure --mpi ${HOME}/mpich/${MPICH_V}/install && make
env:
FFLAGS: ${{ env.ABIN_FFLAGS }} -g
LDLIBS: ${{ env.ABIN_LDLIBS }}
- name: test ABIN
run: make test
- name: Codecov upload
uses: codecov/codecov-action@v4
with:
name: ${{env.CODECOV_NAME}}
fail_ci_if_error: true
openmpi_build:
name: OpenMPI build
runs-on: ubuntu-20.04
timeout-minutes: 25
needs: basic_build
strategy:
fail-fast: false
env:
# To speed-up OpenMPI build
CFLAGS: -O0
CODECOV_NAME: ${{format('{0} OpenMPI-4.0', github.job)}}
OPENMPI_V: "4.1"
OPENMPI_PATCH: "2"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- name: OpenMPI build cache
id: openmpi-cache
uses: actions/cache@v4
with:
path: ~/openmpi/${{ env.OPENMPI_V }}/install
key: ${{runner.os}}-ubuntu20.04-openmpi${{ env.OPENMPI_V }}-gfortran-default-${{hashFiles('dev_scripts/install_openmpi.sh')}}
save-always: true
- name: Build and Install OpenMPI
if: steps.openmpi-cache.outputs.cache-hit != 'true'
run: ./dev_scripts/install_openmpi.sh ${HOME}/openmpi ${OPENMPI_V} ${OPENMPI_PATCH}
- name: build ABIN
run: ./configure --mpi "${HOME}/openmpi/${OPENMPI_V}/install" && make
env:
FFLAGS: ${{ env.ABIN_FFLAGS }}
LDLIBS: ${{ env.ABIN_LDLIBS }}
- name: test ABIN
run: make test
- name: Codecov upload
uses: codecov/codecov-action@v4
with:
name: ${{env.CODECOV_NAME}}
fail_ci_if_error: true
plumed_build:
name: PLUMED build
runs-on: ubuntu-20.04
needs: basic_build
strategy:
fail-fast: false
matrix:
plumed_v: [2.7.6, 2.8.2]
env:
PLUMED_V: ${{ matrix.plumed_v}}
# Speeding up the Plumed build
CFLAGS: -O0
CXXLAGS: -O0
CODECOV_NAME: ${{format('{0} PLUMED-{1}', github.job, matrix.plumed_v)}}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Plumed build cache
id: plumed-cache
uses: actions/cache@v4
with:
path: ~/plumed/${{ env.PLUMED_V }}/install
key: ${{runner.os}}-ubuntu20.04-plumed${{env.PLUMED_V}}-gcc-default-${{hashFiles('dev_scripts/install_plumed.sh')}}
save-always: true
- name: Build and Install PLUMED
if: steps.plumed-cache.outputs.cache-hit != 'true'
run: ./dev_scripts/install_plumed.sh ${HOME}/plumed ${PLUMED_V}
- name: pFUnit build Cache
id: pfunit-cache
uses: actions/cache@v4
with:
path: ~/pfunit/build/installed
key: ${{ runner.os }}-ubuntu20.04-pfunit-gfortran-default-${{ hashFiles('dev_scripts/install_pfunit.sh') }}
- name: Download and build pFUnit
if: steps.pfunit-cache.outputs.cache-hit != 'true'
run: ./dev_scripts/install_pfunit.sh ${HOME}/pfunit
- name: build ABIN
run: |
./configure --plumed "${HOME}/plumed/${PLUMED_V}/install"\
--pfunit ~/pfunit/build/installed/ &&\
make
env:
FFLAGS: ${{ env.ABIN_FFLAGS }}
LDLIBS: ${{ env.ABIN_LDLIBS }}
- name: Run Unit tests
run: make unittest
- name: Codecov upload unit tests
uses: codecov/codecov-action@v4
with:
name: ${{env.CODECOV_NAME}}
flags: unittests
- name: Run End-to-End tests
run: make e2etest
- name: Codecov upload
uses: codecov/codecov-action@v4
with:
name: ${{env.CODECOV_NAME}}
fail_ci_if_error: true