Logo ROOT   6.18/05
Reference Guide
List of all members | Classes | Public Member Functions | Private Attributes | List of all members
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 97 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
 
TCudaDeviceBuffer GetSubBuffer (size_t offset, size_t size)
 Return sub-buffer of the current buffer. More...
 
 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 77 of file CudaBuffers.cxx.

◆ TCudaDeviceBuffer() [2/6]

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

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

◆ CopyTo()

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

Definition at line 132 of file CudaBuffers.cxx.

◆ GetComputeStream()

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

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

◆ operator AFloat *()

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

Convert to raw device data pointer.

Definition at line 117 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 138 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 103 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 104 of file CudaBuffers.h.

◆ fOffset

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

Offset for sub-buffers.

Definition at line 101 of file CudaBuffers.h.

◆ fSize

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

Definition at line 102 of file CudaBuffers.h.


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