forked from SPECFEM/specfem3d
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
265 lines (206 loc) · 8.86 KB
/
.travis.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
# Travis configuration
#
# Note: building Fortran code is not supported (yet): see https://docs.travis-ci.com/user/language-specific/
# this is using C as a base and installs gfortran in the test environment
language: c
dist: bionic
os: linux
arch:
- ppc64le # IBM Power
# - amd64 # travis default
# - arm64 # ARM
compiler: gcc
# deprecated
#sudo: required
env:
global:
- FC=gfortran
- MPIFC=mpif90
- CC=gcc
- OMP_NUM_THREADS=2
- WORKDIR=`pwd`
matrix:
# for test cases, we use
# TESTID - identification number for test
# TESTDIR - test directory id
# TESTFLAGS - flags used for configuration
# TESTCOV - determines whether or not (0/1) code coverage flags are used
# CUDA - flag for compilation with CUDA
# code coverage: mpi, using code coverage flags
- TESTID=0 TESTCOV=1 TESTDIR=22 TESTFLAGS="--with-mpi" CUDA=false
# code coverage: mpi, using code coverage flags
- TESTID=1 TESTCOV=1 TESTDIR=1 TESTFLAGS="--with-mpi" CUDA=false
# code coverage: mpi, using code coverage flags, additional tests
- TESTID=2 TESTCOV=1 TESTDIR=2 TESTFLAGS="--with-mpi" CUDA=false
# code coverage: serial/no mpi, using code coverage flags
- TESTID=3 TESTCOV=1 TESTDIR=5 TESTFLAGS="--without-mpi" CUDA=false
# default test with make tests -- offline, checked on github
#- TESTID=4 TESTCOV=0 TESTDIR=0 TESTFLAGS="" CUDA=false
# default example (elastic)
- TESTID=5 TESTCOV=0 TESTDIR=1 TESTFLAGS="" CUDA=false
# example 2 (acoustic)
- TESTID=6 TESTCOV=0 TESTDIR=2 TESTFLAGS="" CUDA=false
# example 3 (poroelastic) -- offline, checked on github
#- TESTID=7 TESTCOV=0 TESTDIR=3 TESTFLAGS="--with-mpi" CUDA=false
# example 4 (simple model, internal mesher) -- offline, checked on github
#- TESTID=8 TESTCOV=0 TESTDIR=4 TESTFLAGS="--with-mpi" CUDA=false
# serial example (acoustic)
- TESTID=9 TESTCOV=0 TESTDIR=5 TESTFLAGS="--without-mpi" CUDA=false
# debug & double precision (acoustic)
- TESTID=10 TESTCOV=0 TESTDIR=6 TESTFLAGS="--enable-double-precision --enable-debug" CUDA=false
# debug with bounds-check (elastic)
- TESTID=11 TESTCOV=0 TESTDIR=7 TESTFLAGS="--enable-debug" CUDA=false
# PML example (acoustic) -- offline, checked on github
#- TESTID=12 TESTCOV=0 TESTDIR=8 TESTFLAGS="--with-mpi" CUDA=false
# PML example (elastic) -- offline, checked on github
#- TESTID=13 TESTCOV=0 TESTDIR=9 TESTFLAGS="--with-mpi" CUDA=false
# noise example
- TESTID=14 TESTCOV=0 TESTDIR=10 TESTFLAGS="--with-mpi" CUDA=false
# tomographic model example -- offline, checked on github
#- TESTID=15 TESTCOV=0 TESTDIR=11 TESTFLAGS="--with-mpi" CUDA=false
# acoustic kernel example
- TESTID=16 TESTCOV=0 TESTDIR=12 TESTFLAGS="--with-mpi" CUDA=false
# waterlayered example -- offline, checked on github
#- TESTID=17 TESTCOV=0 TESTDIR=13 TESTFLAGS="--with-mpi" CUDA=false
# elastic example, hex27, compilation w/ CUDA and MPI
- TESTID=18 TESTCOV=0 TESTDIR=14 TESTFLAGS="--with-cuda=cuda5 --with-mpi" CUDA=true
# acoustic example, compilation w/ CUDA
- TESTID=19 TESTCOV=0 TESTDIR=15 TESTFLAGS="--with-cuda=cuda5 --without-mpi" CUDA=true
# fault example tpv5 -- offline, checked on github
#- TESTID=20 TESTCOV=0 TESTDIR=16 TESTFLAGS="--with-mpi" CUDA=false
# socal example -- offline, checked on github
#- TESTID=21 TESTCOV=0 TESTDIR=17 TESTFLAGS="--with-mpi" CUDA=false
# socal example w/ 1d_socal -- offline, checked on github
#- TESTID=22 TESTCOV=0 TESTDIR=17 TESTFLAGS="--with-mpi" CUDA=false
# socal example w/ 1d_prem -- offline, checked on github
#- TESTID=23 TESTCOV=0 TESTDIR=17 TESTFLAGS="--with-mpi" CUDA=false
# socal example w/ 1d_cascadia -- offline, checked on github
#- TESTID=24 TESTCOV=0 TESTDIR=17 TESTFLAGS="--with-mpi" CUDA=false
# cavity example -- offline, checked on github
#- TESTID=25 TESTCOV=0 TESTDIR=18 TESTFLAGS="--with-mpi" CUDA=false
# SEP example -- offline, checked on github
#- TESTID=26 TESTCOV=0 TESTDIR=19 TESTFLAGS="--with-mpi" CUDA=false
# couple with FK -- offline, checked on github
#- TESTID=27 TESTCOV=0 TESTDIR=20 TESTFLAGS="--with-mpi" CUDA=false
# layered model w/ point force, NGLL = 6 -- offline, checked on github
#- TESTID=28 TESTCOV=0 TESTDIR=21 TESTFLAGS="--with-mpi" CUDA=false
# elastic halfspace, no absorbing -- offline, checked on github
#- TESTID=29 TESTCOV=0 TESTDIR=22 TESTFLAGS="--with-mpi" CUDA=false
# gmsh example w/ LDDRK
- TESTID=30 TESTCOV=0 TESTDIR=23 TESTFLAGS="--with-mpi" CUDA=false
# example with openmp
- TESTID=31 TESTCOV=0 TESTDIR=24 TESTFLAGS="--enable-vectorization --enable-openmp" CUDA=false
# regular element mesh
- TESTID=32 TESTCOV=0 TESTDIR=25 TESTFLAGS="--enable-vectorization" CUDA=false
# adjoint simulation -- offline, checked on github
#- TESTID=33 TESTCOV=0 TESTDIR=26 TESTFLAGS="--with-mpi" CUDA=false
# gmsh example w/ hex27
- TESTID=34 TESTCOV=0 TESTDIR=27 TESTFLAGS="--without-mpi" CUDA=false
# waterlayered_poroelastic example
- TESTID=35 TESTCOV=0 TESTDIR=28 TESTFLAGS="--enable-vectorization --with-mpi" CUDA=false
# inversion example
- TESTID=36 TESTCOV=1 TESTDIR=29 TESTFLAGS="--with-mpi" CUDA=false
# additional ARM tests
jobs:
include:
- arch: arm64
env: TESTID=5 TESTCOV=0 TESTDIR=1 TESTFLAGS="" CUDA=false
- arch: arm64
env: TESTID=6 TESTCOV=0 TESTDIR=2 TESTFLAGS="" CUDA=false
before_install:
# informations on git
- |
git --version
git rev-parse --verify HEAD
git branch -a
# checks if changes occurred in folders src/ or setup/
- |
echo "request: Branch($TRAVIS_BRANCH) Pull Request($TRAVIS_PULL_REQUEST) Tag($TRAVIS_TAG)"
echo "commit : Commit($TRAVIS_COMMIT) Range($TRAVIS_COMMIT_RANGE)"
# checks file changes
- |
echo "check file changes"
if [ "${TRAVIS_PULL_REQUEST}" = "false" ]; then
# Push
echo "Push request:"
COMMIT_RANGE="$(echo ${TRAVIS_COMMIT_RANGE} | cut -d '.' -f 1,4 --output-delimiter '..')"
DIFF="$(git diff --name-only ${COMMIT_RANGE} --)"
#DIFF=$(git diff --name-only ${TRAVIS_COMMIT_RANGE})
else
# PR build
echo "Pull request:"
DIFF=$(git diff --name-only ${TRAVIS_BRANCH}..HEAD --)
fi
echo "$DIFF"
# Escape newlines (replace \n with %0A)
#NEWDIFF=($( echo "$DIFF" | sed ':a;N;$!ba;s/\n/%0A/g' ))
#echo "$NEWDIFF"
#DIFF=$NEWDIFF
RUN_CHECKS=0
# 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" == .travis ]; then
# .travis/ directory
RUN_CHECKS=1
fi
done <<< "$DIFF"
echo
echo "run checks: ${RUN_CHECKS}"
echo
export RUN_CHECKS=${RUN_CHECKS}
#abort: if [[ ${RUN_CHECKS} -eq 0 ]]; then echo "nothing to check, exiting..."; exit 1; fi
# recommended for MPI projects to unset CC: see https://docs.travis-ci.com/user/languages/c
#- test -n $CC && unset CC
# updates repository
- |
travis_retry sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 6B05F25D762E3157
travis_retry sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 78BD65473CB3BD13
travis_retry sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 762E3157
travis_retry sudo apt-get update
install:
# installs compilers
- bash .travis/run_install.sh
script:
# builds executables
- bash .travis/run_build.sh
# runs test examples
- bash .travis/run_tests.sh
after_success:
###########################################################
# code coverage
###########################################################
- |
if [ "$TESTCOV" == "1" ]; then
gcov --version
echo `pwd`
ls -al obj/
fi
# produces coverage reports (done manually because of different naming for source & object files)
- |
if [ "$TESTCOV" == "1" ]; then
find obj/ -iname '*.o' | sort | awk '{print "gcov -o obj/ "$1;}'
# executes gcov-commands
find obj/ -iname '*.o' | sort | awk '{print "gcov -o obj/ "$1;}' | sh
fi
# code coverage:
# see script : https://github.com/codecov/codecov-bash/blob/master/codecov
# see example: https://github.com/codecov/example-fortran/blob/master/.travis.yml
- if [ "$TESTCOV" == "1" ]; then bash <(curl -s https://codecov.io/bash) -X gcov; fi