request_tag.h
1 
5 #pragma once
6 #include <memory>
7 #include <string>
8 #include <utility>
9 
10 #include <ucp/api/ucp.h>
11 
12 #include <ucxx/delayed_submission.h>
13 #include <ucxx/request.h>
14 #include <ucxx/request_tag_builder.h>
15 #include <ucxx/typedefs.h>
16 
17 namespace ucxx {
18 
25 class RequestTag : public Request {
26  private:
27  bool _cancelRequested{false};
28 
58  RequestTag(
59  std::shared_ptr<Component> endpointOrWorker,
60  const std::variant<data::TagSend, data::TagReceive, data::TagReceiveWithHandle> requestData,
61  std::string operationName,
62  const bool enablePythonFuture = false,
63  RequestCallbackUserFunction callbackFunction = nullptr,
64  RequestCallbackUserData callbackData = nullptr);
65 
66  void populateDelayedSubmissionImpl() override;
67 
68  public:
69  // Allow internal construction without exposing factory functions.
70  friend class detail::ConstructorFactory;
71 
79  void cancel() override;
80 
88  void request();
89 
105  static void tagSendCallback(void* request, ucs_status_t status, void* arg);
106 
124  static void tagRecvCallback(void* request,
125  ucs_status_t status,
126  const ucp_tag_recv_info_t* info,
127  void* arg);
128 
145  void callback(void* request, ucs_status_t status, const ucp_tag_recv_info_t* info);
146 };
147 
148 } // namespace ucxx
Send or receive a message with the UCX Tag API.
Definition: request_tag.h:25
void request()
Create and submit a tag request.
void callback(void *request, ucs_status_t status, const ucp_tag_recv_info_t *info)
Implementation of the tag receive request callback.
static void tagSendCallback(void *request, ucs_status_t status, void *arg)
Callback executed by UCX when a tag send request is completed.
void cancel() override
Cancel the tag request.
static void tagRecvCallback(void *request, ucs_status_t status, const ucp_tag_recv_info_t *info, void *arg)
Callback executed by UCX when a tag receive request is completed.
Base type for a UCXX transfer request.
Definition: request.h:39
Definition: address.h:16
std::function< void(ucs_status_t, std::shared_ptr< void >)> RequestCallbackUserFunction
A user-defined function to execute as part of a ucxx::Request callback.
Definition: typedefs.h:97
std::shared_ptr< void > RequestCallbackUserData
Data for the user-defined function provided to the ucxx::Request callback.
Definition: typedefs.h:105