Skip to content

Commit

Permalink
Merge d08891a into 616ed17
Browse files Browse the repository at this point in the history
  • Loading branch information
srinivasyadav18 authored Nov 10, 2021
2 parents 616ed17 + d08891a commit 3cba68e
Show file tree
Hide file tree
Showing 35 changed files with 2,802 additions and 1,158 deletions.
1 change: 1 addition & 0 deletions libs/core/algorithms/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ set(algorithms_headers
hpx/parallel/container_numeric.hpp
hpx/parallel/datapar.hpp
hpx/parallel/datapar/fill.hpp
hpx/parallel/datapar/find.hpp
hpx/parallel/datapar/generate.hpp
hpx/parallel/datapar/adjacent_difference.hpp
hpx/parallel/datapar/iterator_helpers.hpp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,8 @@ namespace hpx { namespace parallel { inline namespace v1 {
auto f1 = [pred_projected = std::move(pred_projected), tok](
zip_iterator it, std::size_t part_size,
std::size_t base_idx) mutable {
util::loop_idx_n(base_idx, it, part_size, tok,
util::loop_idx_n<std::decay_t<ExPolicy>>(base_idx, it,
part_size, tok,
[&pred_projected, &tok](reference t, std::size_t i) {
using hpx::get;
if (pred_projected(get<0>(t), get<1>(t)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ namespace hpx { namespace parallel { inline namespace v1 {
static bool sequential(
ExPolicy, Iter first, Sent last, F&& f, Proj&& proj)
{
return detail::sequential_find_if(first, last,
return detail::sequential_find_if<ExPolicy>(first, last,
util::invoke_projected<F, Proj>(std::forward<F>(f),
std::forward<Proj>(proj))) == last;
}
Expand All @@ -292,14 +292,9 @@ namespace hpx { namespace parallel { inline namespace v1 {
proj = std::forward<Proj>(proj)](
FwdIter part_begin,
std::size_t part_count) mutable -> bool {
util::loop_n<std::decay_t<ExPolicy>>(part_begin, part_count,
tok, [&op, &tok, &proj](FwdIter const& curr) {
if (hpx::util::invoke(
op, hpx::util::invoke(proj, *curr)))
{
tok.cancel();
}
});
detail::sequential_find_if<std::decay_t<ExPolicy>>(
part_begin, part_count, tok, std::forward<F>(op),
std::forward<Proj>(proj));

return !tok.was_cancelled();
};
Expand All @@ -308,7 +303,8 @@ namespace hpx { namespace parallel { inline namespace v1 {
std::forward<ExPolicy>(policy), first,
detail::distance(first, last), std::move(f1),
[](std::vector<hpx::future<bool>>&& results) {
return detail::sequential_find_if_not(
return detail::sequential_find_if_not<
hpx::execution::sequenced_policy>(
hpx::util::begin(results),
hpx::util::end(results),
[](hpx::future<bool>& val) {
Expand Down Expand Up @@ -369,7 +365,7 @@ namespace hpx { namespace parallel { inline namespace v1 {
static bool sequential(
ExPolicy, Iter first, Sent last, F&& f, Proj&& proj)
{
return detail::sequential_find_if(first, last,
return detail::sequential_find_if<ExPolicy>(first, last,
util::invoke_projected<F, Proj>(std::forward<F>(f),
std::forward<Proj>(proj))) != last;
}
Expand All @@ -391,14 +387,9 @@ namespace hpx { namespace parallel { inline namespace v1 {
proj = std::forward<Proj>(proj)](
FwdIter part_begin,
std::size_t part_count) mutable -> bool {
util::loop_n<std::decay_t<ExPolicy>>(part_begin, part_count,
tok, [&op, &tok, &proj](FwdIter const& curr) {
if (hpx::util::invoke(
op, hpx::util::invoke(proj, *curr)))
{
tok.cancel();
}
});
detail::sequential_find_if<std::decay_t<ExPolicy>>(
part_begin, part_count, tok, std::forward<F>(op),
std::forward<Proj>(proj));

return tok.was_cancelled();
};
Expand All @@ -407,7 +398,8 @@ namespace hpx { namespace parallel { inline namespace v1 {
std::forward<ExPolicy>(policy), first,
detail::distance(first, last), std::move(f1),
[](std::vector<hpx::future<bool>>&& results) {
return detail::sequential_find_if(
return detail::sequential_find_if<
hpx::execution::sequenced_policy>(
hpx::util::begin(results),
hpx::util::end(results),
[](hpx::future<bool>& val) {
Expand Down Expand Up @@ -468,7 +460,7 @@ namespace hpx { namespace parallel { inline namespace v1 {
static bool sequential(
ExPolicy, Iter first, Sent last, F&& f, Proj&& proj)
{
return detail::sequential_find_if_not(first, last,
return detail::sequential_find_if_not<ExPolicy>(first, last,
std::forward<F>(f),
std::forward<Proj>(proj)) == last;
}
Expand All @@ -490,14 +482,9 @@ namespace hpx { namespace parallel { inline namespace v1 {
proj = std::forward<Proj>(proj)](
FwdIter part_begin,
std::size_t part_count) mutable -> bool {
util::loop_n<std::decay_t<ExPolicy>>(part_begin, part_count,
tok, [&op, &tok, &proj](FwdIter const& curr) {
if (!hpx::util::invoke(
op, hpx::util::invoke(proj, *curr)))
{
tok.cancel();
}
});
detail::sequential_find_if_not<std::decay_t<ExPolicy>>(
part_begin, part_count, tok, std::forward<F>(op),
std::forward<Proj>(proj));

return !tok.was_cancelled();
};
Expand All @@ -506,7 +493,8 @@ namespace hpx { namespace parallel { inline namespace v1 {
std::forward<ExPolicy>(policy), first,
detail::distance(first, last), std::move(f1),
[](std::vector<hpx::future<bool>>&& results) {
return detail::sequential_find_if_not(
return detail::sequential_find_if_not<
hpx::execution::sequenced_policy>(
hpx::util::begin(results),
hpx::util::end(results),
[](hpx::future<bool>& val) {
Expand Down
Loading

0 comments on commit 3cba68e

Please sign in to comment.