Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:00:10

0001 /**
0002  * Copyright (c) 2017-present, Facebook, Inc.
0003  * All rights reserved.
0004  *
0005  * This source code is licensed under the BSD-style license found in the
0006  * LICENSE file in the root directory of this source tree.
0007  */
0008 
0009 #pragma once
0010 
0011 #include <chrono>
0012 #include <memory>
0013 
0014 #include "gloo/transport/context.h"
0015 #include "gloo/transport/pair.h"
0016 
0017 namespace gloo {
0018 namespace transport {
0019 
0020 // Forward declarations
0021 class Pair;
0022 class Buffer;
0023 class UnboundBuffer;
0024 
0025 // The device abstraction can be considered as a factory for all
0026 // communication pairs. A communication pair can be associated with
0027 // send and receive buffers. Send buffers serve as the source for one
0028 // sided writes and receive buffers serve as the target of one sided
0029 // writes. Both ends of the pair can create either type of buffer, as
0030 // long as it is paired with the opposite type on the remote end of
0031 // the pair; every receive buffer must be paired with a corresponding
0032 // send buffer and vice versa. The device abstraction may start a
0033 // background thread to handle I/O multiplexing (not configurable).
0034 class Device {
0035  public:
0036   virtual ~Device() = 0;
0037 
0038   virtual std::string str() const = 0;
0039 
0040   virtual const std::string& getPCIBusID() const = 0;
0041 
0042   virtual int getInterfaceSpeed() const { return 0; }
0043 
0044   virtual bool hasGPUDirect() const { return false; }
0045 
0046   // Factory function to create transport context. A single device may
0047   // service multiple contexts, with no constraints on this process
0048   // its rank or the context size.
0049   virtual std::shared_ptr<Context> createContext(int rank, int size) = 0;
0050 };
0051 
0052 } // namespace transport
0053 } // namespace gloo