ITK  5.4.0
Insight Toolkit
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
itk::GPUDataManager Class Reference

#include <itkGPUDataManager.h>

Detailed Description

GPU memory manager implemented using OpenCL. Required by GPUImage class.

This class serves as a base class for GPU data container for GPUImage class, which is similar to ImageBase class for Image class. However, all the image-related meta data will be already stored in image class (parent of GPUImage), therefore we did not name it GPUImageBase. Rather, this class is a GPU-specific data manager that provides functionalities for CPU-GPU data synchronization and grafting GPU data.

Definition at line 42 of file itkGPUDataManager.h.

+ Inheritance diagram for itk::GPUDataManager:
+ Collaboration diagram for itk::GPUDataManager:

Public Types

using ConstPointer = SmartPointer< const Self >
using MutexHolderType = std::lock_guard< std::mutex >
using Pointer = SmartPointer< Self >
using Self = GPUDataManager
using Superclass = Object
- Public Types inherited from itk::Object
using ConstPointer = SmartPointer< const Self >
using Pointer = SmartPointer< Self >
using Self = Object
using Superclass = LightObject
- Public Types inherited from itk::LightObject
using ConstPointer = SmartPointer< const Self >
using Pointer = SmartPointer< Self >
using Self = LightObject

Public Member Functions

void Allocate ()
unsigned int GetBufferSize () const
void * GetCPUBufferPointer ()
int GetCurrentCommandQueueID () const
cl_mem * GetGPUBufferPointer ()
virtual void Graft (const GPUDataManager *data)
virtual void Initialize ()
bool IsCPUBufferDirty () const
bool IsGPUBufferDirty () const
 itkOverrideGetNameOfClassMacro (GPUDataManager)
void SetBufferFlag (cl_mem_flags flags)
void SetBufferSize (unsigned int num)
void SetCPUBufferDirty ()
void SetCPUBufferPointer (void *ptr)
void SetCPUDirtyFlag (bool isDirty)
void SetCurrentCommandQueue (int queueid)
void SetGPUBufferDirty ()
void SetGPUDirtyFlag (bool isDirty)
bool Update ()
virtual void UpdateCPUBuffer ()
virtual void UpdateGPUBuffer ()
- Public Member Functions inherited from itk::Object
unsigned long AddObserver (const EventObject &event, Command *)
unsigned long AddObserver (const EventObject &event, Command *) const
unsigned long AddObserver (const EventObject &event, std::function< void(const EventObject &)> function) const
LightObject::Pointer CreateAnother () const override
virtual void DebugOff () const
virtual void DebugOn () const
CommandGetCommand (unsigned long tag)
bool GetDebug () const
MetaDataDictionaryGetMetaDataDictionary ()
const MetaDataDictionaryGetMetaDataDictionary () const
virtual ModifiedTimeType GetMTime () const
virtual const TimeStampGetTimeStamp () const
bool HasObserver (const EventObject &event) const
void InvokeEvent (const EventObject &)
void InvokeEvent (const EventObject &) const
 itkOverrideGetNameOfClassMacro (Object)
virtual void Modified () const
void Register () const override
void RemoveAllObservers ()
void RemoveObserver (unsigned long tag)
void SetDebug (bool debugFlag) const
void SetReferenceCount (int) override
void UnRegister () const noexcept override
void SetMetaDataDictionary (const MetaDataDictionary &rhs)
void SetMetaDataDictionary (MetaDataDictionary &&rrhs)
virtual void SetObjectName (std::string _arg)
virtual const std::string & GetObjectName () const
- Public Member Functions inherited from itk::LightObject
Pointer Clone () const
virtual void Delete ()
virtual int GetReferenceCount () const
 itkVirtualGetNameOfClassMacro (LightObject)
void Print (std::ostream &os, Indent indent=0) const

Static Public Member Functions

static Pointer New ()
- Static Public Member Functions inherited from itk::Object
static bool GetGlobalWarningDisplay ()
static void GlobalWarningDisplayOff ()
static void GlobalWarningDisplayOn ()
static Pointer New ()
static void SetGlobalWarningDisplay (bool val)
- Static Public Member Functions inherited from itk::LightObject
static void BreakOnError ()
static Pointer New ()

Protected Member Functions

 GPUDataManager ()
void PrintSelf (std::ostream &os, Indent indent) const override
 ~GPUDataManager () override
- Protected Member Functions inherited from itk::Object
 Object ()
bool PrintObservers (std::ostream &os, Indent indent) const
virtual void SetTimeStamp (const TimeStamp &timeStamp)
 ~Object () override
- Protected Member Functions inherited from itk::LightObject
virtual LightObject::Pointer InternalClone () const
 LightObject ()
virtual void PrintHeader (std::ostream &os, Indent indent) const
virtual void PrintTrailer (std::ostream &os, Indent indent) const
virtual ~LightObject ()

Protected Attributes

unsigned int m_BufferSize {}
int m_CommandQueueId {}
GPUContextManagerm_ContextManager {}
void * m_CPUBuffer {}
cl_mem m_GPUBuffer {}
bool m_IsCPUBufferDirty {}
bool m_IsGPUBufferDirty {}
cl_mem_flags m_MemFlags {}
std::mutex m_Mutex {}
- Protected Attributes inherited from itk::LightObject
std::atomic< int > m_ReferenceCount {}


class GPUKernelManager

Member Typedef Documentation

◆ ConstPointer

Definition at line 53 of file itkGPUDataManager.h.

◆ MutexHolderType

using itk::GPUDataManager::MutexHolderType = std::lock_guard<std::mutex>

Definition at line 58 of file itkGPUDataManager.h.

◆ Pointer

Definition at line 52 of file itkGPUDataManager.h.

◆ Self

