From 09b6cedad120e406d68287b8151e4bca91073e99 Mon Sep 17 00:00:00 2001 From: Kacper Stefanski Date: Tue, 14 Nov 2023 21:42:39 +0100 Subject: [PATCH 1/3] added a new mhp::copy signature remove ifdef BENCH_SHP in sort --- benchmarks/gbench/common/sort.cpp | 8 ++++---- include/dr/mhp/algorithms/copy.hpp | 6 ++++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/benchmarks/gbench/common/sort.cpp b/benchmarks/gbench/common/sort.cpp index b0b8b68e06..3d6db6bdc5 100644 --- a/benchmarks/gbench/common/sort.cpp +++ b/benchmarks/gbench/common/sort.cpp @@ -21,11 +21,11 @@ class DRSortFixture : public benchmark::Fixture { a = new xhp::distributed_vector(default_vector_size); std::vector local(default_vector_size); fill_random(local); -#ifdef BENCH_SHP + // #ifdef BENCH_SHP xhp::copy(local.begin(), local.end(), rng::begin(*a)); -#else - xhp::copy(local, rng::begin(*a)); -#endif + // #else + // xhp::copy(local, rng::begin(*a)); + // #endif } void TearDown(::benchmark::State &) { delete a; } diff --git a/include/dr/mhp/algorithms/copy.hpp b/include/dr/mhp/algorithms/copy.hpp index fa53a119a3..feffb73935 100644 --- a/include/dr/mhp/algorithms/copy.hpp +++ b/include/dr/mhp/algorithms/copy.hpp @@ -25,6 +25,12 @@ void copy(DI_IN &&first, DI_IN &&last, dr::distributed_iterator auto &&out) { copy(rng::subrange(first, last), out); } +template +void copy(CI_IN &&first, CI_IN &&last, + dr::distributed_contiguous_iterator auto out) { + copy(0, rng::subrange(first, last), out); +} + /// Copy distributed to local void copy(std::size_t root, dr::distributed_contiguous_range auto &&in, std::contiguous_iterator auto out) { From a222c1b71b6323fc2ecef6ad5aa2936cc5b7c167 Mon Sep 17 00:00:00 2001 From: Kacper Stefanski Date: Tue, 28 Nov 2023 01:31:24 +0100 Subject: [PATCH 2/3] add a ranges contiguous_range mhp::copy signature --- benchmarks/gbench/common/sort.cpp | 4 ++-- include/dr/mhp/algorithms/copy.hpp | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/benchmarks/gbench/common/sort.cpp b/benchmarks/gbench/common/sort.cpp index 3d6db6bdc5..41d4d0e912 100644 --- a/benchmarks/gbench/common/sort.cpp +++ b/benchmarks/gbench/common/sort.cpp @@ -22,9 +22,9 @@ class DRSortFixture : public benchmark::Fixture { std::vector local(default_vector_size); fill_random(local); // #ifdef BENCH_SHP - xhp::copy(local.begin(), local.end(), rng::begin(*a)); + // xhp::copy(local.begin(), local.end(), rng::begin(*a)); // #else - // xhp::copy(local, rng::begin(*a)); + xhp::copy(local, rng::begin(*a)); // #endif } diff --git a/include/dr/mhp/algorithms/copy.hpp b/include/dr/mhp/algorithms/copy.hpp index feffb73935..6dbd9fe4e6 100644 --- a/include/dr/mhp/algorithms/copy.hpp +++ b/include/dr/mhp/algorithms/copy.hpp @@ -31,6 +31,11 @@ void copy(CI_IN &&first, CI_IN &&last, copy(0, rng::subrange(first, last), out); } +template +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) { From a302604b3d674d4101d3b50469e8d1fed1f90b42 Mon Sep 17 00:00:00 2001 From: Kacper Stefanski Date: Tue, 28 Nov 2023 11:45:40 +0100 Subject: [PATCH 3/3] add a ranges contiguous_range shp::copy signature --- benchmarks/gbench/common/sort.cpp | 4 ---- include/dr/shp/algorithms/copy.hpp | 5 +++++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/benchmarks/gbench/common/sort.cpp b/benchmarks/gbench/common/sort.cpp index 41d4d0e912..52698199cc 100644 --- a/benchmarks/gbench/common/sort.cpp +++ b/benchmarks/gbench/common/sort.cpp @@ -21,11 +21,7 @@ class DRSortFixture : public benchmark::Fixture { a = new xhp::distributed_vector(default_vector_size); std::vector 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; } diff --git a/include/dr/shp/algorithms/copy.hpp b/include/dr/shp/algorithms/copy.hpp index 8d59a4d99d..486228aab5 100644 --- a/include/dr/shp/algorithms/copy.hpp +++ b/include/dr/shp/algorithms/copy.hpp @@ -130,6 +130,11 @@ sycl::event copy_async(InputIt first, InputIt last, OutputIt d_first) { return dr::shp::__detail::combine_events(events); } +template +void copy(InputIt first, OutputIt d_first) { + copy(rng::begin(first), rng::end(first), d_first); +} + template requires __detail::is_syclmemcopyable, std::iter_value_t>