Skip to content
Snippets Groups Projects
Commit 490d24f1 authored by Felix Weiglhofer's avatar Felix Weiglhofer
Browse files

algo: Use feature-test macro to check if stl parallel algorithms are available.

parent 74785011
No related branches found
No related tags found
1 merge request!1203algo: Enable parallel sorting when libTBB is available.
...@@ -13,8 +13,8 @@ namespace cbm::algo::BuildInfo ...@@ -13,8 +13,8 @@ namespace cbm::algo::BuildInfo
extern const std::string BUILD_TYPE; extern const std::string BUILD_TYPE;
extern const bool GPU_DEBUG; extern const bool GPU_DEBUG;
inline constexpr bool HAVE_TBB = inline constexpr bool WITH_TBB =
#ifdef WITH_TBB #ifdef HAVE_TBB
true; true;
#else #else
false; false;
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
**/ **/
#include <algorithm> #include <algorithm>
#if __has_include(<execution>) #ifdef __cpp_lib_execution
#define WITH_EXECUTION #define WITH_EXECUTION
#include <execution> #include <execution>
#endif #endif
...@@ -28,11 +28,11 @@ namespace cbm::algo ...@@ -28,11 +28,11 @@ namespace cbm::algo
{ {
#ifdef WITH_EXECUTION #ifdef WITH_EXECUTION
inline constexpr auto ExecPolicy = inline constexpr auto ExecPolicy =
#ifdef HAVE_TBB #if defined(__cpp_lib_parallel_algorithm) && defined(HAVE_TBB)
std::execution::par_unseq; std::execution::par_unseq;
#else #else
std::execution::seq; std::execution::seq;
#endif // HAVE_TBB #endif // __cpp_lib_parallel_algorithm && WITH_TBB
#endif // WITH_EXECUTION #endif // WITH_EXECUTION
} // namespace detail } // namespace detail
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment