Flush Request#
2026-03-31
5 min read time
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::Requestutilizesucxx::DelayedSubmissionto 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 ofstd::shared_ptr<ucxx::Worker>. SeepopulateDelayedSubmission()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::Requestobject that created the transfer, effectivelythispointer as seen byrequest().
Friends
- 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
callbackFunctionis specified, the lifetime ofcallbackDataand of any other objects used in the scope ofcallbackFunctionmust be guaranteed by the caller until it executes orisCompleted()becomes true. ThecallbackFunctionexecutes in the thread progressing theucxx::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::Error –
endpointOrWorkeris not a validstd::shared_ptr<ucxx::Endpoint>orstd::shared_ptr<ucxx::Worker>.- Parameters:
endpointOrWorker – [in] the parent component, which may either be a
std::shared_ptr<Endpoint>orstd::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<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
callbackFunctionis specified, the lifetime ofcallbackDataand of any other objects used in the scope ofcallbackFunctionmust be guaranteed by the caller until it executes orisCompleted()becomes true. ThecallbackFunctionexecutes in the thread progressing theucxx::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::Error –
endpointOrWorkeris not a validstd::shared_ptr<ucxx::Endpoint>orstd::shared_ptr<ucxx::Worker>.- Parameters:
endpointOrWorker – [in] the parent component, which may either be a
std::shared_ptr<Endpoint>orstd::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