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  [[nodiscard]] friend std::shared_ptr<::ucxx::Worker> createWorker(
86  std::shared_ptr<Context> context, const bool enableDelayedSubmission, const bool enableFuture);
87 
98  void populateFuturesPool() override;
99 
109  void clearFuturesPool() override;
110 
120  [[nodiscard]] std::shared_ptr<::ucxx::Future> getFuture() override;
121 
134  [[nodiscard]] RequestNotifierWaitState waitRequestNotifier(uint64_t periodNs) override;
135 
146  void runRequestNotifier() override;
147 
153  void stopRequestNotifierThread() override;
154 };
155 
156 } // namespace python
157 
158 } // namespace ucxx
Component encapsulating a UCP worker.
Definition: worker.h:44
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