forked from SPECFEM/specfem3d_globe
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
236 lines (189 loc) · 7.47 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
# 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: using coverage flags (single test for global model)
- TESTID=0 TESTDIR=2 TESTCOV=1 TESTFLAGS="" CUDA=false
# code coverage: using coverage flags (single test for regional model sgloberani)
- TESTID=0 TESTDIR=5 TESTCOV=1 TESTFLAGS="" CUDA=false
# code coverage: using coverage flags (single test for regional noise)
- TESTID=0 TESTDIR=12 TESTCOV=1 TESTFLAGS="" CUDA=false
# code coverage: using coverage flags
- TESTID=1 TESTDIR=1 TESTCOV=1 TESTFLAGS="" CUDA=false
# code coverage: vectorization & openmp, using coverage flags
- TESTID=2 TESTDIR=1 TESTCOV=1 TESTFLAGS="--enable-vectorization" CUDA=false
# default test (with > make tests)
- TESTID=3 TESTDIR=0 TESTCOV=0 TESTFLAGS="" CUDA=false
# regional example w/ default configuration
- TESTID=4 TESTDIR=1 TESTCOV=0 TESTFLAGS="" CUDA=false
# regional example w/ vectorization
- TESTID=5 TESTDIR=1 TESTCOV=0 TESTFLAGS="--enable-vectorization" CUDA=false
# regional example w/ vectorization & openmp
- TESTID=6 TESTDIR=1 TESTCOV=0 TESTFLAGS="--enable-vectorization --enable-openmp" CUDA=false
# regional example with debug bounds checking
- TESTID=7 TESTDIR=1 TESTCOV=0 TESTFLAGS="--enable-debug" CUDA=false
# regional example with NGLL = 6
- TESTID=8 TESTDIR=1 TESTCOV=0 TESTFLAGS="" CUDA=false
# globe_small example (offline, takes too long)
#- TESTID=9 TESTDIR=2 TESTCOV=0 TESTFLAGS="--enable-vectorization" CUDA=false
# globe_small example with openmp (offline, takes too long)
#- TESTID=10 TESTDIR=2 TESTCOV=0 TESTFLAGS="--enable-vectorization --enable-openmp" CUDA=false
# point force example (tested on github actions)
#- TESTID=11 TESTDIR=3 TESTCOV=0 TESTFLAGS="" CUDA=false
# regular kernel example
- TESTID=12 TESTDIR=4 TESTCOV=0 TESTFLAGS="--enable-vectorization" CUDA=false
# regional_sgloberani (tested on github actions)
#- TESTID=13 TESTDIR=5 TESTCOV=0 TESTFLAGS="--enable-vectorization" CUDA=false
# global_full_sphericalharmonic_model (possible future case)
#- TESTID=14 TESTDIR=6 TESTCOV=0 TESTFLAGS="--enable-vectorization" CUDA=false
# regional s40rts compilation w/ CUDA
- TESTID=15 TESTDIR=7 TESTCOV=0 TESTFLAGS="--with-cuda=cuda5" CUDA=true
# regional s40rts compilation w/ OpenCL (provided from CUDA library)
- TESTID=16 TESTDIR=7 TESTCOV=0 TESTFLAGS="--with-opencl" CUDA=true OPENCL=true
# regional_small_adjoint - pure adjoint example (offline, would need full length simulation)
#- TESTID=17 TESTDIR=8 TESTCOV=0 TESTFLAGS="" CUDA=false
# regional mars (tested on github actions)
#- TESTID=18 TESTDIR=9 TESTCOV=0 TESTFLAGS="" CUDA=false
# regional moon (tested on github actions)
#- TESTID=19 TESTDIR=10 TESTCOV=0 TESTFLAGS="" CUDA=false
# regional LDDRK
- TESTID=20 TESTDIR=11 TESTCOV=0 TESTFLAGS="--enable-vectorization" CUDA=false
# regional noise example
- TESTID=21 TESTDIR=12 TESTCOV=0 TESTFLAGS="--enable-vectorization" CUDA=false
# additional ARM tests
jobs:
include:
- arch: arm64
env: TESTID=4 TESTDIR=1 TESTCOV=0 TESTFLAGS="" CUDA=false
- arch: arm64
env: TESTID=7 TESTDIR=1 TESTCOV=0 TESTFLAGS="--enable-debug" CUDA=false
before_install:
# informations on git
- |
git --version
git rev-parse --verify HEAD
git branch -a
# infos on commits
- |
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
# (fails currently...)
#- |
# 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
# apt explicit update
#- |
# echo "update apt-get"
# travis_retry sudo apt-get update
# echo
addons:
# apt update
apt:
update: true
install:
# installs compilers
- bash .travis/run_install.sh
script:
# builds configurations
- bash .travis/run_build.sh
# runs test examples
- bash .travis/run_tests.sh
after_success:
###########################################################
# code coverage
###########################################################
- |
if [ "$TESTCOV" == "1" ]; then
gcov --version
echo
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