From 65a422c81c99a616f4b2eb502108907460265f51 Mon Sep 17 00:00:00 2001 From: Louis Dionne Date: Wed, 24 Apr 2019 20:12:36 +0000 Subject: [pstl] Make the default backend be the serial backend and always provide parallel policies Summary: Before this change, the default backend was TBB but one could disable anything related to TBB by removing the parallel policies. This change uses the serial backend by default and removes the ability to disable parallel policies, which is not useful anymore. Reviewers: rodgert, MikeDvorskiy Subscribers: mgorny, jkorous, dexonsmith, jdoerfert, libcxx-commits Differential Revision: https://reviews.llvm.org/D59792 llvm-svn: 359134 --- pstl/CMakeLists.txt | 25 ++--- pstl/include/pstl/internal/algorithm_fwd.h | 104 --------------------- pstl/include/pstl/internal/algorithm_impl.h | 112 +---------------------- pstl/include/pstl/internal/execution_defs.h | 6 -- pstl/include/pstl/internal/execution_impl.h | 2 - pstl/include/pstl/internal/glue_execution_defs.h | 10 +- pstl/include/pstl/internal/numeric_fwd.h | 10 -- pstl/include/pstl/internal/numeric_impl.h | 16 +--- pstl/include/pstl/internal/pstl_config.h | 11 +-- pstl/test/support/pstl_test_config.h | 2 +- pstl/test/support/utils.h | 9 -- 11 files changed, 20 insertions(+), 287 deletions(-) (limited to 'pstl') diff --git a/pstl/CMakeLists.txt b/pstl/CMakeLists.txt index a11487f..5fb7504 100644 --- a/pstl/CMakeLists.txt +++ b/pstl/CMakeLists.txt @@ -16,8 +16,7 @@ math(EXPR VERSION_PATCH "(${PARALLELSTL_VERSION_SOURCE} % 10)") project(ParallelSTL VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH} 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) @@ -34,20 +33,16 @@ add_library(ParallelSTL INTERFACE) 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 diff --git a/pstl/include/pstl/internal/algorithm_fwd.h b/pstl/include/pstl/internal/algorithm_fwd.h index d317c22..814356b 100644 --- a/pstl/include/pstl/internal/algorithm_fwd.h +++ b/pstl/include/pstl/internal/algorithm_fwd.h @@ -37,12 +37,10 @@ bool __pattern_any_of(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _Pred, _IsVector, /*parallel=*/std::false_type) noexcept; -#if _PSTL_USE_PAR_POLICIES template bool __pattern_any_of(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _Pred, _IsVector, /*parallel=*/std::true_type); -#endif //------------------------------------------------------------------------ // walk1 (pseudo) @@ -63,24 +61,20 @@ void __pattern_walk1(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _Function, _IsVector, /*parallel=*/std::false_type) noexcept; -#if _PSTL_USE_PAR_POLICIES template void __pattern_walk1(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _Function, _IsVector, /*parallel=*/std::true_type); -#endif template void __pattern_walk_brick(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _Brick, /*parallel=*/std::false_type) noexcept; -#if _PSTL_USE_PAR_POLICIES template void __pattern_walk_brick(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _Brick, /*parallel=*/std::true_type); -#endif //------------------------------------------------------------------------ // walk1_n @@ -99,24 +93,20 @@ _ForwardIterator __pattern_walk1_n(_ExecutionPolicy&&, _ForwardIterator, _Size, _Function, _IsVector, /*is_parallel=*/std::false_type) noexcept; -#if _PSTL_USE_PAR_POLICIES template _RandomAccessIterator __pattern_walk1_n(_ExecutionPolicy&&, _RandomAccessIterator, _Size, _Function, _IsVector, /*is_parallel=*/std::true_type); -#endif template _ForwardIterator __pattern_walk_brick_n(_ExecutionPolicy&&, _ForwardIterator, _Size, _Brick, /*is_parallel=*/std::false_type) noexcept; -#if _PSTL_USE_PAR_POLICIES template _RandomAccessIterator __pattern_walk_brick_n(_ExecutionPolicy&&, _RandomAccessIterator, _Size, _Brick, /*is_parallel=*/std::true_type); -#endif //------------------------------------------------------------------------ // walk2 (pseudo) @@ -145,12 +135,10 @@ _ForwardIterator2 __pattern_walk2(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _Function, _IsVector, /*parallel=*/std::false_type) noexcept; -#if _PSTL_USE_PAR_POLICIES template _ForwardIterator2 __pattern_walk2(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _Function, _IsVector, /*parallel=*/std::true_type); -#endif template @@ -158,38 +146,32 @@ _ForwardIterator2 __pattern_walk2_n(_ExecutionPolicy&&, _ForwardIterator1, _Size, _ForwardIterator2, _Function, _IsVector, /*parallel=*/std::false_type) noexcept; -#if _PSTL_USE_PAR_POLICIES template _RandomAccessIterator2 __pattern_walk2_n(_ExecutionPolicy&&, _RandomAccessIterator1, _Size, _RandomAccessIterator2, _Function, _IsVector, /*parallel=*/std::true_type); -#endif template _ForwardIterator2 __pattern_walk2_brick(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _Brick, /*parallel=*/std::false_type) noexcept; -#if _PSTL_USE_PAR_POLICIES template _RandomAccessIterator2 __pattern_walk2_brick(_ExecutionPolicy&&, _RandomAccessIterator1, _RandomAccessIterator1, _RandomAccessIterator2, _Brick, /*parallel=*/std::true_type); -#endif template _ForwardIterator2 __pattern_walk2_brick_n(_ExecutionPolicy&&, _ForwardIterator1, _Size, _ForwardIterator2, _Brick, /*parallel=*/std::false_type) noexcept; -#if _PSTL_USE_PAR_POLICIES template _RandomAccessIterator2 __pattern_walk2_brick_n(_ExecutionPolicy&&, _RandomAccessIterator1, _Size, _RandomAccessIterator2, _Brick, /*parallel=*/std::true_type); -#endif //------------------------------------------------------------------------ // walk3 (pseudo) @@ -213,13 +195,11 @@ __pattern_walk3(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _Forwa _Function, _IsVector, /*parallel=*/std::false_type) noexcept; -#if _PSTL_USE_PAR_POLICIES template _RandomAccessIterator3 __pattern_walk3(_ExecutionPolicy&&, _RandomAccessIterator1, _RandomAccessIterator1, _RandomAccessIterator2, _RandomAccessIterator3, _Function, _IsVector, /*parallel=*/std::true_type); -#endif //------------------------------------------------------------------------ // equal @@ -239,13 +219,11 @@ bool __pattern_equal(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _BinaryPredicate, _IsVector, /* is_parallel = */ std::false_type) noexcept; -#if _PSTL_USE_PAR_POLICIES template bool __pattern_equal(_ExecutionPolicy&&, _RandomAccessIterator1, _RandomAccessIterator1, _RandomAccessIterator2, _BinaryPredicate, _IsVector, /* is_parallel = */ std::true_type); -#endif template bool __brick_equal(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, _BinaryPredicate, @@ -261,13 +239,11 @@ bool __pattern_equal(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, _BinaryPredicate, _IsVector, /* is_parallel = */ std::false_type) noexcept; -#if _PSTL_USE_PAR_POLICIES template bool __pattern_equal(_ExecutionPolicy&&, _RandomAccessIterator1, _RandomAccessIterator1, _RandomAccessIterator2, _RandomAccessIterator2, _BinaryPredicate, _IsVector, /* is_parallel = */ std::true_type); -#endif //------------------------------------------------------------------------ // find_if @@ -286,12 +262,10 @@ _ForwardIterator __pattern_find_if(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _Predicate, _IsVector, /*is_parallel=*/std::false_type) noexcept; -#if _PSTL_USE_PAR_POLICIES template _ForwardIterator __pattern_find_if(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _Predicate, _IsVector, /*is_parallel=*/std::true_type); -#endif //------------------------------------------------------------------------ // find_end @@ -314,14 +288,12 @@ __pattern_find_end(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _Fo _BinaryPredicate, _IsVector, /*is_parallel=*/std::false_type) noexcept; -#if _PSTL_USE_PAR_POLICIES template _ForwardIterator1 __pattern_find_end(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, _BinaryPredicate, _IsVector, /*is_parallel=*/std::true_type) noexcept; -#endif //------------------------------------------------------------------------ // find_first_of @@ -343,13 +315,11 @@ _ForwardIterator1 __pattern_find_first_of(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, _BinaryPredicate, _IsVector, /*is_parallel=*/std::false_type) noexcept; -#if _PSTL_USE_PAR_POLICIES template _ForwardIterator1 __pattern_find_first_of(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, _BinaryPredicate, _IsVector, /*is_parallel=*/std::true_type) noexcept; -#endif //------------------------------------------------------------------------ // search @@ -372,14 +342,12 @@ __pattern_search(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _Forw _BinaryPredicate, _IsVector, /*is_parallel=*/std::false_type) noexcept; -#if _PSTL_USE_PAR_POLICIES template _ForwardIterator1 __pattern_search(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, _BinaryPredicate, _IsVector, /*is_parallel=*/std::true_type) noexcept; -#endif //------------------------------------------------------------------------ // search_n @@ -402,14 +370,12 @@ __pattern_search_n(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _Size IsVector, /*is_parallel=*/std::false_type) noexcept; -#if _PSTL_USE_PAR_POLICIES template _RandomAccessIterator __pattern_search_n(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Size, const _Tp&, _BinaryPredicate, IsVector, /*is_parallel=*/std::true_type) noexcept; -#endif //------------------------------------------------------------------------ // copy_n @@ -506,13 +472,11 @@ _OutputIterator __pattern_copy_if(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _OutputIterator, _UnaryPredicate, _IsVector, /*parallel=*/std::false_type) noexcept; -#if _PSTL_USE_PAR_POLICIES template _OutputIterator __pattern_copy_if(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _OutputIterator, _UnaryPredicate, _IsVector, /*parallel=*/std::true_type); -#endif //------------------------------------------------------------------------ // count @@ -533,12 +497,10 @@ typename std::iterator_traits<_ForwardIterator>::difference_type __pattern_count(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _Predicate, /* is_parallel */ std::false_type, _IsVector) noexcept; -#if _PSTL_USE_PAR_POLICIES template typename std::iterator_traits<_ForwardIterator>::difference_type __pattern_count(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _Predicate, /* is_parallel */ std::true_type, _IsVector); -#endif //------------------------------------------------------------------------ // unique @@ -557,12 +519,10 @@ _ForwardIterator __pattern_unique(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _BinaryPredicate, _IsVector, /*is_parallel=*/std::false_type) noexcept; -#if _PSTL_USE_PAR_POLICIES template _ForwardIterator __pattern_unique(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _BinaryPredicate, _IsVector, /*is_parallel=*/std::true_type) noexcept; -#endif //------------------------------------------------------------------------ // unique_copy @@ -592,13 +552,11 @@ _DifferenceType __brick_calc_mask_2(_RandomAccessIterator, _RandomAccessIterator, bool* __restrict, _BinaryPredicate, /*vector=*/std::true_type) noexcept; -#if _PSTL_USE_PAR_POLICIES template _OutputIterator __pattern_unique_copy(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _OutputIterator, _BinaryPredicate, _IsVector, /*parallel=*/std::true_type); -#endif //------------------------------------------------------------------------ // reverse @@ -625,12 +583,10 @@ void __pattern_reverse(_ExecutionPolicy&&, _BidirectionalIterator, _BidirectionalIterator, _IsVector, /*is_parallel=*/std::false_type) noexcept; -#if _PSTL_USE_PAR_POLICIES template void __pattern_reverse(_ExecutionPolicy&&, _BidirectionalIterator, _BidirectionalIterator, _IsVector, /*is_parallel=*/std::true_type); -#endif //------------------------------------------------------------------------ // reverse_copy @@ -649,12 +605,10 @@ _OutputIterator __pattern_reverse_copy(_ExecutionPolicy&&, _BidirectionalIterator, _BidirectionalIterator, _OutputIterator, _IsVector, /*is_parallel=*/std::false_type) noexcept; -#if _PSTL_USE_PAR_POLICIES template _OutputIterator __pattern_reverse_copy(_ExecutionPolicy&&, _BidirectionalIterator, _BidirectionalIterator, _OutputIterator, _IsVector, /*is_parallel=*/std::true_type); -#endif //------------------------------------------------------------------------ // rotate @@ -673,12 +627,10 @@ _ForwardIterator __pattern_rotate(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _ForwardIterator, _IsVector, /*is_parallel=*/std::false_type) noexcept; -#if _PSTL_USE_PAR_POLICIES template _ForwardIterator __pattern_rotate(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _ForwardIterator, _IsVector, /*is_parallel=*/std::true_type); -#endif //------------------------------------------------------------------------ // rotate_copy @@ -698,13 +650,11 @@ __pattern_rotate_copy(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _F _IsVector, /*is_parallel=*/std::false_type) noexcept; -#if _PSTL_USE_PAR_POLICIES template _OutputIterator __pattern_rotate_copy(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _ForwardIterator, _OutputIterator, _IsVector, /*is_parallel=*/std::true_type); -#endif //------------------------------------------------------------------------ // is_partitioned @@ -723,12 +673,10 @@ bool __pattern_is_partitioned(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _UnaryPredicate, _IsVector, /*is_parallel=*/std::false_type) noexcept; -#if _PSTL_USE_PAR_POLICIES template bool __pattern_is_partitioned(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _UnaryPredicate, _IsVector, /*is_parallel=*/std::true_type); -#endif //------------------------------------------------------------------------ // partition @@ -747,12 +695,10 @@ _ForwardIterator __pattern_partition(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _UnaryPredicate, _IsVector, /*is_parallel=*/std::false_type) noexcept; -#if _PSTL_USE_PAR_POLICIES template _ForwardIterator __pattern_partition(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _UnaryPredicate, _IsVector, /*is_parallel=*/std::true_type); -#endif //------------------------------------------------------------------------ // stable_partition @@ -772,13 +718,11 @@ __pattern_stable_partition(_ExecutionPolicy&&, _BidirectionalIterator, _Bidirect _IsVector, /*is_parallelization=*/std::false_type) noexcept; -#if _PSTL_USE_PAR_POLICIES template _BidirectionalIterator __pattern_stable_partition(_ExecutionPolicy&&, _BidirectionalIterator, _BidirectionalIterator, _UnaryPredicate, _IsVector, /*is_parallelization=*/std::true_type) noexcept; -#endif //------------------------------------------------------------------------ // partition_copy @@ -801,14 +745,12 @@ __pattern_partition_copy(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _UnaryPredicate, _IsVector, /*is_parallelization=*/std::false_type) noexcept; -#if _PSTL_USE_PAR_POLICIES template std::pair<_OutputIterator1, _OutputIterator2> __pattern_partition_copy(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _OutputIterator1, _OutputIterator2, _UnaryPredicate, _IsVector, /*is_parallelization=*/std::true_type); -#endif //------------------------------------------------------------------------ // sort @@ -820,13 +762,11 @@ void __pattern_sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Compare, _IsVector /*is_vector*/, /*is_parallel=*/std::false_type, _IsMoveConstructible) noexcept; -#if _PSTL_USE_PAR_POLICIES template void __pattern_sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Compare, _IsVector /*is_vector*/, /*is_parallel=*/std::true_type, /*is_move_constructible=*/std::true_type); -#endif //------------------------------------------------------------------------ // stable_sort @@ -838,13 +778,11 @@ __pattern_stable_sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIt _IsVector /*is_vector*/, /*is_parallel=*/std::false_type) noexcept; -#if _PSTL_USE_PAR_POLICIES template void __pattern_stable_sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Compare, _IsVector /*is_vector*/, /*is_parallel=*/std::true_type); -#endif //------------------------------------------------------------------------ // partial_sort @@ -856,13 +794,11 @@ __pattern_partial_sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessI _Compare, _IsVector, /*is_parallel=*/std::false_type) noexcept; -#if _PSTL_USE_PAR_POLICIES template void __pattern_partial_sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare, _IsVector, /*is_parallel=*/std::true_type); -#endif //------------------------------------------------------------------------ // partial_sort_copy @@ -874,13 +810,11 @@ __pattern_partial_sort_copy(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterat _RandomAccessIterator, _Compare, _IsVector, /*is_parallel=*/std::false_type) noexcept; -#if _PSTL_USE_PAR_POLICIES template _RandomAccessIterator __pattern_partial_sort_copy(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare, _IsVector, /*is_parallel=*/std::true_type); -#endif //------------------------------------------------------------------------ // adjacent_find @@ -901,12 +835,10 @@ _ForwardIterator __pattern_adjacent_find(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _BinaryPredicate, /* is_parallel */ std::false_type, _IsVector, bool) noexcept; -#if _PSTL_USE_PAR_POLICIES template _RandomAccessIterator __pattern_adjacent_find(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _BinaryPredicate, /* is_parallel */ std::true_type, _IsVector, bool); -#endif //------------------------------------------------------------------------ // nth_element @@ -917,13 +849,11 @@ __pattern_nth_element(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIt _IsVector, /*is_parallel=*/std::false_type) noexcept; -#if _PSTL_USE_PAR_POLICIES template void __pattern_nth_element(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare, _IsVector, /*is_parallel=*/std::true_type) noexcept; -#endif //------------------------------------------------------------------------ // fill, fill_n @@ -943,12 +873,10 @@ void __pattern_fill(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&, /*is_parallel=*/std::false_type, _IsVector) noexcept; -#if _PSTL_USE_PAR_POLICIES template _ForwardIterator __pattern_fill(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&, /*is_parallel=*/std::true_type, _IsVector); -#endif template _OutputIterator @@ -965,12 +893,10 @@ _OutputIterator __pattern_fill_n(_ExecutionPolicy&&, _OutputIterator, _Size, const _Tp&, /*is_parallel=*/std::false_type, _IsVector) noexcept; -#if _PSTL_USE_PAR_POLICIES template _OutputIterator __pattern_fill_n(_ExecutionPolicy&&, _OutputIterator, _Size, const _Tp&, /*is_parallel=*/std::true_type, _IsVector); -#endif //------------------------------------------------------------------------ // generate, generate_n @@ -989,12 +915,10 @@ void __pattern_generate(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _Generator, /*is_parallel=*/std::false_type, _IsVector) noexcept; -#if _PSTL_USE_PAR_POLICIES template _ForwardIterator __pattern_generate(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _Generator, /*is_parallel=*/std::true_type, _IsVector); -#endif template OutputIterator __brick_generate_n(OutputIterator, Size, _Generator, @@ -1009,12 +933,10 @@ OutputIterator __pattern_generate_n(_ExecutionPolicy&&, OutputIterator, Size, _Generator, /*is_parallel=*/std::false_type, _IsVector) noexcept; -#if _PSTL_USE_PAR_POLICIES template OutputIterator __pattern_generate_n(_ExecutionPolicy&&, OutputIterator, Size, _Generator, /*is_parallel=*/std::true_type, _IsVector); -#endif //------------------------------------------------------------------------ // remove @@ -1032,12 +954,10 @@ _ForwardIterator __pattern_remove_if(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _UnaryPredicate, _IsVector, /*is_parallel*/ std::false_type) noexcept; -#if _PSTL_USE_PAR_POLICIES template _ForwardIterator __pattern_remove_if(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _UnaryPredicate, _IsVector, /*is_parallel*/ std::true_type) noexcept; -#endif //------------------------------------------------------------------------ // merge @@ -1059,14 +979,12 @@ _OutputIterator __pattern_merge(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, _OutputIterator, _Compare, _IsVector, /* is_parallel = */ std::false_type) noexcept; -#if _PSTL_USE_PAR_POLICIES template _OutputIterator __pattern_merge(_ExecutionPolicy&&, _RandomAccessIterator1, _RandomAccessIterator1, _RandomAccessIterator2, _RandomAccessIterator2, _OutputIterator, _Compare, _IsVector, /* is_parallel = */ std::true_type); -#endif //------------------------------------------------------------------------ // inplace_merge @@ -1086,13 +1004,11 @@ __pattern_inplace_merge(_ExecutionPolicy&&, _BidirectionalIterator, _Bidirection _Compare, _IsVector, /* is_parallel = */ std::false_type) noexcept; -#if _PSTL_USE_PAR_POLICIES template void __pattern_inplace_merge(_ExecutionPolicy&&, _BidirectionalIterator, _BidirectionalIterator, _BidirectionalIterator, _Compare, _IsVector, /*is_parallel=*/std::true_type); -#endif //------------------------------------------------------------------------ // includes @@ -1104,13 +1020,11 @@ __pattern_includes(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _Fo _Compare, _IsVector, /*is_parallel=*/std::false_type) noexcept; -#if _PSTL_USE_PAR_POLICIES template bool __pattern_includes(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, _Compare, _IsVector, /*is_parallel=*/std::true_type); -#endif //------------------------------------------------------------------------ // set_union @@ -1132,13 +1046,11 @@ _OutputIterator __pattern_set_union(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, _OutputIterator, _Compare, _IsVector, /*is_parallel=*/std::false_type) noexcept; -#if _PSTL_USE_PAR_POLICIES template _OutputIterator __pattern_set_union(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, _OutputIterator, _Compare, _IsVector, /*is_parallel=*/std::true_type); -#endif //------------------------------------------------------------------------ // set_intersection @@ -1161,13 +1073,11 @@ __pattern_set_intersection(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterat _ForwardIterator2, _OutputIterator, _Compare, _IsVector, /*is_parallel=*/std::false_type) noexcept; -#if _PSTL_USE_PAR_POLICIES template _OutputIterator __pattern_set_intersection(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, _OutputIterator, _Compare, _IsVector, /*is_parallel=*/std::true_type); -#endif //------------------------------------------------------------------------ // set_difference @@ -1189,13 +1099,11 @@ _OutputIterator __pattern_set_difference(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, _OutputIterator, _Compare, _IsVector, /*is_parallel=*/std::false_type) noexcept; -#if _PSTL_USE_PAR_POLICIES template _OutputIterator __pattern_set_difference(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, _OutputIterator, _Compare, _IsVector, /*is_parallel=*/std::true_type); -#endif //------------------------------------------------------------------------ // set_symmetric_difference @@ -1218,14 +1126,12 @@ __pattern_set_symmetric_difference(_ExecutionPolicy&&, _ForwardIterator1, _Forwa _ForwardIterator2, _OutputIterator, _Compare, _IsVector, /*is_parallel=*/std::false_type) noexcept; -#if _PSTL_USE_PAR_POLICIES template _OutputIterator __pattern_set_symmetric_difference(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, _OutputIterator, _Compare, _IsVector, /*is_parallel=*/std::true_type); -#endif //------------------------------------------------------------------------ // is_heap_until @@ -1244,12 +1150,10 @@ _RandomAccessIterator __pattern_is_heap_until(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Compare, _IsVector, /* is_parallel = */ std::false_type) noexcept; -#if _PSTL_USE_PAR_POLICIES template _RandomAccessIterator __pattern_is_heap_until(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Compare, _IsVector, /* is_parallel = */ std::true_type) noexcept; -#endif //------------------------------------------------------------------------ // min_element @@ -1268,12 +1172,10 @@ _ForwardIterator __pattern_min_element(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _Compare, _IsVector, /* is_parallel = */ std::false_type) noexcept; -#if _PSTL_USE_PAR_POLICIES template _RandomAccessIterator __pattern_min_element(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Compare, _IsVector, /* is_parallel = */ std::true_type); -#endif //------------------------------------------------------------------------ // minmax_element @@ -1292,12 +1194,10 @@ std::pair<_ForwardIterator, _ForwardIterator> __pattern_minmax_element(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _Compare, _IsVector, /* is_parallel = */ std::false_type) noexcept; -#if _PSTL_USE_PAR_POLICIES template std::pair<_ForwardIterator, _ForwardIterator> __pattern_minmax_element(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _Compare, _IsVector, /* is_parallel = */ std::true_type); -#endif //------------------------------------------------------------------------ // mismatch @@ -1319,13 +1219,11 @@ __pattern_mismatch(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _Fo _Predicate, _IsVector, /* is_parallel = */ std::false_type) noexcept; -#if _PSTL_USE_PAR_POLICIES template std::pair<_RandomAccessIterator1, _RandomAccessIterator2> __pattern_mismatch(_ExecutionPolicy&&, _RandomAccessIterator1, _RandomAccessIterator1, _RandomAccessIterator2, _RandomAccessIterator2, _Predicate, _IsVector, /* is_parallel = */ std::true_type) noexcept; -#endif //------------------------------------------------------------------------ // lexicographical_compare @@ -1346,12 +1244,10 @@ bool __pattern_lexicographical_compare(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, _Compare, _IsVector, /* is_parallel = */ std::false_type) noexcept; -#if _PSTL_USE_PAR_POLICIES template bool __pattern_lexicographical_compare(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, _Compare, _IsVector, /* is_parallel = */ std::true_type) noexcept; -#endif } // namespace __internal } // namespace __pstl diff --git a/pstl/include/pstl/internal/algorithm_impl.h b/pstl/include/pstl/internal/algorithm_impl.h index 6493817..5fecef4 100644 --- a/pstl/include/pstl/internal/algorithm_impl.h +++ b/pstl/include/pstl/internal/algorithm_impl.h @@ -19,12 +19,10 @@ #include "execution_impl.h" #include "memory_impl.h" #include "parallel_backend_utils.h" +#include "parallel_backend.h" +#include "parallel_impl.h" #include "unseq_backend_simd.h" -#if _PSTL_USE_PAR_POLICIES -# include "parallel_backend.h" -# include "parallel_impl.h" -#endif namespace __pstl { @@ -59,7 +57,6 @@ __pattern_any_of(_ExecutionPolicy&&, _ForwardIterator __first, _ForwardIterator 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 +69,6 @@ __pattern_any_of(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIt }); }); } -#endif // [alg.foreach] // for_each_n with no policy @@ -115,7 +111,6 @@ __pattern_walk1(_ExecutionPolicy&&, _ForwardIterator __first, _ForwardIterator _ __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 +124,6 @@ __pattern_walk1(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIte }); }); } -#endif template void @@ -139,7 +133,6 @@ __pattern_walk_brick(_ExecutionPolicy&&, _ForwardIterator __first, _ForwardItera __brick(__first, __last); } -#if _PSTL_USE_PAR_POLICIES template void __pattern_walk_brick(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, _Brick __brick, @@ -150,7 +143,6 @@ __pattern_walk_brick(_ExecutionPolicy&& __exec, _ForwardIterator __first, _Forwa [__brick](_ForwardIterator __i, _ForwardIterator __j) { __brick(__i, __j); }); }); } -#endif //------------------------------------------------------------------------ // walk1_n @@ -179,7 +171,6 @@ __pattern_walk1_n(_ExecutionPolicy&&, _ForwardIterator __first, _Size __n, _Func 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, @@ -190,7 +181,6 @@ __pattern_walk1_n(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _Siz std::true_type()); return __first + __n; } -#endif template _ForwardIterator @@ -200,7 +190,6 @@ __pattern_walk_brick_n(_ExecutionPolicy&&, _ForwardIterator __first, _Size __n, return __brick(__first, __n); } -#if _PSTL_USE_PAR_POLICIES template _RandomAccessIterator __pattern_walk_brick_n(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _Size __n, _Brick __brick, @@ -213,7 +202,6 @@ __pattern_walk_brick_n(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, return __first + __n; }); } -#endif //------------------------------------------------------------------------ // walk2 (pseudo) @@ -264,7 +252,6 @@ __pattern_walk2(_ExecutionPolicy&&, _ForwardIterator1 __first1, _ForwardIterator 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, @@ -279,7 +266,6 @@ __pattern_walk2(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _ForwardI return __first2 + (__last1 - __first1); }); } -#endif template @@ -308,7 +294,6 @@ __pattern_walk2_brick(_ExecutionPolicy&&, _ForwardIterator1 __first1, _ForwardIt return __brick(__first1, __last1, __first2); } -#if _PSTL_USE_PAR_POLICIES template _RandomAccessIterator2 __pattern_walk2_brick(_ExecutionPolicy&& __exec, _RandomAccessIterator1 __first1, _RandomAccessIterator1 __last1, @@ -323,9 +308,7 @@ __pattern_walk2_brick(_ExecutionPolicy&& __exec, _RandomAccessIterator1 __first1 return __first2 + (__last1 - __first1); }); } -#endif -#if _PSTL_USE_PAR_POLICIES template _RandomAccessIterator2 __pattern_walk2_brick_n(_ExecutionPolicy&& __exec, _RandomAccessIterator1 __first1, _Size __n, @@ -340,7 +323,6 @@ __pattern_walk2_brick_n(_ExecutionPolicy&& __exec, _RandomAccessIterator1 __firs return __first2 + __n; }); } -#endif template _ForwardIterator2 @@ -382,7 +364,6 @@ __pattern_walk3(_ExecutionPolicy&&, _ForwardIterator1 __first1, _ForwardIterator return __internal::__brick_walk3(__first1, __last1, __first2, __first3, __f, __is_vector); } -#if _PSTL_USE_PAR_POLICIES template _RandomAccessIterator3 @@ -400,7 +381,6 @@ __pattern_walk3(_ExecutionPolicy&& __exec, _RandomAccessIterator1 __first1, _Ran return __first3 + (__last1 - __first1); }); } -#endif //------------------------------------------------------------------------ // equal @@ -437,7 +417,6 @@ __pattern_equal(_ExecutionPolicy&&, _ForwardIterator1 __first1, _ForwardIterator return __internal::__brick_equal(__first1, __last1, __first2, __last2, __p, __is_vector); } -#if _PSTL_USE_PAR_POLICIES template bool @@ -457,7 +436,6 @@ __pattern_equal(_ExecutionPolicy&& __exec, _RandomAccessIterator1 __first1, _Ran }); }); } -#endif //------------------------------------------------------------------------ // equal version for sequences with equal length @@ -489,7 +467,6 @@ __pattern_equal(_ExecutionPolicy&&, _ForwardIterator1 __first1, _ForwardIterator return __internal::__brick_equal(__first1, __last1, __first2, __p, __is_vector); } -#if _PSTL_USE_PAR_POLICIES template bool @@ -505,7 +482,6 @@ __pattern_equal(_ExecutionPolicy&& __exec, _RandomAccessIterator1 __first1, _Ran }); }); } -#endif //------------------------------------------------------------------------ // find_if @@ -538,7 +514,6 @@ __pattern_find_if(_ExecutionPolicy&&, _ForwardIterator __first, _ForwardIterator 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, @@ -555,7 +530,6 @@ __pattern_find_if(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardI /*is_first=*/true); }); } -#endif //------------------------------------------------------------------------ // find_end @@ -681,7 +655,6 @@ __pattern_find_end(_ExecutionPolicy&&, _ForwardIterator1 __first, _ForwardIterat return __internal::__brick_find_end(__first, __last, __s_first, __s_last, __pred, __is_vector); } -#if _PSTL_USE_PAR_POLICIES template _ForwardIterator1 @@ -708,7 +681,6 @@ __pattern_find_end(_ExecutionPolicy&& __exec, _ForwardIterator1 __first, _Forwar }); } } -#endif //------------------------------------------------------------------------ // find_first_of @@ -739,7 +711,6 @@ __pattern_find_first_of(_ExecutionPolicy&&, _ForwardIterator1 __first, _ForwardI return __internal::__brick_find_first_of(__first, __last, __s_first, __s_last, __pred, __is_vector); } -#if _PSTL_USE_PAR_POLICIES template _ForwardIterator1 @@ -756,7 +727,6 @@ __pattern_find_first_of(_ExecutionPolicy&& __exec, _ForwardIterator1 __first, _F std::less::difference_type>(), /*is_first=*/true); }); } -#endif //------------------------------------------------------------------------ // search @@ -787,7 +757,6 @@ __pattern_search(_ExecutionPolicy&&, _ForwardIterator1 __first, _ForwardIterator return __internal::__brick_search(__first, __last, __s_first, __s_last, __pred, __is_vector); } -#if _PSTL_USE_PAR_POLICIES template _ForwardIterator1 @@ -815,7 +784,6 @@ __pattern_search(_ExecutionPolicy&& __exec, _ForwardIterator1 __first, _ForwardI }); } } -#endif //------------------------------------------------------------------------ // search_n @@ -846,7 +814,6 @@ __pattern_search_n(_ExecutionPolicy&&, _ForwardIterator __first, _ForwardIterato return __internal::__brick_search_n(__first, __last, __count, __value, __pred, __is_vector); } -#if _PSTL_USE_PAR_POLICIES template _RandomAccessIterator @@ -874,7 +841,6 @@ __pattern_search_n(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _Ra }); } } -#endif //------------------------------------------------------------------------ // copy_n @@ -1080,7 +1046,6 @@ __pattern_copy_if(_ExecutionPolicy&&, _ForwardIterator __first, _ForwardIterator return __internal::__brick_copy_if(__first, __last, __result, __pred, __is_vector); } -#if _PSTL_USE_PAR_POLICIES template _OutputIterator @@ -1115,7 +1080,6 @@ __pattern_copy_if(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _Ran // trivial sequence - use serial algorithm return __internal::__brick_copy_if(__first, __last, __result, __pred, __is_vector); } -#endif //------------------------------------------------------------------------ // count @@ -1144,7 +1108,6 @@ __pattern_count(_ExecutionPolicy&&, _ForwardIterator __first, _ForwardIterator _ return __internal::__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, @@ -1160,7 +1123,6 @@ __pattern_count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIte std::plus<_SizeType>()); }); } -#endif //------------------------------------------------------------------------ // unique @@ -1191,7 +1153,6 @@ __pattern_unique(_ExecutionPolicy&&, _ForwardIterator __first, _ForwardIterator 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 @@ -1270,9 +1231,7 @@ __remove_elements(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardI return __first + __m; }); } -#endif -#if _PSTL_USE_PAR_POLICIES template _ForwardIterator __pattern_unique(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, _BinaryPredicate __pred, @@ -1298,7 +1257,6 @@ __pattern_unique(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIt }, __is_vector); } -#endif //------------------------------------------------------------------------ // unique_copy @@ -1355,7 +1313,6 @@ __brick_calc_mask_2(_RandomAccessIterator __first, _RandomAccessIterator __last, return __unseq_backend::__simd_calc_mask_2(__first, __last - __first, __mask, __pred); } -#if _PSTL_USE_PAR_POLICIES template _OutputIterator @@ -1405,7 +1362,6 @@ __pattern_unique_copy(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, // trivial sequence - use serial algorithm return __internal::__brick_unique_copy(__first, __last, __result, __pred, __is_vector); } -#endif //------------------------------------------------------------------------ // reverse @@ -1468,7 +1424,6 @@ __pattern_reverse(_ExecutionPolicy&&, _BidirectionalIterator __first, _Bidirecti __internal::__brick_reverse(__first, __last, _is_vector); } -#if _PSTL_USE_PAR_POLICIES template void __pattern_reverse(_ExecutionPolicy&& __exec, _BidirectionalIterator __first, _BidirectionalIterator __last, @@ -1480,7 +1435,6 @@ __pattern_reverse(_ExecutionPolicy&& __exec, _BidirectionalIterator __first, _Bi __internal::__brick_reverse(__inner_first, __inner_last, __last - (__inner_first - __first), __is_vector); }); } -#endif //------------------------------------------------------------------------ // reverse_copy @@ -1514,7 +1468,6 @@ __pattern_reverse_copy(_ExecutionPolicy&&, _BidirectionalIterator __first, _Bidi 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, @@ -1530,7 +1483,6 @@ __pattern_reverse_copy(_ExecutionPolicy&& __exec, _BidirectionalIterator __first }); return __d_first + __len; } -#endif //------------------------------------------------------------------------ // rotate @@ -1597,7 +1549,6 @@ __pattern_rotate(_ExecutionPolicy&&, _ForwardIterator __first, _ForwardIterator return __internal::__brick_rotate(__first, __middle, __last, __is_vector); } -#if _PSTL_USE_PAR_POLICIES template _ForwardIterator __pattern_rotate(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __middle, @@ -1659,7 +1610,6 @@ __pattern_rotate(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIt }); } } -#endif //------------------------------------------------------------------------ // rotate_copy @@ -1690,7 +1640,6 @@ __pattern_rotate_copy(_ExecutionPolicy&&, _ForwardIterator __first, _ForwardIter 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, @@ -1720,7 +1669,6 @@ __pattern_rotate_copy(_ExecutionPolicy&& __exec, _ForwardIterator __first, _Forw }); return __result + (__last - __first); } -#endif //------------------------------------------------------------------------ // is_partitioned @@ -1769,7 +1717,6 @@ __pattern_is_partitioned(_ExecutionPolicy&&, _ForwardIterator __first, _ForwardI 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, @@ -1866,7 +1813,6 @@ __pattern_is_partitioned(_ExecutionPolicy&& __exec, _ForwardIterator __first, _F }); } } -#endif //------------------------------------------------------------------------ // partition @@ -1897,7 +1843,6 @@ __pattern_partition(_ExecutionPolicy&&, _ForwardIterator __first, _ForwardIterat return __internal::__brick_partition(__first, __last, __pred, __is_vector); } -#if _PSTL_USE_PAR_POLICIES template _ForwardIterator __pattern_partition(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, @@ -1965,7 +1910,6 @@ __pattern_partition(_ExecutionPolicy&& __exec, _ForwardIterator __first, _Forwar return __result.__pivot; }); } -#endif //------------------------------------------------------------------------ // stable_partition @@ -1997,7 +1941,6 @@ __pattern_stable_partition(_ExecutionPolicy&&, _BidirectionalIterator __first, _ 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, @@ -2049,7 +1992,6 @@ __pattern_stable_partition(_ExecutionPolicy&& __exec, _BidirectionalIterator __f return __result.__pivot; }); } -#endif //------------------------------------------------------------------------ // partition_copy @@ -2085,7 +2027,6 @@ __pattern_partition_copy(_ExecutionPolicy&&, _ForwardIterator __first, _ForwardI return __internal::__brick_partition_copy(__first, __last, __out_true, __out_false, __pred, __is_vector); } -#if _PSTL_USE_PAR_POLICIES template std::pair<_OutputIterator1, _OutputIterator2> @@ -2124,7 +2065,6 @@ __pattern_partition_copy(_ExecutionPolicy&& __exec, _RandomAccessIterator __firs // trivial sequence - use serial algorithm return __internal::__brick_partition_copy(__first, __last, __out_true, __out_false, __pred, __is_vector); } -#endif //------------------------------------------------------------------------ // sort @@ -2139,7 +2079,6 @@ __pattern_sort(_ExecutionPolicy&&, _RandomAccessIterator __first, _RandomAccessI std::sort(__first, __last, __comp); } -#if _PSTL_USE_PAR_POLICIES template void __pattern_sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp, @@ -2152,7 +2091,6 @@ __pattern_sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _Random __last - __first); }); } -#endif //------------------------------------------------------------------------ // stable_sort @@ -2166,7 +2104,6 @@ __pattern_stable_sort(_ExecutionPolicy&&, _RandomAccessIterator __first, _Random std::stable_sort(__first, __last, __comp); } -#if _PSTL_USE_PAR_POLICIES template void __pattern_stable_sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last, @@ -2178,7 +2115,6 @@ __pattern_stable_sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _Compare __comp) { std::stable_sort(__first, __last, __comp); }); }); } -#endif //------------------------------------------------------------------------ // partial_sort @@ -2193,7 +2129,6 @@ __pattern_partial_sort(_ExecutionPolicy&&, _RandomAccessIterator __first, _Rando std::partial_sort(__first, __middle, __last, __comp); } -#if _PSTL_USE_PAR_POLICIES template void __pattern_partial_sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __middle, @@ -2212,7 +2147,6 @@ __pattern_partial_sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, __n); }); } -#endif //------------------------------------------------------------------------ // partial_sort_copy @@ -2227,7 +2161,6 @@ __pattern_partial_sort_copy(_ExecutionPolicy&&, _ForwardIterator __first, _Forwa 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, @@ -2296,7 +2229,6 @@ __pattern_partial_sort_copy(_ExecutionPolicy&& __exec, _ForwardIterator __first, } }); } -#endif //------------------------------------------------------------------------ // adjacent_find @@ -2325,7 +2257,6 @@ __pattern_adjacent_find(_ExecutionPolicy&&, _ForwardIterator __first, _ForwardIt 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, @@ -2371,7 +2302,6 @@ __pattern_adjacent_find(_ExecutionPolicy&& __exec, _RandomAccessIterator __first ); }); } -#endif //------------------------------------------------------------------------ // nth_element @@ -2386,7 +2316,6 @@ __pattern_nth_element(_ExecutionPolicy&&, _RandomAccessIterator __first, _Random std::nth_element(__first, __nth, __last, __comp); } -#if _PSTL_USE_PAR_POLICIES template void __pattern_nth_element(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __nth, @@ -2433,7 +2362,6 @@ __pattern_nth_element(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, } } while (__x != __nth); } -#endif //------------------------------------------------------------------------ // fill, fill_n @@ -2462,7 +2390,6 @@ __pattern_fill(_ExecutionPolicy&&, _ForwardIterator __first, _ForwardIterator __ __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, @@ -2476,7 +2403,6 @@ __pattern_fill(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIter return __last; }); } -#endif template _OutputIterator @@ -2536,7 +2462,6 @@ __pattern_generate(_ExecutionPolicy&&, _ForwardIterator __first, _ForwardIterato __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, @@ -2550,7 +2475,6 @@ __pattern_generate(_ExecutionPolicy&& __exec, _ForwardIterator __first, _Forward return __last; }); } -#endif template OutputIterator @@ -2574,7 +2498,6 @@ __pattern_generate_n(_ExecutionPolicy&&, _OutputIterator __first, _Size __count, 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, @@ -2585,7 +2508,6 @@ __pattern_generate_n(_ExecutionPolicy&& __exec, _OutputIterator __first, _Size _ return __internal::__pattern_generate(std::forward<_ExecutionPolicy>(__exec), __first, __first + __count, __g, std::true_type(), __is_vector); } -#endif //------------------------------------------------------------------------ // remove @@ -2619,7 +2541,6 @@ __pattern_remove_if(_ExecutionPolicy&&, _ForwardIterator __first, _ForwardIterat 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, @@ -2641,7 +2562,6 @@ __pattern_remove_if(_ExecutionPolicy&& __exec, _ForwardIterator __first, _Forwar }, __is_vector); } -#endif //------------------------------------------------------------------------ // merge @@ -2676,7 +2596,6 @@ __pattern_merge(_ExecutionPolicy&&, _ForwardIterator1 __first1, _ForwardIterator return __internal::__brick_merge(__first1, __last1, __first2, __last2, __d_first, __comp, __is_vector); } -#if _PSTL_USE_PAR_POLICIES template _OutputIterator @@ -2692,7 +2611,6 @@ __pattern_merge(_ExecutionPolicy&& __exec, _RandomAccessIterator1 __first1, _Ran }); return __d_first + (__last1 - __first1) + (__last2 - __first2); } -#endif //------------------------------------------------------------------------ // inplace_merge @@ -2723,7 +2641,6 @@ __pattern_inplace_merge(_ExecutionPolicy&&, _BidirectionalIterator __first, _Bid __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, @@ -2765,7 +2682,6 @@ __pattern_inplace_merge(_ExecutionPolicy&& __exec, _BidirectionalIterator __firs }); }); } -#endif //------------------------------------------------------------------------ // includes @@ -2780,7 +2696,6 @@ __pattern_includes(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _Forwa return std::includes(__first1, __last1, __first2, __last2, __comp); } -#if _PSTL_USE_PAR_POLICIES template bool __pattern_includes(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _ForwardIterator1 __last1, @@ -2835,11 +2750,9 @@ __pattern_includes(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _Forwa }); }); } -#endif constexpr auto __set_algo_cut_off = 1000; -#if _PSTL_USE_PAR_POLICIES template _OutputIterator @@ -2928,9 +2841,7 @@ __parallel_set_op(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _Forwar return __result + __m; }); } -#endif -#if _PSTL_USE_PAR_POLICIES //a shared parallel pattern for '__pattern_set_union' and '__pattern_set_symmetric_difference' template @@ -3046,7 +2957,6 @@ __parallel_set_union_op(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _ std::forward<_ExecutionPolicy>(__exec), __first1, __last1, __first2, __last2, __result, __comp, [](_DifferenceType __n, _DifferenceType __m) { return __n + __m; }, __set_union_op, __is_vector); } -#endif //------------------------------------------------------------------------ // set_union @@ -3082,7 +2992,6 @@ __pattern_set_union(_ExecutionPolicy&&, _ForwardIterator1 __first1, _ForwardIter return __internal::__brick_set_union(__first1, __last1, __first2, __last2, __result, __comp, __is_vector); } -#if _PSTL_USE_PAR_POLICIES template _OutputIterator @@ -3106,7 +3015,6 @@ __pattern_set_union(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _Forw _Compare __comp) { return std::set_union(__first1, __last1, __first2, __last2, __result, __comp); }, __is_vector); } -#endif //------------------------------------------------------------------------ // set_intersection @@ -3141,7 +3049,6 @@ __pattern_set_intersection(_ExecutionPolicy&&, _ForwardIterator1 __first1, _Forw return __internal::__brick_set_intersection(__first1, __last1, __first2, __last2, __result, __comp, __is_vector); } -#if _PSTL_USE_PAR_POLICIES template _OutputIterator @@ -3203,7 +3110,6 @@ __pattern_set_intersection(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1 // [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 @@ -3238,7 +3144,6 @@ __pattern_set_difference(_ExecutionPolicy&&, _ForwardIterator1 __first1, _Forwar return __internal::__brick_set_difference(__first1, __last1, __first2, __last2, __result, __comp, __is_vector); } -#if _PSTL_USE_PAR_POLICIES template _OutputIterator @@ -3299,7 +3204,6 @@ __pattern_set_difference(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, // use serial algorithm return std::set_difference(__first1, __last1, __first2, __last2, __result, __comp); } -#endif //------------------------------------------------------------------------ // set_symmetric_difference @@ -3335,7 +3239,6 @@ __pattern_set_symmetric_difference(_ExecutionPolicy&&, _ForwardIterator1 __first __is_vector); } -#if _PSTL_USE_PAR_POLICIES template _OutputIterator @@ -3360,7 +3263,6 @@ __pattern_set_symmetric_difference(_ExecutionPolicy&& __exec, _ForwardIterator1 }, __is_vector); } -#endif //------------------------------------------------------------------------ // is_heap_until @@ -3421,7 +3323,6 @@ __is_heap_until_local(_RandomAccessIterator __first, _DifferenceType __begin, _D [&__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, @@ -3439,7 +3340,6 @@ __pattern_is_heap_until(_ExecutionPolicy&& __exec, _RandomAccessIterator __first std::less::difference_type>(), /*is_first=*/true); }); } -#endif //------------------------------------------------------------------------ // min_element @@ -3473,7 +3373,6 @@ __pattern_min_element(_ExecutionPolicy&&, _ForwardIterator __first, _ForwardIter 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, @@ -3496,7 +3395,6 @@ __pattern_min_element(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, }); }); } -#endif //------------------------------------------------------------------------ // minmax_element @@ -3530,7 +3428,6 @@ __pattern_minmax_element(_ExecutionPolicy&&, _ForwardIterator __first, _ForwardI 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, @@ -3557,7 +3454,6 @@ __pattern_minmax_element(_ExecutionPolicy&& __exec, _ForwardIterator __first, _F }); }); } -#endif //------------------------------------------------------------------------ // mismatch @@ -3603,7 +3499,6 @@ __pattern_mismatch(_ExecutionPolicy&&, _ForwardIterator1 __first1, _ForwardItera return __internal::__brick_mismatch(__first1, __last1, __first2, __last2, __pred, __is_vector); } -#if _PSTL_USE_PAR_POLICIES template std::pair<_RandomAccessIterator1, _RandomAccessIterator2> @@ -3624,7 +3519,6 @@ __pattern_mismatch(_ExecutionPolicy&& __exec, _RandomAccessIterator1 __first1, _ return std::make_pair(__result, __first2 + (__result - __first1)); }); } -#endif //------------------------------------------------------------------------ // lexicographical_compare @@ -3684,7 +3578,6 @@ __pattern_lexicographical_compare(_ExecutionPolicy&&, _ForwardIterator1 __first1 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, @@ -3728,7 +3621,6 @@ __pattern_lexicographical_compare(_ExecutionPolicy&& __exec, _ForwardIterator1 _ } } } -#endif } // namespace __internal } // namespace __pstl diff --git a/pstl/include/pstl/internal/execution_defs.h b/pstl/include/pstl/internal/execution_defs.h index b4f984c..e42aff5 100644 --- a/pstl/include/pstl/internal/execution_defs.h +++ b/pstl/include/pstl/internal/execution_defs.h @@ -41,7 +41,6 @@ class sequenced_policy } }; -#if _PSTL_USE_PAR_POLICIES // 2.5, Parallel execution policy class parallel_policy { @@ -85,7 +84,6 @@ class parallel_unsequenced_policy return std::true_type{}; } }; -#endif class unsequenced_policy { @@ -110,10 +108,8 @@ class unsequenced_policy // 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 @@ template <> struct is_execution_policy<__pstl::execution::sequenced_policy> : std::true_type { }; -#if _PSTL_USE_PAR_POLICIES template <> struct is_execution_policy<__pstl::execution::parallel_policy> : std::true_type { @@ -135,7 +130,6 @@ template <> struct is_execution_policy<__pstl::execution::parallel_unsequenced_policy> : std::true_type { }; -#endif template <> struct is_execution_policy<__pstl::execution::unsequenced_policy> : std::true_type { diff --git a/pstl/include/pstl/internal/execution_impl.h b/pstl/include/pstl/internal/execution_impl.h index fdc6282..4ac73b3 100644 --- a/pstl/include/pstl/internal/execution_impl.h +++ b/pstl/include/pstl/internal/execution_impl.h @@ -87,7 +87,6 @@ struct __policy_traits typedef std::true_type allow_vector; }; -#if _PSTL_USE_PAR_POLICIES template <> struct __policy_traits { @@ -103,7 +102,6 @@ struct __policy_traits typedef std::true_type allow_unsequenced; typedef std::true_type allow_vector; }; -#endif template using __collector_t = diff --git a/pstl/include/pstl/internal/glue_execution_defs.h b/pstl/include/pstl/internal/glue_execution_defs.h index b02af55..24ede33 100644 --- a/pstl/include/pstl/internal/glue_execution_defs.h +++ b/pstl/include/pstl/internal/glue_execution_defs.h @@ -30,17 +30,15 @@ using __pstl::execution::is_execution_policy_v; namespace execution { // 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 +using __pstl::execution::sequenced_policy; + // Standard predefined policy instances -using __pstl::execution::seq; -#if _PSTL_USE_PAR_POLICIES using __pstl::execution::par; using __pstl::execution::par_unseq; -#endif +using __pstl::execution::seq; + // Implementation-defined names // Unsequenced policy is not yet standard, but for consistency // we include it into namespace std::execution as well diff --git a/pstl/include/pstl/internal/numeric_fwd.h b/pstl/include/pstl/internal/numeric_fwd.h index 726eda9..d92cacb 100644 --- a/pstl/include/pstl/internal/numeric_fwd.h +++ b/pstl/include/pstl/internal/numeric_fwd.h @@ -39,14 +39,12 @@ __pattern_transform_reduce(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterat _BinaryOperation1, _BinaryOperation2, _IsVector, /*is_parallel=*/std::false_type) noexcept; -#if _PSTL_USE_PAR_POLICIES template _Tp __pattern_transform_reduce(_ExecutionPolicy&&, _RandomAccessIterator1, _RandomAccessIterator1, _RandomAccessIterator2, _Tp, _BinaryOperation1, _BinaryOperation2, _IsVector __is_vector, /*is_parallel=*/std::true_type); -#endif //------------------------------------------------------------------------ // transform_reduce (version with unary and binary functions) @@ -67,14 +65,12 @@ __pattern_transform_reduce(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterato _UnaryOperation, _IsVector, /*is_parallel=*/std::false_type) noexcept; -#if _PSTL_USE_PAR_POLICIES template _Tp __pattern_transform_reduce(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _Tp, _BinaryOperation, _UnaryOperation, _IsVector, /*is_parallel=*/std::true_type); -#endif //------------------------------------------------------------------------ // transform_exclusive_scan @@ -99,21 +95,17 @@ __pattern_transform_scan(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _BinaryOperation, _Inclusive, _IsVector, /*is_parallel=*/std::false_type) noexcept; -#if _PSTL_USE_PAR_POLICIES template typename std::enable_if::value, _OutputIterator>::type __pattern_transform_scan(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _OutputIterator, _UnaryOperation, _Tp, _BinaryOperation, _Inclusive, _IsVector, /*is_parallel=*/std::true_type); -#endif -#if _PSTL_USE_PAR_POLICIES template typename std::enable_if::value, _OutputIterator>::type __pattern_transform_scan(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _OutputIterator, _UnaryOperation, _Tp, _BinaryOperation, _Inclusive, _IsVector, /*is_parallel=*/std::true_type); -#endif //------------------------------------------------------------------------ // adjacent_difference @@ -133,13 +125,11 @@ _OutputIterator __pattern_adjacent_difference(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _OutputIterator, _BinaryOperation, _IsVector, /*is_parallel*/ std::false_type) noexcept; -#if _PSTL_USE_PAR_POLICIES template _OutputIterator __pattern_adjacent_difference(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _OutputIterator, _BinaryOperation, _IsVector, /*is_parallel*/ std::true_type); -#endif } // namespace __internal } // namespace __pstl diff --git a/pstl/include/pstl/internal/numeric_impl.h b/pstl/include/pstl/internal/numeric_impl.h index fe17235..1f108aa 100644 --- a/pstl/include/pstl/internal/numeric_impl.h +++ b/pstl/include/pstl/internal/numeric_impl.h @@ -14,14 +14,12 @@ #include #include +#include "parallel_backend.h" +#include "pstl_config.h" #include "execution_impl.h" #include "unseq_backend_simd.h" #include "algorithm_fwd.h" -#if _PSTL_USE_PAR_POLICIES -# include "parallel_backend.h" -#endif - namespace __pstl { namespace __internal @@ -63,7 +61,6 @@ __pattern_transform_reduce(_ExecutionPolicy&&, _ForwardIterator1 __first1, _Forw return __brick_transform_reduce(__first1, __last1, __first2, __init, __binary_op1, __binary_op2, __is_vector); } -#if _PSTL_USE_PAR_POLICIES template _Tp @@ -86,7 +83,6 @@ __pattern_transform_reduce(_ExecutionPolicy&& __exec, _RandomAccessIterator1 __f }); }); } -#endif //------------------------------------------------------------------------ // transform_reduce (version with unary and binary functions) @@ -125,7 +121,6 @@ __pattern_transform_reduce(_ExecutionPolicy&&, _ForwardIterator __first, _Forwar return __internal::__brick_transform_reduce(__first, __last, __init, __binary_op, __unary_op, __is_vector); } -#if _PSTL_USE_PAR_POLICIES template _Tp @@ -142,7 +137,6 @@ __pattern_transform_reduce(_ExecutionPolicy&& __exec, _ForwardIterator __first, }); }); } -#endif //------------------------------------------------------------------------ // transform_exclusive_scan @@ -229,7 +223,6 @@ __pattern_transform_scan(_ExecutionPolicy&&, _ForwardIterator __first, _ForwardI .first; } -#if _PSTL_USE_PAR_POLICIES template typename std::enable_if::value, _OutputIterator>::type @@ -259,9 +252,7 @@ __pattern_transform_scan(_ExecutionPolicy&& __exec, _RandomAccessIterator __firs return __result + (__last - __first); }); } -#endif -#if _PSTL_USE_PAR_POLICIES template typename std::enable_if::value, _OutputIterator>::type @@ -297,7 +288,6 @@ __pattern_transform_scan(_ExecutionPolicy&& __exec, _RandomAccessIterator __firs return __result + (__last - __first); }); } -#endif //------------------------------------------------------------------------ // adjacent_difference @@ -338,7 +328,6 @@ __pattern_adjacent_difference(_ExecutionPolicy&&, _ForwardIterator __first, _For return __internal::__brick_adjacent_difference(__first, __last, __d_first, __op, __is_vector); } -#if _PSTL_USE_PAR_POLICIES template _ForwardIterator2 @@ -362,7 +351,6 @@ __pattern_adjacent_difference(_ExecutionPolicy&& __exec, _ForwardIterator1 __fir }); return __d_first + (__last - __first); } -#endif } // namespace __internal } // namespace __pstl diff --git a/pstl/include/pstl/internal/pstl_config.h b/pstl/include/pstl/internal/pstl_config.h index 7f32725..a6867ca 100644 --- a/pstl/include/pstl/internal/pstl_config.h +++ b/pstl/include/pstl/internal/pstl_config.h @@ -16,17 +16,8 @@ #define _PSTL_VERSION_MINOR ((_PSTL_VERSION % 1000) / 10) #define _PSTL_VERSION_PATCH (_PSTL_VERSION % 10) -// 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" +# error "The parallel backend is neither serial nor TBB" #endif // Check the user-defined macro for warnings diff --git a/pstl/test/support/pstl_test_config.h b/pstl/test/support/pstl_test_config.h index 8400492..9424451 100644 --- a/pstl/test/support/pstl_test_config.h +++ b/pstl/test/support/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 \ diff --git a/pstl/test/support/utils.h b/pstl/test/support/utils.h index e06c5aa..6547d93 100644 --- a/pstl/test/support/utils.h +++ b/pstl/test/support/utils.h @@ -606,13 +606,6 @@ multiply_matrix(const Matrix2x2& left, const Matrix2x2& right) 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 @@ invoke_on_all_policies(Op op, T&&... rest) // 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 -- cgit v1.1