go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Friends
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.

Note
This file was taken from ITK 4.1.0. It was modified by Denis P. Shamonin and Marius Staring. Division of Image Processing, Department of Radiology, Leiden, The Netherlands. Added functionality is described in the Insight Journal paper: http://hdl.handle.net/10380/3393

Definition at line 64 of file itkGPUDataManager.h.

Inheritance diagram for itk::GPUDataManager:
Inheritance graph
[legend]

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 Member Functions

void Allocate ()
 
unsigned int GetBufferSize ()
 
virtual const char * GetClassName () const
 
virtual const boolGetCPUBufferLock ()
 
void * GetCPUBufferPointer ()
 
virtual const boolGetGPUBufferLock ()
 
cl_mem * GetGPUBufferPointer ()
 
virtual void Graft (const GPUDataManager *data)
 
virtual void Initialize ()
 
bool IsCPUBufferDirty ()
 
bool IsGPUBufferDirty ()
 
 ITK_DISALLOW_COPY_AND_MOVE (GPUDataManager)
 
void SetBufferFlag (cl_mem_flags flags)
 
void SetBufferSize (unsigned int num)
 
void SetCPUBufferDirty ()
 
void SetCPUBufferLock (const bool v)
 
void SetCPUBufferPointer (void *ptr)
 
void SetCPUDirtyFlag (bool isDirty)
 
void SetGPUBufferDirty ()
 
void SetGPUBufferLock (const bool v)
 
void SetGPUDirtyFlag (bool isDirty)
 
bool Update ()
 
virtual void UpdateCPUBuffer ()
 
virtual void UpdateGPUBuffer ()
 

Static Public Member Functions

static Pointer New ()
 

Protected Member Functions

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

Protected Attributes

unsigned int m_BufferSize
 
OpenCLContextm_Context
 
void * m_CPUBuffer
 
bool m_CPUBufferLock
 
cl_mem m_GPUBuffer
 
bool m_GPUBufferLock
 
bool m_IsCPUBufferDirty
 
bool m_IsGPUBufferDirty
 
cl_mem_flags m_MemFlags
 
std::mutex m_Mutex
 

Friends

class OpenCLKernelManager
 

Member Typedef Documentation

◆ ConstPointer

using itk::GPUDataManager::ConstPointer = SmartPointer<const Self>

Definition at line 75 of file itkGPUDataManager.h.

◆ MutexHolderType

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

Definition at line 83 of file itkGPUDataManager.h.

◆ Pointer

using itk::GPUDataManager::Pointer = SmartPointer<Self>

Definition at line 74 of file itkGPUDataManager.h.

◆ Self

Definition at line 72 of file itkGPUDataManager.h.

◆ Superclass

Definition at line 73 of file itkGPUDataManager.h.

Constructor & Destructor Documentation

◆ GPUDataManager()

itk::GPUDataManager::GPUDataManager ( )
protected

◆ ~GPUDataManager()

itk::GPUDataManager::~GPUDataManager ( )
overrideprotected

Member Function Documentation

◆ Allocate()

void itk::GPUDataManager::Allocate ( )

◆ GetBufferSize()

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

Definition at line 90 of file itkGPUDataManager.h.

◆ GetClassName()

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

Run-time type information (and related methods).

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

◆ GetCPUBufferLock()

virtual const bool & itk::GPUDataManager::GetCPUBufferLock ( )
virtual

◆ GetCPUBufferPointer()

void * itk::GPUDataManager::GetCPUBufferPointer ( )

Get GPU buffer pointer

◆ GetGPUBufferLock()

virtual const bool & itk::GPUDataManager::GetGPUBufferLock ( )
virtual

◆ GetGPUBufferPointer()

cl_mem * itk::GPUDataManager::GetGPUBufferPointer ( )

Get GPU buffer pointer

◆ Graft()

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

Method for grafting the content of one GPUDataManager into another one

◆ Initialize()

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

Initialize GPUDataManager

◆ IsCPUBufferDirty()

bool itk::GPUDataManager::IsCPUBufferDirty ( )
inline

Definition at line 118 of file itkGPUDataManager.h.

◆ IsGPUBufferDirty()

bool itk::GPUDataManager::IsGPUBufferDirty ( )
inline

Definition at line 124 of file itkGPUDataManager.h.

◆ ITK_DISALLOW_COPY_AND_MOVE()

itk::GPUDataManager::ITK_DISALLOW_COPY_AND_MOVE ( GPUDataManager  )

◆ New()

static Pointer itk::GPUDataManager::New ( )
static

Method for creation through the object factory.

◆ PrintSelf()

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

◆ 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

◆ SetCPUBufferLock()

void itk::GPUDataManager::SetCPUBufferLock ( const bool  v)
inline

Make CPU buffer locked to avoid extra update from ITK pipeline.

Definition at line 162 of file itkGPUDataManager.h.

◆ SetCPUBufferPointer()

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

◆ SetCPUDirtyFlag()

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

◆ 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

◆ SetGPUBufferLock()

void itk::GPUDataManager::SetGPUBufferLock ( const bool  v)
inline

Make GPU buffer locked to avoid extra update from ITK pipeline.

Definition at line 170 of file itkGPUDataManager.h.

◆ 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 ( )
virtual

actual GPU->CPU memory copy takes place here

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

◆ UpdateGPUBuffer()

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

actual CPU->GPU memory copy takes place here

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

Friends And Related Function Documentation

◆ OpenCLKernelManager

friend class OpenCLKernelManager
friend

allow GPUKernelManager to access GPU buffer pointer

Definition at line 67 of file itkGPUDataManager.h.

Field Documentation

◆ m_BufferSize

unsigned int itk::GPUDataManager::m_BufferSize
protected

Definition at line 183 of file itkGPUDataManager.h.

◆ m_Context

OpenCLContext* itk::GPUDataManager::m_Context
protected

Definition at line 185 of file itkGPUDataManager.h.

◆ m_CPUBuffer

void* itk::GPUDataManager::m_CPUBuffer
protected

Definition at line 192 of file itkGPUDataManager.h.

◆ m_CPUBufferLock

bool itk::GPUDataManager::m_CPUBufferLock
protected

extra safety flags

Definition at line 199 of file itkGPUDataManager.h.

◆ m_GPUBuffer

cl_mem itk::GPUDataManager::m_GPUBuffer
protected

buffer pointers

Definition at line 191 of file itkGPUDataManager.h.

◆ m_GPUBufferLock

bool itk::GPUDataManager::m_GPUBufferLock
protected

Definition at line 200 of file itkGPUDataManager.h.

◆ m_IsCPUBufferDirty

bool itk::GPUDataManager::m_IsCPUBufferDirty
protected

Definition at line 196 of file itkGPUDataManager.h.

◆ m_IsGPUBufferDirty

bool itk::GPUDataManager::m_IsGPUBufferDirty
protected

checks if buffer needs to be updated

Definition at line 195 of file itkGPUDataManager.h.

◆ m_MemFlags

cl_mem_flags itk::GPUDataManager::m_MemFlags
protected

buffer type

Definition at line 188 of file itkGPUDataManager.h.

◆ m_Mutex

std::mutex itk::GPUDataManager::m_Mutex
protected

Mutex lock to prevent r/w hazard for multithreaded code

Definition at line 203 of file itkGPUDataManager.h.



Generated on 2023-01-13 for elastix by doxygen 1.9.6 elastix logo