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

Add unit test cases and fixes for the S/R versions of the parallel algorithms #6494

Merged
merged 48 commits into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
79d0fbc
Add more unit tests for S/R algorithms
zhekemist May 22, 2024
0314c06
fix whitespace issues indicated by "inspect"
zhekemist May 22, 2024
56b7249
Change usages of tt::sync_wait to function calls
zhekemist May 25, 2024
dadf073
Add the remaining S/R test cases
zhekemist May 28, 2024
75605fe
Add missing include
zhekemist May 28, 2024
e5a7f75
Merge branch 'STEllAR-GROUP:master' into add-sr-unit-tests
zhekemist Jun 28, 2024
9405f50
Fix S/R adaptors of some parallel algorithms
zhekemist Jul 9, 2024
2baa8be
Add missing include
zhekemist Jul 9, 2024
5aa62d6
Fix error in `adjacent_find`
zhekemist Jul 9, 2024
679c8ac
Fix formatting issues
zhekemist Jul 9, 2024
1f3738a
Fix CMake formatting issues
zhekemist Jul 9, 2024
f3248db
Add CircleCI targets, fix `CMakeLists` for algorithm unit tests
zhekemist Jul 9, 2024
83a180f
Squash merge PR #6431, switching to NVIDIA's S/R implementation
zhekemist Jul 29, 2024
e4b3eb9
Revert temporary fix of then sender
zhekemist Jul 17, 2024
8bf92e8
Add guard against invocables returning booleans
zhekemist Jul 29, 2024
ffd7842
Fix S/R adaptors of more parallel algorithms
zhekemist Jul 29, 2024
087c8b2
Update CircleCI targets
zhekemist Jul 29, 2024
a101036
Fix CircleCI targets
zhekemist Jul 29, 2024
65e35d8
Merge branch 'master' into add-sr-unit-tests
zhekemist Jul 29, 2024
03cc5aa
Use C++20 for HPX in CircleCI
zhekemist Jul 29, 2024
22e5bc3
Upgrade CircleCI build environment
zhekemist Jul 30, 2024
a60d958
Fix tool versions in CircleCI config
zhekemist Jul 30, 2024
c41aac7
Try experimental, temporary CircleCI fix
zhekemist Jul 30, 2024
30d71fb
Temporarily adjust clang-tidy config
zhekemist Jul 30, 2024
6880e02
Temporarily disable clang-tidy, clang-format
zhekemist Jul 31, 2024
e193798
Fix minor errors
zhekemist Aug 1, 2024
c4f5276
Temporarily disable work requesting scheduling policy
zhekemist Aug 1, 2024
1085a10
Fix S/R adaptors of more parallel algorithms
zhekemist Aug 6, 2024
c590cdd
Update CircleCI configuration
zhekemist Aug 6, 2024
ecfaf5c
Fix minor problems
zhekemist Aug 6, 2024
f20e649
Fix S/R adaptors of more parallel algorithms
zhekemist Aug 8, 2024
568201c
Remove HPX_UNUSED_PACK macro
zhekemist Aug 8, 2024
e2baf86
Update CircleCI targets
zhekemist Aug 14, 2024
1dcd257
Fix S/R version of rotate_copy
zhekemist Aug 15, 2024
a20f1b4
Remove currently pointless S/R unit tests
zhekemist Aug 17, 2024
3443586
Conditionally disable S/R algorithm unit tests
zhekemist Aug 16, 2024
15b4be5
Fix formatting
zhekemist Aug 17, 2024
e0178e3
Make minor adjustments in unit tests
zhekemist Aug 18, 2024
1cfafee
Fix minor errors
zhekemist Aug 19, 2024
a219c74
Make minor cleanups
zhekemist Aug 19, 2024
2f41d32
Revert squash merging PR #6431
zhekemist Aug 20, 2024
c4aad3a
Revert CircleCI configuration changes
zhekemist Aug 20, 2024
c2afce0
Remove S/R tests from CircleCI targets
zhekemist Aug 20, 2024
1c24595
Merge branch 'STEllAR-GROUP:master' into add-sr-unit-tests
zhekemist Aug 20, 2024
5a2d965
Revert remaining unrelated changes
zhekemist Aug 20, 2024
46a4883
Fix findend regression test
zhekemist Aug 21, 2024
0344d00
Merge branch 'STEllAR-GROUP:master' into add-sr-unit-tests
zhekemist Aug 26, 2024
e35074d
Accommodate removal of transfer_just
zhekemist Aug 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions .circleci/tests.unit1.algorithms
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

