Skip to content

Count FLOPs and HitRate inside functor and output them to a log file #1571

Count FLOPs and HitRate inside functor and output them to a log file

Count FLOPs and HitRate inside functor and output them to a log file #1571

Workflow file for this run

# Workflow for unit tests
name: CI
# This Workflow is triggered by any PR or a direct push to master.
on:
push:
branches: [ master ]
pull_request:
# abort old runs if a new one is started
concurrency:
group: ${{ github.head_ref }}-tests
cancel-in-progress: true
jobs:
# Check that everything is formatted correctly. This does not apply any changes!
StyleCheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: DoozyX/clang-format-lint-action@v0.16.2
with:
source: 'src tests examples applicationLibrary tools'
# exclude: 'none'
extensions: 'h,cpp'
clangFormatVersion: 14
style: file
# Make sure contribution guidelines are followed. This does not apply any changes!
CustomChecks:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Checks
# this exits immediately when any command returns != 0
run: |
# enable recursive globbing syntax
shopt -s globstar
# '!' at the beginning of the line negates the exit code
# all headers should contain pragma once
! grep --files-without-match '#pragma once' **/*.h
# all files should contain a file comment
! grep --files-without-match '@file' **/*.{h,cpp}
# no file should contain 'NULL'
! grep --word-regexp 'NULL' **/*.{h,cpp}
# no file should contain 'assert'
! grep --word-regexp 'assert' **/*.{h,cpp}
# no file should include autopas with '<>'
! grep '#include <autopas' **/*.{h,cpp}
# prohibit 'typedef' to force 'using'
! grep --word-regexp 'typedef' **/*.{h,cpp}
# prohibit old usage of AUTOPAS_OPENMP
! grep '#ifdef AUTOPAS_OPENMP' **/*.{h,cpp}
! grep '#if defined.AUTOPAS_OPENMP' **/*.{h,cpp}
MatrixJob:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
part: [1, 2] # Split tests into two parts, to be run by separate runners
md-flex-mode: [singlesite, multisite]
config: [
# 0 1 2 3 4 5 6 7 8
# container , CC , CXX , builder , mode , OpenMP , ASan, TSan, AVX
[autopas-build-clang , clang, clang++, Ninja , Debug , ON , ON , OFF , ON],
[autopas-build-clang , clang, clang++, Ninja , Release, OFF , ON , OFF , ON],
[autopas-build-archer, clang, clang++, Ninja , Release, ON , OFF , ON , ON],
[autopas-build-clang , clang, clang++, Ninja , Release, ON , ON , OFF , ON],
[autopas-build-gcc , gcc , g++ ,"'Unix Makefiles'", Release, ON , OFF , OFF , ON],
[autopas-build-gcc , mpicc, mpic++ ,"'Unix Makefiles'", Release, ON , ON , OFF , ON],
]
exclude:
# Exclude multisite tests (to later be re-added for some configurations)
- md-flex-mode: multisite
# Exclude MPI configuration from part 2, as there are not many tests and so don't need to be split
- config: [autopas-build-gcc , mpicc, mpic++ ,"'Unix Makefiles'", Release, ON , ON , OFF , ON]
part: 2
# For two configurations, compile with Multi-Site Molecule support for md-flexible. There are not so many tests
# so we only add tests for part 1
include:
- config: [autopas-build-archer, clang, clang++, Ninja , Release, ON , OFF , ON , OFF]
md-flex-mode: multisite
part: 1
- config: [autopas-build-gcc , mpicc, mpic++ ,"'Unix Makefiles'", Release, ON , ON , OFF , OFF]
md-flex-mode: multisite
part: 1
name: Matrix - ${{ matrix.config[1] }}|${{ matrix.config[4] }}|${{ matrix.md-flex-mode }}|OpenMP=${{ matrix.config[5] }}|ASan=${{ matrix.config[6] }}|TSan=${{ matrix.config[7] }} (${{ matrix.part }}/2)
container: autopas/${{ matrix.config[0] }}
env:
TSAN_OPTIONS: "ignore_noninstrumented_modules=1"
LSAN_OPTIONS: "verbosity=1:log_threads=1"
defaults:
run:
# make sure the scripts are executed with bash (needed for [[) and not sh.
shell: bash
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build everything
run: |
# derive whether or not to compile with MPI options ON.
[ "${{ matrix.config[1] }}" = 'mpicc' ] && UseMPI=ON || UseMPI=OFF
mkdir build && cd build
CC=${{ matrix.config[1] }} CXX=${{ matrix.config[2] }} cmake \
-G ${{ matrix.config[3] }} \
-DCCACHE=ON \
-DCMAKE_BUILD_TYPE=${{ matrix.config[4] }} \
-DAUTOPAS_LOG_ALL=ON \
-DAUTOPAS_MIN_LOG_LVL:STRING=TRACE \
-DAUTOPAS_OPENMP=${{ matrix.config[5] }} \
-DAUTOPAS_ENABLE_ADDRESS_SANITIZER=${{ matrix.config[6] }} \
-DAUTOPAS_ENABLE_THREAD_SANITIZER=${{ matrix.config[7] }} \
-DAUTOPAS_INTERNODE_TUNING=${UseMPI} \
-DMD_FLEXIBLE_USE_MPI=${UseMPI} \
-DMD_FLEXIBLE_MODE=${{ matrix.md-flex-mode }} \
-DMD_FLEXIBLE_FUNCTOR_AUTOVEC=ON \
-DMD_FLEXIBLE_FUNCTOR_AUTOVEC_GLOBALS=OFF \
-DMD_FLEXIBLE_FUNCTOR_AVX=${{ matrix.config[8] }} \
-DMD_FLEXIBLE_FUNCTOR_SVE=OFF \
-DAUTOPAS_ENABLE_ALLLBL=${UseMPI} \
-DAUTOPAS_ENABLE_RULE_BASED_TUNING=ON \
..
entrypoint.sh cmake --build . --parallel 8
- name: Run tests ${{ matrix.part }}/2
run: |
# If single-site & No MPI, run every other AutoPas and example test
if [[ "${{ matrix.md-flex-mode }}" = 'singlesite' ]] && [[ "${{ matrix.config[1] }}" != 'mpicc' ]]
then
cd build
# Start with test 0 or 1 and do every second test
ctest --output-on-failure -I ${{ matrix.part }},,2 -j 2
cd applicationLibrary
ctest --output-on-failure -I ${{ matrix.part }},,2 -j 2
cd ../examples
ctest --output-on-failure --build-config checkExamples -I ${{ matrix.part }},,2 -j 2
fi
# If single-site & MPI, run MPI tests for AutoPas and example tests
if [[ "${{ matrix.md-flex-mode }}" = 'singlesite' ]] && [[ "${{ matrix.config[1] }}" = 'mpicc' ]]
then
cd build
# Only run MPI tests.
# No `--oversubscribe`, as MPI in container doesn't need it.
ctest --output-on-failure --tests-regex MPIParallelAutoPasTests
cd examples
# exclude examples that do not support MPI
ctest --output-on-failure --build-config checkExamples --exclude-regex 'sph-((main.test)|(diagram.*))'
fi
# If multi-site run every md-flexible test and multi site tests
if [[ "${{ matrix.md-flex-mode }}" = 'multisite' ]]
then
cd build/applicationLibrary
# Only run multi-site tests for non-mpi case
if [[ "${{ matrix.config[1] }}" != 'mpicc' ]]
then
ctest --output-on-failure --tests-regex '[mM]ulti[sS]ite'
fi
cd ../examples/md-flexible
ctest --output-on-failure --build-config mdFlexTests
fi