Sparse all-to-all collective over explicit source and destination peer sets. More...
#include <sparse_alltoall.hpp>
Public Member Functions | |
| SparseAlltoall (std::shared_ptr< Communicator > comm, OpID op_id, BufferResource *br, std::vector< Rank > srcs, std::vector< Rank > dsts, std::function< void()> &&finished_callback=nullptr) | |
| Construct a sparse all-to-all collective instance. More... | |
| SparseAlltoall (SparseAlltoall const &)=delete | |
| SparseAlltoall & | operator= (SparseAlltoall const &)=delete |
| SparseAlltoall (SparseAlltoall &&)=delete | |
| SparseAlltoall & | operator= (SparseAlltoall &&)=delete |
| std::shared_ptr< Communicator > const & | comm () const noexcept |
| Gets the communicator associated with this SparseAlltoall. More... | |
| void | insert (Rank dst, PackedData &&packed_data) |
| Insert data to send to a destination rank. More... | |
| void | insert_finished () |
| Indicate that no more data will be inserted for any destination. More... | |
| void | wait (std::chrono::milliseconds timeout=std::chrono::milliseconds{-1}) |
| Wait for local completion. More... | |
| std::vector< PackedData > | extract (Rank src) |
| Extract all received messages from a source rank. More... | |
Sparse all-to-all collective over explicit source and destination peer sets.
Each rank may send zero or more messages to ranks listed in dsts and receives zero or more messages from ranks listed in srcs. Sender order is defined by the local order of calls to insert(dst, ...) for each destination rank.
This object is logically collective over the communicator and identified by op_id. Local extraction is only valid after wait() has completed.
Definition at line 35 of file sparse_alltoall.hpp.
| rapidsmpf::coll::SparseAlltoall::SparseAlltoall | ( | std::shared_ptr< Communicator > | comm, |
| OpID | op_id, | ||
| BufferResource * | br, | ||
| std::vector< Rank > | srcs, | ||
| std::vector< Rank > | dsts, | ||
| std::function< void()> && | finished_callback = nullptr |
||
| ) |
Construct a sparse all-to-all collective instance.
| comm | Communicator for the collective. |
| op_id | Collective operation identifier. |
| br | Buffer resource used for allocations. |
| srcs | Ranks this rank will receive from. |
| dsts | Ranks this rank will send to. |
| finished_callback | Optional callback invoked exactly once when the collective is locally complete. The callback should be fast and non-blocking. Ideally it should only be used to signal a thread to do the actual work of extraction. Note in particular that the callback should not extract any data. |
| std::out_of_range | If either srcs or dsts have invalid values. All source and destination ranks must be in [0, ..., comm->nranks()), and not equal to the current rank. |
| std::invalid_argument | If the rank lists are not unique. |
| std::logic_error | If the communicator or buffer resource pointers are null. |
op_id as soon as wait has completed locally or the finished_callback has been invoked.
|
noexcept |
Gets the communicator associated with this SparseAlltoall.
| std::vector<PackedData> rapidsmpf::coll::SparseAlltoall::extract | ( | Rank | src | ) |
Extract all received messages from a source rank.
The returned vector is ordered by the sender's local insertion order.
| src | Source rank. Must be present in the constructor's srcs. |
src.| std::logic_error | If extracting before the collective is complete. |
| void rapidsmpf::coll::SparseAlltoall::insert | ( | Rank | dst, |
| PackedData && | packed_data | ||
| ) |
Insert data to send to a destination rank.
The order the destination rank obtains the sent data is given by the insertion order on the send side. If inserting concurrently to the same destination, the caller must establish a total order of the insertions, otherwise the reconstruction order on the receive side is unspecified.
insert_finished() is called after all insert() calls have completed.| dst | Destination rank. Must be present in the constructor's dsts. |
| packed_data | Packed payload and metadata to send. |
| void rapidsmpf::coll::SparseAlltoall::insert_finished | ( | ) |
Indicate that no more data will be inserted for any destination.
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(). | void rapidsmpf::coll::SparseAlltoall::wait | ( | std::chrono::milliseconds | timeout = std::chrono::milliseconds{-1} | ) |
Wait for local completion.
| timeout | Optional timeout. Negative values mean no timeout. |
| std::runtime_error | If the timeout is reached. |