8 #include <coro/event.hpp>
10 #include <rapidsmpf/shuffler/shuffler.hpp>
11 #include <rapidsmpf/streaming/core/actor.hpp>
12 #include <rapidsmpf/streaming/core/channel.hpp>
13 #include <rapidsmpf/streaming/core/context.hpp>
14 #include <rapidsmpf/streaming/cudf/partition.hpp>
61 std::shared_ptr<Context>
ctx,
62 std::shared_ptr<Communicator>
comm,
80 [[nodiscard]] constexpr std::shared_ptr<
Context> const&
ctx()
const {
89 [[nodiscard]] std::shared_ptr<Communicator>
const&
comm() const noexcept {
90 return shuffler_.
comm();
116 void insert(std::unordered_map<shuffler::PartID, PackedData>&& chunks);
140 std::shared_ptr<Context> ctx_;
169 std::shared_ptr<Context> ctx,
170 std::shared_ptr<Communicator> comm,
171 std::shared_ptr<Channel> ch_in,
172 std::shared_ptr<Channel> ch_out,
Shuffle service for all-to-all style communication of partitioned data.
std::function< Rank(std::shared_ptr< Communicator > const &, PartID, PartID)> PartitionOwner
Function that given a Communicator, PartID, and total partition count, returns the rapidsmpf::Rank of...
PartID const total_num_partitions
Total number of partition in the shuffle.
static Rank round_robin(std::shared_ptr< Communicator > const &comm, PartID pid, [[maybe_unused]] PartID total_num_partitions)
A PartitionOwner that distributes partitions using round robin assignment.
std::shared_ptr< Communicator > const & comm() const noexcept
Gets the communicator associated with this Shuffler.
PartitionOwner const partition_owner
Function to determine partition ownership.
Context for actors (coroutines) in rapidsmpf.
An asynchronous shuffler that wraps the synchronous shuffler with a coroutine interface.
constexpr std::shared_ptr< Context > const & ctx() const
Gets the streaming context associated with this shuffler.
std::shared_ptr< Communicator > const & comm() const noexcept
Gets the communicator associated with this shuffler.
constexpr shuffler::Shuffler::PartitionOwner const & partition_owner() const
Gets the partition owner function used by this shuffler.
ShufflerAsync(std::shared_ptr< Context > ctx, std::shared_ptr< Communicator > comm, OpID op_id, shuffler::PartID total_num_partitions, shuffler::Shuffler::PartitionOwner partition_owner=shuffler::Shuffler::round_robin)
Constructs a new ShufflerAsync instance.
Actor insert_finished()
Signal that no more data will be inserted into the shuffle.
constexpr shuffler::PartID total_num_partitions() const
Gets the total number of partitions for this shuffle operation.
void insert(std::unordered_map< shuffler::PartID, PackedData > &&chunks)
Insert a bunch of packed (serialized) chunks into the shuffle.
std::span< shuffler::PartID const > local_partitions() const
Returns the local partition IDs owned by the current node.
std::vector< PackedData > extract(shuffler::PartID pid)
Extract all chunks belonging to the specified partition.
std::uint32_t PartID
Partition ID, which goes from 0 to the total number of partitions.
Actor shuffler(std::shared_ptr< Context > ctx, std::shared_ptr< Communicator > comm, std::shared_ptr< Channel > ch_in, std::shared_ptr< Channel > ch_out, OpID op_id, shuffler::PartID total_num_partitions, shuffler::Shuffler::PartitionOwner partition_owner=shuffler::Shuffler::round_robin)
Launches a shuffler actor for a single shuffle operation.
coro::task< void > Actor
Alias for an actor in a streaming graph.
std::int32_t OpID
Operation ID defined by the user. This allows users to concurrently execute multiple operations,...