loop and transform_loop unseq adaptation - #6017
Conversation
|
Can one of the admins verify this patch? |
|
ok to test |
hkaiser
left a comment
There was a problem hiding this comment.
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.
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.
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.
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::loopandtransform_loop. Will affecttransform,for_eachandfor_loop.Any background context you want to provide?
This is based on #6016