Skip to content

Commit 9139a6f

Browse files
authored
Merge branch 'master' into custom_hookup
2 parents e744704 + 37c665c commit 9139a6f

31 files changed

Lines changed: 399 additions & 224 deletions

File tree

libs/core/algorithms/include/hpx/parallel/algorithms/adjacent_difference.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ namespace hpx::parallel {
316316
std::size_t part_size) mutable {
317317
// VS2015RC bails out when op is captured by ref
318318
using hpx::get;
319-
util::loop_n<std::decay_t<ExPolicy>>(
319+
util::const_loop_n<std::decay_t<ExPolicy>>(
320320
part_begin, part_size, [op](auto&& it) mutable {
321321
get<2>(*it) =
322322
HPX_INVOKE(op, get<0>(*it), get<1>(*it));

libs/core/algorithms/include/hpx/parallel/algorithms/copy.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,8 @@ namespace hpx::parallel {
590590
// below makes gcc generate errors
591591

592592
// MSVC complains if proj is captured by ref below
593-
util::loop_n<std::decay_t<ExPolicy>>(part_begin, part_size,
593+
util::const_loop_n<std::decay_t<ExPolicy>>(part_begin,
594+
part_size,
594595
[&pred, proj, &curr](zip_iterator it) mutable -> void {
595596
bool f = hpx::invoke(
596597
pred, hpx::invoke(proj, get<0>(*it)));
@@ -606,8 +607,8 @@ namespace hpx::parallel {
606607
std::size_t part_size, std::size_t val) mutable {
607608
HPX_UNUSED(flags);
608609
std::advance(dest, val);
609-
util::loop_n<std::decay_t<ExPolicy>>(part_begin, part_size,
610-
[&dest](zip_iterator it) mutable {
610+
util::const_loop_n<std::decay_t<ExPolicy>>(part_begin,
611+
part_size, [&dest](zip_iterator it) mutable {
611612
if (get<1>(*it))
612613
*dest++ = get<0>(*it);
613614
});
@@ -789,8 +790,7 @@ namespace hpx {
789790
>
790791
)
791792
// clang-format on
792-
friend typename hpx::parallel::util::detail::algorithm_result<ExPolicy,
793-
FwdIter2>::type
793+
friend parallel::util::detail::algorithm_result_t<ExPolicy, FwdIter2>
794794
tag_fallback_invoke(hpx::copy_if_t, ExPolicy&& policy, FwdIter1 first,
795795
FwdIter1 last, FwdIter2 dest, Pred pred)
796796
{

libs/core/algorithms/include/hpx/parallel/algorithms/count.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ namespace hpx::parallel {
277277
operator()(Iter part_begin, std::size_t part_size)
278278
{
279279
typename std::iterator_traits<Iter>::difference_type ret = 0;
280-
util::loop_n<execution_policy_type>(part_begin, part_size,
280+
util::const_loop_n<execution_policy_type>(part_begin, part_size,
281281
hpx::bind_back(*this, std::ref(ret)));
282282
return ret;
283283
}
@@ -313,7 +313,7 @@ namespace hpx::parallel {
313313

314314
typename std::iterator_traits<InIterB>::difference_type ret = 0;
315315

316-
util::loop(HPX_FORWARD(ExPolicy, policy), first, last,
316+
util::const_loop(HPX_FORWARD(ExPolicy, policy), first, last,
317317
hpx::bind_back(HPX_MOVE(f1), std::ref(ret)));
318318

319319
return ret;
@@ -379,7 +379,7 @@ namespace hpx::parallel {
379379

380380
typename std::iterator_traits<InIterB>::difference_type ret = 0;
381381

382-
util::loop(HPX_FORWARD(ExPolicy, policy), first, last,
382+
util::const_loop(HPX_FORWARD(ExPolicy, policy), first, last,
383383
hpx::bind_back(HPX_MOVE(f1), std::ref(ret)));
384384

385385
return ret;

libs/core/algorithms/include/hpx/parallel/algorithms/destroy.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ namespace hpx::parallel {
209209
return util::foreach_partitioner<ExPolicy>::call(
210210
HPX_FORWARD(ExPolicy, policy), first, count,
211211
[](Iter first, std::size_t count, std::size_t) {
212-
return util::loop_n<std::decay_t<ExPolicy>>(
212+
return util::const_loop_n<std::decay_t<ExPolicy>>(
213213
first, count, [](Iter it) -> void {
214214
std::destroy_at(std::addressof(*it));
215215
});

libs/core/algorithms/include/hpx/parallel/algorithms/detail/contains.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ namespace hpx::parallel::detail {
4848
Iterator first, T const& val, std::size_t count, Token& tok,
4949
Proj&& proj)
5050
{
51-
util::loop_n<ExPolicy>(
51+
util::const_loop_n<ExPolicy>(
5252
first, count, tok, [&val, &tok, &proj](auto const& cur) {
5353
if (HPX_INVOKE(proj, *cur) == val)
5454
{

libs/core/algorithms/include/hpx/parallel/algorithms/detail/equal.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ namespace hpx::parallel::detail {
3434
friend constexpr void tag_fallback_invoke(sequential_equal_t,
3535
ZipIterator it, std::size_t part_count, Token& tok, F&& f)
3636
{
37-
util::loop_n<ExPolicy>(it, part_count, tok,
37+
util::const_loop_n<ExPolicy>(it, part_count, tok,
3838
[&f, &tok](auto const& curr) mutable -> void {
3939
auto t = *curr;
4040
if (!HPX_INVOKE(f, hpx::get<0>(t), hpx::get<1>(t)))
@@ -98,7 +98,7 @@ namespace hpx::parallel::detail {
9898
ZipIterator it, std::size_t part_count, Token& tok, F&& f,
9999
Proj1&& proj1, Proj2&& proj2)
100100
{
101-
util::loop_n<ExPolicy>(it, part_count, tok,
101+
util::const_loop_n<ExPolicy>(it, part_count, tok,
102102
[&f, &proj1, &proj2, &tok](auto const& curr) mutable -> void {
103103
auto t = *curr;
104104
if (!hpx::invoke(f, hpx::invoke(proj1, hpx::get<0>(t)),

libs/core/algorithms/include/hpx/parallel/algorithms/detail/find.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ namespace hpx::parallel::detail {
102102
sequential_find_if_t<ExPolicy>, FwdIter part_begin,
103103
std::size_t part_count, Token& tok, F&& op, Proj&& proj)
104104
{
105-
util::loop_n<std::decay_t<ExPolicy>>(part_begin, part_count, tok,
106-
[&op, &tok, &proj](auto const& curr) {
105+
util::const_loop_n<std::decay_t<ExPolicy>>(part_begin, part_count,
106+
tok, [&op, &tok, &proj](auto const& curr) {
107107
if (HPX_INVOKE(op, HPX_INVOKE(proj, *curr)))
108108
{
109109
tok.cancel();
@@ -184,8 +184,8 @@ namespace hpx::parallel::detail {
184184
sequential_find_if_not_t<ExPolicy>, FwdIter part_begin,
185185
std::size_t part_count, Token& tok, F&& op, Proj&& proj)
186186
{
187-
util::loop_n<std::decay_t<ExPolicy>>(part_begin, part_count, tok,
188-
[&op, &tok, &proj](auto const& curr) {
187+
util::const_loop_n<std::decay_t<ExPolicy>>(part_begin, part_count,
188+
tok, [&op, &tok, &proj](auto const& curr) {
189189
if (!HPX_INVOKE(op, HPX_INVOKE(proj, *curr)))
190190
{
191191
tok.cancel();

libs/core/algorithms/include/hpx/parallel/algorithms/detail/iota.hpp

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -102,23 +102,18 @@ namespace hpx::parallel::detail {
102102
{
103103
auto dist = hpx::parallel::detail::distance(first, last);
104104

105-
// clang-format off
106105
auto f = [value](FwdIter part_begin, std::size_t part_size,
107106
std::size_t global_index) {
108107
T cur_value = value + global_index;
109-
return util::loop_n<std::decay_t<Expolicy>>(
110-
part_begin,
111-
part_size,
108+
return util::const_loop_n<std::decay_t<Expolicy>>(
109+
part_begin, part_size,
112110
[&cur_value](FwdIter it) { *it = cur_value++; });
113111
};
114112

115-
return util::partitioner<Expolicy, FwdIter, FwdIter>::call_with_index(
116-
HPX_FORWARD(Expolicy, policy),
117-
first,
118-
dist, 1,
119-
std::move(f),
113+
return util::partitioner<Expolicy, FwdIter,
114+
FwdIter>::call_with_index(HPX_FORWARD(Expolicy, policy),
115+
first, dist, 1, std::move(f),
120116
[last = first + dist](auto&&) { return last; });
121-
// clang-format on
122117
}
123118
else
124119
{

libs/core/algorithms/include/hpx/parallel/algorithms/exclusive_scan.hpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -409,8 +409,8 @@ namespace hpx::parallel {
409409
*dst++ = val;
410410

411411
// MSVC 2015 fails if op is captured by reference
412-
util::loop_n<std::decay_t<ExPolicy>>(dst, part_size - 1,
413-
[=, &val](FwdIter2 it) mutable -> void {
412+
util::const_loop_n<std::decay_t<ExPolicy>>(dst,
413+
part_size - 1, [=, &val](FwdIter2 it) mutable -> void {
414414
*it = HPX_INVOKE(op, val, *it);
415415
});
416416
};
@@ -495,8 +495,7 @@ namespace hpx {
495495
hpx::traits::is_iterator_v<FwdIter2>
496496
)
497497
// clang-format on
498-
friend typename parallel::util::detail::algorithm_result<ExPolicy,
499-
FwdIter2>::type
498+
friend parallel::util::detail::algorithm_result_t<ExPolicy, FwdIter2>
500499
tag_fallback_invoke(hpx::exclusive_scan_t, ExPolicy&& policy,
501500
FwdIter1 first, FwdIter1 last, FwdIter2 dest, T init)
502501
{
@@ -557,8 +556,7 @@ namespace hpx {
557556
>
558557
)
559558
// clang-format on
560-
friend typename parallel::util::detail::algorithm_result<ExPolicy,
561-
FwdIter2>::type
559+
friend parallel::util::detail::algorithm_result_t<ExPolicy, FwdIter2>
562560
tag_fallback_invoke(hpx::exclusive_scan_t, ExPolicy&& policy,
563561
FwdIter1 first, FwdIter1 last, FwdIter2 dest, T init, Op op)
564562
{

libs/core/algorithms/include/hpx/parallel/algorithms/for_each_index.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,13 +137,13 @@ namespace hpx::parallel::detail {
137137
}
138138

139139
///////////////////////////////////////////////////////////////////////////
140-
// Functor used by the parallel partitioner.
140+
// Function object used by the parallel partitioner.
141141
//
142142
// The partitioner splits the integer range [0, extent(0)) across threads.
143143
// Each call receives a sub-range of i0 values; for each i0 we recurse
144144
// sequentially over the remaining dimensions.
145145
//
146-
// The Mapping and Fun are stored by value so the functor is
146+
// The Mapping and Fun are stored by value so the function object is
147147
// thread-safe and can be copied to GPU device memory if needed.
148148
template <typename ExPolicy, typename Mapping, typename Fun>
149149
struct for_each_index_iteration_right
@@ -332,8 +332,8 @@ namespace hpx::parallel::detail {
332332
// Parallel path.
333333
//
334334
// Dispatch is layout-aware: column-major (layout_left) mappings
335-
// parallelise the last extent and recurse inward; row-major
336-
// (layout_right) and all other layouts parallelise the first extent.
335+
// parallelize the last extent and recurse inward; row-major
336+
// (layout_right) and all other layouts parallelize the first extent.
337337
template <typename ExPolicy, typename Mapping, typename Fun>
338338
static decltype(auto) parallel(
339339
ExPolicy&& policy, Mapping const& m, Fun&& f)

0 commit comments

Comments
 (0)