Index: pstl/CMakeLists.txt =================================================================== --- pstl/CMakeLists.txt +++ pstl/CMakeLists.txt @@ -16,8 +16,7 @@ project(ParallelSTL VERSION ${VERSION_MAJOR}.${VERSION_MINOR} LANGUAGES CXX) -option(PARALLELSTL_USE_PARALLEL_POLICIES "Enable parallel policies" OFF) -set(PARALLELSTL_BACKEND "tbb" CACHE STRING "Threading backend; defaults to TBB") +set(PARALLELSTL_BACKEND "serial" CACHE STRING "Threading backend to use. Valid choices are 'serial' and 'tbb'. The default is 'serial'.") if (NOT TBB_DIR) get_filename_component(PSTL_DIR_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME) @@ -31,20 +30,16 @@ add_library(pstl::ParallelSTL ALIAS ParallelSTL) target_compile_features(ParallelSTL INTERFACE cxx_std_17) -if (PARALLELSTL_USE_PARALLEL_POLICIES) - if (PARALLELSTL_BACKEND STREQUAL "serial") - message(STATUS "Parallel STL uses the serial backend") - target_compile_definitions(ParallelSTL INTERFACE -D__PSTL_PAR_BACKEND_SERIAL) - elseif (PARALLELSTL_BACKEND STREQUAL "tbb") - find_package(TBB 2018 REQUIRED tbb OPTIONAL_COMPONENTS tbbmalloc) - message(STATUS "Parallel STL uses TBB ${TBB_VERSION} (interface version: ${TBB_INTERFACE_VERSION})") - target_link_libraries(ParallelSTL INTERFACE TBB::tbb) - target_compile_definitions(ParallelSTL INTERFACE -D__PSTL_PAR_BACKEND_TBB) - else() - message(FATAL_ERROR "Requested unknown Parallel STL backend '${PARALLELSTL_BACKEND}'.") - endif() +if (PARALLELSTL_BACKEND STREQUAL "serial") + message(STATUS "Parallel STL uses the serial backend") + target_compile_definitions(ParallelSTL INTERFACE -D__PSTL_PAR_BACKEND_SERIAL) +elseif (PARALLELSTL_BACKEND STREQUAL "tbb") + find_package(TBB 2018 REQUIRED tbb OPTIONAL_COMPONENTS tbbmalloc) + message(STATUS "Parallel STL uses TBB ${TBB_VERSION} (interface version: ${TBB_INTERFACE_VERSION})") + target_link_libraries(ParallelSTL INTERFACE TBB::tbb) + target_compile_definitions(ParallelSTL INTERFACE -D__PSTL_PAR_BACKEND_TBB) else() - target_compile_definitions(ParallelSTL INTERFACE PSTL_USE_PARALLEL_POLICIES=0) + message(FATAL_ERROR "Requested unknown Parallel STL backend '${PARALLELSTL_BACKEND}'.") endif() target_include_directories(ParallelSTL Index: pstl/include/pstl/internal/algorithm_impl.h =================================================================== --- pstl/include/pstl/internal/algorithm_impl.h +++ pstl/include/pstl/internal/algorithm_impl.h @@ -19,12 +19,9 @@ #include "execution_impl.h" #include "memory_impl.h" #include "parallel_backend_utils.h" -#include "unseq_backend_simd.h" - -#if __PSTL_USE_PAR_POLICIES #include "parallel_backend.h" #include "parallel_impl.h" -#endif +#include "unseq_backend_simd.h" namespace __pstl { @@ -59,7 +56,6 @@ return internal::brick_any_of(__first, __last, __pred, __is_vector); } -#if __PSTL_USE_PAR_POLICIES template bool pattern_any_of(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, _Pred __pred, @@ -72,7 +68,6 @@ }); }); } -#endif // [alg.foreach] // for_each_n with no policy @@ -115,7 +110,6 @@ internal::brick_walk1(__first, __last, __f, __is_vector); } -#if __PSTL_USE_PAR_POLICIES template void pattern_walk1(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, _Function __f, @@ -129,7 +123,6 @@ }); }); } -#endif template void @@ -139,7 +132,6 @@ __brick(__first, __last); } -#if __PSTL_USE_PAR_POLICIES template void pattern_walk_brick(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, _Brick __brick, @@ -150,7 +142,6 @@ [__brick](_ForwardIterator __i, _ForwardIterator __j) { __brick(__i, __j); }); }); } -#endif //------------------------------------------------------------------------ // walk1_n @@ -178,7 +169,6 @@ return internal::brick_walk1_n(__first, __n, __f, __is_vector); } -#if __PSTL_USE_PAR_POLICIES template _RandomAccessIterator pattern_walk1_n(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _Size __n, _Function __f, @@ -189,7 +179,6 @@ std::true_type()); return __first + __n; } -#endif template _ForwardIterator @@ -199,7 +188,6 @@ return __brick(__first, __n); } -#if __PSTL_USE_PAR_POLICIES template _RandomAccessIterator pattern_walk_brick_n(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _Size __n, _Brick __brick, @@ -212,7 +200,6 @@ return __first + __n; }); } -#endif //------------------------------------------------------------------------ // walk2 (pseudo) @@ -263,7 +250,6 @@ return internal::brick_walk2(__first1, __last1, __first2, __f, __is_vector); } -#if __PSTL_USE_PAR_POLICIES template _ForwardIterator2 pattern_walk2(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _ForwardIterator1 __last1, @@ -277,7 +263,6 @@ return __first2 + (__last1 - __first1); }); } -#endif template @@ -306,7 +291,6 @@ return __brick(__first1, __last1, __first2); } -#if __PSTL_USE_PAR_POLICIES template _RandomAccessIterator2 pattern_walk2_brick(_ExecutionPolicy&& __exec, _RandomAccessIterator1 __first1, _RandomAccessIterator1 __last1, @@ -321,9 +305,7 @@ return __first2 + (__last1 - __first1); }); } -#endif -#if __PSTL_USE_PAR_POLICIES template _RandomAccessIterator2 pattern_walk2_brick_n(_ExecutionPolicy&& __exec, _RandomAccessIterator1 __first1, _Size __n, @@ -338,7 +320,6 @@ return __first2 + __n; }); } -#endif template _ForwardIterator2 @@ -380,7 +361,6 @@ return internal::brick_walk3(__first1, __last1, __first2, __first3, __f, __is_vector); } -#if __PSTL_USE_PAR_POLICIES template _RandomAccessIterator3 @@ -398,7 +378,6 @@ return __first3 + (__last1 - __first1); }); } -#endif //------------------------------------------------------------------------ // equal @@ -430,7 +409,6 @@ return internal::brick_equal(__first1, __last1, __first2, __p, __is_vector); } -#if __PSTL_USE_PAR_POLICIES template bool @@ -446,7 +424,6 @@ }); }); } -#endif //------------------------------------------------------------------------ // find_if @@ -479,7 +456,6 @@ return internal::brick_find_if(__first, __last, __pred, __is_vector); } -#if __PSTL_USE_PAR_POLICIES template _ForwardIterator pattern_find_if(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, _Predicate __pred, @@ -495,7 +471,6 @@ /*is_first=*/true); }); } -#endif //------------------------------------------------------------------------ // find_end @@ -622,7 +597,6 @@ return internal::brick_find_end(__first, __last, __s_first, __s_last, __pred, __is_vector); } -#if __PSTL_USE_PAR_POLICIES template _ForwardIterator1 @@ -649,7 +623,6 @@ }); } } -#endif //------------------------------------------------------------------------ // find_first_of @@ -680,7 +653,6 @@ return internal::brick_find_first_of(__first, __last, __s_first, __s_last, __pred, __is_vector); } -#if __PSTL_USE_PAR_POLICIES template _ForwardIterator1 @@ -697,7 +669,6 @@ std::less::difference_type>(), /*is_first=*/true); }); } -#endif //------------------------------------------------------------------------ // search @@ -728,7 +699,6 @@ return internal::brick_search(__first, __last, __s_first, __s_last, __pred, __is_vector); } -#if __PSTL_USE_PAR_POLICIES template _ForwardIterator1 @@ -754,7 +724,6 @@ }); } } -#endif //------------------------------------------------------------------------ // search_n @@ -785,7 +754,6 @@ return internal::brick_search_n(__first, __last, __count, __value, __pred, __is_vector); } -#if __PSTL_USE_PAR_POLICIES template _RandomAccessIterator @@ -813,7 +781,6 @@ }); } } -#endif //------------------------------------------------------------------------ // copy_n @@ -1019,7 +986,6 @@ return internal::brick_copy_if(__first, __last, __result, __pred, __is_vector); } -#if __PSTL_USE_PAR_POLICIES template _OutputIterator @@ -1054,7 +1020,6 @@ // trivial sequence - use serial algorithm return brick_copy_if(__first, __last, __result, __pred, __is_vector); } -#endif //------------------------------------------------------------------------ // count @@ -1083,7 +1048,6 @@ return brick_count(__first, __last, __pred, __is_vector); } -#if __PSTL_USE_PAR_POLICIES template typename std::iterator_traits<_ForwardIterator>::difference_type pattern_count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, _Predicate __pred, @@ -1099,7 +1063,6 @@ std::plus<_SizeType>()); }); } -#endif //------------------------------------------------------------------------ // unique @@ -1130,7 +1093,6 @@ return internal::brick_unique(__first, __last, __pred, __is_vector); } -#if __PSTL_USE_PAR_POLICIES // That function is shared between two algorithms - remove_if (pattern_remove_if) and unique (pattern unique). But a mask calculation is different. // So, a caller passes _CalcMask brick into remove_elements. template @@ -1207,9 +1169,7 @@ return __first + __m; }); } -#endif -#if __PSTL_USE_PAR_POLICIES template _ForwardIterator pattern_unique(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, _BinaryPredicate __pred, @@ -1235,7 +1195,6 @@ }, __is_vector); } -#endif //------------------------------------------------------------------------ // unique_copy @@ -1292,7 +1251,6 @@ return unseq_backend::simd_calc_mask_2(__first, __last - __first, __mask, __pred); } -#if __PSTL_USE_PAR_POLICIES template _OutputIterator @@ -1342,7 +1300,6 @@ // trivial sequence - use serial algorithm return brick_unique_copy(__first, __last, __result, __pred, __is_vector); } -#endif //------------------------------------------------------------------------ // reverse @@ -1404,7 +1361,6 @@ brick_reverse(__first, __last, _is_vector); } -#if __PSTL_USE_PAR_POLICIES template void pattern_reverse(_ExecutionPolicy&& __exec, _BidirectionalIterator __first, _BidirectionalIterator __last, @@ -1416,7 +1372,6 @@ brick_reverse(__inner_first, __inner_last, __last - (__inner_first - __first), __is_vector); }); } -#endif //------------------------------------------------------------------------ // reverse_copy @@ -1450,7 +1405,6 @@ return internal::brick_reverse_copy(__first, __last, __d_first, __is_vector); } -#if __PSTL_USE_PAR_POLICIES template _OutputIterator pattern_reverse_copy(_ExecutionPolicy&& __exec, _BidirectionalIterator __first, _BidirectionalIterator __last, @@ -1465,7 +1419,6 @@ }); return __d_first + __len; } -#endif //------------------------------------------------------------------------ // rotate @@ -1531,7 +1484,6 @@ return internal::brick_rotate(__first, __middle, __last, __is_vector); } -#if __PSTL_USE_PAR_POLICIES template _ForwardIterator pattern_rotate(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last, @@ -1591,7 +1543,6 @@ }); } } -#endif //------------------------------------------------------------------------ // rotate_copy @@ -1622,7 +1573,6 @@ return internal::brick_rotate_copy(__first, __middle, __last, __result, __is_vector); } -#if __PSTL_USE_PAR_POLICIES template _OutputIterator pattern_rotate_copy(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __middle, @@ -1652,7 +1602,6 @@ }); return __result + (__last - __first); } -#endif //------------------------------------------------------------------------ // is_partitioned @@ -1701,7 +1650,6 @@ return internal::brick_is_partitioned(__first, __last, __pred, __is_vector); } -#if __PSTL_USE_PAR_POLICIES template bool pattern_is_partitioned(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, @@ -1798,7 +1746,6 @@ }); } } -#endif //------------------------------------------------------------------------ // partition @@ -1829,7 +1776,6 @@ return internal::brick_partition(__first, __last, __pred, __is_vector); } -#if __PSTL_USE_PAR_POLICIES template _ForwardIterator pattern_partition(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, _UnaryPredicate __pred, @@ -1897,7 +1843,6 @@ return __result.__pivot; }); } -#endif //------------------------------------------------------------------------ // stable_partition @@ -1928,7 +1873,6 @@ return internal::brick_stable_partition(__first, __last, __pred, __is_vector); } -#if __PSTL_USE_PAR_POLICIES template _BidirectionalIterator pattern_stable_partition(_ExecutionPolicy&& __exec, _BidirectionalIterator __first, _BidirectionalIterator __last, @@ -1980,7 +1924,6 @@ return __result.__pivot; }); } -#endif //------------------------------------------------------------------------ // partition_copy @@ -2016,7 +1959,6 @@ return internal::brick_partition_copy(__first, __last, __out_true, __out_false, __pred, __is_vector); } -#if __PSTL_USE_PAR_POLICIES template std::pair<_OutputIterator1, _OutputIterator2> @@ -2055,7 +1997,6 @@ // trivial sequence - use serial algorithm return internal::brick_partition_copy(__first, __last, __out_true, __out_false, __pred, __is_vector); } -#endif //------------------------------------------------------------------------ // sort @@ -2070,7 +2011,6 @@ std::sort(__first, __last, __comp); } -#if __PSTL_USE_PAR_POLICIES template void pattern_sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp, @@ -2083,7 +2023,6 @@ __last - __first); }); } -#endif //------------------------------------------------------------------------ // stable_sort @@ -2097,7 +2036,6 @@ std::stable_sort(__first, __last, __comp); } -#if __PSTL_USE_PAR_POLICIES template void pattern_stable_sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last, @@ -2109,7 +2047,6 @@ _Compare __comp) { std::stable_sort(__first, __last, __comp); }); }); } -#endif //------------------------------------------------------------------------ // partial_sort @@ -2123,7 +2060,6 @@ std::partial_sort(__first, __middle, __last, __comp); } -#if __PSTL_USE_PAR_POLICIES template void pattern_partial_sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __middle, @@ -2142,7 +2078,6 @@ __n); }); } -#endif //------------------------------------------------------------------------ // partial_sort_copy @@ -2157,7 +2092,6 @@ return std::partial_sort_copy(__first, __last, __d_first, __d_last, __comp); } -#if __PSTL_USE_PAR_POLICIES template _RandomAccessIterator pattern_partial_sort_copy(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, @@ -2226,7 +2160,6 @@ } }); } -#endif //------------------------------------------------------------------------ // adjacent_find @@ -2255,7 +2188,6 @@ return internal::brick_adjacent_find(__first, __last, __pred, __is_vector, __or_semantic); } -#if __PSTL_USE_PAR_POLICIES template _RandomAccessIterator pattern_adjacent_find(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last, @@ -2301,7 +2233,6 @@ ); }); } -#endif //------------------------------------------------------------------------ // nth_element @@ -2315,7 +2246,6 @@ std::nth_element(__first, __nth, __last, __comp); } -#if __PSTL_USE_PAR_POLICIES template void pattern_nth_element(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __nth, @@ -2361,7 +2291,6 @@ } } while (__x != __nth); } -#endif //------------------------------------------------------------------------ // fill, fill_n @@ -2390,7 +2319,6 @@ internal::brick_fill(__first, __last, __value, __is_vector); } -#if __PSTL_USE_PAR_POLICIES template _ForwardIterator pattern_fill(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, @@ -2404,7 +2332,6 @@ return __last; }); } -#endif template _OutputIterator @@ -2464,7 +2391,6 @@ internal::brick_generate(__first, __last, __g, __is_vector); } -#if __PSTL_USE_PAR_POLICIES template _ForwardIterator pattern_generate(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, _Generator __g, @@ -2478,7 +2404,6 @@ return __last; }); } -#endif template OutputIterator @@ -2502,7 +2427,6 @@ return internal::brick_generate_n(__first, __count, __g, __is_vector); } -#if __PSTL_USE_PAR_POLICIES template _OutputIterator pattern_generate_n(_ExecutionPolicy&& __exec, _OutputIterator __first, _Size __count, _Generator __g, @@ -2513,7 +2437,6 @@ return internal::pattern_generate(std::forward<_ExecutionPolicy>(__exec), __first, __first + __count, __g, std::true_type(), __is_vector); } -#endif //------------------------------------------------------------------------ // remove @@ -2547,7 +2470,6 @@ return internal::brick_remove_if(__first, __last, __pred, __is_vector); } -#if __PSTL_USE_PAR_POLICIES template _ForwardIterator pattern_remove_if(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, _UnaryPredicate __pred, @@ -2568,7 +2490,6 @@ }, __is_vector); } -#endif //------------------------------------------------------------------------ // merge @@ -2603,7 +2524,6 @@ return internal::brick_merge(__first1, __last1, __first2, __last2, __d_first, __comp, __is_vector); } -#if __PSTL_USE_PAR_POLICIES template _OutputIterator @@ -2618,7 +2538,6 @@ _Compare __comp) { return brick_merge(__f1, __l1, __f2, __l2, __f3, __comp, __is_vector); }); return __d_first + (__last1 - __first1) + (__last2 - __first2); } -#endif //------------------------------------------------------------------------ // inplace_merge @@ -2649,7 +2568,6 @@ internal::brick_inplace_merge(__first, __middle, __last, __comp, __is_vector); } -#if __PSTL_USE_PAR_POLICIES template void pattern_inplace_merge(_ExecutionPolicy&& __exec, _BidirectionalIterator __first, _BidirectionalIterator __middle, @@ -2690,7 +2608,6 @@ }); }); } -#endif //------------------------------------------------------------------------ // includes @@ -2705,7 +2622,6 @@ return std::includes(__first1, __last1, __first2, __last2, __comp); } -#if __PSTL_USE_PAR_POLICIES template bool pattern_includes(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _ForwardIterator1 __last1, @@ -2760,11 +2676,9 @@ }); }); } -#endif constexpr auto __set_algo_cut_off = 1000; -#if __PSTL_USE_PAR_POLICIES template _OutputIterator @@ -2853,9 +2767,7 @@ return __result + __m; }); } -#endif -#if __PSTL_USE_PAR_POLICIES //a shared parallel pattern for 'pattern_set_union' and 'pattern_set_symmetric_difference' template @@ -2969,7 +2881,6 @@ __comp, [](_DifferenceType __n, _DifferenceType __m) { return __n + __m; }, __set_union_op, __is_vector); } -#endif //------------------------------------------------------------------------ // set_union @@ -3004,7 +2915,6 @@ return internal::brick_set_union(__first1, __last1, __first2, __last2, __result, __comp, __is_vector); } -#if __PSTL_USE_PAR_POLICIES template _OutputIterator @@ -3029,7 +2939,6 @@ }, __is_vector); } -#endif //------------------------------------------------------------------------ // set_intersection @@ -3064,7 +2973,6 @@ return internal::brick_set_intersection(__first1, __last1, __first2, __last2, __result, __comp, __is_vector); } -#if __PSTL_USE_PAR_POLICIES template _OutputIterator @@ -3126,7 +3034,6 @@ // [left_bound_seq_1; last1) and [left_bound_seq_2; last2) - use serial algorithm return std::set_intersection(__left_bound_seq_1, __last1, __left_bound_seq_2, __last2, __result, __comp); } -#endif //------------------------------------------------------------------------ // set_difference @@ -3161,7 +3068,6 @@ return internal::brick_set_difference(__first1, __last1, __first2, __last2, __result, __comp, __is_vector); } -#if __PSTL_USE_PAR_POLICIES template _OutputIterator @@ -3222,7 +3128,6 @@ // use serial algorithm return std::set_difference(__first1, __last1, __first2, __last2, __result, __comp); } -#endif //------------------------------------------------------------------------ // set_symmetric_difference @@ -3258,7 +3163,6 @@ __is_vector); } -#if __PSTL_USE_PAR_POLICIES template _OutputIterator @@ -3283,7 +3187,6 @@ }, __is_vector); } -#endif //------------------------------------------------------------------------ // is_heap_until @@ -3344,7 +3247,6 @@ [&__comp](_RandomAccessIterator __it, _DifferenceType __i) { return __comp(__it[(__i - 1) / 2], __it[__i]); }); } -#if __PSTL_USE_PAR_POLICIES template _RandomAccessIterator pattern_is_heap_until(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last, @@ -3362,7 +3264,6 @@ std::less::difference_type>(), /*is_first=*/true); }); } -#endif //------------------------------------------------------------------------ // min_element @@ -3396,7 +3297,6 @@ return internal::brick_min_element(__first, __last, __comp, __is_vector); } -#if __PSTL_USE_PAR_POLICIES template _RandomAccessIterator pattern_min_element(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last, @@ -3418,7 +3318,6 @@ }); }); } -#endif //------------------------------------------------------------------------ // minmax_element @@ -3452,7 +3351,6 @@ return internal::brick_minmax_element(__first, __last, __comp, __is_vector); } -#if __PSTL_USE_PAR_POLICIES template std::pair<_ForwardIterator, _ForwardIterator> pattern_minmax_element(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, _Compare __comp, @@ -3479,7 +3377,6 @@ }); }); } -#endif //------------------------------------------------------------------------ // mismatch @@ -3525,7 +3422,6 @@ return internal::brick_mismatch(__first1, __last1, __first2, __last2, __pred, __is_vector); } -#if __PSTL_USE_PAR_POLICIES template std::pair<_RandomAccessIterator1, _RandomAccessIterator2> @@ -3546,7 +3442,6 @@ return std::make_pair(__result, __first2 + (__result - __first1)); }); } -#endif //------------------------------------------------------------------------ // lexicographical_compare @@ -3605,7 +3500,6 @@ return internal::brick_lexicographical_compare(__first1, __last1, __first2, __last2, __comp, __is_vector); } -#if __PSTL_USE_PAR_POLICIES template bool pattern_lexicographical_compare(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _ForwardIterator1 __last1, @@ -3649,7 +3543,6 @@ } } } -#endif } // namespace internal } // namespace __pstl Index: pstl/include/pstl/internal/execution_defs.h =================================================================== --- pstl/include/pstl/internal/execution_defs.h +++ pstl/include/pstl/internal/execution_defs.h @@ -41,7 +41,6 @@ } }; -#if __PSTL_USE_PAR_POLICIES // 2.5, Parallel execution policy class parallel_policy { @@ -85,7 +84,6 @@ return std::true_type{}; } }; -#endif class unsequenced_policy { @@ -110,10 +108,8 @@ // 2.8, Execution policy objects constexpr sequenced_policy seq{}; -#if __PSTL_USE_PAR_POLICIES constexpr parallel_policy par{}; constexpr parallel_unsequenced_policy par_unseq{}; -#endif constexpr unsequenced_policy unseq{}; // 2.3, Execution policy type trait @@ -126,7 +122,6 @@ struct is_execution_policy : std::true_type { }; -#if __PSTL_USE_PAR_POLICIES template <> struct is_execution_policy : std::true_type { @@ -135,7 +130,6 @@ struct is_execution_policy : std::true_type { }; -#endif template <> struct is_execution_policy : std::true_type { Index: pstl/include/pstl/internal/execution_impl.h =================================================================== --- pstl/include/pstl/internal/execution_impl.h +++ pstl/include/pstl/internal/execution_impl.h @@ -87,7 +87,6 @@ typedef std::true_type allow_vector; }; -#if __PSTL_USE_PAR_POLICIES template <> struct policy_traits { @@ -103,7 +102,6 @@ typedef std::true_type allow_unsequenced; typedef std::true_type allow_vector; }; -#endif template using collector_t = typename policy_traits::type>::collector_type; Index: pstl/include/pstl/internal/glue_execution_defs.h =================================================================== --- pstl/include/pstl/internal/glue_execution_defs.h +++ pstl/include/pstl/internal/glue_execution_defs.h @@ -31,16 +31,14 @@ { // Standard C++ policy classes using __pstl::execution::sequenced_policy; -#if __PSTL_USE_PAR_POLICIES using __pstl::execution::parallel_policy; using __pstl::execution::parallel_unsequenced_policy; -#endif + // Standard predefined policy instances using __pstl::execution::seq; -#if __PSTL_USE_PAR_POLICIES using __pstl::execution::par; using __pstl::execution::par_unseq; -#endif + // Implementation-defined names // Unsequenced policy is not yet standard, but for consistency // we include it into namespace std::execution as well Index: pstl/include/pstl/internal/numeric_impl.h =================================================================== --- pstl/include/pstl/internal/numeric_impl.h +++ pstl/include/pstl/internal/numeric_impl.h @@ -14,14 +14,11 @@ #include #include +#include "parallel_backend.h" #include "pstl_config.h" #include "execution_impl.h" #include "unseq_backend_simd.h" -#if __PSTL_USE_PAR_POLICIES -#include "parallel_backend.h" -#endif - namespace __pstl { namespace internal @@ -63,7 +60,6 @@ return brick_transform_reduce(__first1, __last1, __first2, __init, __binary_op1, __binary_op2, __is_vector); } -#if __PSTL_USE_PAR_POLICIES template _Tp @@ -86,7 +82,6 @@ }); }); } -#endif //------------------------------------------------------------------------ // transform_reduce (version with unary and binary functions) @@ -125,7 +120,6 @@ return brick_transform_reduce(__first, __last, __init, __binary_op, __unary_op, __is_vector); } -#if __PSTL_USE_PAR_POLICIES template _Tp @@ -142,7 +136,6 @@ }); }); } -#endif //------------------------------------------------------------------------ // transform_exclusive_scan @@ -228,7 +221,6 @@ .first; } -#if __PSTL_USE_PAR_POLICIES template typename std::enable_if::value, _OutputIterator>::type @@ -257,9 +249,7 @@ return __result + (__last - __first); }); } -#endif -#if __PSTL_USE_PAR_POLICIES template typename std::enable_if::value, _OutputIterator>::type @@ -295,7 +285,6 @@ return __result + (__last - __first); }); } -#endif //------------------------------------------------------------------------ // adjacent_difference @@ -336,7 +325,6 @@ return internal::brick_adjacent_difference(__first, __last, __d_first, __op, __is_vector); } -#if __PSTL_USE_PAR_POLICIES template _ForwardIterator2 @@ -360,7 +348,6 @@ }); return __d_first + (__last - __first); } -#endif } // namespace internal } // namespace __pstl Index: pstl/include/pstl/internal/pstl_config.h =================================================================== --- pstl/include/pstl/internal/pstl_config.h +++ pstl/include/pstl/internal/pstl_config.h @@ -14,15 +14,6 @@ #define PSTL_VERSION_MAJOR (PSTL_VERSION / 100) #define PSTL_VERSION_MINOR (PSTL_VERSION - PSTL_VERSION_MAJOR * 100) -// Check the user-defined macro for parallel policies -#if defined(PSTL_USE_PARALLEL_POLICIES) -#undef __PSTL_USE_PAR_POLICIES -#define __PSTL_USE_PAR_POLICIES PSTL_USE_PARALLEL_POLICIES -// Check the internal macro for parallel policies -#elif !defined(__PSTL_USE_PAR_POLICIES) -#define __PSTL_USE_PAR_POLICIES 1 -#endif - #if !defined(__PSTL_PAR_BACKEND_SERIAL) && !defined(__PSTL_PAR_BACKEND_TBB) # error "The parallel backend is neither serial nor TBB" #endif Index: pstl/test/pstl_test_config.h =================================================================== --- pstl/test/pstl_test_config.h +++ pstl/test/pstl_test_config.h @@ -30,7 +30,7 @@ #define __PSTL_ICC_16_VC14_TEST_SIMD_LAMBDA_DEBUG_32_BROKEN \ (_M_IX86 && _DEBUG && __INTEL_COMPILER >= 1600 && __INTEL_COMPILER < 1700 && _MSC_VER == 1900) #define __PSTL_ICC_16_VC14_TEST_PAR_TBB_RT_RELEASE_64_BROKEN \ - (__PSTL_USE_PAR_POLICIES && ((_M_X64 && _MSC_VER == 1900) || __x86_64) && !_DEBUG && __INTEL_COMPILER < 1700) + (((_M_X64 && _MSC_VER == 1900) || __x86_64) && !_DEBUG && __INTEL_COMPILER < 1700) #define __PSTL_ICC_16_17_TEST_64_TIMEOUT (__x86_64 && __INTEL_COMPILER && __INTEL_COMPILER < 1800 && !__APPLE__) #define __PSTL_ICC_18_TEST_EARLY_EXIT_MONOTONIC_RELEASE_BROKEN (!_DEBUG && __INTEL_COMPILER && __INTEL_COMPILER == 1800) #define __PSTL_CLANG_TEST_BIG_OBJ_DEBUG_32_BROKEN \ Index: pstl/test/utils.h =================================================================== --- pstl/test/utils.h +++ pstl/test/utils.h @@ -606,13 +606,6 @@ return result; } -// Check that Intel(R) Threading Building Blocks header files are not used when parallel policies are off -#if !__PSTL_USE_PAR_POLICIES -#if defined(TBB_INTERFACE_VERSION) -#error The parallel backend is used while it should not (__PSTL_USE_PAR_POLICIES==0) -#endif -#endif - //============================================================================ // Adapters for creating different types of iterators. // @@ -1051,10 +1044,8 @@ // Try static execution policies invoke_on_all_iterator_types()(seq, op, std::forward(rest)...); invoke_on_all_iterator_types()(unseq, op, std::forward(rest)...); -#if __PSTL_USE_PAR_POLICIES invoke_on_all_iterator_types()(par, op, std::forward(rest)...); invoke_on_all_iterator_types()(par_unseq, op, std::forward(rest)...); -#endif } template