Public Member Functions | List of all members
ucxx::experimental::WorkerBuilder Class Referencefinal

Builder class for constructing std::shared_ptr<ucxx::Worker> objects. More...

#include <worker_builder.h>

Public Member Functions

 WorkerBuilder (std::shared_ptr< Context > context)
 Constructor for WorkerBuilder with required context. More...
 
 ~WorkerBuilder ()
 WorkerBuilder destructor.
 
 WorkerBuilder (const WorkerBuilder &other)
 Copy constructor (deep-copies internal state).
 
WorkerBuilderoperator= (const WorkerBuilder &other)
 Copy assignment operator (deep-copies internal state).
 
 WorkerBuilder (WorkerBuilder &&) noexcept
 Move constructor.
 
WorkerBuilderoperator= (WorkerBuilder &&) noexcept
 Move assignment operator.
 
 operator std::shared_ptr< Worker > () const
 Implicit conversion operator to shared_ptr<Worker>. More...
 
WorkerBuilderdelayedSubmission (bool enable=true)
 Configure delayed submission to the progress thread. More...
 
WorkerBuilderpythonFuture (bool enable=true)
 Configure Python future support. More...
 
WorkerBuilderrequestAttributes (bool enable=true)
 Configure request attributes querying. More...
 
WorkerBuildercudaBufferType (BufferType bufferType)
 Configure the preferred buffer type for CUDA allocations. More...
 
std::shared_ptr< Workerbuild () const
 Build and return the Worker. More...
 

Detailed Description

Builder class for constructing std::shared_ptr<ucxx::Worker> objects.

This class implements the builder pattern for std::shared_ptr<ucxx::Worker>, allowing optional parameters to be specified via method chaining. Construction happens when the builder expression completes (via implicit conversion) or when build() is called.

The context is required and must be provided to createWorker(). The enableDelayedSubmission() and enableFuture() methods are optional.

// Minimal usage (no options enabled)
auto worker = ucxx::experimental::createWorker(context).build();
// With optional parameters
auto worker = ucxx::experimental::createWorker(context)
.enableDelayedSubmission(true)
.enableFuture(true)
.build();
// Using implicit conversion
std::shared_ptr<ucxx::Worker> worker = ucxx::experimental::createWorker(context);
std::shared_ptr< Worker > build() const
Build and return the Worker.

Constructor & Destructor Documentation

◆ WorkerBuilder()

ucxx::experimental::WorkerBuilder::WorkerBuilder ( std::shared_ptr< Context context)
explicit

Constructor for WorkerBuilder with required context.

Parameters
[in]contextcontext from which the worker will be created (required).

Member Function Documentation

◆ build()

std::shared_ptr<Worker> ucxx::experimental::WorkerBuilder::build ( ) const

Build and return the Worker.

This method constructs the Worker with the specified parameters and returns it. Each call to build() creates a new Worker instance with the current parameters.

Returns
The constructed shared_ptr<ucxx::Worker> object.

◆ cudaBufferType()

WorkerBuilder& ucxx::experimental::WorkerBuilder::cudaBufferType ( BufferType  bufferType)

Configure the preferred buffer type for CUDA allocations.

Parameters
[in]bufferTypethe preferred buffer type for CUDA allocations.
Returns
Reference to this builder for method chaining.

◆ delayedSubmission()

WorkerBuilder& ucxx::experimental::WorkerBuilder::delayedSubmission ( bool  enable = true)

Configure delayed submission to the progress thread.

Parameters
[in]enablewhether delayed submission is enabled (default: true).
Returns
Reference to this builder for method chaining.

◆ operator std::shared_ptr< Worker >()

ucxx::experimental::WorkerBuilder::operator std::shared_ptr< Worker > ( ) const

Implicit conversion operator to shared_ptr<Worker>.

Enables automatic construction of the Worker when the builder is used in a context requiring a shared_ptr<Worker>, delegating to build().

Returns
The constructed shared_ptr<ucxx::Worker> object.

◆ pythonFuture()

WorkerBuilder& ucxx::experimental::WorkerBuilder::pythonFuture ( bool  enable = true)

Configure Python future support.

Parameters
[in]enablewhether Python futures are enabled (default: true).
Returns
Reference to this builder for method chaining.

◆ requestAttributes()

WorkerBuilder& ucxx::experimental::WorkerBuilder::requestAttributes ( bool  enable = true)

Configure request attributes querying.

When enabled, each ucxx::Request created from the worker will have its UCP attributes (such as the debug string) queried immediately after submission, making them available via ucxx::Request::getRequestAttributes(). This may have non-negligible runtime cost and is therefore disabled by default.

Parameters
[in]enablewhether request attributes querying is enabled (default: true).
Returns
Reference to this builder for method chaining.

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