tests.unit.modules.algorithms.algorithms.adjacentdifference
tests.unit.modules.algorithms.algorithms.adjacentdifference_sender
tests.unit.modules.algorithms.algorithms.adjacentfind
tests.unit.modules.algorithms.algorithms.adjacentfind_binary
tests.unit.modules.algorithms.algorithms.all_of
Expand All @@ -31,7 +30,6 @@ tests.unit.modules.algorithms.algorithms.exclusive_scan_validate
tests.unit.modules.algorithms.algorithms.fill
tests.unit.modules.algorithms.algorithms.filln
tests.unit.modules.algorithms.algorithms.find
tests.unit.modules.algorithms.algorithms.find_sender
tests.unit.modules.algorithms.algorithms.findend
tests.unit.modules.algorithms.algorithms.findfirstof
tests.unit.modules.algorithms.algorithms.findfirstof_binary
Expand All @@ -40,7 +38,6 @@ tests.unit.modules.algorithms.algorithms.findifnot
tests.unit.modules.algorithms.algorithms.foreach
tests.unit.modules.algorithms.algorithms.foreach_executors
tests.unit.modules.algorithms.algorithms.foreach_prefetching
tests.unit.modules.algorithms.algorithms.foreach_sender
tests.unit.modules.algorithms.algorithms.foreach_scheduler
tests.unit.modules.algorithms.algorithms.foreachn
tests.unit.modules.algorithms.algorithms.foreachn_exception
Expand All @@ -53,7 +50,6 @@ tests.unit.modules.algorithms.algorithms.for_loop_n
tests.unit.modules.algorithms.algorithms.for_loop_n_strided
tests.unit.modules.algorithms.algorithms.for_loop_reduction
tests.unit.modules.algorithms.algorithms.for_loop_reduction_async
tests.unit.modules.algorithms.algorithms.for_loop_sender
tests.unit.modules.algorithms.algorithms.for_loop_strided
tests.unit.modules.algorithms.algorithms.generate
tests.unit.modules.algorithms.algorithms.generaten
Expand All @@ -74,3 +70,5 @@ tests.unit.modules.algorithms.algorithms.min_element
tests.unit.modules.algorithms.algorithms.minmax_element
tests.unit.modules.algorithms.algorithms.mismatch
tests.unit.modules.algorithms.algorithms.mismatch_binary
tests.unit.modules.algorithms.algorithms.move
tests.unit.modules.algorithms.algorithms.nth_element
5 changes: 0 additions & 5 deletions .circleci/tests.unit2.algorithms
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

