Flush Request#

2026-03-31

5 min read time

Applies to Linux

The ucxx::RequestFlush class implements a flush operation that ensures all outstanding operations on an endpoint or worker have completed remotely.

#include <ucxx/request_flush.h>

namespace ucxx

class RequestFlush : public ucxx::Request#

Flush a UCP endpoint or worker.

Flush outstanding AMO (Atomic Memory Operation) and RMA (Remote Memory Access) operations on a UCP endpoint or worker.

Public Functions

virtual void populateDelayedSubmission(
)#

Populate the internal submission dispatcher.

The ucxx::Request utilizes ucxx::DelayedSubmission to manage when the request will be dispatched. This method is registered as a callback in the worker, that may choose to either execute (submit) it immediately or delay for the next iteration of its progress loop, depending on the progress mode in use by the worker.

See ucxx::DelayedSubmission::DelayedSubmission() for more details.

void request(
)#

Create and submit a flush request.

This is the method that should be called to actually submit a flush request. It is meant to be called from populateDelayedSubmission(), which is decided at the discretion of std::shared_ptr<ucxx::Worker>. See populateDelayedSubmission() for more details.

Public Static Functions

static void flushCallback(
void *request,
ucs_status_t status,
void *arg
)#

Callback executed by UCX when a flush request is completed.

Callback executed by UCX when a flush request is completed, that will dispatch ucxx::Request::callback().

Warning

This is not intended to be called by the user, but it currently needs to be a public method so that UCX may access it. In future changes this will be moved to an internal object and remove this method from the public API.

Parameters:
  • request[in] the UCX request pointer.

  • status[in] the completion status of the request.

  • arg[in] the pointer to the ucxx::Request object that created the transfer, effectively this pointer as seen by request().

Friends

friend std::shared_ptr<RequestFlush> createRequestFlush(
std::shared_ptr<Component> endpointOrWorker,
const data::Flush requestData,
const bool enablePythonFuture,
RequestCallbackUserFunction callbackFunction,
RequestCallbackUserData callbackData
)#

Constructor for std::shared_ptr<ucxx::RequestFlush>.

The constructor for a std::shared_ptr<ucxx::RequestFlush> object, creating a request to flush outstanding AMO (Atomic Memory Operation) and RMA (Remote Memory Access) operations on a UCP endpoint or worker, returning a pointer to a request object that can be later awaited and checked for errors. This is a non-blocking operation, and its status must be verified from the resulting request object to confirm the flush operation has completed successfully.

Note

If a callbackFunction is specified, the lifetime of callbackData and of any other objects used in the scope of callbackFunction must be guaranteed by the caller until it executes or isCompleted() becomes true. The callbackFunction executes in the thread progressing the ucxx::Worker, unless the request completes immediately, in which case the callback will also execute immediately within the calling thread and before the method returns.

Throws:

ucxx::ErrorendpointOrWorker is not a valid std::shared_ptr<ucxx::Endpoint> or std::shared_ptr<ucxx::Worker>.

Parameters:
  • endpointOrWorker[in] the parent component, which may either be a std::shared_ptr<Endpoint> or std::shared_ptr<Worker>.

  • requestData[in] container of the specified message type, including all type-specific data.

  • enablePythonFuture[in] whether a python future should be created and subsequently notified.

  • callbackFunction[in] user-defined callback function to call upon completion.

  • callbackData[in] user-defined data to pass to the callbackFunction.

Returns:

The shared_ptr<ucxx::RequestFlush> object

Factory Functions#

#include <ucxx/constructors.h>

std::shared_ptr<RequestFlush> ucxx::createRequestFlush(
std::shared_ptr<Component> endpointOrWorker,
const data::Flush requestData,
const bool enablePythonFuture,
RequestCallbackUserFunction callbackFunction,
RequestCallbackUserData callbackData
)#

The constructor for a std::shared_ptr<ucxx::RequestFlush> object, creating a request to flush outstanding AMO (Atomic Memory Operation) and RMA (Remote Memory Access) operations on a UCP endpoint or worker, returning a pointer to a request object that can be later awaited and checked for errors. This is a non-blocking operation, and its status must be verified from the resulting request object to confirm the flush operation has completed successfully.

Note

If a callbackFunction is specified, the lifetime of callbackData and of any other objects used in the scope of callbackFunction must be guaranteed by the caller until it executes or isCompleted() becomes true. The callbackFunction executes in the thread progressing the ucxx::Worker, unless the request completes immediately, in which case the callback will also execute immediately within the calling thread and before the method returns.

Throws:

ucxx::ErrorendpointOrWorker is not a valid std::shared_ptr<ucxx::Endpoint> or std::shared_ptr<ucxx::Worker>.

Parameters:
  • endpointOrWorker[in] the parent component, which may either be a std::shared_ptr<Endpoint> or std::shared_ptr<Worker>.

  • requestData[in] container of the specified message type, including all type-specific data.

  • enablePythonFuture[in] whether a python future should be created and subsequently notified.

  • callbackFunction[in] user-defined callback function to call upon completion.

  • callbackData[in] user-defined data to pass to the callbackFunction.

Returns:

The shared_ptr<ucxx::RequestFlush> object