ITK  4.4.0
Insight Segmentation and Registration Toolkit
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Friends | List of all members
itk::GPUDataManager Class Reference

#include <itkGPUDataManager.h>

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

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 functionalties for CPU-GPU data synchronization and grafting GPU data.

Definition at line 43 of file itkGPUDataManager.h.

Public Types

typedef SmartPointer< const SelfConstPointer
 
typedef MutexLockHolder
< SimpleFastMutexLock
MutexHolderType
 
typedef SmartPointer< SelfPointer
 
typedef GPUDataManager Self
 
typedef Object Superclass
 
- Public Types inherited from itk::Object
typedef SmartPointer< const SelfConstPointer
 
typedef SmartPointer< SelfPointer
 
typedef Object Self
 
typedef LightObject Superclass
 
- Public Types inherited from itk::LightObject
typedef SmartPointer< const SelfConstPointer
 
typedef SmartPointer< SelfPointer
 
typedef LightObject Self
 

Public Member Functions

void Allocate ()
 
virtual ::itk::LightObject::Pointer CreateAnother (void) const
 
unsigned int GetBufferSize ()
 
void * GetCPUBufferPointer ()
 
int GetCurrentCommandQueueID ()
 
cl_mem * GetGPUBufferPointer ()
 
virtual const char * GetNameOfClass () const
 
virtual void Graft (const GPUDataManager *data)
 
virtual void Initialize ()
 
bool IsCPUBufferDirty ()
 
bool IsGPUBufferDirty ()
 
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
 
virtual void DebugOff () const
 
virtual void DebugOn () const
 
CommandGetCommand (unsigned long tag)
 
bool GetDebug () const
 
MetaDataDictionaryGetMetaDataDictionary (void)
 
const MetaDataDictionaryGetMetaDataDictionary (void) const
 
virtual ModifiedTimeType GetMTime () const
 
virtual const TimeStampGetTimeStamp () const
 
bool HasObserver (const EventObject &event) const
 
void InvokeEvent (const EventObject &)
 
void InvokeEvent (const EventObject &) const
 
virtual void Modified () const
 
virtual void Register () const
 
void RemoveAllObservers ()
 
void RemoveObserver (unsigned long tag)
 
void SetDebug (bool debugFlag) const
 
void SetMetaDataDictionary (const MetaDataDictionary &rhs)
 
virtual void SetReferenceCount (int)
 
virtual void UnRegister () const
 
- Public Member Functions inherited from itk::LightObject
virtual void Delete ()
 
virtual int GetReferenceCount () const
 
 itkCloneMacro (Self)
 
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 flag)
 
- Static Public Member Functions inherited from itk::LightObject
static void BreakOnError ()
 
static Pointer New ()
 

Protected Member Functions

 GPUDataManager ()
 
virtual void PrintSelf (std::ostream &os, Indent indent) const
 
virtual ~GPUDataManager ()
 
- Protected Member Functions inherited from itk::Object
 Object ()
 
bool PrintObservers (std::ostream &os, Indent indent) const
 
virtual void SetTimeStamp (const TimeStamp &time)
 
virtual ~Object ()
 
- 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
 
SimpleFastMutexLock m_Mutex
 

Private Member Functions

 GPUDataManager (const Self &)
 
void operator= (const Self &)
 

Friends

class GPUKernelManager
 

Additional Inherited Members

- Protected Types inherited from itk::LightObject
typedef int InternalReferenceCountType
 

Member Typedef Documentation

Definition at line 53 of file itkGPUDataManager.h.

Definition at line 56 of file itkGPUDataManager.h.

Definition at line 52 of file itkGPUDataManager.h.

Definition at line 50 of file itkGPUDataManager.h.

Definition at line 51 of file itkGPUDataManager.h.

Constructor & Destructor Documentation

itk::GPUDataManager::GPUDataManager ( )
protected
virtual itk::GPUDataManager::~GPUDataManager ( )
protectedvirtual
itk::GPUDataManager::GPUDataManager ( const Self )
private

Member Function Documentation

void itk::GPUDataManager::Allocate ( )
virtual::itk::LightObject::Pointer itk::GPUDataManager::CreateAnother ( void  ) const
virtual