tests.unit.modules.algorithms.algorithms.move
tests.unit.modules.algorithms.algorithms.nth_element
tests.unit.modules.algorithms.algorithms.none_of
tests.unit.modules.algorithms.algorithms.parallel_sort
tests.unit.modules.algorithms.algorithms.partial_sort
Expand All @@ -15,7 +13,6 @@ tests.unit.modules.algorithms.algorithms.partition_copy
tests.unit.modules.algorithms.algorithms.reduce_
tests.unit.modules.algorithms.algorithms.reduce_by_key
tests.unit.modules.algorithms.algorithms.remove
tests.unit.modules.algorithms.algorithms.remove
tests.unit.modules.algorithms.algorithms.remove1
tests.unit.modules.algorithms.algorithms.remove2
tests.unit.modules.algorithms.algorithms.remove_if
Expand All @@ -28,10 +25,8 @@ tests.unit.modules.algorithms.algorithms.replace_copy
tests.unit.modules.algorithms.algorithms.replace_copy_if
tests.unit.modules.algorithms.algorithms.reverse
tests.unit.modules.algorithms.algorithms.reverse_copy
tests.unit.modules.algorithms.algorithms.reverse_sender
tests.unit.modules.algorithms.algorithms.rotate
tests.unit.modules.algorithms.algorithms.rotate_copy
tests.unit.modules.algorithms.algorithms.rotate_sender
tests.unit.modules.algorithms.algorithms.search
tests.unit.modules.algorithms.algorithms.searchn
tests.unit.modules.algorithms.algorithms.set_difference
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,27 +276,34 @@ namespace hpx::parallel {
util::detail::algorithm_result<ExPolicy, FwdIter2>;
using difference_type =
typename std::iterator_traits<FwdIter1>::difference_type;

constexpr bool scheduler_policy =
constexpr bool has_scheduler_policy =
hpx::execution_policy_has_scheduler_executor_v<ExPolicy>;

if constexpr (!scheduler_policy)
FwdIter1 prev = first;
difference_type count;

if (first == last)
{
if (first == last)
if constexpr (!has_scheduler_policy)
{
return result::get(HPX_MOVE(dest));
}
else
{
count = static_cast<difference_type>(0);
}
}
else
{
count = detail::distance(first, last) - 1;

difference_type count = detail::distance(first, last) - 1;

FwdIter1 prev = first;
hpx::traits::proxy_value_t<
typename std::iterator_traits<FwdIter1>::value_type>
tmp = *first++;
*dest++ = HPX_MOVE(tmp);
hpx::traits::proxy_value_t<
typename std::iterator_traits<FwdIter1>::value_type>
tmp = *first++;
*dest++ = HPX_MOVE(tmp);
}

if constexpr (!scheduler_policy)
if constexpr (!has_scheduler_policy)
{
if (count == 0)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,18 +173,24 @@ namespace hpx::parallel {

template <typename ExPolicy, typename FwdIter, typename Sent_,
typename Pred, typename Proj>
static util::detail::algorithm_result_t<ExPolicy, FwdIter> parallel(
ExPolicy&& orgpolicy, FwdIter first, Sent_ last, Pred&& pred,
Proj&& proj)
static decltype(auto) parallel(ExPolicy&& orgpolicy, FwdIter first,
Sent_ last, Pred&& pred, Proj&& proj)
{
using zip_iterator = hpx::util::zip_iterator<FwdIter, FwdIter>;
using difference_type =
typename std::iterator_traits<FwdIter>::difference_type;
using result =
util::detail::algorithm_result<ExPolicy, FwdIter>;

if (first == last)
constexpr bool has_scheduler_executor =
hpx::execution_policy_has_scheduler_executor_v<ExPolicy>;

if constexpr (!has_scheduler_executor)
{
return util::detail::algorithm_result<ExPolicy,
FwdIter>::get(HPX_MOVE(last));
if (first == last)
{
return result::get(HPX_MOVE(last));
}
}

decltype(auto) policy = parallel::util::adapt_placement_mode(
Expand All @@ -209,10 +215,15 @@ namespace hpx::parallel {
};

auto f2 = [tok, count, first, last](
auto&& data) mutable -> FwdIter {
// make sure iterators embedded in function object that is
// attached to futures are invalidated
util::detail::clear_container(data);
auto&&... data) mutable -> FwdIter {
static_assert(sizeof...(data) < 2);
if constexpr (sizeof...(data) == 1)
{
// make sure iterators embedded in function object that
// is attached to futures are invalidated
util::detail::clear_container(data...);
}

difference_type adj_find_res = tok.get_data();
if (adj_find_res != count)
{
Expand All @@ -222,9 +233,16 @@ namespace hpx::parallel {
{
first = last;
}
return HPX_MOVE(first);
return first;
};

if constexpr (has_scheduler_executor)
{
// underflow prevention for the upcoming call
if (count == 0)
++count;
}

using partitioner_type =
util::partitioner<policy_type, FwdIter, void>;
return partitioner_type::call_with_index(
Expand Down Expand Up @@ -269,10 +287,8 @@ namespace hpx {
hpx::traits::is_forward_iterator_v<FwdIter>
)>
// clang-format on
friend typename parallel::util::detail::algorithm_result<ExPolicy,
FwdIter>::type
tag_fallback_invoke(hpx::adjacent_find_t, ExPolicy&& policy,
FwdIter first, FwdIter last, Pred pred = Pred())
friend decltype(auto) tag_fallback_invoke(hpx::adjacent_find_t,
ExPolicy&& policy, FwdIter first, FwdIter last, Pred pred = Pred())
{
static_assert(hpx::traits::is_forward_iterator_v<FwdIter>,
"Requires at least a forward iterator");
Expand Down
Loading
Loading