diff --git a/algo/base/BuildInfo.h b/algo/base/BuildInfo.h index d044534a545f184c491114841cb10b052982d2ab..679d18742e61610355f5adf319409f484ba31736 100644 --- a/algo/base/BuildInfo.h +++ b/algo/base/BuildInfo.h @@ -6,6 +6,10 @@ #include <string> +#if __has_include(<execution>) && !defined(__CLING__) +#include <execution> // for feature test macro __cpp_lib_parallel_algorithm +#endif + #if defined(HAVE_TBB) && defined(__cpp_lib_parallel_algorithm) #define HAVE_PARALLEL_ALGORITHM #endif diff --git a/algo/base/compat/Algorithm.h b/algo/base/compat/Algorithm.h index 94c03a7de8c96c0c397dcf896d1fe95d2ae4a1b5..b6864ab8223f406f2e612ea0a4cb9187ddb18868 100644 --- a/algo/base/compat/Algorithm.h +++ b/algo/base/compat/Algorithm.h @@ -19,8 +19,7 @@ #include <algorithm> -#if defined(__cpp_lib_execution) && defined(HAVE_PARALLEL_ALGORITHM) -#define WITH_EXECUTION +#ifdef HAVE_PARALLEL_ALGORITHM #include <execution> #endif @@ -36,7 +35,11 @@ namespace cbm::algo template<typename It, typename Compare> void Sort(It first, It last, Compare comp) { -#ifdef WITH_EXECUTION +// Disable parallel sorting for the moment +// The underlying implementation in libTBB has a massive memory leak: +// https://community.intel.com/t5/Intel-oneAPI-Threading-Building/std-sort-std-execution-par-unseq-has-a-memory-leak-on-Linux/m-p/1580910 +#if 0 +// #ifdef HAVE_PARALLEL_ALGORITHM std::sort(std::execution::par_unseq, first, last, comp); #else std::sort(first, last, comp);