-
Notifications
You must be signed in to change notification settings - Fork 148
601 lines (498 loc) · 15.1 KB
/
CI.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
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
# Github Actions workflow
#
# runs compilation tests on Linux Ubuntu and Mac platforms
name: CI
on: [push, pull_request]
jobs:
changesCheck:
name: Check file changes
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Check for changes
id: diff
run: |
if [ $GITHUB_BASE_REF ]; then
# Pull Request
echo "Pull request:"
git fetch origin $GITHUB_BASE_REF --depth=1
export DIFF=$( git diff --name-only origin/$GITHUB_BASE_REF $GITHUB_SHA )
echo " diff between origin/$GITHUB_BASE_REF and $GITHUB_SHA"
else
# Push
echo "Push request:"
git fetch origin ${{ github.event.before }} --depth=1
export DIFF=$( git diff --name-only ${{ github.event.before }} $GITHUB_SHA )
echo " diff between ${{ github.event.before }} and $GITHUB_SHA"
fi
echo "***"; echo "$DIFF"; echo "***"
# Escape newlines (replace \n with %0A)
# deprecated:
#echo "::set-output name=diff::$( echo "$DIFF" | sed ':a;N;$!ba;s/\n/%0A/g' )"
# new:
# replace new line with %0A - will result finding only one file with a very long name...
#echo "diff=$( echo "$DIFF" | sed ':a;N;$!ba;s/\n/%0A/g' )" >> $GITHUB_OUTPUT
# doesn't work...
#echo "diff=\"$DIFF\"" >> "$GITHUB_OUTPUT"
# new multi-line format:
# (https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#multiline-strings)
echo "diff<<EOF" >> $GITHUB_OUTPUT
echo "$DIFF" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Output changes
run: echo "${{ steps.diff.outputs.diff }}"
- name: Check files
run: |
RUN_CHECKS=0
DIFF="${{ steps.diff.outputs.diff }}"
# Loop by lines
while read path; do
# Set $directory to substring before /
directory="$( echo $path | cut -d'/' -f1 -s )"
echo "file: $path - directory: $directory"
if [ -z "$directory" ]; then
# root directory
RUN_CHECKS=1
elif [ "$directory" == src ]; then
# src/ directory
RUN_CHECKS=1
elif [ "$directory" == setup ]; then
# setup/ directory
RUN_CHECKS=1
elif [ "$directory" == EXAMPLES ]; then
# EXAMPLES/ directory
RUN_CHECKS=1
elif [ "$directory" == tests ]; then
# tests/ directory
RUN_CHECKS=1
elif [ "$directory" == .github ]; then
# .github/ directory
RUN_CHECKS=1
fi
done <<< "$DIFF"
echo
echo "run checks: ${RUN_CHECKS}"
if [[ ${RUN_CHECKS} -eq 0 ]]; then echo "nothing to check, exiting..."; exit 1; fi
macosCheck:
name: Test on Mac
runs-on: macos-latest
needs: changesCheck
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: |
brew cleanup
brew reinstall gcc # need gfortran (symlink to gfortran-10)
brew install hwloc openmpi
echo ""
echo "compiler versions:"
echo "gcc --version"
gcc --version
echo "gfortran --version"
gfortran --version
echo "mpif90 --version"
mpif90 --version
echo ""
## avoids sed -i '' issue on MacOS, using gnu sed to have the same sed command lines as in linux
brew install gnu-sed
echo "PATH=/usr/local/opt/gnu-sed/libexec/gnubin:$PATH" >> $GITHUB_ENV
## OpenMP
echo "OMP_NUM_THREADS=2" >> $GITHUB_ENV
## avoids MPI issue with number of slots
echo "OMPI_MCA_rmaps_base_oversubscribe=1" >> $GITHUB_ENV
echo "OMPI_MCA_rmaps_base_inherit=1" >> $GITHUB_ENV
## avoids MPI issue when running in MacOS
echo "OMPI_MCA_btl=self,tcp" >> $GITHUB_ENV
# exports for xterm output (for make tests)
echo "TERM=xterm" >> $GITHUB_ENV
echo ""
echo "exports:"
export
echo ""
- name: configure
run: ./configure
# skipping - compilation check done as well in make tests
#- name: make
# run: make -j2 all
- name: make tests
run: make tests
linuxCheck:
name: Test on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
needs: changesCheck
strategy:
matrix:
os: [ubuntu-latest,ubuntu-20.04]
steps:
- uses: actions/checkout@v3
- name: Install packages
run: ./.github/scripts/run_install.sh
shell: bash
- name: configure
run: ./configure
- name: make
run: make -j2 all
linuxCheck-Intel:
name: Test Intel on ubuntu-20.04
runs-on: ubuntu-20.04
needs: changesCheck
steps:
- uses: actions/checkout@v3
- name: Cache Intel oneapi packages
id: cache-intel-oneapi
uses: actions/cache@v3
with:
path: /opt/intel/oneapi
key: install-${{ runner.os }}-all
- name: Install packages
if: steps.cache-intel-oneapi.outputs.cache-hit != 'true'
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
echo ""
sudo echo "deb https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list
sudo apt-get update
echo ""
# info
#sudo -E apt-cache pkgnames intel | grep intel-oneapi
#echo ""
echo "installing packages intel oneapi:"
sudo apt-get install -y intel-oneapi-compiler-fortran-2023.2.2 intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic-2023.2.2 intel-oneapi-mpi intel-oneapi-mpi-devel
echo ""
- name: compiler infos
run: |
echo ""
source /opt/intel/oneapi/setvars.sh
echo ""
echo "compiler versions:"
echo "icx --version"
which icx
icx --version
echo ""
echo "icc --version"
which icc
icc --version
echo ""
echo "ifx --version"
which ifx
ifx --version
echo ""
echo "ifort --version"
which ifort
ifort --version
echo ""
echo "mpiifort --version"
which mpiifort
mpiifort --version
echo ""
echo "mpif90 --version"
which mpif90
mpif90 --version
echo ""
# infos
which ifort
which icc
which mpiifort
echo "mpirun:"
which mpirun
echo ""
# intel setup for running tests
echo ""
echo "replacing mpif90 with mpiifort link:"
sudo ln -sf $(which mpiifort) $(which mpif90)
mpif90 --version
echo ""
# debug
#export I_MPI_DEBUG=5,pid,host
#export I_MPI_LIBRARY_KIND=debug
# remove -ftrapuv which leads to issues for running tests
sed -i "s/-ftrapuv//g" flags.guess
# environment setting
export TERM=xterm
# export info
echo "exports:"
export
echo ""
echo ""
printenv >> $GITHUB_ENV
echo "CXX=icpc" >> $GITHUB_ENV
echo "CC=icc" >> $GITHUB_ENV
echo "FC=ifort" >> $GITHUB_ENV
echo ""
- name: configure debug
run: |
./configure --enable-debug FC=ifort CC=icc
- name: make debug
run: |
make -j2 all
make -j2 all --always-make
make clean
- name: configure
run: |
./configure FC=ifort CC=icc
- name: make
run: |
make -j2 all
make clean
- name: configure parallel debug
run: |
./configure --enable-debug --with-mpi FC=ifort CC=icc MPIFC=mpiifort MPI_INC="${I_MPI_ROOT}/include"
- name: make parallel debug
run: |
make -j2 all
make -j2 all --always-make
make clean
- name: configure parallel
run: |
./configure --with-mpi FC=ifort CC=icc MPIFC=mpiifort MPI_INC="${I_MPI_ROOT}/include"
- name: make parallel
run: |
make -j2 all
make clean
# note: fails with -ftrapuv flag due to MPI issue on virtual nodes
- name: make tests
run: |
make tests
linuxTest_0:
name: Test run example 0 - make tests
runs-on: ubuntu-latest
needs: [linuxCheck]
steps:
- uses: actions/checkout@v3
- name: Install packages
run: ./.github/scripts/run_install.sh
shell: bash
- name: configure
run: ./configure
- name: make tests
run: make tests
linuxTest_1:
name: Test run example 1 - benchmark claerbout kernel acoustic
runs-on: ubuntu-latest
needs: [linuxCheck]
steps:
- uses: actions/checkout@v3
- name: Install packages
run: ./.github/scripts/run_install.sh
shell: bash
- name: Run build
env:
TESTFLAGS: --with-mpi # --enable-vectorization
run: ./.github/scripts/run_build.sh
shell: bash
- name: Run test
env:
TESTDIR: EXAMPLES/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC
run: ./.github/scripts/run_tests.sh
shell: bash
linuxTest_2:
name: Test run example 2 - benchmark claerbout kernel elastic P-SV
runs-on: ubuntu-latest
needs: [linuxCheck]
steps:
- uses: actions/checkout@v3
- name: Install packages
run: ./.github/scripts/run_install.sh
shell: bash
- name: Run build
env:
TESTFLAGS: --with-mpi # --enable-vectorization
run: ./.github/scripts/run_build.sh
shell: bash
- name: Run test
env:
TESTDIR: EXAMPLES/BENCHMARK_CLAERBOUT_ADJOINT/ELASTIC
TESTCASE: P-SV
run: ./.github/scripts/run_tests.sh
shell: bash
linuxTest_3:
name: Test run example 3 - benchmark claerbout kernel elastic SH
runs-on: ubuntu-latest
needs: [linuxCheck]
steps:
- uses: actions/checkout@v3
- name: Install packages
run: ./.github/scripts/run_install.sh
shell: bash
- name: Run build
env:
TESTFLAGS: --with-mpi # --enable-vectorization
run: ./.github/scripts/run_build.sh
shell: bash
- name: Run test
env:
TESTDIR: EXAMPLES/BENCHMARK_CLAERBOUT_ADJOINT/ELASTIC
TESTCASE: SH
run: ./.github/scripts/run_tests.sh
shell: bash
linuxTest_4:
name: Test run example 4 - benchmark claerbout kernel acoustic-elastic
runs-on: ubuntu-latest
needs: [linuxCheck]
steps:
- uses: actions/checkout@v3
- name: Install packages
run: ./.github/scripts/run_install.sh
shell: bash
- name: Run build
env:
TESTFLAGS: --with-mpi # --enable-vectorization
run: ./.github/scripts/run_build.sh
shell: bash
- name: Run test
env:
TESTDIR: EXAMPLES/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC_ELASTIC
run: ./.github/scripts/run_tests.sh
shell: bash
linuxTest_5:
name: Test run example 5 - moving sources
runs-on: ubuntu-latest
needs: [linuxCheck]
steps:
- uses: actions/checkout@v3
- name: Install packages
run: ./.github/scripts/run_install.sh
shell: bash
- name: Run build
env:
TESTFLAGS: --with-mpi # --enable-vectorization
run: ./.github/scripts/run_build.sh
shell: bash
- name: Run test
env:
TESTDIR: EXAMPLES/moving_sources_acoustic
run: ./.github/scripts/run_tests.sh
shell: bash
linuxTest_6:
name: Test run example 6 - anisotropy
runs-on: ubuntu-latest
needs: [linuxCheck]
steps:
- uses: actions/checkout@v3
- name: Install packages
run: ./.github/scripts/run_install.sh
shell: bash
- name: Run build
env:
TESTFLAGS: --with-mpi # --enable-vectorization
run: ./.github/scripts/run_build.sh
shell: bash
- name: Run test
env:
TESTDIR: EXAMPLES/anisotropic_isotropic_model
run: ./.github/scripts/run_tests.sh
shell: bash
linuxTest_7:
name: Test run example 7 - Industrial_Format_SEP
runs-on: ubuntu-latest
needs: [linuxCheck]
steps:
- uses: actions/checkout@v3
- name: Install packages
run: ./.github/scripts/run_install.sh
shell: bash
- name: Run build
env:
TESTFLAGS: --with-mpi # --enable-vectorization
run: ./.github/scripts/run_build.sh
shell: bash
- name: Run test
env:
TESTDIR: EXAMPLES/Industrial_Format_SEP
run: ./.github/scripts/run_tests.sh
shell: bash
linuxTest_8:
name: Test run example 8 - axisymmetric_case_AXISYM_option
runs-on: ubuntu-latest
needs: [linuxCheck]
steps:
- uses: actions/checkout@v3
- name: Install packages
run: ./.github/scripts/run_install.sh
shell: bash
- name: Run build
env:
TESTFLAGS: --with-mpi # --enable-vectorization
run: ./.github/scripts/run_build.sh
shell: bash
- name: Run test
env:
TESTDIR: EXAMPLES/axisymmetric_case_AXISYM_option
run: ./.github/scripts/run_tests.sh
shell: bash
linuxTest_9:
name: Test run example 9 - simple_topography_and_also_a_simple_fluid_layer debug
runs-on: ubuntu-latest
needs: [linuxCheck]
steps:
- uses: actions/checkout@v3
- name: Install packages
run: ./.github/scripts/run_install.sh
shell: bash
- name: Run build
env:
TESTFLAGS: --enable-debug
run: ./.github/scripts/run_build.sh
shell: bash
- name: Run test
env:
TESTDIR: EXAMPLES/simple_topography_and_also_a_simple_fluid_layer
run: ./.github/scripts/run_tests.sh
shell: bash
linuxTest_10:
name: Test run example 10 - simple_topography_and_also_a_simple_fluid_layer debug double_precision
runs-on: ubuntu-latest
needs: [linuxCheck]
steps:
- uses: actions/checkout@v3
- name: Install packages
run: ./.github/scripts/run_install.sh
shell: bash
- name: Run build
env:
TESTFLAGS: --enable-double-precision --enable-debug
run: ./.github/scripts/run_build.sh
shell: bash
- name: Run test
env:
TESTDIR: EXAMPLES/simple_topography_and_also_a_simple_fluid_layer
run: ./.github/scripts/run_tests.sh
shell: bash
linuxTest_11:
name: Test run example 11 - tomographic_ocean_model
runs-on: ubuntu-latest
needs: [linuxCheck]
steps:
- uses: actions/checkout@v3
- name: Install packages
run: ./.github/scripts/run_install.sh
shell: bash
- name: Run build
env:
TESTFLAGS: # default w/out MPI
run: ./.github/scripts/run_build.sh
shell: bash
- name: Run test
env:
TESTDIR: EXAMPLES/tomographic_ocean_model
run: ./.github/scripts/run_tests.sh
shell: bash
linuxTest_12:
name: Test run example 11 - Marmousi2
runs-on: ubuntu-latest
needs: [linuxCheck]
steps:
- uses: actions/checkout@v3
- name: Install packages
run: ./.github/scripts/run_install.sh
shell: bash
- name: Run build
env:
TESTFLAGS: --with-mpi --enable-vectorization
run: ./.github/scripts/run_build.sh
shell: bash
- name: Run test
env:
TESTDIR: EXAMPLES/Marmousi2
run: ./.github/scripts/run_tests.sh
shell: bash