Context for actors (coroutines) in rapidsmpf. More...
#include <context.hpp>
Public Member Functions | |
| Context (config::Options options, std::shared_ptr< Communicator::Logger > logger, std::shared_ptr< CoroThreadPoolExecutor > executor, std::shared_ptr< BufferResource > br) | |
| Full constructor for the Context. More... | |
| Context (config::Options options, std::shared_ptr< Communicator::Logger > logger, std::shared_ptr< BufferResource > br) | |
| Convenience constructor using the provided configuration options. More... | |
| Context (Context const &)=delete | |
| Context & | operator= (Context const &)=delete |
| Context (Context &&)=delete | |
| Context & | operator= (Context &&)=delete |
| void | shutdown () noexcept |
| Shut down the context. More... | |
| config::Options | options () const noexcept |
| Returns the configuration options. More... | |
| std::shared_ptr< Communicator::Logger > const & | logger () const noexcept |
| std::shared_ptr< CoroThreadPoolExecutor > const & | executor () const noexcept |
| Returns the coroutine executor. More... | |
| std::shared_ptr< BufferResource > const & | br () const noexcept |
| Returns the buffer resource. More... | |
| std::shared_ptr< MemoryReserveOrWait > const & | memory (MemoryType mem_type) const noexcept |
| Get the handle for memory reservations for a given memory type. More... | |
| std::shared_ptr< Statistics > | statistics () const noexcept |
| Returns the statistics collector. More... | |
| std::shared_ptr< Channel > | create_channel () const noexcept |
| Create a new channel associated with this context. More... | |
| std::shared_ptr< SpillableMessages > const & | spillable_messages () const noexcept |
| Returns the spillable messages collection. More... | |
| std::shared_ptr< BoundedQueue > | create_bounded_queue (std::size_t buffer_size) const noexcept |
| Create a new bounded queue associated with this context. More... | |
| std::size_t | uid () const noexcept |
| Return a unique identifier for this context. More... | |
Static Public Member Functions | |
| static std::shared_ptr< Context > | from_options (RmmResourceAdaptor *mr, std::shared_ptr< Communicator::Logger > logger, config::Options options) |
| Create a Context based on configuration options. More... | |
Context for actors (coroutines) in rapidsmpf.
The context owns shared resources used during execution, including the coroutine executor and memory reservation infrastructure.
shutdown() from a different thread results in program termination. Since the destructor implicitly calls shutdown(), destroying the context from a different thread also results in termination unless the executor has already been shut down explicitly.A recommended usage pattern is to create a single Context instance up front on the main thread and reuse it throughout the lifetime of the program. This reduces overhead and avoids issues related to destruction on a different thread.
Definition at line 41 of file context.hpp.
| rapidsmpf::streaming::Context::Context | ( | config::Options | options, |
| std::shared_ptr< Communicator::Logger > | logger, | ||
| std::shared_ptr< CoroThreadPoolExecutor > | executor, | ||
| std::shared_ptr< BufferResource > | br | ||
| ) |
Full constructor for the Context.
All provided pointers must be non-null.
| options | Configuration options. |
| logger | Shared pointer to a logger. |
| executor | Shared pointer to a coroutine executor. |
| br | Shared pointer to a buffer resource. |
| rapidsmpf::streaming::Context::Context | ( | config::Options | options, |
| std::shared_ptr< Communicator::Logger > | logger, | ||
| std::shared_ptr< BufferResource > | br | ||
| ) |
Convenience constructor using the provided configuration options.
| options | Configuration options. |
| logger | Shared pointer to a logger. |
| br | Buffer resource used to reserve host memory and perform data movement. |
|
noexcept |
Returns the buffer resource.
|
noexcept |
Create a new bounded queue associated with this context.
| buffer_size | Maximum size of the queue. |
|
noexcept |
Create a new channel associated with this context.
|
noexcept |
Returns the coroutine executor.
|
static |
Create a Context based on configuration options.
This is a convenience factory that wires up a fully initialized and usable Context.
| mr | Device memory resource adaptor used by RapidsMPF. The adaptor must outlive the returned Context. |
| logger | The logger to use. |
| options | Configuration options used to initialize the Context and its components. |
| std::invalid_argument | If an option value is invalid. |
| std::out_of_range | If an option value exceeds the representable range. |
shutdown() from a different thread results in program termination. Since the destructor implicitly calls shutdown(), destroying the context from a different thread also results in termination unless the executor has already been shut down explicitly.A recommended usage pattern is to create a single Context instance up front on the main thread and reuse it throughout the lifetime of the program. This reduces overhead and avoids issues related to destruction on a different thread.
|
noexcept |
|
noexcept |
Get the handle for memory reservations for a given memory type.
Returns an object that coordinates asynchronous memory reservation requests for the specified memory type. The returned instance provides backpressure and global progress guarantees, and should be used to reserve memory before performing operations that require memory.
A recommended usage pattern is to reserve all required memory up front as a single atomic reservation. This allows callers to co_await the reservation request and only start executing the operation once all required memory is available.
| mem_type | Memory type for which reservations are requested. |
|
noexcept |
Returns the configuration options.
|
noexcept |
Shut down the context.
This method is idempotent and only performs shutdown once. Subsequent calls have no effect.
|
noexcept |
Returns the spillable messages collection.
|
noexcept |
Returns the statistics collector.
|
noexcept |