-
Notifications
You must be signed in to change notification settings - Fork 15
220 lines (198 loc) · 7.48 KB
/
ls1_test.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
name: C/C++ CI for ls1
on:
push:
# pushes to master
branches: [ master ]
pull_request:
# PRs to master
branches: [ master ]
# abort old runs if a new one is started
concurrency:
group: ${{ github.head_ref }}-tests
cancel-in-progress: true
jobs:
ci-matrix:
runs-on: ubuntu-latest
strategy:
# do not cancel all other workflow runs if one fails
fail-fast: false
matrix:
vector: ['SSE', 'NONE', 'AVX', 'AVX2']
target: ['Debug', 'Release']
parall: ['SEQ', 'PAR']
cc: ['gcc', 'clang']
cxx: ['g++', 'clang++']
autopas: ['ON', 'OFF']
procs: ['1', '4', '8'] #TODO: >= 27 ranks case, to have non-border rank
openmp: ['ON', 'OFF']
exclude:
# exclude incompatible compiler pairs
- cc: 'gcc'
cxx: 'clang++'
- cc: 'clang'
cxx: 'g++'
# exclude legacy configurations
- vector: 'SSE'
- vector: 'AVX'
- openmp: 'OFF'
# exclude SEQ & np > 1, exclude PAR & np = 1
- parall: 'PAR'
procs: '1'
- parall: 'SEQ'
procs: '4'
- parall: 'SEQ'
procs: '8'
env:
JOBNAME: ${{ join(matrix.*, '-') }}
name: ${{ matrix.vector }}-${{ matrix.target }}-${{ matrix.parall }}-${{ matrix.cc }}-AutoPas=${{ matrix.autopas }}-Ranks=${{ matrix.procs }}-OMP=${{ matrix.openmp }}
steps:
# setup github actions runner node
- uses: actions/checkout@v4
- name: Setup
run: |
sudo apt-get update
# MPICH 4.0.3 seems to have a bug that triggers a FP exception in our collective communication when doing 0+0.
sudo apt-get install -y \
libcppunit-dev \
libopenmpi-dev \
libomp-dev \
libxerces-c-dev
echo "Running ${JOBNAME}"
git status
mkdir build_${JOBNAME}
# build testing & unit testing
- name: Build and Unit Test
run: |
cd build_${JOBNAME}
#translate matrix to ON/OFF for certain entries
if [[ ${{ matrix.parall }} == 'PAR' ]]
then
mpi_enabled='ON'
else
mpi_enabled='OFF'
fi
if [[ ${{ matrix.parall }} == 'PAR' ]] && [[ ${{ matrix.autopas }} == 'ON' ]]
then
alllbl_enabled='ON'
else
alllbl_enabled='OFF'
fi
cmake -DVECTOR_INSTRUCTIONS=${{ matrix.vector }} \
-DCMAKE_BUILD_TYPE=${{ matrix.target }} \
-DENABLE_AUTOPAS=${{ matrix.autopas }} \
-DENABLE_ALLLBL=$alllbl_enabled \
-DOPENMP=${{ matrix.openmp }} \
-DENABLE_MPI=$mpi_enabled \
-DENABLE_UNIT_TESTS=ON \
-DENABLE_VTK=ON \
..
cmake --build . --parallel 1
cd ..
if [[ ${{ matrix.parall }} == 'PAR' ]]
then
# when using OpenMPI --oversubscribe is needed. Remove it if you switch to MPICH.
mpirun --oversubscribe -np ${{ matrix.procs }} ./build_${JOBNAME}/src/MarDyn -t -d ./test_input/
else
./build_${JOBNAME}/src/MarDyn -t -d ./test_input/
fi
env:
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cxx }}
OMP_NUM_THREADS: 2
# validation testing
- if: ${{ matrix.parall == 'PAR' }}
name: Validation
run: |
#save absolute path to root of ls1 directory
repoPath=$PWD
examplesFile="branchExamples_${JOBNAME}.txt"
# choose and save examples (so that this commit and master execute the same list)
if [[ ${{ matrix.autopas }} == 'ON' ]]
then
cp ./examples/example-list_autopas.txt "${examplesFile}"
else
cp ./examples/example-list.txt "${examplesFile}"
fi
#translate matrix to ON/OFF for certain entries
if [[ ${{ matrix.parall }} == 'PAR' ]]
then
mpi_enabled='ON'
else
mpi_enabled='OFF'
fi
if [[ ${{ matrix.parall }} == 'PAR' ]] && [[ ${{ matrix.autopas }} == 'ON' ]]
then
alllbl_enabled='ON'
else
alllbl_enabled='OFF'
fi
#build master branch equivalent to compare new build to
mkdir build_${JOBNAME}_master
git fetch
git checkout master
git status
cd build_${JOBNAME}_master
#note: ALLLBL is enabled if AutoPas is enabled.
cmake -DVECTOR_INSTRUCTIONS=${{ matrix.vector }} \
-DCMAKE_BUILD_TYPE=${{ matrix.target }} \
-DENABLE_AUTOPAS=${{ matrix.autopas }} \
-DENABLE_ALLLBL=$alllbl_enabled \
-DOPENMP=${{ matrix.openmp }} \
-DENABLE_MPI=$mpi_enabled \
-DENABLE_VTK=ON \
..
cmake --build . --parallel 1
#as example list of new version is used, also the example files of new version should be used
#therefore, go back to new version
git checkout -
cd "${repoPath}"
#set strict pipefail option
set -eo pipefail
# execute all examples. These calls create artifacts which we will then compare
IFS=$'\n'
for i in $(cat "${repoPath}/${examplesFile}" )
do
# skip if comment or empty line
if [[ $i == \#* || -z "$i" ]]
then
continue
fi
echo $i
cd $repoPath/examples/$(dirname $i)
# patch input files according to current conf
cp $(basename $i) input_patched.xml
# if AutoPas is enabled, replace all occurrences of LinkedCell in the examples' config files with AutoPas
if [[ ${{ matrix.autopas }} == 'ON' ]]
then
sed --in-place 's/LinkedCells/AutoPas/g' input_patched.xml
fi
# if AutoPas is enabled and no vectorization is used, the AVX functor of Autopas has to be disabled
if [[ ${{ matrix.vector }} == 'NONE' ]]
then
sed --in-place 's|AutoPas">|AutoPas">\n\t<functor>autoVec</functor>|g' input_patched.xml
fi
# run the example with the old and new exe
for VERSION in "master" "new"
do
if [[ "${VERSION}" == "master" ]]
then
printf " Running master... "
EXE=$repoPath/build_${JOBNAME}_master/src/MarDyn
else
printf " Running new version... "
EXE=$repoPath/build_${JOBNAME}/src/MarDyn
fi
# when using OpenMPI --oversubscribe is needed. Remove it if you switch to MPICH.
mpirun --oversubscribe -np ${{ matrix.procs }} ${EXE} input_patched.xml --steps=20 \
| tee "output_${{ join(matrix.*, '-') }}" \
| awk '/Simstep = /{ print $7 " " $10 " " $13 " " $16 }' > ${repoPath}/output_${VERSION} \
|| (exitCode=$?; cat "output_${{ join(matrix.*, '-') }}"; (exit $exitCode))
printf "Done\n"
done
# compare the two runs
diff ${repoPath}/output_new ${repoPath}/output_master
done
env:
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cxx }}
OMP_NUM_THREADS: 2