Skip to content

Commit 2d75a67

Browse files
setup CI
1 parent a2261f9 commit 2d75a67

1 file changed

Lines changed: 29 additions & 6 deletions

File tree

‎.github/workflows/dynamic_arch.yml‎

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,8 @@ jobs:
349349
check-name: "linux_thread_stress (openmp)"
350350
- backend: tsan
351351
check-name: linux_thread_sanitizer
352+
- backend: tsan-openmp
353+
check-name: linux_thread_sanitizer_openmp
352354

353355
steps:
354356
- name: Checkout repository
@@ -362,8 +364,11 @@ jobs:
362364
EOF
363365
sudo apt-get update
364366
sudo apt-get install -y ccache cmake ninja-build
365-
if [ "${{ matrix.backend }}" = "tsan" ]; then
366-
sudo apt-get install -y clang llvm
367+
case "${{ matrix.backend }}" in
368+
tsan|tsan-openmp) sudo apt-get install -y clang llvm ;;
369+
esac
370+
if [ "${{ matrix.backend }}" = "tsan-openmp" ]; then
371+
sudo apt-get install -y libomp-dev
367372
fi
368373
369374
- name: Compilation cache
@@ -398,7 +403,7 @@ jobs:
398403
sanitizer_flags=
399404
if [ "${{ matrix.backend }}" = "openmp" ]; then
400405
use_openmp=ON
401-
elif [ "${{ matrix.backend }}" = "tsan" ]; then
406+
elif [ "${{ matrix.backend }}" = "tsan" ] || [ "${{ matrix.backend }}" = "tsan-openmp" ]; then
402407
build_type=RelWithDebInfo
403408
c_compiler=clang
404409
cxx_compiler=clang++
@@ -408,6 +413,10 @@ jobs:
408413
dgemm_mixed_args="131072;8;10"
409414
dgemv_args="64;4;1"
410415
sanitizer_flags="-fsanitize=thread -g -O1 -fno-omit-frame-pointer"
416+
if [ "${{ matrix.backend }}" = "tsan-openmp" ]; then
417+
use_openmp=ON
418+
cpp_thread_safety_use_openmp=ON
419+
fi
411420
fi
412421
cmake_args=(
413422
-G Ninja
@@ -436,7 +445,7 @@ jobs:
436445
-DCMAKE_C_COMPILER_LAUNCHER=ccache
437446
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
438447
)
439-
if [ "${{ matrix.backend }}" = "tsan" ]; then
448+
if [ "${{ matrix.backend }}" = "tsan" ] || [ "${{ matrix.backend }}" = "tsan-openmp" ]; then
440449
cmake_args+=(
441450
"-DCMAKE_C_FLAGS=$sanitizer_flags"
442451
"-DCMAKE_CXX_FLAGS=$sanitizer_flags"
@@ -459,10 +468,24 @@ jobs:
459468
timeout-minutes: 30
460469
run: |
461470
cd build
462-
if [ "${{ matrix.backend }}" = "tsan" ]; then
471+
if [ "${{ matrix.backend }}" = "tsan" ] || [ "${{ matrix.backend }}" = "tsan-openmp" ]; then
463472
export LLVM_SYMBOLIZER_PATH=/usr/bin/llvm-symbolizer
464473
export TSAN_OPTIONS=halt_on_error=1:exitcode=66:second_deadlock_stack=1
465-
else
474+
fi
475+
if [ "${{ matrix.backend }}" = "tsan-openmp" ]; then
476+
# Load Archer (the OMPT tool from Ubuntu's libomp-dev) so TSan
477+
# understands libomp's barriers instead of flagging them as false positives. The OpenMP runtime will load this tool automatically if OMP_TOOL_LIBRARIES is set.
478+
archer=$(clang -print-file-name=libarcher.so)
479+
[ -f "$archer" ] || archer=$(find /usr/lib/llvm-* -name libarcher.so 2>/dev/null | head -1)
480+
if [ ! -f "$archer" ]; then
481+
echo "::error::libarcher.so not found (expected from libomp-dev)"
482+
exit 1
483+
fi
484+
echo "Using distro Archer: $archer"
485+
export OMP_TOOL_LIBRARIES="$archer"
486+
export TSAN_OPTIONS="$TSAN_OPTIONS:ignore_noninstrumented_modules=1"
487+
fi
488+
if [ "${{ matrix.backend }}" != "tsan" ]; then
466489
export OMP_NUM_THREADS=16
467490
fi
468491
export OPENBLAS_NUM_THREADS=8

0 commit comments

Comments
 (0)