Loading...
Searching...
No Matches
ucxx::Context Class Reference

Component encapsulating the UCP context. More...

#include <context.h>

Inheritance diagram for ucxx::Context:
ucxx::Component

Public Member Functions

 Context (const Context &)=delete
Context & operator= (Context const &)=delete
 Context (Context &&o)=delete
Context & operator= (Context &&o)=delete
 ~Context ()
 ucxx::Context destructor
ConfigMap getConfig ()
 Get the context configuration.
ucp_context_h getHandle ()
 Get the underlying ucp_context_h handle.
std::string getInfo ()
 Get information from UCP context.
uint64_t getFeatureFlags () const
 Get feature flags that were used to construct the UCP context.
bool hasCudaSupport () const
 Query whether CUDA support is available.
WorkerBuilder workerBuilder ()
 Create a builder for a new ucxx::Worker.
MemoryHandleBuilder memoryHandleBuilder (size_t size)
 Create a builder for a new ucxx::MemoryHandle.
Public Member Functions inherited from ucxx::Component
void setParent (std::shared_ptr< Component > parent)
 Set the internal parent reference.
std::shared_ptr< Component > getParent () const
 Get the internal parent reference.

Static Public Attributes

static constexpr uint64_t defaultFeatureFlags
 Suggested default context feature flags to use.

Friends

class detail::ConstructorFactory
class ContextBuilder
 Allow ContextBuilder to access private constructor.

Additional Inherited Members

Protected Attributes inherited from ucxx::Component
std::shared_ptr< Component > _parent {nullptr}
 A reference-counted pointer to the parent.

Detailed Description

Component encapsulating the UCP context.

The UCP layer provides a handle to access its context in form of ucp_context_h object, this class encapsulates that object and provides methods to simplify its handling.

Use ucxx::contextBuilder to create and configure Context instances.

Member Function Documentation

◆ getConfig()

ConfigMap ucxx::Context::getConfig ( )
nodiscard

Get the context configuration.

The context configuration is a ConfigMap containing entries of the UCX variables that were set upon creation of the UCP context. Only those variables known to UCP can be acquired.

// context is `std::shared_ptr<ucxx::Context>`
auto contextConfig = context->getConfig();
Returns
A ConfigMap corresponding to the context's configuration.

◆ getFeatureFlags()

uint64_t ucxx::Context::getFeatureFlags ( ) const
nodiscard

Get feature flags that were used to construct the UCP context.

Get feature flags that were used to construct the UCP context, this has the same value that was specified by the user when creating the ucxx::Context object.

// context is `std::shared_ptr<ucxx::Context>`
uint64_t contextFeatureFlags= context->getFeatureFlags();
Returns
Feature flags for this context

◆ getHandle()

ucp_context_h ucxx::Context::getHandle ( )
nodiscard

Get the underlying ucp_context_h handle.

Lifetime of the ucp_context_h handle is managed by the ucxx::Context object and its ownership is non-transferrable. Once the ucxx::Context is destroyed the handle is not valid anymore, it is the user's responsibility to ensure the owner's lifetime while using the handle.

// context is `std::shared_ptr<ucxx::Context>`
ucp_context_h contextHandle = context->getHandle();
Returns
The underlying ucp_context_h handle

◆ getInfo()

std::string ucxx::Context::getInfo ( )
nodiscard

Get information from UCP context.

Get information from UCP context, including memory domains, transport resources, and other useful information. This method is a wrapper to ucp_context_print_info.

// context is `std::shared_ptr<ucxx::Context>`
auto contextInfo = context->getInfo();
Returns
String containing context information

◆ hasCudaSupport()

bool ucxx::Context::hasCudaSupport ( ) const
nodiscard

Query whether CUDA support is available.

Query whether the UCP context has CUDA support available. This is a done through a combination of verifying whether CUDA memory support is available and UCX_TLS allows CUDA to be enabled, essentially UCX_TLS must explicitly be one of the following:

  1. Exactly all;
  2. Contain a field starting with cuda;
  3. Start with ^ (disable all listed transports) and NOT contain a field named either cuda or cuda_copy.
Returns
Whether CUDA support is available.

◆ memoryHandleBuilder()

MemoryHandleBuilder ucxx::Context::memoryHandleBuilder ( size_t size)
nodiscard

Create a builder for a new ucxx::MemoryHandle.

Calling this method only creates the builder. Finalizing it with .build() or implicit conversion maps memory as a child of this context.

Parameters
[in]sizethe minimum size of the memory allocation.
Returns
Builder to configure optional memory mapping parameters.

◆ workerBuilder()

WorkerBuilder ucxx::Context::workerBuilder ( )
nodiscard

Create a builder for a new ucxx::Worker.

Calling this method only creates the builder. Finalizing it with .build() or implicit conversion constructs a ucxx::Worker as a child of this context.

Returns
Builder to configure optional worker parameters.

Member Data Documentation

◆ defaultFeatureFlags

uint64_t ucxx::Context::defaultFeatureFlags
staticconstexpr
Initial value:
=
UCP_FEATURE_TAG | UCP_FEATURE_WAKEUP | UCP_FEATURE_STREAM | UCP_FEATURE_AM |
UCP_FEATURE_RMA

Suggested default context feature flags to use.


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