Public Member Functions | List of all members
rapidsmpf::streaming::SparseAlltoall Class Reference

Asynchronous (coroutine) interface to coll::SparseAlltoall. More...

#include <sparse_alltoall.hpp>

Public Member Functions

 SparseAlltoall (std::shared_ptr< Context > ctx, std::shared_ptr< Communicator > comm, OpID op_id, std::vector< Rank > srcs, std::vector< Rank > dsts)
 Construct an asynchronous sparse all-to-all. More...
 
 SparseAlltoall (SparseAlltoall const &)=delete
 
SparseAlltoalloperator= (SparseAlltoall const &)=delete
 
 SparseAlltoall (SparseAlltoall &&)=delete
 
SparseAlltoalloperator= (SparseAlltoall &&)=delete
 
std::shared_ptr< Context > const & ctx () const noexcept
 Gets the streaming context associated with this object. More...
 
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...
 
coro::task< void > insert_finished ()
 Indicate that no more data will be inserted for any destination. More...
 
std::vector< PackedDataextract (Rank src)
 Extract all received messages from a source rank. More...
 

Detailed Description

Asynchronous (coroutine) interface to coll::SparseAlltoall.

Many tasks may insert data concurrently. If multiple tasks insert data, the caller is responsible for arranging that insert_finished() is only called after all insert() operations have completed. Once insert_finished() is awaited, extraction is non-blocking.

Definition at line 29 of file sparse_alltoall.hpp.

Constructor & Destructor Documentation

◆ SparseAlltoall()

rapidsmpf::streaming::SparseAlltoall::SparseAlltoall ( std::shared_ptr< Context ctx,
std::shared_ptr< Communicator comm,
OpID  op_id,
std::vector< Rank srcs,
std::vector< Rank dsts 
)

Construct an asynchronous sparse all-to-all.

Parameters
ctxStreaming context.
commCommunicator for the collective operation.
op_idUnique identifier for the collective.
srcsRanks this rank expects to receive from.
dstsRanks this rank may send to.

Member Function Documentation

◆ comm()

std::shared_ptr<Communicator> const& rapidsmpf::streaming::SparseAlltoall::comm ( ) const
noexcept

Gets the communicator associated with this SparseAlltoall.

Returns
Shared pointer to communicator.

◆ ctx()

std::shared_ptr<Context> const& rapidsmpf::streaming::SparseAlltoall::ctx ( ) const
noexcept

Gets the streaming context associated with this object.

Returns
Shared pointer to context.

◆ extract()

std::vector<PackedData> rapidsmpf::streaming::SparseAlltoall::extract ( Rank  src)

Extract all received messages from a source rank.

The returned vector is ordered by the sender's local insertion order.

Parameters
srcSource rank. Must be present in the constructor's srcs.
Returns
All messages received from src.
Note
Concurrent extraction is supported, behaviour is undefined if two threads attempt to extract data from the same source.
Exceptions
std::logic_errorIf extracting before the collective is complete.

◆ insert()

void rapidsmpf::streaming::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.

Note
Concurrent insertion by multiple threads is supported.
the caller must ensure that insert_finished() is called after all insert() calls have completed.
Parameters
dstDestination rank. Must be present in the constructor's dsts.
packed_dataPacked payload and metadata to send.

◆ insert_finished()

coro::task<void> rapidsmpf::streaming::SparseAlltoall::insert_finished ( )

Indicate that no more data will be inserted for any destination.

Must be called exactly once.

Note
If multiple threads are insert()ing, you must establish a happens-before relationship between the completion of all insert()s and the final call to insert_finished().
Returns
Coroutine that completes once all data is ready for extraction.

The documentation for this class was generated from the following file: