-
Notifications
You must be signed in to change notification settings - Fork 15
190 lines (168 loc) · 6.69 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
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 \
uuid-dev \
libcppunit-dev \
libopenmpi-dev \
libomp-dev \
libxerces-c-dev
# Install python modules to execute validation script
pip3 install numpy pandas
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_exec="cmake -DVECTOR_INSTRUCTIONS=${{ matrix.vector }} \
-DCMAKE_BUILD_TYPE=${{ matrix.target }} \
-DENABLE_AUTOPAS=${{ matrix.autopas }} \
-DAUTOPAS_ENABLE_RULES_BASED_AND_FUZZY_TUNING=ON \
-DENABLE_ALLLBL=$alllbl_enabled \
-DOPENMP=${{ matrix.openmp }} \
-DENABLE_MPI=$mpi_enabled \
-DENABLE_UNIT_TESTS=ON \
-DENABLE_VTK=ON \
.."
# Omit quotes to trim whitespace of cmake_exec in second echo command
echo "The following cmake command is executed:"
echo CC=${{ matrix.cc }} CXX=${{ matrix.cxx }} ${cmake_exec}
echo ""
${cmake_exec}
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: |
#set strict pipefail option
set -eo pipefail
#save absolute path to root of ls1 directory
repoPath=$PWD
#example list of new version is used
examplesFile="branchExamples_${JOBNAME}.txt"
# choose and save examples (so that the same file name could be used regardless of AutoPas is on or off)
if [[ ${{ matrix.autopas }} == 'ON' ]]
then
cp ./examples/example-list_autopas.txt "${examplesFile}"
else
cp ./examples/example-list.txt "${examplesFile}"
fi
# execute all examples. These calls create artifacts which we will then compare to the validation JSON file
IFS=$'\n'
for i in $(cat "${repoPath}/${examplesFile}" )
do
# skip if comment or empty line
if [[ $i == \#* || -z "$i" ]]
then
continue
fi
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 new exe
printf " Running example: $i ... "
EXE=$repoPath/build_${JOBNAME}/src/MarDyn
# 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"
# compare the output of the run to the validation file
# validation files are named after the respective config xml but without the file extension (::-4)
python3 ${repoPath}/checks/validation_compare_files.py \
--validation-file "validation_$(basename ${i::-4}).json" \
--logfile "output_${{ join(matrix.*, '-') }}"
done
env:
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cxx }}
OMP_NUM_THREADS: 2