File tree Expand file tree Collapse file tree 5 files changed +27
-2
lines changed
Expand file tree Collapse file tree 5 files changed +27
-2
lines changed Original file line number Diff line number Diff line change @@ -166,6 +166,12 @@ jobs:
166166 export CC=clang
167167 export CXX=clang++
168168 fi
169+ if [ "${{ matrix.config.sanitizer == 'tsan' ]; then
170+ # required to to avoid compile error: 'FATAL: ThreadSanitizer: unexpected memory mapping'
171+ # see: https://stackoverflow.com/questions/77850769/fatal-threadsanitizer-unexpected-memory-mapping-when-running-on-linux-kernels
172+ sysctl vm.mmap_rnd_bits=28
173+ fi
174+
169175 cmake -G Ninja \
170176 -DCMAKE_BUILD_TYPE=Release \
171177 ${alpaka_cmake_flags} -Dalpaka_DEP_OMP=ON \
Original file line number Diff line number Diff line change @@ -497,3 +497,10 @@ option(alpaka_ASAN "Enable/Disable linking the address sanitizer for cpu targets
497497option (alpaka_TSAN "Enable/Disable linking the thread sanitizer for cpu targets" OFF )
498498option (alpaka_LSAN "Enable/Disable linking the memory leak sanitizer for cpu targets" OFF )
499499option (alpaka_UBSAN "Enable/Disable linking the undefined behavior sanitizer for cpu targets" OFF )
500+
501+ if (alpaka_TSAN)
502+ message (
503+ WARNING
504+ "Threadsanitizers enabled: You should reduce mmap rnd bits to avoid compile issues: call as root 'sysctl vm.mmap_rnd_bits=28'"
505+ )
506+ endif ()
Original file line number Diff line number Diff line change @@ -224,6 +224,8 @@ function(alpaka_finalize target)
224224 message (STATUS "Linking TSAN to ${target} " )
225225 target_compile_options (${target} PRIVATE -fsanitize=thread)
226226 target_link_options (${target} PRIVATE -fsanitize=thread)
227+ # - to get nicer stack-traces:
228+ target_link_options (${target} PRIVATE -fno-omit-frame-pointer)
227229 if (alpaka_LSAN OR alpaka_UBSAN)
228230 message (
229231 WARNING
Original file line number Diff line number Diff line change @@ -92,10 +92,20 @@ namespace alpaka::onHost
9292 {
9393 std::lock_guard<std::mutex> lk (m_mutex);
9494 fn ();
95+ // silent tsan warnings: The promise is fulfilled directly and only a future which is true is
96+ // returned, there can not be a data race in between.
97+ #if defined(__GNUC__) && !defined(__clang__)
98+ # pragma GCC diagnostic push
99+ # pragma GCC diagnostic ignored "-Wtsan"
100+ #endif
95101 // return a ready future-like placeholder; reuse CallbackThread interface minimally
96102 std::promise<void > p;
97- auto f = p.get_future ();
98103 p.set_value ();
104+ #if defined(__GNUC__) && !defined(__clang__)
105+ # pragma GCC diagnostic pop
106+ #endif
107+ auto f = p.get_future ();
108+
99109 // to keep the uniform interface with the non-blocking case,
100110 // return by moving the f since it is move-only
101111 return f;
Original file line number Diff line number Diff line change 11# suppression list for the thread sanitizer
22
33# the active waiting in the events unit test is detected as a data race, but is fine
4- race:unit_test_event
4+ race:unit_test_event_event
55race:docs_test_cheatsheet
66
77# omp library is not instrumented, exclude it
You can’t perform that action at this time.
0 commit comments