ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
CaloGPUHybridClusterProcessor::simple_GPU_pointer_holder Class Reference

A simple RAII wrapper to ensure proper allocation and deallocation of GPU memory in a void * for the temporaries. More...

Collaboration diagram for CaloGPUHybridClusterProcessor::simple_GPU_pointer_holder:

Public Member Functions

void allocate (const size_t size)
 
 simple_GPU_pointer_holder ()
 
 simple_GPU_pointer_holder (const simple_GPU_pointer_holder &)=delete
 
 simple_GPU_pointer_holder (simple_GPU_pointer_holder &&other)
 
simple_GPU_pointer_holderoperator= (const simple_GPU_pointer_holder &)=delete
 
simple_GPU_pointer_holderoperator= (simple_GPU_pointer_holder &&other)
 
 ~simple_GPU_pointer_holder ()
 
void * operator* ()
 
void * get_pointer ()
 

Private Attributes

void * m_ptr
 

Detailed Description

A simple RAII wrapper to ensure proper allocation and deallocation of GPU memory in a void * for the temporaries.

Definition at line 190 of file CaloGPUHybridClusterProcessor.h.

Constructor & Destructor Documentation

◆ simple_GPU_pointer_holder() [1/3]

CaloGPUHybridClusterProcessor::simple_GPU_pointer_holder::simple_GPU_pointer_holder ( )
inline

Definition at line 205 of file CaloGPUHybridClusterProcessor.h.

205  :
206  m_ptr(nullptr)
207  {
208  }

◆ simple_GPU_pointer_holder() [2/3]

CaloGPUHybridClusterProcessor::simple_GPU_pointer_holder::simple_GPU_pointer_holder ( const simple_GPU_pointer_holder )
delete

◆ simple_GPU_pointer_holder() [3/3]

CaloGPUHybridClusterProcessor::simple_GPU_pointer_holder::simple_GPU_pointer_holder ( simple_GPU_pointer_holder &&  other)
inline

Definition at line 210 of file CaloGPUHybridClusterProcessor.h.

211  {
212  m_ptr = other.m_ptr;
213  other.m_ptr = nullptr;
214  }

◆ ~simple_GPU_pointer_holder()

CaloGPUHybridClusterProcessor::simple_GPU_pointer_holder::~simple_GPU_pointer_holder ( )
inline

Definition at line 223 of file CaloGPUHybridClusterProcessor.h.

224  {
225  if (m_ptr != nullptr)
226  //This check might still be needed to ensure the code behaves on non-CUDA enabled platforms
227  //where some destructors might still be called with nullptr.
228  {
230  }
231  }

Member Function Documentation

◆ allocate()

void CaloGPUHybridClusterProcessor::simple_GPU_pointer_holder::allocate ( const size_t  size)
inline

Definition at line 197 of file CaloGPUHybridClusterProcessor.h.

198  {
199  if (m_ptr == nullptr && size > 0)
200  {
202  }
203  }

◆ get_pointer()

void* CaloGPUHybridClusterProcessor::simple_GPU_pointer_holder::get_pointer ( )
inline

Definition at line 238 of file CaloGPUHybridClusterProcessor.h.

239  {
240  return m_ptr;
241  }

◆ operator*()

void* CaloGPUHybridClusterProcessor::simple_GPU_pointer_holder::operator* ( )
inline

Definition at line 233 of file CaloGPUHybridClusterProcessor.h.

234  {
235  return m_ptr;
236  }

◆ operator=() [1/2]

simple_GPU_pointer_holder& CaloGPUHybridClusterProcessor::simple_GPU_pointer_holder::operator= ( const simple_GPU_pointer_holder )
delete

◆ operator=() [2/2]

simple_GPU_pointer_holder& CaloGPUHybridClusterProcessor::simple_GPU_pointer_holder::operator= ( simple_GPU_pointer_holder &&  other)
inline

Definition at line 217 of file CaloGPUHybridClusterProcessor.h.

218  {
219  std::swap(m_ptr, other.m_ptr);
220  return (*this);
221  }

Member Data Documentation

◆ m_ptr

void* CaloGPUHybridClusterProcessor::simple_GPU_pointer_holder::m_ptr
private

Definition at line 193 of file CaloGPUHybridClusterProcessor.h.


The documentation for this class was generated from the following file:
CaloRecGPU::CUDA_Helpers::deallocate
void deallocate(void *address)
Deallocates address in GPU memory.
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
WriteCalibToCool.swap
swap
Definition: WriteCalibToCool.py:94
CaloRecGPU::CUDA_Helpers::allocate
void * allocate(const size_t num)
Allocates and returns the address of num bytes from GPU memory.
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
CaloGPUHybridClusterProcessor::simple_GPU_pointer_holder::m_ptr
void * m_ptr
Definition: CaloGPUHybridClusterProcessor.h:193