diff --git a/.github/workflows/ci_linux.yml b/.github/workflows/ci_linux.yml index cb1d2308..6369604c 100644 --- a/.github/workflows/ci_linux.yml +++ b/.github/workflows/ci_linux.yml @@ -31,23 +31,29 @@ jobs: fail-fast: false matrix: include: + - name: "clang17" + compiler: "clang-17" + build: unit + build_type: Release + cxx_flags: "-std=c++20" + - name: "gcc13" compiler: "gcc-13" build: unit build_type: Release - cxx_flags: "-std=c++23" + cxx_flags: "-std=c++23 -Wno-interference-size" - name: "gcc12" compiler: "gcc-12" build: unit build_type: Release - cxx_flags: "-std=c++23" + cxx_flags: "-std=c++23 -Wno-interference-size" - name: "gcc11" compiler: "gcc-11" build: unit build_type: Release - cxx_flags: "-std=c++23" + cxx_flags: "-std=c++23 -Wno-interference-size" steps: - name: Checkout @@ -63,6 +69,10 @@ jobs: compiler: ${{ matrix.compiler }} ccache_size: 150M + - name: Install OpenMP + if: contains(matrix.name, 'clang') + run: install libomp-17-dev + - name: Install CMake uses: seqan/actions/setup-cmake@main with: @@ -73,7 +83,7 @@ jobs: mkdir build cd build cmake ../raptor/test/${{ matrix.build }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ - -DCMAKE_CXX_FLAGS="${{ matrix.cxx_flags }} -Wno-interference-size" \ + -DCMAKE_CXX_FLAGS="${{ matrix.cxx_flags }}" \ -DRAPTOR_NATIVE_BUILD=OFF make -j2 gtest_build diff --git a/.github/workflows/ci_sanitizer.yml b/.github/workflows/ci_sanitizer.yml index 1ba686d1..5a9adb95 100644 --- a/.github/workflows/ci_sanitizer.yml +++ b/.github/workflows/ci_sanitizer.yml @@ -13,6 +13,7 @@ env: SHARG_NO_VERSION_CHECK: 1 TZ: Europe/Berlin ASAN_OPTIONS: strict_string_checks=1:detect_stack_use_after_return=1:check_initialization_order=1:strict_init_order=1 + TSAN_OPTIONS: ignore_noninstrumented_modules=1 UBSAN_OPTIONS: print_stacktrace=1 defaults: @@ -32,13 +33,16 @@ jobs: build_type: [Release, Debug] include: - name: "AddressSanitizer" - cxx_flags: "-std=c++23 -fno-omit-frame-pointer -fsanitize=address -Wno-maybe-uninitialized" + compiler: gcc-13 + cxx_flags: "-std=c++23 -fno-omit-frame-pointer -fsanitize=address -Wno-maybe-uninitialized -Wno-interference-size" - name: "ThreadSanitizer" - cxx_flags: "-std=c++23 -fno-omit-frame-pointer -fsanitize=thread" + compiler: clang-17 + cxx_flags: "-std=c++20 -fno-omit-frame-pointer -fsanitize=thread" - name: "UndefinedBehaviorSanitizer" - cxx_flags: "-std=c++23 -fno-omit-frame-pointer -fsanitize=undefined" + compiler: gcc-13 + cxx_flags: "-std=c++23 -fno-omit-frame-pointer -fsanitize=undefined -Wno-interference-size" steps: - name: Checkout @@ -53,6 +57,12 @@ jobs: with: compiler: gcc-13 + - name: Install OpenMP + if: contains(matrix.name, 'clang') + run: | + install libomp-17-dev + echo "OMP_TOOL_LIBRARIES=/usr/lib/llvm-17/lib/libarcher.so" >> "$GITHUB_ENV" + - name: Configure OS run: | sudo bash -c "echo 0 > /proc/sys/vm/overcommit_memory" @@ -68,7 +78,7 @@ jobs: mkdir build cd build cmake ../raptor/test/unit -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ - -DCMAKE_CXX_FLAGS="${{ matrix.cxx_flags }} -Wno-interference-size" + -DCMAKE_CXX_FLAGS="${{ matrix.cxx_flags }}" make -j2 gtest_build - name: Build tests diff --git a/build_system/raptor-config.cmake b/build_system/raptor-config.cmake index 1d7f960f..314acbcd 100644 --- a/build_system/raptor-config.cmake +++ b/build_system/raptor-config.cmake @@ -247,7 +247,8 @@ endif () check_cxx_compiler_flag ("-fopenmp-simd" RAPTOR_HAS_OPENMP_SIMD) if (RAPTOR_HAS_OPENMP_SIMD) - set (RAPTOR_CXX_FLAGS "${RAPTOR_CXX_FLAGS} -fopenmp-simd -DSIMDE_ENABLE_OPENMP") + set (RAPTOR_CXX_FLAGS "${RAPTOR_CXX_FLAGS} -fopenmp-simd") + set (RAPTOR_DEFINITIONS ${RAPTOR_DEFINITIONS} "-DSIMDE_ENABLE_OPENMP") raptor_config_print ("SIMD-OpenMP Support: via -fopenmp-simd") else () raptor_config_print ("SIMD-OpenMP Support: not found") @@ -290,10 +291,12 @@ endif () if (RAPTOR_IS_DEBUG) raptor_config_print ("Link Time Optimization: disabled") else () - if ("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin") - set (RAPTOR_LTO_FLAGS "-flto=auto") + # CMake's check_ipo_supported uses hardcoded lto flags + # macOS GCC supports -flto-auto, but not the hardcoded flag "-fno-fat-lto-objects" + if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND NOT "${CMAKE_SYSTEM_NAME}" MATCHES "Darwin") + set (RAPTOR_LTO_FLAGS "-flto=auto -ffat-lto-objects") else () - set (RAPTOR_LTO_FLAGS "-flto=auto -fno-fat-lto-objects") + set (RAPTOR_LTO_FLAGS "-flto=auto") endif () set (LTO_CMAKE_SOURCE @@ -326,7 +329,7 @@ else () endif () option (RAPTOR_STRIP_BINARY "Enable binary-stripping. Not supported on macOS." ON) -if ("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin") +if ("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") raptor_config_print ("Binary-stripping: not supported") elseif (RAPTOR_IS_DEBUG OR NOT RAPTOR_STRIP_BINARY) raptor_config_print ("Binary-stripping: disabled") diff --git a/include/raptor/argument_parsing/search_arguments.hpp b/include/raptor/argument_parsing/search_arguments.hpp index eac61f31..d21d0c4d 100644 --- a/include/raptor/argument_parsing/search_arguments.hpp +++ b/include/raptor/argument_parsing/search_arguments.hpp @@ -81,15 +81,15 @@ struct search_arguments raptor::threshold::threshold_parameters make_threshold_parameters() const noexcept { - return {.window_size{window_size}, - .shape{shape}, - .query_length{query_length}, - .errors{errors}, - .percentage{threshold}, - .p_max{p_max}, - .tau{tau}, - .cache_thresholds{cache_thresholds}, - .output_directory{index_file.parent_path()}}; + return {.window_size = window_size, + .shape = shape, + .query_length = query_length, + .errors = errors, + .percentage = threshold, + .p_max = p_max, + .tau = tau, + .cache_thresholds = cache_thresholds, + .output_directory = index_file.parent_path()}; } }; diff --git a/include/raptor/build/index_factory.hpp b/include/raptor/build/index_factory.hpp index b95f92a8..dfcee53a 100644 --- a/include/raptor/build/index_factory.hpp +++ b/include/raptor/build/index_factory.hpp @@ -31,8 +31,8 @@ class index_factory index_factory() = default; index_factory(index_factory const &) = default; index_factory(index_factory &&) = default; - index_factory & operator=(index_factory const &) = default; - index_factory & operator=(index_factory &&) = default; + index_factory & operator=(index_factory const &) = delete; // const member + index_factory & operator=(index_factory &&) = delete; // const member ~index_factory() = default; explicit index_factory(build_arguments const & args) : arguments{std::addressof(args)} @@ -76,11 +76,14 @@ class index_factory seqan::hibf::serial_timer local_timer{}; auto & ibf = index.ibf(); local_timer.start(); - for (auto && [file_names, bin_number] : zipped_view) + // https://godbolt.org/z/PeKnxzjn1 + for (auto && zipped : zipped_view) { std::visit( [&](auto const & reader) { + auto && [file_names, bin_number] = zipped; + if (config == nullptr) reader.hash_into(file_names, emplacer(ibf, seqan::hibf::bin_index{bin_number})); else diff --git a/include/raptor/search/search_singular_ibf.hpp b/include/raptor/search/search_singular_ibf.hpp index 48a9d117..fc3c6963 100644 --- a/include/raptor/search/search_singular_ibf.hpp +++ b/include/raptor/search/search_singular_ibf.hpp @@ -51,7 +51,11 @@ void search_singular_ibf(search_arguments const & arguments, index_t && index) seqan::hibf::serial_timer local_query_ibf_timer{}; seqan::hibf::serial_timer local_generate_results_timer{}; +#if defined(__clang__) + auto counter = [&index]() +#else auto counter = [&index, is_ibf]() +#endif { if constexpr (is_ibf) return index.ibf().template counting_agent(); diff --git a/include/raptor/search/sync_out.hpp b/include/raptor/search/sync_out.hpp index 6adf0364..d51980b1 100644 --- a/include/raptor/search/sync_out.hpp +++ b/include/raptor/search/sync_out.hpp @@ -26,10 +26,10 @@ class sync_out { public: sync_out() = default; - sync_out(sync_out const &) = default; - sync_out & operator=(sync_out const &) = default; - sync_out(sync_out &&) = default; - sync_out & operator=(sync_out &&) = default; + sync_out(sync_out const &) = delete; // std::ofstream + sync_out & operator=(sync_out const &) = delete; // std::ofstream + sync_out(sync_out &&) = delete; // std::mutex + sync_out & operator=(sync_out &&) = delete; // std::mutex ~sync_out() = default; sync_out(search_arguments const & arguments) : file{arguments.out_file} diff --git a/lib/seqan3 b/lib/seqan3 index de22aa76..baece6f4 160000 --- a/lib/seqan3 +++ b/lib/seqan3 @@ -1 +1 @@ -Subproject commit de22aa76a050323c479e245c1d580739154635b9 +Subproject commit baece6f427f6b178ec7876253246e531af15b102 diff --git a/src/layout/CMakeLists.txt b/src/layout/CMakeLists.txt index 2eafebd4..ffd04222 100644 --- a/src/layout/CMakeLists.txt +++ b/src/layout/CMakeLists.txt @@ -2,6 +2,6 @@ cmake_minimum_required (VERSION 3.15) if (NOT TARGET raptor_layout) add_library ("raptor_layout" STATIC raptor_layout.cpp) - + target_compile_options (chopper_layout_lib PRIVATE "-w") target_link_libraries ("raptor_layout" PUBLIC "raptor_interface" "chopper_layout_lib" xxHash::xxhash) endif () diff --git a/test/include/raptor/test/cli_test.hpp b/test/include/raptor/test/cli_test.hpp index 230b449c..a42cddbd 100644 --- a/test/include/raptor/test/cli_test.hpp +++ b/test/include/raptor/test/cli_test.hpp @@ -155,7 +155,7 @@ struct raptor_base : public cli_test using strong_bool::value; }; - static inline auto const get_repeated_bins(size_t const repetitions) noexcept + static inline auto get_repeated_bins(size_t const repetitions) noexcept { using vec_t = std::vector; diff --git a/test/include/raptor/test/tmp_test_file.hpp b/test/include/raptor/test/tmp_test_file.hpp index 5c21cf23..0827855b 100644 --- a/test/include/raptor/test/tmp_test_file.hpp +++ b/test/include/raptor/test/tmp_test_file.hpp @@ -16,10 +16,10 @@ class tmp_test_file { public: tmp_test_file() = default; - tmp_test_file(tmp_test_file const &) = default; - tmp_test_file & operator=(tmp_test_file const &) = default; - tmp_test_file(tmp_test_file &&) = default; - tmp_test_file & operator=(tmp_test_file &&) = default; + tmp_test_file(tmp_test_file const &) = delete; + tmp_test_file & operator=(tmp_test_file const &) = delete; + tmp_test_file(tmp_test_file &&) = delete; + tmp_test_file & operator=(tmp_test_file &&) = delete; ~tmp_test_file() = default; template diff --git a/test/unit/cli/build/build_hibf_test.cpp b/test/unit/cli/build/build_hibf_test.cpp index 4c17fa66..caa3323e 100644 --- a/test/unit/cli/build/build_hibf_test.cpp +++ b/test/unit/cli/build/build_hibf_test.cpp @@ -7,22 +7,12 @@ #include -#if defined(__SANITIZE_THREAD__) -# define RAPTOR_USES_TSAN true -#else -# define RAPTOR_USES_TSAN false -#endif - struct build_hibf : public raptor_base, public testing::WithParamInterface> {}; TEST_P(build_hibf, with_file) { auto const [number_of_repeated_bins, window_size, run_parallel_tmp] = GetParam(); - - if (RAPTOR_USES_TSAN && run_parallel_tmp) - GTEST_SKIP() << "Threadsantizier + OpenMP causes false positives."; - bool const run_parallel = run_parallel_tmp && number_of_repeated_bins >= 32; cli_test_result const result = execute_app("raptor", @@ -47,10 +37,6 @@ TEST_P(build_hibf, with_file) TEST_P(build_hibf, with_shape) { auto const [number_of_repeated_bins, window_size, run_parallel_tmp] = GetParam(); - - if (RAPTOR_USES_TSAN && run_parallel_tmp) - GTEST_SKIP() << "Threadsantizier + OpenMP causes false positives."; - bool const run_parallel = run_parallel_tmp && number_of_repeated_bins >= 32; cli_test_result const result = execute_app("raptor", diff --git a/test/unit/cli/search/search_hibf_preprocessing_test.cpp b/test/unit/cli/search/search_hibf_preprocessing_test.cpp index 25c7ceb4..c7657a27 100644 --- a/test/unit/cli/search/search_hibf_preprocessing_test.cpp +++ b/test/unit/cli/search/search_hibf_preprocessing_test.cpp @@ -9,12 +9,6 @@ #include -#if defined(__SANITIZE_THREAD__) -# define RAPTOR_USES_TSAN true -#else -# define RAPTOR_USES_TSAN false -#endif - struct search_hibf_preprocessing : public raptor_base, public testing::WithParamInterface> @@ -74,7 +68,7 @@ TEST_P(search_hibf_preprocessing, pipeline) cli_test_result const result2 = execute_app("raptor", "build", "--threads ", - (run_parallel && !RAPTOR_USES_TSAN) ? "2" : "1", + run_parallel ? "2" : "1", "--output raptor.index", "--quiet", "--input raptor_cli_test.layout");