1 #ifndef COLLECTIVE_DEVICE_BUFFER_H 2 #define COLLECTIVE_DEVICE_BUFFER_H 8 #if defined(NAMD_CUDA) || defined(NAMD_HIP) 91 numElemsAlloc = other.numElemsAlloc;
92 buffer = other.buffer;
93 d_peerBuffers = other.d_peerBuffers;
96 other.numElemsAlloc = 0;
97 other.buffer =
nullptr;
98 other.d_peerBuffers =
nullptr;
100 h_peerBuffers = std::move(other.h_peerBuffers);
108 numElemsAlloc = other.numElemsAlloc;
109 buffer = other.buffer;
110 d_peerBuffers = other.d_peerBuffers;
111 h_peerBuffers = other.h_peerBuffers;
119 numElemsAlloc = other.numElemsAlloc;
120 buffer = other.buffer;
121 d_peerBuffers = other.d_peerBuffers;
122 h_peerBuffers = other.h_peerBuffers;
132 T** d_peerBuffers =
nullptr;
134 std::vector<T*> h_peerBuffers;
136 size_t numElemsAlloc = 0;
143 #endif // COLLECTIVE_DEVICE_BUFFER_H CollectiveDeviceBuffer< T > & operator=(CollectiveDeviceBuffer< T > &&other)
void reallocate(CollectiveBufferType type_in, const size_t newNumElems, const double factor, SynchronousCollectiveScope scope=SynchronousCollectiveScope::all)
Reallocates a symmetric device buffer on all devices if needed.
std::vector< T * > const & getHostPeer() const
Returns a host-vector containing peer's device pointers.
T **const getDevicePeerPtr() const
Returns the pointer to peer's pointer on the device.
CollectiveDeviceBuffer(const CollectiveDeviceBuffer &other)
void allocate(CollectiveBufferType type_in, const size_t numElemsIn, SynchronousCollectiveScope scope=SynchronousCollectiveScope::all)
Allocates a symmetric buffer on all devices.
T *const getDevicePtr() const
Returns the pointer to the device buffer.
void reallocate_no_check(CollectiveBufferType type_in, const size_t newNumElems, const double factor)
CollectiveDeviceBuffer< T > & operator=(const CollectiveDeviceBuffer< T > &other)
SynchronousCollectiveScope
void allocate_no_check(CollectiveBufferType type_in, const size_t numElemsIn)
Allocates a symmetric buffer on all devices without reducing the buffer sizes.