Logo ROOT   6.12/07
Reference Guide
List of all members | Classes | Public Member Functions | Private Attributes | List of all members
TMVA::DNN::TCudaHostBuffer< AFloat > Class Template Reference

template<typename AFloat>
class TMVA::DNN::TCudaHostBuffer< AFloat >

TCudaHostBuffer.

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.

Template Parameters
AFloatThe floating point type to be stored in the buffers.

Definition at line 41 of file CudaBuffers.h.

Classes

struct  TDestructor
 

Public Member Functions

 TCudaHostBuffer (size_t size)
 
 TCudaHostBuffer (AFloat *)
 
 TCudaHostBuffer ()=default
 
 TCudaHostBuffer (const TCudaHostBuffer &)=default
 
 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
 
TCudaHostBufferoperator= (const TCudaHostBuffer &)=default
 
TCudaHostBufferoperator= (TCudaHostBuffer &&)=default
 
AFloat & operator[] (size_t index)
 
AFloat operator[] (size_t index) const
 

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>

Constructor & Destructor Documentation

◆ TCudaHostBuffer() [1/5]

template<typename AFloat >
TMVA::DNN::TCudaHostBuffer< AFloat >::TCudaHostBuffer ( size_t  size)

Definition at line 38 of file CudaBuffers.cxx.

◆ TCudaHostBuffer() [2/5]

template<typename AFloat>
TMVA::DNN::TCudaHostBuffer< AFloat >::TCudaHostBuffer ( AFloat *  )

◆ TCudaHostBuffer() [3/5]

template<typename AFloat>
TMVA::DNN::TCudaHostBuffer< AFloat >::TCudaHostBuffer ( )
default

◆ TCudaHostBuffer() [4/5]

template<typename AFloat>
TMVA::DNN::TCudaHostBuffer< AFloat >::TCudaHostBuffer ( const TCudaHostBuffer< AFloat > &  )
default

◆ TCudaHostBuffer() [5/5]

template<typename AFloat>
TMVA::DNN::TCudaHostBuffer< AFloat >::TCudaHostBuffer ( TCudaHostBuffer< AFloat > &&  )
default

Member Function Documentation

◆ GetSize()

template<typename AFloat>
size_t TMVA::DNN::TCudaHostBuffer< AFloat >::GetSize ( ) const
inline

Definition at line 81 of file CudaBuffers.h.

◆ GetSubBuffer()

template<typename AFloat >
TCudaHostBuffer< AFloat > TMVA::DNN::TCudaHostBuffer< AFloat >::GetSubBuffer ( size_t  offset,
size_t  size 
)

Return sub-buffer of the current buffer.

Definition at line 55 of file CudaBuffers.cxx.

◆ operator AFloat *()

template<typename AFloat >
TMVA::DNN::TCudaHostBuffer< AFloat >::operator AFloat * ( ) const

Definition at line 48 of file CudaBuffers.cxx.

◆ operator=() [1/2]

template<typename AFloat>
TCudaHostBuffer& TMVA::DNN::TCudaHostBuffer< AFloat >::operator= ( const TCudaHostBuffer< AFloat > &  )
default

◆ operator=() [2/2]

template<typename AFloat>
TCudaHostBuffer& TMVA::DNN::TCudaHostBuffer< AFloat >::operator= ( TCudaHostBuffer< AFloat > &&  )
default

◆ operator[]() [1/2]

template<typename AFloat >
AFloat & TMVA::DNN::TCudaHostBuffer< AFloat >::operator[] ( size_t  index)
inline

Definition at line 146 of file CudaBuffers.h.

◆ operator[]() [2/2]

template<typename AFloat >
AFloat TMVA::DNN::TCudaHostBuffer< AFloat >::operator[] ( size_t  index) const
inline

Definition at line 152 of file CudaBuffers.h.

Member Data Documentation

◆ fComputeStream

template<typename AFloat>
cudaStream_t TMVA::DNN::TCudaHostBuffer< AFloat >::fComputeStream
mutableprivate

cudaStream for data transfer

Definition at line 47 of file CudaBuffers.h.

◆ fDestructor

template<typename AFloat>
struct TMVA::DNN::TCudaHostBuffer::TDestructor TMVA::DNN::TCudaHostBuffer< AFloat >::fDestructor
private

◆ fHostPointer

template<typename AFloat>
std::shared_ptr<AFloat *> TMVA::DNN::TCudaHostBuffer< AFloat >::fHostPointer
private

Pointer to the buffer data.

Definition at line 48 of file CudaBuffers.h.

◆ fOffset

template<typename AFloat>
size_t TMVA::DNN::TCudaHostBuffer< AFloat >::fOffset
private

Offset for sub-buffers.

Definition at line 45 of file CudaBuffers.h.

◆ fSize

template<typename AFloat>
size_t TMVA::DNN::TCudaHostBuffer< AFloat >::fSize
private

Definition at line 46 of file CudaBuffers.h.

◆ TCudaDeviceBuffer< AFloat >

template<typename AFloat>
friend TMVA::DNN::TCudaHostBuffer< AFloat >::TCudaDeviceBuffer< AFloat >
private

Definition at line 61 of file CudaBuffers.h.

Libraries for TMVA::DNN::TCudaHostBuffer< AFloat >:
[legend]

The documentation for this class was generated from the following files: