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

added new copy signatures for shp and mhp #640

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 0 additions & 4 deletions benchmarks/gbench/common/sort.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,7 @@ class DRSortFixture : public benchmark::Fixture {
a = new xhp::distributed_vector<T>(default_vector_size);
std::vector<T> local(default_vector_size);
fill_random(local);
#ifdef BENCH_SHP
xhp::copy(local.begin(), local.end(), rng::begin(*a));
#else
xhp::copy(local, rng::begin(*a));
#endif
}

void TearDown(::benchmark::State &) { delete a; }
Expand Down
11 changes: 11 additions & 0 deletions include/dr/mhp/algorithms/copy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,17 @@ void copy(DI_IN &&first, DI_IN &&last, dr::distributed_iterator auto &&out) {
copy(rng::subrange(first, last), out);
}

template <std::contiguous_iterator CI_IN>
void copy(CI_IN &&first, CI_IN &&last,
dr::distributed_contiguous_iterator auto out) {
copy(0, rng::subrange(first, last), out);
}

template <rng::contiguous_range CR_IN>
void copy(CR_IN &&in, dr::distributed_contiguous_iterator auto out) {
copy(0, in, out);
}

/// Copy distributed to local
void copy(std::size_t root, dr::distributed_contiguous_range auto &&in,
std::contiguous_iterator auto out) {
Expand Down
5 changes: 5 additions & 0 deletions include/dr/shp/algorithms/copy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,11 @@ sycl::event copy_async(InputIt first, InputIt last, OutputIt d_first) {
return dr::shp::__detail::combine_events(events);
}

template <rng::contiguous_range InputIt, dr::distributed_iterator OutputIt>
void copy(InputIt first, OutputIt d_first) {
copy(rng::begin(first), rng::end(first), d_first);
}

template <std::forward_iterator InputIt, dr::distributed_iterator OutputIt>
requires __detail::is_syclmemcopyable<std::iter_value_t<InputIt>,
std::iter_value_t<OutputIt>>
Expand Down