Add thread sanitizer test in CI #46
Workflow file for this run
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: 🧴 clang sanitizers | |
on: [push, pull_request] | |
concurrency: | |
group: ${{ github.ref }}-${{ github.head_ref }}-clangsanitizers | |
cancel-in-progress: true | |
jobs: | |
build_UB_sanitizer: | |
name: Clang UB sanitizer | |
runs-on: ubuntu-22.04 | |
if: github.event.pull_request.draft == false | |
env: | |
CC: clang | |
CXX: clang++ | |
# On CI for this test, Ninja is slower than the default: | |
#CMAKE_GENERATOR: Ninja | |
steps: | |
- uses: actions/checkout@v4 | |
- name: install dependencies | |
run: | | |
.github/workflows/dependencies/clang15.sh | |
- name: CCache Cache | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/ccache | |
key: ccache-${{ github.workflow }}-${{ github.job }}-git-${{ github.sha }} | |
restore-keys: | | |
ccache-${{ github.workflow }}-${{ github.job }}-git- | |
- name: build WarpX | |
run: | | |
export CCACHE_COMPRESS=1 | |
export CCACHE_COMPRESSLEVEL=10 | |
export CCACHE_MAXSIZE=100M | |
ccache -z | |
export CXX=$(which clang++-15) | |
export CC=$(which clang-15) | |
export CXXFLAGS="-fsanitize=undefined -fno-sanitize-recover=all" | |
cmake -S . -B build \ | |
-GNinja \ | |
-DCMAKE_VERBOSE_MAKEFILE=ON \ | |
-DCMAKE_BUILD_TYPE=RelWithDebInfo \ | |
-DWarpX_DIMS="RZ;1;2;3" \ | |
-DWarpX_FFT=ON \ | |
-DWarpX_QED=ON \ | |
-DWarpX_QED_TABLE_GEN=ON \ | |
-DWarpX_OPENPMD=ON \ | |
-DWarpX_PRECISION=SINGLE \ | |
-DWarpX_PARTICLE_PRECISION=SINGLE | |
cmake --build build -j 4 | |
ccache -s | |
du -hs ~/.cache/ccache | |
- name: run with UB sanitizer | |
run: | | |
export OMP_NUM_THREADS=2 | |
mpirun -n 2 ./build/bin/warpx.rz Examples/Physics_applications/laser_acceleration/inputs_rz | |
mpirun -n 2 ./build/bin/warpx.1d Examples/Physics_applications/laser_acceleration/inputs_1d | |
mpirun -n 2 ./build/bin/warpx.2d Examples/Physics_applications/laser_acceleration/inputs_2d | |
mpirun -n 2 ./build/bin/warpx.3d Examples/Physics_applications/laser_acceleration/inputs_3d | |
build_thread_sanitizer: | |
name: Clang thread sanitizer | |
runs-on: ubuntu-22.04 | |
container: ubuntu:23.10 | |
if: github.event.pull_request.draft == false | |
env: | |
CC: clang | |
CXX: clang++ | |
# On CI for this test, Ninja is slower than the default: | |
#CMAKE_GENERATOR: Ninja | |
steps: | |
- uses: actions/checkout@v4 | |
- name: install dependencies | |
run: | | |
.github/workflows/dependencies/clang17.sh | |
- name: CCache Cache | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/ccache | |
key: ccache-${{ github.workflow }}-${{ github.job }}-git-${{ github.sha }} | |
restore-keys: | | |
ccache-${{ github.workflow }}-${{ github.job }}-git- | |
- name: build WarpX | |
run: | | |
export CCACHE_COMPRESS=1 | |
export CCACHE_COMPRESSLEVEL=10 | |
export CCACHE_MAXSIZE=100M | |
ccache -z | |
export CXX=$(which clang++-17) | |
export CC=$(which clang-17) | |
export CXXFLAGS="-fsanitize=thread" | |
cmake -S . -B build \ | |
-GNinja \ | |
-DCMAKE_VERBOSE_MAKEFILE=ON \ | |
-DCMAKE_BUILD_TYPE=RelWithDebInfo \ | |
-DWarpX_DIMS="RZ;1;2;3" \ | |
-DWarpX_FFT=ON \ | |
-DWarpX_QED=ON \ | |
-DWarpX_QED_TABLE_GEN=ON \ | |
-DWarpX_OPENPMD=ON \ | |
-WarpX_EB=ON \ | |
-DWarpX_PRECISION=SINGLE \ | |
-DWarpX_PARTICLE_PRECISION=SINGLE | |
cmake --build build -j 4 | |
ccache -s | |
du -hs ~/.cache/ccache | |
- name: run with thread sanitizer | |
run: | | |
export PMIX_MCA_gds=hash | |
export TSAN_OPTIONS='ignore_noninstrumented_modules=1' | |
export ARCHER_OPTIONS="verbose=1" | |
# We need these two lines because these tests run inside a docker container | |
export OMPI_ALLOW_RUN_AS_ROOT=1 | |
export OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1 | |
export OMP_NUM_THREADS=2 | |
mpirun -n 2 ./build/bin/warpx.rz Examples/Physics_applications/laser_acceleration/inputs_rz warpx.serialize_initial_conditions = 0 | |
mpirun -n 2 ./build/bin/warpx.1d Examples/Physics_applications/laser_acceleration/inputs_1d warpx.serialize_initial_conditions = 0 | |
mpirun -n 2 ./build/bin/warpx.2d Examples/Physics_applications/laser_acceleration/inputs_2d warpx.serialize_initial_conditions = 0 | |
mpirun -n 2 ./build/bin/warpx.3d Examples/Physics_applications/laser_acceleration/inputs_3d warpx.serialize_initial_conditions = 0 | |
git clone https://github.com/ECP-WarpX/warpx-data ../warpx-data | |
cd Examples/Tests/embedded_circle | |
# Note: warpx.self_fields_required_precision here is increased due to frequent failures of this test | |
mpirun -n 2 ../../../build/bin/warpx.2d inputs_2d warpx.serialize_initial_conditions = 0 warpx.self_fields_required_precision = 7e-06 | |
save_pr_number: | |
if: github.event_name == 'pull_request' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Save PR number | |
env: | |
PR_NUMBER: ${{ github.event.number }} | |
run: | | |
echo $PR_NUMBER > pr_number.txt | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: pr_number | |
path: pr_number.txt | |
retention-days: 1 |