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 165 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 180 of file CaloGPUHybridClusterProcessor.h.

180  :
181  m_ptr(nullptr)
182  {
183  }

◆ 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 185 of file CaloGPUHybridClusterProcessor.h.

186  {
187  m_ptr = other.m_ptr;
188  other.m_ptr = nullptr;
189  }

◆ ~simple_GPU_pointer_holder()

CaloGPUHybridClusterProcessor::simple_GPU_pointer_holder::~simple_GPU_pointer_holder ( )
inline

Definition at line 198 of file CaloGPUHybridClusterProcessor.h.

199  {
200  if (m_ptr != nullptr)
201  //This check might still be needed to ensure the code behaves on non-CUDA enabled platforms
202  //where some destructors might still be called with nullptr.
203  {
205  }
206  }

Member Function Documentation

◆ allocate()

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

Definition at line 172 of file CaloGPUHybridClusterProcessor.h.

173  {
174  if (m_ptr == nullptr && size > 0)
175  {
177  }
178  }

◆ get_pointer()

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

Definition at line 213 of file CaloGPUHybridClusterProcessor.h.

214  {
215  return m_ptr;
216  }

◆ operator*()

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

Definition at line 208 of file CaloGPUHybridClusterProcessor.h.

209  {
210  return m_ptr;
211  }

◆ 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 192 of file CaloGPUHybridClusterProcessor.h.

193  {
194  std::swap(m_ptr, other.m_ptr);
195  return (*this);
196  }

Member Data Documentation

◆ m_ptr

void* CaloGPUHybridClusterProcessor::simple_GPU_pointer_holder::m_ptr
private

Definition at line 168 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:168