11 #include <coro/coro.hpp>
13 #include <rapidsmpf/communicator/logger.hpp>
14 #include <rapidsmpf/config.hpp>
15 #include <rapidsmpf/error.hpp>
16 #include <rapidsmpf/memory/resource_types.hpp>
17 #include <rapidsmpf/statistics.hpp>
18 #include <rapidsmpf/streaming/core/channel.hpp>
19 #include <rapidsmpf/streaming/core/coro_executor.hpp>
20 #include <rapidsmpf/streaming/core/memory_reserve_or_wait.hpp>
21 #include <rapidsmpf/streaming/core/queue.hpp>
56 std::shared_ptr<Logger>
logger,
57 std::shared_ptr<CoroThreadPoolExecutor>
executor,
58 std::shared_ptr<BufferResource>
br
70 std::shared_ptr<Logger>
logger,
71 std::shared_ptr<BufferResource>
br
108 std::shared_ptr<Logger>
logger,
140 [[nodiscard]] config::Options
options() const noexcept;
212 std::
size_t buffer_size
224 [[nodiscard]] std::
size_t uid() const noexcept;
227 std::
size_t const uid_;
228 std::atomic<
bool> is_shutdown_{
false};
229 std::thread::id creator_thread_id_;
231 std::shared_ptr<Logger> logger_;
232 std::shared_ptr<CoroThreadPoolExecutor> executor_;
233 std::shared_ptr<BufferResource> br_;
234 std::array<std::shared_ptr<MemoryReserveOrWait>,
MEMORY_TYPES.size()> memory_ = {};
235 std::shared_ptr<SpillableMessages> spillable_messages_;
239 static_assert(StatisticsProvider<Context>);
Class managing buffer resources.
A logger base class for handling different levels of log messages.
std::size_t SpillFunctionID
Represents a unique identifier for a registered spill function.
Tracks statistics across rapidsmpf operations.
static std::shared_ptr< Statistics > disabled()
Returns a disabled Statistics instance which can be enabled later.
Manages configuration options for RapidsMPF operations.
A bounded queue for type-erased Messages.
A coroutine-based channel for sending and receiving messages asynchronously.
Context for actors (coroutines) in rapidsmpf.
std::shared_ptr< SpillableMessages > const & spillable_messages() const noexcept
Returns the spillable messages collection.
std::size_t uid() const noexcept
Return a unique identifier for this context.
std::shared_ptr< Channel > create_channel() const noexcept
Create a new channel associated with this context.
Context(config::Options options, std::shared_ptr< Logger > logger, std::shared_ptr< BufferResource > br)
Convenience constructor using the provided configuration options.
std::shared_ptr< BoundedQueue > create_bounded_queue(std::size_t buffer_size) const noexcept
Create a new bounded queue associated with this context.
std::shared_ptr< CoroThreadPoolExecutor > const & executor() const noexcept
Returns the coroutine executor.
config::Options options() const noexcept
Returns the configuration options.
std::shared_ptr< Logger > const & logger() const noexcept
std::shared_ptr< MemoryReserveOrWait > const & memory(MemoryType mem_type) const noexcept
Get the handle for memory reservations for a given memory type.
static std::shared_ptr< Context > from_options(any_device_resource mr, std::shared_ptr< Logger > logger, config::Options options, std::shared_ptr< Statistics > statistics=Statistics::disabled())
Create a Context based on configuration options.
void shutdown() noexcept
Shut down the context.
std::shared_ptr< BufferResource > const & br() const noexcept
Returns the buffer resource.
std::shared_ptr< Statistics > statistics() const noexcept
Returns the statistics collector.
Context(config::Options options, std::shared_ptr< Logger > logger, std::shared_ptr< CoroThreadPoolExecutor > executor, std::shared_ptr< BufferResource > br)
Full constructor for the Context.
Executor wrapper around a coro::thread_pool used for coroutine execution.
Asynchronous coordinator for memory reservation requests.
Container for individually spillable messages.
constexpr std::array< MemoryType, 3 > MEMORY_TYPES
All memory types sorted in decreasing order of preference.
MemoryType
Enum representing the type of memory sorted in decreasing order of preference.
cuda::mr::any_resource< cuda::mr::device_accessible > any_device_resource
Owning type-erased device memory resource.