Cleanup of readers #569
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
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 \ | |
.. | |
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 \ | |
.. | |
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 |