-
-
Notifications
You must be signed in to change notification settings - Fork 460
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
loop and transform_loop unseq adaptation #6017
Conversation
Can one of the admins verify this patch? |
ok to test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we could reduce the amount of code duplication in loop.hpp et.al. by enabling the tag_invoke overloads for unseq for random_access iterators only.
template <typename Begin, typename End, typename F> | ||
HPX_HOST_DEVICE HPX_FORCEINLINE static typename std::enable_if< | ||
!hpx::traits::is_random_access_iterator_v<Begin>, Begin>::type | ||
call(Begin it, End end, F&& f) | ||
{ | ||
for (/* */; it != end; it++) | ||
{ | ||
HPX_INVOKE(f, it); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we make this fall back to the existing non-vectorized implementation?
template <typename Begin, typename End, typename CancelToken, | ||
typename F> | ||
HPX_HOST_DEVICE HPX_FORCEINLINE static typename std::enable_if< | ||
!hpx::traits::is_random_access_iterator_v<Begin>, Begin>::type | ||
call(Begin it, End end, CancelToken& tok, | ||
F&& f) | ||
{ | ||
for (/* */; it != end; ++it) | ||
{ | ||
HPX_INVOKE(f, it); | ||
if (tok.was_cancelled()) | ||
return it; | ||
} | ||
return it; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here: Could we make this fall back to the existing non-vectorized implementation?
template <typename Begin, typename End, typename F> | ||
HPX_HOST_DEVICE HPX_FORCEINLINE static typename std::enable_if< | ||
!hpx::traits::is_random_access_iterator_v<Begin>, Begin>::type | ||
call(Begin it, End end, F&& f) | ||
{ | ||
for (/* */; it != end; ++it) | ||
{ | ||
HPX_INVOKE(f, *it); | ||
} | ||
return it; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we make this fall back to the existing non-vectorized implementation? This comment applies to many more places in this file below.
6018: transform_reduce unseq adaptation r=hkaiser a=akcube ## Proposed Changes - New `unseq_reduce` CPOs to accept `unseq` overloads from `transform_reduce`, `reduce` and `transform_reduce_binary` algorithms. - Adds overloads to accept `unseq` and `par_unseq` overloads for the same algorithms. - Unit tests for all three algorithms ## Any background context you want to provide? This is based off of #6017 Co-authored-by: akcube <a.kishorekumar@students.iiit.ac.in> Co-authored-by: Hartmut Kaiser <hartmut.kaiser@gmail.com>
@akcube can you please help me out with how I can run the algorithms using the par_unseq execution policy? I am not able to be unseq/loop.hpp in my hpx installation
also I did place a breakpoint at loop.hpp and did find the execution breaking over here. Was this the expected behaviour? |
Proposed Changes
util::loop
andtransform_loop
. Will affecttransform
,for_each
andfor_loop
.Any background context you want to provide?
This is based on #6016