Wrapper class for pinned memory buffers on the host. Uses std::shared_pointer with custom destructor to ensure consistent memory management and allow for easy copying/moving of the buffers. Copying is asynchronous and will set the cudaStream of the device buffer so that subsequent computations on the device buffer can be performed on the same stream.
AFloat | The floating point type to be stored in the buffers. |
Definition at line 42 of file CudaBuffers.h.
Classes | |
struct | TDestructor |
Public Member Functions | |
TCudaHostBuffer ()=default | |
TCudaHostBuffer (AFloat *) | |
TCudaHostBuffer (const TCudaHostBuffer &)=default | |
TCudaHostBuffer (size_t size) | |
TCudaHostBuffer (TCudaHostBuffer &&)=default | |
size_t | GetSize () const |
TCudaHostBuffer | GetSubBuffer (size_t offset, size_t size) |
Return sub-buffer of the current buffer. More... | |
operator AFloat * () const | |
TCudaHostBuffer & | operator= (const TCudaHostBuffer &)=default |
TCudaHostBuffer & | operator= (TCudaHostBuffer &&)=default |
AFloat & | operator[] (size_t index) |
AFloat | operator[] (size_t index) const |
void | SetConstVal (const AFloat constVal) |
Sets the entire buffer to a constant value. More... | |
Private Attributes | |
cudaStream_t | fComputeStream |
cudaStream for data transfer More... | |
struct TMVA::DNN::TCudaHostBuffer::TDestructor | fDestructor |
std::shared_ptr< AFloat * > | fHostPointer |
Pointer to the buffer data. More... | |
size_t | fOffset |
Offset for sub-buffers. More... | |
size_t | fSize |
friend | TCudaDeviceBuffer< AFloat > |
#include <TMVA/DNN/Architectures/Cuda/CudaBuffers.h>
TMVA::DNN::TCudaHostBuffer< AFloat >::TCudaHostBuffer | ( | size_t | size | ) |
Definition at line 44 of file CudaBuffers.cxx.
TMVA::DNN::TCudaHostBuffer< AFloat >::TCudaHostBuffer | ( | AFloat * | ) |
|
default |
|
default |
|
default |
|
inline |
Definition at line 84 of file CudaBuffers.h.
TCudaHostBuffer< AFloat > TMVA::DNN::TCudaHostBuffer< AFloat >::GetSubBuffer | ( | size_t | offset, |
size_t | size | ||
) |
Return sub-buffer of the current buffer.
Definition at line 60 of file CudaBuffers.cxx.
TMVA::DNN::TCudaHostBuffer< AFloat >::operator AFloat * |
Definition at line 53 of file CudaBuffers.cxx.
|
default |
|
default |
|
inline |
Definition at line 152 of file CudaBuffers.h.
|
inline |
Definition at line 158 of file CudaBuffers.h.
void TMVA::DNN::TCudaHostBuffer< AFloat >::SetConstVal | ( | const AFloat | constVal | ) |
Sets the entire buffer to a constant value.
Definition at line 70 of file CudaBuffers.cxx.
|
mutableprivate |
cudaStream for data transfer
Definition at line 48 of file CudaBuffers.h.
|
private |
|
private |
Pointer to the buffer data.
Definition at line 49 of file CudaBuffers.h.
|
private |
Offset for sub-buffers.
Definition at line 46 of file CudaBuffers.h.
|
private |
Definition at line 47 of file CudaBuffers.h.
|
private |
Definition at line 62 of file CudaBuffers.h.