An asynchronous shuffler that wraps the synchronous shuffler with a coroutine interface. More...
#include <shuffler.hpp>
Public Member Functions | |
| 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. More... | |
| ShufflerAsync (ShufflerAsync const &)=delete | |
| ShufflerAsync & | operator= (ShufflerAsync const &)=delete |
| constexpr std::shared_ptr< Context > const & | ctx () const |
| Gets the streaming context associated with this shuffler. More... | |
| std::shared_ptr< Communicator > const & | comm () const noexcept |
| Gets the communicator associated with this shuffler. More... | |
| constexpr shuffler::PartID | total_num_partitions () const |
| Gets the total number of partitions for this shuffle operation. More... | |
| constexpr shuffler::Shuffler::PartitionOwner const & | partition_owner () const |
| Gets the partition owner function used by this shuffler. More... | |
| std::span< shuffler::PartID const > | local_partitions () const |
| Returns the local partition IDs owned by the current node. More... | |
| void | insert (std::unordered_map< shuffler::PartID, PackedData > &&chunks) |
| Insert a bunch of packed (serialized) chunks into the shuffle. More... | |
| Actor | insert_finished () |
| Signal that no more data will be inserted into the shuffle. More... | |
| std::vector< PackedData > | extract (shuffler::PartID pid) |
| Extract all chunks belonging to the specified partition. More... | |
An asynchronous shuffler that wraps the synchronous shuffler with a coroutine interface.
ShufflerAsync provides an asynchronous interface to the shuffler, allowing data to be inserted and then extracted after the shuffle completes. All local partitions complete simultaneously, so extraction is non-blocking after awaiting insert_finished().
insert_finished() must be awaited before the object is destroyed, otherwise the shuffle with terminate in destruction and/or deadlocks will occur.Example usage:
{}
Definition at line 43 of file shuffler.hpp.
| rapidsmpf::streaming::ShufflerAsync::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.
| ctx | The streaming context to use. |
| comm | Communicator for the collective operation. |
| op_id | Unique operation ID for this shuffle. Must not be reused until all participants have completed the shuffle operation. |
| total_num_partitions | Total number of partitions to shuffle data into. |
| partition_owner | Function that maps a partition ID to its owning rank/node. Defaults to round-robin distribution. |
|
inlinenoexcept |
Gets the communicator associated with this shuffler.
Definition at line 89 of file shuffler.hpp.
|
inlineconstexpr |
Gets the streaming context associated with this shuffler.
Definition at line 80 of file shuffler.hpp.
| std::vector<PackedData> rapidsmpf::streaming::ShufflerAsync::extract | ( | shuffler::PartID | pid | ) |
Extract all chunks belonging to the specified partition.
| pid | The ID of the partition to extract. |
| std::logic_error | If the partition has already been extracted or is otherwise not available. |
| void rapidsmpf::streaming::ShufflerAsync::insert | ( | std::unordered_map< shuffler::PartID, PackedData > && | chunks | ) |
Insert a bunch of packed (serialized) chunks into the shuffle.
insert_finished() is called after all insert() calls have completed.| chunks | A map of partition IDs and their packed chunks. |
| Actor rapidsmpf::streaming::ShufflerAsync::insert_finished | ( | ) |
Signal that no more data will be inserted into the shuffle.
This informs the shuffler that this rank has finished inserting data. Must be called exactly once.
insert()ing, you must establish a happens-before relationship between the completion of all insert()s and the final call to insert_finished().| std::span<shuffler::PartID const> rapidsmpf::streaming::ShufflerAsync::local_partitions | ( | ) | const |
Returns the local partition IDs owned by the current node.
| comm | The communicator to use. |
| total_num_partitions | Total number of partitions in the shuffle. |
| partition_owner | Function that determines partition ownership. |
|
inlineconstexpr |
Gets the partition owner function used by this shuffler.
Definition at line 108 of file shuffler.hpp.
|
inlineconstexpr |
Gets the total number of partitions for this shuffle operation.
Definition at line 98 of file shuffler.hpp.