Skip to content

Add parallel distributed algorithms for segmented copy and copy_if#7253

Open
arpittkhandelwal wants to merge 1 commit intoTheHPXProject:masterfrom
arpittkhandelwal:feature/segmented-copy
Open

Add parallel distributed algorithms for segmented copy and copy_if#7253
arpittkhandelwal wants to merge 1 commit intoTheHPXProject:masterfrom
arpittkhandelwal:feature/segmented-copy

Conversation

@arpittkhandelwal
Copy link
Copy Markdown
Contributor

Description

This PR extends HPX's distributed algorithms library by implementing parallel, distributed-aware segmented_copy and segmented_copy_if algorithms for hpx::partitioned_vector.

Previously, applying these algorithms to a partitioned vector would fall back to sequential or non-segmented executions, which resulted in suboptimal performance and cross-node data transfer bottlenecks. This implementation directly maps the execution to the underlying segments (localities) using asynchronous dataflow execution and localized dispatching.

Key Changes:

  • Implementation: Added the cross-locality dispatch logic in libs/full/segmented_algorithms/include/hpx/parallel/segmented_algorithms/copy.hpp.
  • CPO Registration: Registered the segmented tag_invoke overloads for both hpx::copy_t and hpx::copy_if_t within the hpx::segmented namespace.
  • Header Integration: Hooked the algorithms into hpx/parallel/segmented_algorithm.hpp and exposed them globally via hpx/include/parallel_copy.hpp.
  • Testing: Expanded partitioned_vector_copy.cpp to validate cross-node data movement, multi-partition behavior, and sequential/parallel policy integration for both standard and _async variants.

Testing:

  • Successfully compiled all test targets with ninja tests.unit.modules.segmented_algorithms.partitioned_vector_copy.
  • Tested across both sequenced (hpx::execution::seq) and parallel (hpx::execution::par) execution policies.

Copilot AI review requested due to automatic review settings May 6, 2026 02:38
@arpittkhandelwal arpittkhandelwal requested a review from hkaiser as a code owner May 6, 2026 02:38
@codacy-production
Copy link
Copy Markdown

codacy-production Bot commented May 6, 2026

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds segmented (distributed-aware) implementations of copy and copy_if intended to execute across hpx::partitioned_vector segments/localities, and wires them into the segmented algorithms umbrella headers and public include entry point.

Changes:

  • Added a new segmented algorithms header implementing tag_invoke overloads for hpx::copy_t and hpx::copy_if_t.
  • Integrated the new header into hpx/parallel/segmented_algorithm.hpp and hpx/include/parallel_copy.hpp.
  • Expanded the partitioned_vector_copy.cpp unit test to cover copy_if (sync/async, seq/par policies).

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

File Description
libs/full/segmented_algorithms/tests/unit/partitioned_vector_copy.cpp Adds new copy_if tests for partitioned_vector (sync + task-based async).
libs/full/segmented_algorithms/include/hpx/parallel/segmented_algorithms/copy.hpp New segmented implementations and CPO registrations for copy/copy_if.
libs/full/segmented_algorithms/include/hpx/parallel/segmented_algorithm.hpp Includes the new segmented copy.hpp in the umbrella segmented algorithm header.
libs/full/include/include/hpx/include/parallel_copy.hpp Exposes the segmented copy/copy_if implementation via the public include header.

Comment thread libs/full/segmented_algorithms/tests/unit/partitioned_vector_copy.cpp Outdated
Comment thread libs/full/segmented_algorithms/include/hpx/parallel/segmented_algorithms/copy.hpp Outdated
Comment thread libs/full/segmented_algorithms/include/hpx/parallel/segmented_algorithms/copy.hpp Outdated
@arpittkhandelwal arpittkhandelwal force-pushed the feature/segmented-copy branch from 9b560be to ac8a89e Compare May 6, 2026 02:57
Copilot AI review requested due to automatic review settings May 6, 2026 03:13
@arpittkhandelwal arpittkhandelwal force-pushed the feature/segmented-copy branch from ac8a89e to 4382751 Compare May 6, 2026 03:13
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

Comment thread libs/full/segmented_algorithms/CMakeLists.txt Outdated
Comment thread libs/full/segmented_algorithms/include/hpx/parallel/segmented_algorithms/copy.hpp Outdated
Comment thread libs/full/segmented_algorithms/include/hpx/parallel/segmented_algorithms/copy.hpp Outdated
Comment thread libs/full/segmented_algorithms/include/hpx/parallel/segmented_algorithms/copy.hpp Outdated
@arpittkhandelwal arpittkhandelwal force-pushed the feature/segmented-copy branch from 4382751 to 85693a0 Compare May 6, 2026 03:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants