Abstract base class for a communication mechanism between nodes. More...
#include <communicator.hpp>
Classes | |
| class | Future |
| Abstract base class for asynchronous operation within the communicator. More... | |
| class | Logger |
| A logger base class for handling different levels of log messages. More... | |
Public Member Functions | |
| virtual Rank | rank () const =0 |
| Retrieves the rank of the current node. More... | |
| virtual Rank | nranks () const =0 |
| Retrieves the total number of ranks. More... | |
| virtual std::unique_ptr< Future > | send (std::unique_ptr< std::vector< std::uint8_t >> msg, Rank rank, Tag tag)=0 |
| Sends a host message to a specific rank. More... | |
| virtual std::unique_ptr< Future > | send (std::unique_ptr< Buffer > msg, Rank rank, Tag tag)=0 |
Sends a message (device or host) to a specific rank. Use release_data to obtain the data buffer again once the future is completed. More... | |
| virtual std::unique_ptr< Future > | recv (Rank rank, Tag tag, std::unique_ptr< Buffer > recv_buffer)=0 |
Receives a message from a specific rank to a buffer. Use release_data to extract the data out of the buffer once the future is completed. More... | |
| virtual std::unique_ptr< Future > | recv_sync_host_data (Rank rank, Tag tag, std::unique_ptr< std::vector< std::uint8_t >> synced_buffer)=0 |
Receives a message from a specific rank to an allocated (synchronized) host buffer. Use release_sync_host_data to extract the data out of the buffer once the future is completed. More... | |
| virtual std::pair< std::unique_ptr< std::vector< std::uint8_t > >, Rank > | recv_any (Tag tag)=0 |
| Receives a message from any rank (blocking). More... | |
| virtual std::unique_ptr< std::vector< std::uint8_t > > | recv_from (Rank src, Tag tag)=0 |
| Receives a message from a specific rank (blocking). More... | |
| virtual std::pair< std::vector< std::unique_ptr< Future > >, std::vector< std::size_t > > | test_some (std::vector< std::unique_ptr< Future >> &future_vector)=0 |
| Tests for completion of multiple futures. More... | |
| virtual std::vector< std::size_t > | test_some (std::unordered_map< std::size_t, std::unique_ptr< Communicator::Future >> const &future_map)=0 |
| Tests for completion of multiple futures in a map. More... | |
| virtual bool | test (std::unique_ptr< Communicator::Future > &future)=0 |
| Test for completion of a single future. More... | |
| virtual std::vector< std::unique_ptr< Buffer > > | wait_all (std::vector< std::unique_ptr< Communicator::Future >> &&futures)=0 |
| Wait for completion of all futures and return their data buffers. More... | |
| virtual std::unique_ptr< Buffer > | wait (std::unique_ptr< Future > future)=0 |
| Wait for a future to complete and return the data buffer. More... | |
| virtual std::unique_ptr< Buffer > | release_data (std::unique_ptr< Communicator::Future > future)=0 |
| Retrieves data associated with a completed future. More... | |
| virtual std::unique_ptr< std::vector< std::uint8_t > > | release_sync_host_data (std::unique_ptr< Communicator::Future > future)=0 |
| Retrieves synchronized host data associated with a completed future. When the future is completed, the the host data is valid, and ready, but not stream-ordered. More... | |
| virtual std::shared_ptr< Communicator::Logger > const & | logger ()=0 |
| Retrieves the logger associated with this communicator. More... | |
| virtual std::shared_ptr< ProgressThread > const & | progress_thread () const =0 |
| Retrieves the progress thread associated with this communicator. More... | |
| virtual std::string | str () const =0 |
| Provides a string representation of the communicator. More... | |
Abstract base class for a communication mechanism between nodes.
Provides an interface for sending and receiving messages between nodes, supporting asynchronous operations, GPU data transfers, and custom logging. Implementations must define the virtual methods to enable specific communication backends.
The API of the Communicator is not stream-ordered (since the concrete libraries we use to implement communication patterns are not stream-ordered). A consequence of this is that the user must ensure that any stream-ordered work on buffers is complete before passing a buffer into send or recv. As a corollary, after completing a future, the extracted Buffer is valid on its stream (it has no stream-ordered work queued up).
Sends and receives are matched on (rank, tag) pairs. The concrete implementation must provide that there is no message overtaking.
Definition at line 188 of file communicator.hpp.
|
pure virtual |
Retrieves the logger associated with this communicator.
Implemented in rapidsmpf::ucxx::UCXX, rapidsmpf::Single, and rapidsmpf::MPI.
|
pure virtual |
Retrieves the total number of ranks.
Implemented in rapidsmpf::ucxx::UCXX, rapidsmpf::Single, and rapidsmpf::MPI.
|
pure virtual |
Retrieves the progress thread associated with this communicator.
Implemented in rapidsmpf::ucxx::UCXX, rapidsmpf::Single, and rapidsmpf::MPI.
|
pure virtual |
Retrieves the rank of the current node.
Implemented in rapidsmpf::ucxx::UCXX, rapidsmpf::Single, and rapidsmpf::MPI.
|
pure virtual |
Receives a message from a specific rank to a buffer. Use release_data to extract the data out of the buffer once the future is completed.
| rank | The source rank. |
| tag | Message tag for identification. |
| recv_buffer | The receive buffer. |
Future representing the asynchronous operation.| std::invalid_argument | If recv_buffer is nullptr. |
| std::logic_error | If recv_buffer is not ready (see warning for more details). |
Buffer allocation is already valid before calling, for example, when a CUDA allocation and/or copy are done asynchronously. Specifically, the caller should ensure Buffer::is_ready() returns true before calling this function. Providing a non-ready buffer leads to an irrecoverable condition. Implemented in rapidsmpf::ucxx::UCXX, rapidsmpf::Single, and rapidsmpf::MPI.
|
pure virtual |
Receives a message from any rank (blocking).
| tag | Message tag for identification. |
nullptr in the first slot of the pair. Implemented in rapidsmpf::ucxx::UCXX, rapidsmpf::Single, and rapidsmpf::MPI.
|
pure virtual |
Receives a message from a specific rank (blocking).
| src | The source rank from which to receive the message. |
| tag | Message tag for identification. |
Implemented in rapidsmpf::ucxx::UCXX, rapidsmpf::Single, and rapidsmpf::MPI.
|
pure virtual |
Receives a message from a specific rank to an allocated (synchronized) host buffer. Use release_sync_host_data to extract the data out of the buffer once the future is completed.
| rank | The source rank. |
| tag | Message tag for identification. |
| synced_buffer | The receive buffer. |
Future representing the asynchronous operation.| std::invalid_argument | If synced_buffer is nullptr. |
Implemented in rapidsmpf::ucxx::UCXX, rapidsmpf::Single, and rapidsmpf::MPI.
|
pure virtual |
Retrieves data associated with a completed future.
| future | The completed future. |
| std::runtime_error | if the future has no data. |
|
pure virtual |
Retrieves synchronized host data associated with a completed future. When the future is completed, the the host data is valid, and ready, but not stream-ordered.
| future | The completed future. |
| std::runtime_error | if the future has no data. |
|
pure virtual |
Sends a message (device or host) to a specific rank. Use release_data to obtain the data buffer again once the future is completed.
| msg | Unique pointer to the message data (Buffer). |
| rank | The destination rank. |
| tag | Message tag for identification. |
Future representing the asynchronous operation.| std::invalid_argument | If msg is nullptr. |
| std::logic_error | If msg is not ready (see warning for more details). |
Buffer allocation and data are already valid before calling, for example, when a CUDA allocation and/or copy are done asynchronously. Specifically, the caller should ensure Buffer::is_ready() returns true before calling this function. Providing a non-ready buffer leads to an irrecoverable condition. Implemented in rapidsmpf::ucxx::UCXX, rapidsmpf::Single, and rapidsmpf::MPI.
|
pure virtual |
Sends a host message to a specific rank.
This is used to send data that resides in host memory and is guaranteed to be valid at the time of the call.
Use release_sync_host_data to obtain the data buffer again once the future is completed.
| msg | Unique pointer to the message data (host memory). |
| rank | The destination rank. |
| tag | Message tag for identification. |
Future representing the asynchronous operation.| std::invalid_argument | If msg is nullptr. |
Implemented in rapidsmpf::ucxx::UCXX, rapidsmpf::Single, and rapidsmpf::MPI.
|
pure virtual |
Provides a string representation of the communicator.
Implemented in rapidsmpf::ucxx::UCXX, rapidsmpf::Single, and rapidsmpf::MPI.
|
pure virtual |
Test for completion of a single future.
| future | Future to test |
test returns true, it is safe to call release_data().
|
pure virtual |
Tests for completion of multiple futures in a map.
| future_map | Map of futures identified by keys. |
|
pure virtual |
Tests for completion of multiple futures.
| [in,out] | future_vector | Vector of Future objects. Completed futures are erased from the vector. |
|
pure virtual |
Wait for a future to complete and return the data buffer.
| future | The future to wait for completion of. |
nullptr if the future had no data).
|
pure virtual |
Wait for completion of all futures and return their data buffers.
| futures | Futures to wait for completion of, consumed. |