Definition at line 50 of file itkGPUDataManager.h.

◆ Superclass

Definition at line 51 of file itkGPUDataManager.h.

Constructor & Destructor Documentation

◆ GPUDataManager()

itk::GPUDataManager::GPUDataManager ( )

◆ ~GPUDataManager()

itk::GPUDataManager::~GPUDataManager ( )

Member Function Documentation

◆ Allocate()

void itk::GPUDataManager::Allocate ( )

◆ GetBufferSize()

unsigned int itk::GPUDataManager::GetBufferSize ( ) const

Definition at line 65 of file itkGPUDataManager.h.

References m_BufferSize.

◆ GetCPUBufferPointer()

void* itk::GPUDataManager::GetCPUBufferPointer ( )

Get GPU buffer pointer

◆ GetCurrentCommandQueueID()

int itk::GPUDataManager::GetCurrentCommandQueueID ( ) const

◆ GetGPUBufferPointer()

cl_mem* itk::GPUDataManager::GetGPUBufferPointer ( )

Get GPU buffer pointer

◆ Graft()

virtual void itk::GPUDataManager::Graft ( const GPUDataManager data)

Method for grafting the content of one GPUDataManager into another one

◆ Initialize()

virtual void itk::GPUDataManager::Initialize ( )

Initialize GPUDataManager

◆ IsCPUBufferDirty()

bool itk::GPUDataManager::IsCPUBufferDirty ( ) const

Definition at line 93 of file itkGPUDataManager.h.

References m_IsCPUBufferDirty.

◆ IsGPUBufferDirty()

bool itk::GPUDataManager::IsGPUBufferDirty ( ) const

Definition at line 99 of file itkGPUDataManager.h.

References m_IsGPUBufferDirty.

◆ itkOverrideGetNameOfClassMacro()

itk::GPUDataManager::itkOverrideGetNameOfClassMacro ( GPUDataManager  )

◆ New()

static Pointer itk::GPUDataManager::New ( )

◆ PrintSelf()

void itk::GPUDataManager::PrintSelf ( std::ostream &  os,
Indent  indent 
) const

Methods invoked by Print() to print information about the object including superclasses. Typically not called by the user (use Print() instead) but used in the hierarchical print process to combine the output of several classes.

Reimplemented from itk::Object.

◆ SetBufferFlag()

void itk::GPUDataManager::SetBufferFlag ( cl_mem_flags  flags)

◆ SetBufferSize()

void itk::GPUDataManager::SetBufferSize ( unsigned int  num)

total buffer size in bytes

◆ SetCPUBufferDirty()

void itk::GPUDataManager::SetCPUBufferDirty ( )

Make GPU up-to-date and mark CPU as dirty. Call this function when you want to modify CPU data

◆ SetCPUBufferPointer()

void itk::GPUDataManager::SetCPUBufferPointer ( void *  ptr)

◆ SetCPUDirtyFlag()

void itk::GPUDataManager::SetCPUDirtyFlag ( bool  isDirty)

◆ SetCurrentCommandQueue()

void itk::GPUDataManager::SetCurrentCommandQueue ( int  queueid)

◆ SetGPUBufferDirty()

void itk::GPUDataManager::SetGPUBufferDirty ( )

Make CPU up-to-date and mark GPU as dirty. Call this function when you want to modify GPU data

◆ SetGPUDirtyFlag()

void itk::GPUDataManager::SetGPUDirtyFlag ( bool  isDirty)

◆ Update()

bool itk::GPUDataManager::Update ( )

Synchronize CPU and GPU buffers (using dirty flags)

◆ UpdateCPUBuffer()

virtual void itk::GPUDataManager::UpdateCPUBuffer ( )

actual GPU->CPU memory copy takes place here

◆ UpdateGPUBuffer()

virtual void itk::GPUDataManager::UpdateGPUBuffer ( )

actual CPU->GPU memory copy takes place here

Friends And Related Function Documentation

◆ GPUKernelManager

friend class GPUKernelManager

allow GPUKernelManager to access GPU buffer pointer

Definition at line 45 of file itkGPUDataManager.h.

Member Data Documentation

◆ m_BufferSize

unsigned int itk::GPUDataManager::m_BufferSize {}

Definition at line 150 of file itkGPUDataManager.h.

Referenced by GetBufferSize().

◆ m_CommandQueueId

int itk::GPUDataManager::m_CommandQueueId {}

Definition at line 154 of file itkGPUDataManager.h.

◆ m_ContextManager

GPUContextManager* itk::GPUDataManager::m_ContextManager {}

Definition at line 152 of file itkGPUDataManager.h.

◆ m_CPUBuffer

void* itk::GPUDataManager::m_CPUBuffer {}

Definition at line 161 of file itkGPUDataManager.h.

◆ m_GPUBuffer

cl_mem itk::GPUDataManager::m_GPUBuffer {}

buffer pointers

Definition at line 160 of file itkGPUDataManager.h.

◆ m_IsCPUBufferDirty

bool itk::GPUDataManager::m_IsCPUBufferDirty {}

Definition at line 165 of file itkGPUDataManager.h.

Referenced by IsCPUBufferDirty().

◆ m_IsGPUBufferDirty

bool itk::GPUDataManager::m_IsGPUBufferDirty {}

checks if buffer needs to be updated

Definition at line 164 of file itkGPUDataManager.h.

Referenced by IsGPUBufferDirty().

◆ m_MemFlags

cl_mem_flags itk::GPUDataManager::m_MemFlags {}

buffer type

Definition at line 157 of file itkGPUDataManager.h.

◆ m_Mutex

std::mutex itk::GPUDataManager::m_Mutex {}

Mutex lock to prevent r/w hazard for multithreaded code

Definition at line 168 of file itkGPUDataManager.h.

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