Logo ROOT  
Reference Guide
TMVA::DNN::TCudaDeviceBuffer< AFloat > Class Template Reference

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

TCudaDeviceBuffer.

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.

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

Definition at line 40 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. More...
 
size_t GetUseCount () const
 
 operator AFloat * () const
 Convert to raw device data pointer. More...
 
TCudaDeviceBufferoperator= (const TCudaDeviceBuffer &)=default
 
TCudaDeviceBufferoperator= (TCudaDeviceBuffer &&)=default
 
void SetComputeStream (cudaStream_t stream)
 

Private Attributes

cudaStream_t fComputeStream
 cudaStream for data transfer More...
 
struct TMVA::DNN::TCudaDeviceBuffer::TDestructor fDestructor
 
std::shared_ptr< AFloat * > fDevicePointer
 Pointer to the buffer data. More...
 
size_t fOffset
 Offset for sub-buffers. More...
 
size_t fSize
 

#include <TMVA/DNN/Architectures/Cuda/CudaBuffers.h>

Constructor & Destructor Documentation

◆ TCudaDeviceBuffer() [1/6]

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

Definition at line 99 of file CudaBuffers.cxx.

◆ TCudaDeviceBuffer() [2/6]

template<typename AFloat >
TMVA::DNN::TCudaDeviceBuffer< AFloat >::TCudaDeviceBuffer ( size_t  size,
cudaStream_t  stream 
)

Definition at line 109 of file CudaBuffers.cxx.

◆ TCudaDeviceBuffer() [3/6]

template<typename AFloat >
TMVA::DNN::TCudaDeviceBuffer< AFloat >::TCudaDeviceBuffer ( AFloat *  devicePointer,
size_t  size,
cudaStream_t  stream 
)

Definition at line 119 of file CudaBuffers.cxx.

◆ TCudaDeviceBuffer() [4/6]

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

◆ TCudaDeviceBuffer() [5/6]

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

◆ TCudaDeviceBuffer() [6/6]

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

Member Function Documentation

◆ CopyFrom()

template<typename AFloat >
void TMVA::DNN::TCudaDeviceBuffer< AFloat >::CopyFrom ( const TCudaHostBuffer< AFloat > &  buffer) const

Definition at line 146 of file CudaBuffers.cxx.

◆ CopyTo()

template<typename AFloat >
void TMVA::DNN::TCudaDeviceBuffer< AFloat >::CopyTo ( const TCudaHostBuffer< AFloat > &  buffer) const

Definition at line 154 of file CudaBuffers.cxx.

◆ GetComputeStream()

template<typename AFloat >
cudaStream_t TMVA::DNN::TCudaDeviceBuffer< AFloat >::GetComputeStream ( ) const
inline

Definition at line 152 of file CudaBuffers.h.

◆ GetSize()

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

Definition at line 151 of file CudaBuffers.h.

◆ GetSubBuffer()

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

Return sub-buffer of the current buffer.

Definition at line 129 of file CudaBuffers.cxx.

◆ GetUseCount()

template<typename AFloat >
size_t TMVA::DNN::TCudaDeviceBuffer< AFloat >::GetUseCount ( ) const
inline

Definition at line 155 of file CudaBuffers.h.

◆ operator AFloat *()

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

Convert to raw device data pointer.

Definition at line 139 of file CudaBuffers.cxx.

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

◆ SetComputeStream()

template<typename AFloat >
void TMVA::DNN::TCudaDeviceBuffer< AFloat >::SetComputeStream ( cudaStream_t  stream)
inline

Definition at line 153 of file CudaBuffers.h.

Member Data Documentation

◆ fComputeStream

template<typename AFloat >
cudaStream_t TMVA::DNN::TCudaDeviceBuffer< AFloat >::fComputeStream
private

cudaStream for data transfer

Definition at line 117 of file CudaBuffers.h.

◆ fDestructor

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

◆ fDevicePointer

template<typename AFloat >
std::shared_ptr<AFloat *> TMVA::DNN::TCudaDeviceBuffer< AFloat >::fDevicePointer
private

Pointer to the buffer data.

Definition at line 118 of file CudaBuffers.h.

◆ fOffset

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

Offset for sub-buffers.

Definition at line 115 of file CudaBuffers.h.

◆ fSize

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

Definition at line 116 of file CudaBuffers.h.


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