Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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 99 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.
 
size_t GetUseCount () const
 
 operator AFloat * () const
 Convert to raw device data pointer.
 
TCudaDeviceBufferoperator= (const TCudaDeviceBuffer &)=default
 
TCudaDeviceBufferoperator= (TCudaDeviceBuffer &&)=default
 
void SetComputeStream (cudaStream_t stream)
 

Private Attributes

cudaStream_t fComputeStream
 cudaStream for data transfer
 
struct TMVA::DNN::TCudaDeviceBuffer::TDestructor fDestructor
 
std::shared_ptr< AFloat * > fDevicePointer
 Pointer to the buffer data.
 
size_t fOffset
 Offset for sub-buffers.
 
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 87 of file CudaBuffers.cxx.

◆ TCudaDeviceBuffer() [2/6]

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

Definition at line 97 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 107 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 134 of file CudaBuffers.cxx.

◆ CopyTo()

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

Definition at line 142 of file CudaBuffers.cxx.

◆ GetComputeStream()

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

Definition at line 140 of file CudaBuffers.h.

◆ GetSize()

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

Definition at line 139 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 117 of file CudaBuffers.cxx.

◆ GetUseCount()

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

Definition at line 143 of file CudaBuffers.h.

◆ operator AFloat *()

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

Convert to raw device data pointer.

Definition at line 127 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 141 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 105 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 106 of file CudaBuffers.h.

◆ fOffset

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

Offset for sub-buffers.

Definition at line 103 of file CudaBuffers.h.

◆ fSize

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

Definition at line 104 of file CudaBuffers.h.

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