Service class for on-device memory buffers. Uses std::shared_pointer with custom destructor to ensure consistent memory management and allow for easy copying/moving. A device buffer has an associated CUDA compute stream , which is used for implicit synchronization of data transfers.
AFloat | The floating point type to be stored in the buffers. |
Definition at line 99 of file CudaBuffers.h.
Classes | |
struct | TDestructor |
Public Member Functions | |
TCudaDeviceBuffer ()=default | |
TCudaDeviceBuffer (AFloat *, size_t size, cudaStream_t stream) | |
TCudaDeviceBuffer (const TCudaDeviceBuffer &)=default | |
TCudaDeviceBuffer (size_t size) | |
TCudaDeviceBuffer (size_t size, cudaStream_t stream) | |
TCudaDeviceBuffer (TCudaDeviceBuffer &&)=default | |
void | CopyFrom (const TCudaHostBuffer< AFloat > &) const |
void | CopyTo (const TCudaHostBuffer< AFloat > &) const |
cudaStream_t | GetComputeStream () const |
size_t | GetSize () const |
TCudaDeviceBuffer | GetSubBuffer (size_t offset, size_t size) |
Return sub-buffer of the current buffer. | |
size_t | GetUseCount () const |
operator AFloat * () const | |
Convert to raw device data pointer. | |
TCudaDeviceBuffer & | operator= (const TCudaDeviceBuffer &)=default |
TCudaDeviceBuffer & | operator= (TCudaDeviceBuffer &&)=default |
void | SetComputeStream (cudaStream_t stream) |
Private Attributes | |
cudaStream_t | fComputeStream |
cudaStream for data transfer | |
struct TMVA::DNN::TCudaDeviceBuffer::TDestructor | fDestructor |
std::shared_ptr< AFloat * > | fDevicePointer |
Pointer to the buffer data. | |
size_t | fOffset |
Offset for sub-buffers. | |
size_t | fSize |
#include <TMVA/DNN/Architectures/Cuda/CudaBuffers.h>
TMVA::DNN::TCudaDeviceBuffer< AFloat >::TCudaDeviceBuffer | ( | size_t | size | ) |
Definition at line 87 of file CudaBuffers.cxx.
TMVA::DNN::TCudaDeviceBuffer< AFloat >::TCudaDeviceBuffer | ( | size_t | size, |
cudaStream_t | stream | ||
) |
Definition at line 97 of file CudaBuffers.cxx.
TMVA::DNN::TCudaDeviceBuffer< AFloat >::TCudaDeviceBuffer | ( | AFloat * | devicePointer, |
size_t | size, | ||
cudaStream_t | stream | ||
) |
Definition at line 107 of file CudaBuffers.cxx.
|
default |
|
default |
|
default |
void TMVA::DNN::TCudaDeviceBuffer< AFloat >::CopyFrom | ( | const TCudaHostBuffer< AFloat > & | buffer | ) | const |
Definition at line 134 of file CudaBuffers.cxx.
void TMVA::DNN::TCudaDeviceBuffer< AFloat >::CopyTo | ( | const TCudaHostBuffer< AFloat > & | buffer | ) | const |
Definition at line 142 of file CudaBuffers.cxx.
|
inline |
Definition at line 140 of file CudaBuffers.h.
|
inline |
Definition at line 139 of file CudaBuffers.h.
TCudaDeviceBuffer< AFloat > TMVA::DNN::TCudaDeviceBuffer< AFloat >::GetSubBuffer | ( | size_t | offset, |
size_t | size | ||
) |
Return sub-buffer of the current buffer.
Definition at line 117 of file CudaBuffers.cxx.
|
inline |
Definition at line 143 of file CudaBuffers.h.
TMVA::DNN::TCudaDeviceBuffer< AFloat >::operator AFloat * |
Convert to raw device data pointer.
Definition at line 127 of file CudaBuffers.cxx.
|
default |
|
default |
|
inline |
Definition at line 141 of file CudaBuffers.h.
|
private |
cudaStream for data transfer
Definition at line 105 of file CudaBuffers.h.
|
private |
|
private |
Pointer to the buffer data.
Definition at line 106 of file CudaBuffers.h.
|
private |
Offset for sub-buffers.
Definition at line 103 of file CudaBuffers.h.
|
private |
Definition at line 104 of file CudaBuffers.h.