All Classes Namespaces Functions Variables Typedefs Enumerations Friends
worker.h
1 
5 #pragma once
6 
7 #include <functional>
8 #include <memory>
9 #include <mutex>
10 #include <queue>
11 #include <thread>
12 
13 #include <ucp/api/ucp.h>
14 
15 #include <ucxx/python/future.h>
16 #include <ucxx/python/notifier.h>
17 #include <ucxx/worker.h>
18 
19 namespace ucxx {
20 
21 namespace python {
22 
29 class Worker : public ::ucxx::Worker {
30  private:
46  Worker(std::shared_ptr<Context> context,
47  const bool enableDelayedSubmission = false,
48  const bool enableFuture = false);
49 
50  public:
51  Worker() = delete;
52  Worker(const Worker&) = delete;
53  Worker& operator=(Worker const&) = delete;
54  Worker(Worker&& o) = delete;
55  Worker& operator=(Worker&& o) = delete;
56 
85  friend std::shared_ptr<::ucxx::Worker> createWorker(std::shared_ptr<Context> context,
86  const bool enableDelayedSubmission,
87  const bool enableFuture);
88 
99  void populateFuturesPool() override;
100 
110  void clearFuturesPool() override;
111 
121  [[nodiscard]] std::shared_ptr<::ucxx::Future> getFuture() override;
122 
135  [[nodiscard]] RequestNotifierWaitState waitRequestNotifier(uint64_t periodNs) override;
136 
147  void runRequestNotifier() override;
148 
154  void stopRequestNotifierThread() override;
155 };
156 
157 } // namespace python
158 
159 } // namespace ucxx
Component encapsulating a UCP worker.
Definition: worker.h:45
Specialized Python implementation of a ucxx::Worker.
Definition: worker.h:29
RequestNotifierWaitState waitRequestNotifier(uint64_t periodNs) override
Block until a request event.
friend std::shared_ptr<::ucxx::Worker > createWorker(std::shared_ptr< Context > context, const bool enableDelayedSubmission, const bool enableFuture)
Constructor of shared_ptr<ucxx::python::Worker>.
void populateFuturesPool() override
Populate the Python futures pool.
void runRequestNotifier() override
Notify Python futures of each completed communication request.
void clearFuturesPool() override
Clear the futures pool.
std::shared_ptr<::ucxx::Future > getFuture() override
Get a Python future from the pool.
void stopRequestNotifierThread() override
Signal the notifier to terminate.
Definition: address.h:15
RequestNotifierWaitState
The state with which a wait operation completed.
Definition: notifier.h:26