Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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 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.
 
 operator AFloat * () const
 
TCudaHostBufferoperator= (const TCudaHostBuffer &)=default
 
TCudaHostBufferoperator= (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>

Constructor & Destructor Documentation

◆ TCudaHostBuffer() [1/5]

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

Definition at line 44 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 84 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 60 of file CudaBuffers.cxx.

◆ operator AFloat *()

template<typename AFloat >
TMVA::DNN::TCudaHostBuffer< AFloat >::operator AFloat *

Definition at line 53 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 152 of file CudaBuffers.h.

◆ operator[]() [2/2]

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

Definition at line 158 of file CudaBuffers.h.

◆ SetConstVal()

template<typename AFloat >
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.

Member Data Documentation

◆ fComputeStream

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

cudaStream for data transfer

Definition at line 48 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 49 of file CudaBuffers.h.

◆ fOffset

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

Offset for sub-buffers.

Definition at line 46 of file CudaBuffers.h.

◆ fSize

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

Definition at line 47 of file CudaBuffers.h.

◆ TCudaDeviceBuffer< AFloat >

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

Definition at line 62 of file CudaBuffers.h.

  • tmva/tmva/inc/TMVA/DNN/Architectures/Cuda/CudaBuffers.h
  • tmva/tmva/src/DNN/Architectures/Cuda/CudaBuffers.cxx