File indexing completed on 2025-01-18 10:00:11
0001
0002
0003
0004
0005
0006
0007
0008
0009 #pragma once
0010
0011 #include <chrono>
0012 #include <memory>
0013 #include <vector>
0014
0015 #include <gloo/transport/pair.h>
0016
0017 namespace gloo {
0018
0019
0020 namespace transport {
0021 class Context;
0022 class Device;
0023 class UnboundBuffer;
0024 }
0025
0026 class Context {
0027 public:
0028 Context(int rank, int size, int base = 2);
0029 virtual ~Context();
0030
0031 const int rank;
0032 const int size;
0033 int base;
0034
0035 std::shared_ptr<transport::Device>& getDevice();
0036
0037 std::unique_ptr<transport::Pair>& getPair(int i);
0038
0039
0040
0041
0042 std::unique_ptr<transport::UnboundBuffer> createUnboundBuffer(
0043 void* ptr, size_t size);
0044
0045 int nextSlot(int numToSkip = 1);
0046
0047 void closeConnections();
0048
0049 void setTimeout(std::chrono::milliseconds timeout);
0050
0051 std::chrono::milliseconds getTimeout() const;
0052
0053 protected:
0054 std::shared_ptr<transport::Device> device_;
0055 std::shared_ptr<transport::Context> transportContext_;
0056 int slot_;
0057 std::chrono::milliseconds timeout_;
0058 };
0059
0060 }