Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simd all any none #5638

Merged
merged 12 commits into from
Nov 12, 2021
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