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 | |
AFloat * | data () const |
size_t | GetSize () const |
TCudaHostBuffer | GetSubBuffer (size_t offset, size_t size) |
Return sub-buffer of the current buffer. | |
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. | |
Private Attributes | |
cudaStream_t | fComputeStream |
cudaStream for data transfer | |
struct TMVA::DNN::TCudaHostBuffer::TDestructor | fDestructor |
std::shared_ptr< AFloat * > | fHostPointer |
Pointer to the buffer data. | |
size_t | fOffset |
Offset for sub-buffers. | |
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 |
AFloat * TMVA::DNN::TCudaHostBuffer< AFloat >::data |
Definition at line 53 of file CudaBuffers.cxx.
|
inline |
Definition at line 85 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.
|
inline |
Definition at line 79 of file CudaBuffers.h.
|
default |
|
default |
|
inline |
Definition at line 154 of file CudaBuffers.h.
|
inline |
Definition at line 160 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.