diff --git a/algo/CMakeLists.txt b/algo/CMakeLists.txt index eb3ee186eb09d43c0a364eb566181ad3e94f2000..4723ad70ff35fc0d07ac777bdb5c21ecf76849d9 100644 --- a/algo/CMakeLists.txt +++ b/algo/CMakeLists.txt @@ -94,7 +94,7 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Linux") if (TBB_FOUND) message(STATUS "Found TBB") - add_compile_definitions(HAVE_TBB) + target_compile_definitions(Algo PUBLIC -DHAVE_TBB) target_link_libraries(Algo PUBLIC TBB::tbb) else() message(STATUS "TBB not found") diff --git a/algo/base/BuildInfo.h b/algo/base/BuildInfo.h index 5eba468404086385592082f731fe137a1ee1a00b..bdacc7a166b19cf390075c6ec7e28415c32f9fe4 100644 --- a/algo/base/BuildInfo.h +++ b/algo/base/BuildInfo.h @@ -6,6 +6,10 @@ #include <string> +#if defined(HAVE_TBB) && defined(__cpp_lib_parallel_algorithm) +#define HAVE_PARALLEL_ALGORITHM +#endif + namespace cbm::algo::BuildInfo { @@ -20,6 +24,13 @@ namespace cbm::algo::BuildInfo false; #endif + inline constexpr bool WITH_PARALLEL_ALGORITHM = +#ifdef HAVE_PARALLEL_ALGORITHM + true; +#else + false; +#endif + } // namespace cbm::algo::BuildInfo #endif // CBM_ALGO_BUILD_INFO_H diff --git a/algo/base/compat/Algorithm.h b/algo/base/compat/Algorithm.h index 5aef2404f79dd26f7aea39f77f4d584bc03d88d3..cf784419c2ece575d83f606fb2759a392f7df162 100644 --- a/algo/base/compat/Algorithm.h +++ b/algo/base/compat/Algorithm.h @@ -16,6 +16,9 @@ **/ #include <algorithm> + +#include "BuildInfo.h" + #ifdef __cpp_lib_execution #define WITH_EXECUTION #include <execution> @@ -28,11 +31,11 @@ namespace cbm::algo { #ifdef WITH_EXECUTION inline constexpr auto ExecPolicy = -#if defined(__cpp_lib_parallel_algorithm) && defined(HAVE_TBB) +#ifdef HAVE_PARALLEL_ALGORITHM std::execution::par_unseq; #else std::execution::seq; -#endif // __cpp_lib_parallel_algorithm && WITH_TBB +#endif // HAVE_PARALLEL_ALGORITHM #endif // WITH_EXECUTION } // namespace detail diff --git a/algo/unpack/Unpack.cxx b/algo/unpack/Unpack.cxx index a4000d7c60cd6fb8570d6693e0bef0ba7e334d38..cd318a5949d95998685b20557da4d7c8ae801b39 100644 --- a/algo/unpack/Unpack.cxx +++ b/algo/unpack/Unpack.cxx @@ -59,7 +59,7 @@ namespace cbm::algo } } //# component - // --- Sorting of output digis. Is required by both digi trigger and event builder. + // --- Sorting of output digis. Is required by both digi trigger and event builder. ParallelSort(digiTs.fData.fSts.fDigis.begin(), digiTs.fData.fSts.fDigis.end(), [](CbmStsDigi digi1, CbmStsDigi digi2) { return digi1.GetTime() < digi2.GetTime(); }); ParallelSort(digiTs.fData.fMuch.fDigis.begin(), digiTs.fData.fMuch.fDigis.end(), diff --git a/reco/app/cbmreco/main.cxx b/reco/app/cbmreco/main.cxx index b7a84cd7db67fbfa4cad50ee2935446d3ea4adf8..32f2b08078824cd6e54da55671eb0cd1638774de 100644 --- a/reco/app/cbmreco/main.cxx +++ b/reco/app/cbmreco/main.cxx @@ -34,7 +34,7 @@ int main(int argc, char** argv) xpu::preload<GPUReco>(); L_(info) << "CBMRECO buildType=" << BuildInfo::BUILD_TYPE << " gpuDebug=" << BuildInfo::GPU_DEBUG - << " commit=" << BuildInfo::GIT_HASH; + << " parallelSTL=" << BuildInfo::WITH_PARALLEL_ALGORITHM << " commit=" << BuildInfo::GIT_HASH; std::stringstream ss; for (int i = 0; i < argc; i++) { ss << argv[i] << " ";