Single process communicator class that implements the Communicator interface.
More...
#include <single.hpp>
Classes | |
| class | Future |
| Represents the future result of an operation. More... | |
Public Member Functions | |
| Single (config::Options options, std::shared_ptr< ProgressThread > progress_thread) | |
| Construct a single process communicator. More... | |
| constexpr Rank | rank () const override |
| Retrieves the rank of the current node. More... | |
| constexpr Rank | nranks () const override |
| Retrieves the total number of ranks. More... | |
| std::unique_ptr< Communicator::Future > | send (std::unique_ptr< std::vector< std::uint8_t >> msg, Rank rank, Tag tag) override |
| Sends a host message to a specific rank. More... | |
| std::unique_ptr< Communicator::Future > | send (std::unique_ptr< Buffer > msg, Rank rank, Tag tag) override |
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... | |
| std::unique_ptr< Communicator::Future > | recv (Rank rank, Tag tag, std::unique_ptr< Buffer > recv_buffer) override |
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... | |
| std::unique_ptr< Communicator::Future > | recv_sync_host_data (Rank rank, Tag tag, std::unique_ptr< std::vector< std::uint8_t >> synced_buffer) override |
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... | |
| std::pair< std::unique_ptr< std::vector< std::uint8_t > >, Rank > | recv_any (Tag tag) override |
| Receives a message from any rank (blocking). More... | |
| std::unique_ptr< std::vector< std::uint8_t > > | recv_from (Rank src, Tag tag) override |
| Receives a message from a specific rank (blocking). More... | |
| std::pair< std::vector< std::unique_ptr< Communicator::Future > >, std::vector< std::size_t > > | test_some (std::vector< std::unique_ptr< Communicator::Future >> &future_vector) override |
| Tests for completion of multiple futures. More... | |
| std::vector< std::size_t > | test_some (std::unordered_map< std::size_t, std::unique_ptr< Communicator::Future >> const &future_map) override |
| Tests for completion of multiple futures in a map. More... | |
| bool | test (std::unique_ptr< Communicator::Future > &future) override |
| Test for completion of a single future. More... | |
| std::vector< std::unique_ptr< Buffer > > | wait_all (std::vector< std::unique_ptr< Communicator::Future >> &&futures) override |
| Wait for completion of all futures and return their data buffers. More... | |
| std::unique_ptr< Buffer > | wait (std::unique_ptr< Communicator::Future > future) override |
| Wait for a future to complete and return the data buffer. More... | |
| std::unique_ptr< Buffer > | release_data (std::unique_ptr< Communicator::Future > future) override |
| Retrieves data associated with a completed future. More... | |
| std::unique_ptr< std::vector< std::uint8_t > > | release_sync_host_data (std::unique_ptr< Communicator::Future > future) override |
| 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... | |
| std::shared_ptr< Communicator::Logger > const & | logger () override |
| Retrieves the logger associated with this communicator. More... | |
| std::shared_ptr< ProgressThread > const & | progress_thread () const override |
| Retrieves the progress thread associated with this communicator. More... | |
| std::string | str () const override |
| Provides a string representation of the communicator. More... | |
Public Member Functions inherited from rapidsmpf::Communicator | |
| 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... | |
Single process communicator class that implements the Communicator interface.
This class stubs out the Communicator interface with functions that throw. When sending to/receiving from self the internal logic should move buffers through the shuffler, rather than invoking send/recv.
Definition at line 28 of file single.hpp.
| rapidsmpf::Single::Single | ( | config::Options | options, |
| std::shared_ptr< ProgressThread > | progress_thread | ||
| ) |
Construct a single process communicator.
| options | Configuration options. |
| progress_thread | Progress thread for this communicator. |
|
inlineoverridevirtual |
Retrieves the logger associated with this communicator.
Implements rapidsmpf::Communicator.
Definition at line 190 of file single.hpp.
|
inlineconstexproverridevirtual |
Retrieves the total number of ranks.
Implements rapidsmpf::Communicator.
Definition at line 63 of file single.hpp.
|
inlineoverridevirtual |
Retrieves the progress thread associated with this communicator.
Implements rapidsmpf::Communicator.
Definition at line 198 of file single.hpp.
|
inlineconstexproverridevirtual |
Retrieves the rank of the current node.
Implements rapidsmpf::Communicator.
Definition at line 56 of file single.hpp.
|
overridevirtual |
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.| std::runtime_error | if called (single-process communicators should never send messages). |
Implements rapidsmpf::Communicator.
|
overridevirtual |
Receives a message from any rank (blocking).
| tag | Message tag for identification. |
nullptr in the first slot of the pair.Implements rapidsmpf::Communicator.
|
overridevirtual |
Receives a message from a specific rank (blocking).
| src | The source rank from which to receive the message. |
| tag | Message tag for identification. |
Implements rapidsmpf::Communicator.
|
overridevirtual |
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. |
| std::runtime_error | if called (single-process communicators should never send messages). |
Implements rapidsmpf::Communicator.
|
override |
Retrieves data associated with a completed future.
| future | The completed future. |
| std::runtime_error | if the future has no data. |
| std::runtime_error | if called (single-process communicators should never send messages). |
|
override |
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. |
| std::runtime_error | if called (single-process communicators should never send messages). |
|
overridevirtual |
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.| std::runtime_error | if called (single-process communicators should never send messages). |
Implements rapidsmpf::Communicator.
|
overridevirtual |
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. |
Implements rapidsmpf::Communicator.
|
overridevirtual |
Provides a string representation of the communicator.
Implements rapidsmpf::Communicator.
|
override |
Test for completion of a single future.
| future | Future to test |
test returns true, it is safe to call release_data().
|
override |
Tests for completion of multiple futures in a map.
| future_map | Map of futures identified by keys. |
| std::runtime_error | if called (single-process communicators should never send messages). |
|
override |
Tests for completion of multiple futures.
| [in,out] | future_vector | Vector of Future objects. Completed futures are erased from the vector. |
| std::runtime_error | if called (single-process communicators should never send messages). |
|
override |
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).| std::runtime_error | if called (single-process communicators should never send messages) |
|
override |
Wait for completion of all futures and return their data buffers.
| futures | Futures to wait for completion of, consumed. |