From 528b4e064d687ab8416ee7e4e5368fae910fb681 Mon Sep 17 00:00:00 2001 From: Hari Hara Naveen S Date: Sun, 16 Jul 2023 07:21:14 -0500 Subject: [PATCH 01/12] unseq find Signed-off-by: Hari Hara Naveen S --- .../hpx/parallel/algorithms/detail/find.hpp | 3 +- .../include/hpx/parallel/util/loop.hpp | 41 +++++++++++++++++-- 2 files changed, 39 insertions(+), 5 deletions(-) diff --git a/libs/core/algorithms/include/hpx/parallel/algorithms/detail/find.hpp b/libs/core/algorithms/include/hpx/parallel/algorithms/detail/find.hpp index 649e386386e9..30db28d9ac45 100644 --- a/libs/core/algorithms/include/hpx/parallel/algorithms/detail/find.hpp +++ b/libs/core/algorithms/include/hpx/parallel/algorithms/detail/find.hpp @@ -34,8 +34,7 @@ namespace hpx::parallel::detail { sequential_find_t, Iterator first, Sentinel last, T const& value, Proj proj = Proj()) { - return util::loop_pred< - std::decay_t>( + return util::loop_pred( first, last, [&value, &proj](auto const& curr) { return HPX_INVOKE(proj, *curr) == value; }); diff --git a/libs/core/algorithms/include/hpx/parallel/util/loop.hpp b/libs/core/algorithms/include/hpx/parallel/util/loop.hpp index 8071cd73ff50..65aa60e087c3 100644 --- a/libs/core/algorithms/include/hpx/parallel/util/loop.hpp +++ b/libs/core/algorithms/include/hpx/parallel/util/loop.hpp @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -104,11 +105,12 @@ namespace hpx::parallel::util { /////////////////////////////////////////////////////////////////////////// namespace detail { - + template + struct loop_pred; // Helper class to repeatedly call a function starting from a given // iterator position till the predicate returns true. template - struct loop_pred + struct loop_pred { /////////////////////////////////////////////////////////////////// template @@ -125,6 +127,39 @@ namespace hpx::parallel::util { }; } // namespace detail + /////////////////////////////////////////////////////////////////////////// + namespace detail { + + // Helper class to repeatedly call a function starting from a given + // iterator position till the predicate returns true. + template + struct loop_pred + { + /////////////////////////////////////////////////////////////////// + template + HPX_HOST_DEVICE HPX_FORCEINLINE static constexpr Begin call( + Begin it, End end, Pred&& pred) + { + if constexpr (hpx::is_unsequenced_execution_policy_v< + ExPolicy> && + hpx::traits::is_random_access_iterator_v) + { + return unseq_first_n( + it, std::distance(it, end), HPX_FORWARD(Pred, pred)); + } + else + { + for (/**/; it != end; ++it) + { + if (HPX_INVOKE(pred, it)) + return it; + } + return it; + } + } + }; + } // namespace detail + template struct loop_pred_t final : hpx::functional::detail::tag_fallback> @@ -135,7 +170,7 @@ namespace hpx::parallel::util { tag_fallback_invoke(hpx::parallel::util::loop_pred_t, Begin begin, End end, Pred&& pred) { - return detail::loop_pred::call( + return detail::loop_pred::call( begin, end, HPX_FORWARD(Pred, pred)); } }; From f2e2640ba409ef8d1d97e745331229079390fd97 Mon Sep 17 00:00:00 2001 From: Hari Hara Naveen S Date: Sun, 16 Jul 2023 08:55:40 -0500 Subject: [PATCH 02/12] predicate parameter in simd-helpers first take iterators Signed-off-by: Hari Hara Naveen S --- .../include/hpx/parallel/unseq/simd_helpers.hpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/libs/core/algorithms/include/hpx/parallel/unseq/simd_helpers.hpp b/libs/core/algorithms/include/hpx/parallel/unseq/simd_helpers.hpp index 4ecc66cfdcfc..4e2dd5131810 100644 --- a/libs/core/algorithms/include/hpx/parallel/unseq/simd_helpers.hpp +++ b/libs/core/algorithms/include/hpx/parallel/unseq/simd_helpers.hpp @@ -42,7 +42,7 @@ namespace hpx::parallel::util { HPX_PRAGMA_VECTOR_UNALIGNED HPX_PRAGMA_SIMD_EARLYEXIT for (; i < n; ++i) { - if (f(*(first + i))) + if (f(first + i)) { break; } @@ -64,7 +64,7 @@ namespace hpx::parallel::util { HPX_PRAGMA_VECTOR_UNALIGNED HPX_VECTOR_REDUCTION(| : found_flag) for (IterDiff j = i; j < i + num_blocks; ++j) { - std::int32_t const t = f(*(first + j)); + std::int32_t const t = f(first + j); simd_lane[j - i] = t; found_flag |= t; } @@ -88,7 +88,7 @@ namespace hpx::parallel::util { //Keep remainder scalar while (i != n) { - if (f(*(first + i))) + if (f(first + i)) { break; } @@ -108,7 +108,7 @@ namespace hpx::parallel::util { // clang-format off HPX_PRAGMA_VECTOR_UNALIGNED HPX_PRAGMA_SIMD_EARLYEXIT for (; i < n; ++i) - if (f(*(first1 + i), *(first2 + i))) + if (f(first1 + i, first2 + i)) break; // clang-format on @@ -129,8 +129,8 @@ namespace hpx::parallel::util { HPX_PRAGMA_VECTOR_UNALIGNED HPX_VECTOR_REDUCTION(| : found_flag) for (i = 0; i < num_blocks; ++i) { - IterDiff const t = f(*(first1 + outer_loop_ind + i), - *(first2 + outer_loop_ind + i)); + IterDiff const t = f(first1 + outer_loop_ind + i, + first2 + outer_loop_ind + i); simd_lane[i] = t; found_flag |= t; } @@ -152,7 +152,7 @@ namespace hpx::parallel::util { //Keep remainder scalar for (; outer_loop_ind != n; ++outer_loop_ind) - if (f(*(first1 + outer_loop_ind), *(first2 + outer_loop_ind))) + if (f(first1 + outer_loop_ind, first2 + outer_loop_ind)) break; return std::make_pair(first1 + outer_loop_ind, first2 + outer_loop_ind); From 7327cb1c669ccae9c92f32a152f78ca7707d9201 Mon Sep 17 00:00:00 2001 From: Hari Hara Naveen S Date: Mon, 17 Jul 2023 08:30:46 -0500 Subject: [PATCH 03/12] changing test according to change made to helper Signed-off-by: Hari Hara Naveen S --- .../tests/unit/algorithms/util/test_simd_helpers.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/core/algorithms/tests/unit/algorithms/util/test_simd_helpers.cpp b/libs/core/algorithms/tests/unit/algorithms/util/test_simd_helpers.cpp index 9fc98de2af61..932867e03a9d 100644 --- a/libs/core/algorithms/tests/unit/algorithms/util/test_simd_helpers.cpp +++ b/libs/core/algorithms/tests/unit/algorithms/util/test_simd_helpers.cpp @@ -36,7 +36,7 @@ void test_unseq_first_n1_dispatch2(std::size_t length, std::size_t first_index) i++; }); - auto f = [](T t) { return t; }; + auto f = [](auto t) { return *t; }; auto iter_test = hpx::parallel::util::unseq_first_n( v.begin(), static_cast(length), f); @@ -80,7 +80,7 @@ void test_unseq_first_n2_dispatch2(std::size_t length, std::size_t first_index) idx++; } - auto f = [](T t1, T t2) { return t1 && t2; }; + auto f = [](auto t1, auto t2) { return *t1 && *t2; }; auto iter_pair_test = hpx::parallel::util::unseq2_first_n( v1.begin(), v2.begin(), static_cast(length), f); From ad84137519ea9fb27bfaf154c50c9f45ff3d6b5b Mon Sep 17 00:00:00 2001 From: Hari Hara Naveen S Date: Tue, 18 Jul 2023 04:36:17 -0500 Subject: [PATCH 04/12] adding par_unseq to find Signed-off-by: Hari Hara Naveen S --- .../core/algorithms/include/hpx/parallel/util/loop.hpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libs/core/algorithms/include/hpx/parallel/util/loop.hpp b/libs/core/algorithms/include/hpx/parallel/util/loop.hpp index 65aa60e087c3..3998049795de 100644 --- a/libs/core/algorithms/include/hpx/parallel/util/loop.hpp +++ b/libs/core/algorithms/include/hpx/parallel/util/loop.hpp @@ -821,7 +821,7 @@ namespace hpx::parallel::util { // Helper class to repeatedly call a function a given number of times // starting from a given iterator position. - template + template struct loop_idx_n { /////////////////////////////////////////////////////////////////// @@ -859,8 +859,8 @@ namespace hpx::parallel::util { } }; - template <> - struct loop_idx_n + template + struct loop_idx_n { /////////////////////////////////////////////////////////////////// // handle sequences of non-futures @@ -928,7 +928,7 @@ namespace hpx::parallel::util { std::size_t base_idx, Iter it, std::size_t count, F&& f) { using cat = typename std::iterator_traits::iterator_category; - return detail::loop_idx_n::call( + return detail::loop_idx_n::call( base_idx, it, count, HPX_FORWARD(F, f)); } @@ -939,7 +939,7 @@ namespace hpx::parallel::util { F&& f) { using cat = typename std::iterator_traits::iterator_category; - return detail::loop_idx_n::call( + return detail::loop_idx_n::call( base_idx, it, count, tok, HPX_FORWARD(F, f)); } }; From a7bd010c9e7e9c610ce3b7a991f523a93db10c8c Mon Sep 17 00:00:00 2001 From: Hari Hara Naveen S Date: Tue, 8 Aug 2023 06:59:48 -0500 Subject: [PATCH 05/12] unseq Signed-off-by: Hari Hara Naveen S --- .../hpx/parallel/algorithms/detail/find.hpp | 3 ++ .../include/hpx/parallel/util/loop.hpp | 39 ++++++++++++------- 2 files changed, 28 insertions(+), 14 deletions(-) diff --git a/libs/core/algorithms/include/hpx/parallel/algorithms/detail/find.hpp b/libs/core/algorithms/include/hpx/parallel/algorithms/detail/find.hpp index 30db28d9ac45..8d80fe055f3c 100644 --- a/libs/core/algorithms/include/hpx/parallel/algorithms/detail/find.hpp +++ b/libs/core/algorithms/include/hpx/parallel/algorithms/detail/find.hpp @@ -45,6 +45,7 @@ namespace hpx::parallel::detail { std::size_t base_idx, FwdIter part_begin, std::size_t part_count, Token& tok, T const& val, Proj&& proj) { + // TODO util::loop_idx_n(base_idx, part_begin, part_count, tok, [&val, &proj, &tok](auto& v, std::size_t i) -> void { if (HPX_INVOKE(proj, v) == val) @@ -101,6 +102,7 @@ namespace hpx::parallel::detail { sequential_find_if_t, FwdIter part_begin, std::size_t part_count, Token& tok, F&& op, Proj&& proj) { + // TODO util::loop_n>(part_begin, part_count, tok, [&op, &tok, &proj](auto const& curr) { if (HPX_INVOKE(op, HPX_INVOKE(proj, *curr))) @@ -116,6 +118,7 @@ namespace hpx::parallel::detail { FwdIter part_begin, std::size_t part_count, Token& tok, F&& f, Proj&& proj) { + // TODO util::loop_idx_n(base_idx, part_begin, part_count, tok, [&f, &proj, &tok](auto& v, std::size_t i) -> void { if (HPX_INVOKE(f, HPX_INVOKE(proj, v))) diff --git a/libs/core/algorithms/include/hpx/parallel/util/loop.hpp b/libs/core/algorithms/include/hpx/parallel/util/loop.hpp index 3998049795de..f3d5a1fd07c1 100644 --- a/libs/core/algorithms/include/hpx/parallel/util/loop.hpp +++ b/libs/core/algorithms/include/hpx/parallel/util/loop.hpp @@ -140,22 +140,12 @@ namespace hpx::parallel::util { HPX_HOST_DEVICE HPX_FORCEINLINE static constexpr Begin call( Begin it, End end, Pred&& pred) { - if constexpr (hpx::is_unsequenced_execution_policy_v< - ExPolicy> && - hpx::traits::is_random_access_iterator_v) - { - return unseq_first_n( - it, std::distance(it, end), HPX_FORWARD(Pred, pred)); - } - else + for (/**/; it != end; ++it) { - for (/**/; it != end; ++it) - { - if (HPX_INVOKE(pred, it)) - return it; - } - return it; + if (HPX_INVOKE(pred, it)) + return it; } + return it; } }; } // namespace detail @@ -175,6 +165,27 @@ namespace hpx::parallel::util { } }; + template )> + HPX_HOST_DEVICE HPX_FORCEINLINE Begin tag_invoke( + hpx::parallel::util::loop_pred_t, + Begin HPX_RESTRICT begin, End HPX_RESTRICT end, Pred&& pred) + { + return unseq_first_n( + begin, std::distance(begin, end), HPX_FORWARD(Pred, pred)); + } + + template )> + HPX_HOST_DEVICE HPX_FORCEINLINE Begin tag_invoke( + hpx::parallel::util::loop_pred_t< + hpx::execution::unsequenced_task_policy>, + Begin HPX_RESTRICT begin, End HPX_RESTRICT end, Pred&& pred) + { + return unseq_first_n( + begin, std::distance(begin, end), HPX_FORWARD(Pred, pred)); + } + #if !defined(HPX_COMPUTE_DEVICE_CODE) template inline constexpr loop_pred_t loop_pred = loop_pred_t{}; From e3c741d92b242c4ac800810a3cb78a46efc8df9a Mon Sep 17 00:00:00 2001 From: Hari Hara Naveen S Date: Tue, 8 Aug 2023 16:20:45 -0500 Subject: [PATCH 06/12] removed ExPolicy as template for loop_pred (tag_invoke is being used for function call deduction) Signed-off-by: Hari Hara Naveen S --- .../hpx/parallel/unseq/simd_helpers.hpp | 2 +- .../include/hpx/parallel/util/loop.hpp | 28 ++----------------- 2 files changed, 3 insertions(+), 27 deletions(-) diff --git a/libs/core/algorithms/include/hpx/parallel/unseq/simd_helpers.hpp b/libs/core/algorithms/include/hpx/parallel/unseq/simd_helpers.hpp index 4e2dd5131810..62f3caa7658a 100644 --- a/libs/core/algorithms/include/hpx/parallel/unseq/simd_helpers.hpp +++ b/libs/core/algorithms/include/hpx/parallel/unseq/simd_helpers.hpp @@ -13,6 +13,7 @@ #include #include + #include #include #include @@ -20,7 +21,6 @@ #include #include -// Please use static assert and enforce Iter to be Random Access Iterator namespace hpx::parallel::util { /* Compiler and Hardware should also support vector operations for IterDiff, diff --git a/libs/core/algorithms/include/hpx/parallel/util/loop.hpp b/libs/core/algorithms/include/hpx/parallel/util/loop.hpp index f3d5a1fd07c1..56d642f23f10 100644 --- a/libs/core/algorithms/include/hpx/parallel/util/loop.hpp +++ b/libs/core/algorithms/include/hpx/parallel/util/loop.hpp @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -105,34 +106,9 @@ namespace hpx::parallel::util { /////////////////////////////////////////////////////////////////////////// namespace detail { - template - struct loop_pred; // Helper class to repeatedly call a function starting from a given // iterator position till the predicate returns true. template - struct loop_pred - { - /////////////////////////////////////////////////////////////////// - template - HPX_HOST_DEVICE HPX_FORCEINLINE static constexpr Begin call( - Begin it, End end, Pred&& pred) - { - for (/**/; it != end; ++it) - { - if (HPX_INVOKE(pred, it)) - return it; - } - return it; - } - }; - } // namespace detail - - /////////////////////////////////////////////////////////////////////////// - namespace detail { - - // Helper class to repeatedly call a function starting from a given - // iterator position till the predicate returns true. - template struct loop_pred { /////////////////////////////////////////////////////////////////// @@ -160,7 +136,7 @@ namespace hpx::parallel::util { tag_fallback_invoke(hpx::parallel::util::loop_pred_t, Begin begin, End end, Pred&& pred) { - return detail::loop_pred::call( + return detail::loop_pred::call( begin, end, HPX_FORWARD(Pred, pred)); } }; From adfd8b6eda0d9c4ed5c36ead9f04a44932d22947 Mon Sep 17 00:00:00 2001 From: Hari Hara Naveen S Date: Tue, 8 Aug 2023 16:29:20 -0500 Subject: [PATCH 07/12] false changed to 0 Signed-off-by: Hari Hara Naveen S --- .../algorithms/tests/unit/algorithms/util/test_simd_helpers.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/core/algorithms/tests/unit/algorithms/util/test_simd_helpers.cpp b/libs/core/algorithms/tests/unit/algorithms/util/test_simd_helpers.cpp index 932867e03a9d..e2927525257c 100644 --- a/libs/core/algorithms/tests/unit/algorithms/util/test_simd_helpers.cpp +++ b/libs/core/algorithms/tests/unit/algorithms/util/test_simd_helpers.cpp @@ -23,7 +23,7 @@ void test_unseq_first_n1_dispatch2(std::size_t length, std::size_t first_index) { first_index = first_index % length; - std::vector v(length, static_cast(false)); + std::vector v(length, static_cast(0)); std::size_t i = 0; std::for_each(v.begin(), v.end(), [&](T& t) { From 215ae4f31985aed6382f14547ec10b6684640171 Mon Sep 17 00:00:00 2001 From: Hari Hara Naveen S Date: Tue, 8 Aug 2023 16:33:44 -0500 Subject: [PATCH 08/12] fixed cf Signed-off-by: Hari Hara Naveen S --- libs/core/algorithms/include/hpx/parallel/unseq/simd_helpers.hpp | 1 - 1 file changed, 1 deletion(-) diff --git a/libs/core/algorithms/include/hpx/parallel/unseq/simd_helpers.hpp b/libs/core/algorithms/include/hpx/parallel/unseq/simd_helpers.hpp index 62f3caa7658a..cf7bf8380e86 100644 --- a/libs/core/algorithms/include/hpx/parallel/unseq/simd_helpers.hpp +++ b/libs/core/algorithms/include/hpx/parallel/unseq/simd_helpers.hpp @@ -13,7 +13,6 @@ #include #include - #include #include #include From e854a4579e14e32edfeff1e9c1dad7001ceacfb3 Mon Sep 17 00:00:00 2001 From: Hari Hara Naveen S Date: Sat, 12 Aug 2023 06:10:34 -0500 Subject: [PATCH 09/12] fixed expolicy not accepting par_unseq Signed-off-by: Hari Hara Naveen S --- .../include/hpx/parallel/util/loop.hpp | 20 +++++-------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/libs/core/algorithms/include/hpx/parallel/util/loop.hpp b/libs/core/algorithms/include/hpx/parallel/util/loop.hpp index 56d642f23f10..4752efd7e33c 100644 --- a/libs/core/algorithms/include/hpx/parallel/util/loop.hpp +++ b/libs/core/algorithms/include/hpx/parallel/util/loop.hpp @@ -141,22 +141,12 @@ namespace hpx::parallel::util { } }; - template )> + template && + hpx::is_unsequenced_execution_policy_v)> HPX_HOST_DEVICE HPX_FORCEINLINE Begin tag_invoke( - hpx::parallel::util::loop_pred_t, - Begin HPX_RESTRICT begin, End HPX_RESTRICT end, Pred&& pred) - { - return unseq_first_n( - begin, std::distance(begin, end), HPX_FORWARD(Pred, pred)); - } - - template )> - HPX_HOST_DEVICE HPX_FORCEINLINE Begin tag_invoke( - hpx::parallel::util::loop_pred_t< - hpx::execution::unsequenced_task_policy>, - Begin HPX_RESTRICT begin, End HPX_RESTRICT end, Pred&& pred) + hpx::parallel::util::loop_pred_t, Begin HPX_RESTRICT begin, + End HPX_RESTRICT end, Pred&& pred) { return unseq_first_n( begin, std::distance(begin, end), HPX_FORWARD(Pred, pred)); From ae0cefe99a6b255251a17e6f596bac20c1ab8e9e Mon Sep 17 00:00:00 2001 From: Hari Hara Naveen S Date: Sat, 12 Aug 2023 12:48:25 -0500 Subject: [PATCH 10/12] cleanup changes Signed-off-by: Hari Hara Naveen S --- .../include/hpx/parallel/algorithms/detail/find.hpp | 3 --- .../algorithms/include/hpx/parallel/util/loop.hpp | 11 +++++------ .../tests/unit/algorithms/util/test_simd_helpers.cpp | 2 +- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/libs/core/algorithms/include/hpx/parallel/algorithms/detail/find.hpp b/libs/core/algorithms/include/hpx/parallel/algorithms/detail/find.hpp index 8d80fe055f3c..30db28d9ac45 100644 --- a/libs/core/algorithms/include/hpx/parallel/algorithms/detail/find.hpp +++ b/libs/core/algorithms/include/hpx/parallel/algorithms/detail/find.hpp @@ -45,7 +45,6 @@ namespace hpx::parallel::detail { std::size_t base_idx, FwdIter part_begin, std::size_t part_count, Token& tok, T const& val, Proj&& proj) { - // TODO util::loop_idx_n(base_idx, part_begin, part_count, tok, [&val, &proj, &tok](auto& v, std::size_t i) -> void { if (HPX_INVOKE(proj, v) == val) @@ -102,7 +101,6 @@ namespace hpx::parallel::detail { sequential_find_if_t, FwdIter part_begin, std::size_t part_count, Token& tok, F&& op, Proj&& proj) { - // TODO util::loop_n>(part_begin, part_count, tok, [&op, &tok, &proj](auto const& curr) { if (HPX_INVOKE(op, HPX_INVOKE(proj, *curr))) @@ -118,7 +116,6 @@ namespace hpx::parallel::detail { FwdIter part_begin, std::size_t part_count, Token& tok, F&& f, Proj&& proj) { - // TODO util::loop_idx_n(base_idx, part_begin, part_count, tok, [&f, &proj, &tok](auto& v, std::size_t i) -> void { if (HPX_INVOKE(f, HPX_INVOKE(proj, v))) diff --git a/libs/core/algorithms/include/hpx/parallel/util/loop.hpp b/libs/core/algorithms/include/hpx/parallel/util/loop.hpp index 4752efd7e33c..101e36ef34b2 100644 --- a/libs/core/algorithms/include/hpx/parallel/util/loop.hpp +++ b/libs/core/algorithms/include/hpx/parallel/util/loop.hpp @@ -10,7 +10,6 @@ #include #include #include -#include #include #include #include @@ -798,7 +797,7 @@ namespace hpx::parallel::util { // Helper class to repeatedly call a function a given number of times // starting from a given iterator position. - template + template struct loop_idx_n { /////////////////////////////////////////////////////////////////// @@ -836,8 +835,8 @@ namespace hpx::parallel::util { } }; - template - struct loop_idx_n + template <> + struct loop_idx_n { /////////////////////////////////////////////////////////////////// // handle sequences of non-futures @@ -905,7 +904,7 @@ namespace hpx::parallel::util { std::size_t base_idx, Iter it, std::size_t count, F&& f) { using cat = typename std::iterator_traits::iterator_category; - return detail::loop_idx_n::call( + return detail::loop_idx_n::call( base_idx, it, count, HPX_FORWARD(F, f)); } @@ -916,7 +915,7 @@ namespace hpx::parallel::util { F&& f) { using cat = typename std::iterator_traits::iterator_category; - return detail::loop_idx_n::call( + return detail::loop_idx_n::call( base_idx, it, count, tok, HPX_FORWARD(F, f)); } }; diff --git a/libs/core/algorithms/tests/unit/algorithms/util/test_simd_helpers.cpp b/libs/core/algorithms/tests/unit/algorithms/util/test_simd_helpers.cpp index e2927525257c..ab512b4c8316 100644 --- a/libs/core/algorithms/tests/unit/algorithms/util/test_simd_helpers.cpp +++ b/libs/core/algorithms/tests/unit/algorithms/util/test_simd_helpers.cpp @@ -23,7 +23,7 @@ void test_unseq_first_n1_dispatch2(std::size_t length, std::size_t first_index) { first_index = first_index % length; - std::vector v(length, static_cast(0)); + std::vector v(length); std::size_t i = 0; std::for_each(v.begin(), v.end(), [&](T& t) { From f5d65cea90e01fe686161b8ff28e68f5a92bef96 Mon Sep 17 00:00:00 2001 From: Hari Hara Naveen S Date: Sat, 12 Aug 2023 13:25:52 -0500 Subject: [PATCH 11/12] remove unseq Signed-off-by: Hari Hara Naveen S --- .../include/hpx/parallel/algorithms/remove.hpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/libs/core/algorithms/include/hpx/parallel/algorithms/remove.hpp b/libs/core/algorithms/include/hpx/parallel/algorithms/remove.hpp index def8fdd72d5f..a813e927e30b 100644 --- a/libs/core/algorithms/include/hpx/parallel/algorithms/remove.hpp +++ b/libs/core/algorithms/include/hpx/parallel/algorithms/remove.hpp @@ -247,12 +247,13 @@ namespace hpx::parallel { namespace detail { /// \cond NOINTERNAL - template + template constexpr Iter sequential_remove_if( - Iter first, Sent last, Pred pred, Proj proj) + ExPolicy, Iter first, Sent last, Pred pred, Proj proj) { - first = hpx::parallel::detail::sequential_find_if< - hpx::execution::sequenced_policy>(first, last, pred, proj); + first = hpx::parallel::detail::sequential_find_if( + first, last, pred, proj); if (first != last) { @@ -275,11 +276,12 @@ namespace hpx::parallel { template - static constexpr Iter sequential( - ExPolicy, Iter first, Sent last, Pred&& pred, Proj&& proj) + static constexpr Iter sequential(ExPolicy&& policy, Iter first, + Sent last, Pred&& pred, Proj&& proj) { - return sequential_remove_if(first, last, - HPX_FORWARD(Pred, pred), HPX_FORWARD(Proj, proj)); + return sequential_remove_if(HPX_FORWARD(ExPolicy, policy), + first, last, HPX_FORWARD(Pred, pred), + HPX_FORWARD(Proj, proj)); } template Date: Wed, 6 Sep 2023 10:54:25 -0500 Subject: [PATCH 12/12] added concepts header Signed-off-by: Hari Hara Naveen S --- libs/core/algorithms/include/hpx/parallel/util/loop.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/libs/core/algorithms/include/hpx/parallel/util/loop.hpp b/libs/core/algorithms/include/hpx/parallel/util/loop.hpp index 101e36ef34b2..875837316f8d 100644 --- a/libs/core/algorithms/include/hpx/parallel/util/loop.hpp +++ b/libs/core/algorithms/include/hpx/parallel/util/loop.hpp @@ -8,6 +8,7 @@ #include #include +#include #include #include #include