File indexing completed on 2025-03-13 09:13:00
0001
0002
0003
0004
0005
0006
0007
0008
0009 #pragma once
0010
0011 #include <memory>
0012
0013 #include "gloo/common/logging.h"
0014 #include "gloo/transport/address.h"
0015 #include "gloo/transport/buffer.h"
0016 #include "gloo/transport/unbound_buffer.h"
0017
0018 namespace gloo {
0019 namespace transport {
0020
0021 class Pair {
0022 public:
0023 virtual ~Pair() = 0;
0024
0025 virtual const Address& address() const = 0;
0026
0027 virtual void connect(const std::vector<char>& bytes) = 0;
0028
0029 virtual void close() = 0;
0030
0031 virtual void setSync(bool enable, bool busyPoll) = 0;
0032
0033 virtual std::unique_ptr<Buffer>
0034 createSendBuffer(int slot, void* ptr, size_t size) = 0;
0035
0036 virtual std::unique_ptr<Buffer>
0037 createRecvBuffer(int slot, void* ptr, size_t size) = 0;
0038
0039
0040 virtual void send(
0041 UnboundBuffer* buf,
0042 uint64_t tag,
0043 size_t offset = 0,
0044 size_t nbytes = 0) = 0;
0045
0046
0047 virtual void recv(
0048 UnboundBuffer* buf,
0049 uint64_t tag,
0050 size_t offset = 0,
0051 size_t nbytes = 0) = 0;
0052
0053
0054
0055 void setLocalRank(int localRank) {
0056
0057 GLOO_ENFORCE(localRank >= 0, "LocalRank must be non-negative");
0058
0059 localRank_ = localRank;
0060 }
0061
0062
0063
0064 int getLocalRank() const {
0065 return localRank_;
0066 }
0067
0068 protected:
0069
0070
0071
0072
0073
0074 int localRank_;
0075 };
0076
0077 }
0078 }