Create an object from an instance, potentially deferring to a factory. This method allows you to create an instance of an object that is exactly the same type as the referring object. This is useful in cases where an object has been cast back to a base class.

Reimplemented from itk::Object.

Reimplemented in itk::GPUImageDataManager< ImageType >, and itk::GPUImageDataManager< itk::GPUImage >.

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

Definition at line 63 of file itkGPUDataManager.h.

void* itk::GPUDataManager::GetCPUBufferPointer ( )

Get GPU buffer pointer

int itk::GPUDataManager::GetCurrentCommandQueueID ( )
cl_mem* itk::GPUDataManager::GetGPUBufferPointer ( )

Get GPU buffer pointer

virtual const char* itk::GPUDataManager::GetNameOfClass ( ) const
virtual

Standard part of all itk objects.

Reimplemented from itk::Object.

Reimplemented in itk::GPUImageDataManager< ImageType >, and itk::GPUImageDataManager< itk::GPUImage >.

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

Method for grafting the content of one GPUDataManager into another one

Reimplemented in itk::GPUImageDataManager< ImageType >, and itk::GPUImageDataManager< itk::GPUImage >.

virtual void itk::GPUDataManager::Initialize ( )
virtual

Initialize GPUDataManager

bool itk::GPUDataManager::IsCPUBufferDirty ( )
inline

Definition at line 83 of file itkGPUDataManager.h.

bool itk::GPUDataManager::IsGPUBufferDirty ( )
inline

Definition at line 87 of file itkGPUDataManager.h.

static Pointer itk::GPUDataManager::New ( )
static
void itk::GPUDataManager::operator= ( const Self )
private
virtual void itk::GPUDataManager::PrintSelf ( std::ostream &  os,
Indent  indent 
) const
protectedvirtual

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.

void itk::GPUDataManager::SetBufferFlag ( cl_mem_flags  flags)
void itk::GPUDataManager::SetBufferSize ( unsigned int  num)

total buffer size in bytes

void itk::GPUDataManager::SetCPUBufferDirty ( )

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

void itk::GPUDataManager::SetCPUBufferPointer ( void *  ptr)
void itk::GPUDataManager::SetCPUDirtyFlag ( bool  isDirty)
void itk::GPUDataManager::SetCurrentCommandQueue ( int  queueid)
void itk::GPUDataManager::SetGPUBufferDirty ( )

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

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

Synchronize CPU and GPU buffers (using dirty flags)

virtual void itk::GPUDataManager::UpdateCPUBuffer ( )
virtual

actual GPU->CPU memory copy takes place here

virtual void itk::GPUDataManager::UpdateGPUBuffer ( )
virtual

actual CPU->GPU memory copy takes place here

Friends And Related Function Documentation

friend class GPUKernelManager
friend

allow GPUKernelManager to access GPU buffer pointer

Definition at line 46 of file itkGPUDataManager.h.

Member Data Documentation

unsigned int itk::GPUDataManager::m_BufferSize
protected

Definition at line 131 of file itkGPUDataManager.h.

int itk::GPUDataManager::m_CommandQueueId
protected

Definition at line 135 of file itkGPUDataManager.h.

GPUContextManager* itk::GPUDataManager::m_ContextManager
protected

Definition at line 133 of file itkGPUDataManager.h.

void* itk::GPUDataManager::m_CPUBuffer
protected

Definition at line 142 of file itkGPUDataManager.h.

cl_mem itk::GPUDataManager::m_GPUBuffer
protected

buffer pointers

Definition at line 141 of file itkGPUDataManager.h.

bool itk::GPUDataManager::m_IsCPUBufferDirty
protected

Definition at line 146 of file itkGPUDataManager.h.

bool itk::GPUDataManager::m_IsGPUBufferDirty
protected

checks if buffer needs to be updated

Definition at line 145 of file itkGPUDataManager.h.

cl_mem_flags itk::GPUDataManager::m_MemFlags
protected

buffer type

Definition at line 138 of file itkGPUDataManager.h.

SimpleFastMutexLock itk::GPUDataManager::m_Mutex
protected

Mutex lock to prevent r/w hazard for multithreaded code

Definition at line 149 of file itkGPUDataManager.h.


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