Loading...
Searching...
No Matches
itkGPUDataManager.h
Go to the documentation of this file.
/*=========================================================================
*
* Copyright UMC Utrecht and contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0.txt
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*=========================================================================*/
/*=========================================================================
*
* Copyright Insight Software Consortium
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0.txt
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*=========================================================================*/
#ifndef itkGPUDataManager_h
#define itkGPUDataManager_h
#include "itkObject.h"
#include "itkDataObject.h"
#include "itkObjectFactory.h"
#include "itkOpenCLContext.h"
#include <mutex>
namespace itk
{
class ITKOpenCL_EXPORT GPUDataManager : public Object // DataObject//
{
friend class OpenCLKernelManager;
public:
ITK_DISALLOW_COPY_AND_MOVE(GPUDataManager);
using Self = GPUDataManager;
using Superclass = Object;
using Pointer = SmartPointer<Self>;
using ConstPointer = SmartPointer<const Self>;
itkNewMacro(Self);
itkTypeMacro(GPUDataManager, Object);
using MutexHolderType = std::lock_guard<std::mutex>;
void
SetBufferSize(unsigned int num);
unsigned int
GetBufferSize()
{
return m_BufferSize;
}
void
SetBufferFlag(cl_mem_flags flags);
void
SetCPUBufferPointer(void * ptr);
void
SetCPUDirtyFlag(bool isDirty);
void
SetGPUDirtyFlag(bool isDirty);
void
SetCPUBufferDirty();
void
SetGPUBufferDirty();
bool
IsCPUBufferDirty()
{
return m_IsCPUBufferDirty;
}
bool
IsGPUBufferDirty()
{
return m_IsGPUBufferDirty;
}
virtual void
UpdateCPUBuffer();
virtual void
UpdateGPUBuffer();
void
Allocate();
bool
Update();
virtual void
Graft(const GPUDataManager * data);
virtual void
Initialize();
cl_mem *
GetGPUBufferPointer();
void *
GetCPUBufferPointer();
void
SetCPUBufferLock(const bool v)
{
this->m_CPUBufferLock = v;
}
itkGetConstReferenceMacro(CPUBufferLock, bool);
void
SetGPUBufferLock(const bool v)
{
this->m_GPUBufferLock = v;
}
itkGetConstReferenceMacro(GPUBufferLock, bool);
protected:
GPUDataManager();
~GPUDataManager() override;
void
PrintSelf(std::ostream & os, Indent indent) const override;
protected:
unsigned int m_BufferSize{}; // # of bytes
OpenCLContext * m_Context{};
cl_mem_flags m_MemFlags{};
cl_mem m_GPUBuffer{};
void * m_CPUBuffer{};
bool m_IsGPUBufferDirty{};
bool m_IsCPUBufferDirty{};
bool m_CPUBufferLock{};
bool m_GPUBufferLock{};
std::mutex m_Mutex{};
};
} // namespace itk
#endif
itk::GPUDataManager::Pointer
SmartPointer< Self > Pointer
Definition itkGPUDataManager.h:74
itk::GPUDataManager::Allocate
void Allocate()
itk::GPUDataManager::IsGPUBufferDirty
bool IsGPUBufferDirty()
Definition itkGPUDataManager.h:124
itk::GPUDataManager::SetCPUBufferLock
void SetCPUBufferLock(const bool v)
Definition itkGPUDataManager.h:162
itk::GPUDataManager::SetBufferSize
void SetBufferSize(unsigned int num)
itk::GPUDataManager::SetGPUBufferDirty
void SetGPUBufferDirty()
itk::GPUDataManager::SetCPUBufferPointer
void SetCPUBufferPointer(void *ptr)
itk::GPUDataManager::m_MemFlags
cl_mem_flags m_MemFlags
Definition itkGPUDataManager.h:188
itk::GPUDataManager::GPUDataManager
GPUDataManager()
itk::GPUDataManager::IsCPUBufferDirty
bool IsCPUBufferDirty()
Definition itkGPUDataManager.h:118
itk::GPUDataManager::SetGPUBufferLock
void SetGPUBufferLock(const bool v)
Definition itkGPUDataManager.h:170
itk::GPUDataManager::m_GPUBufferLock
bool m_GPUBufferLock
Definition itkGPUDataManager.h:200
itk::GPUDataManager::m_Mutex
std::mutex m_Mutex
Definition itkGPUDataManager.h:203
itk::GPUDataManager::ConstPointer
SmartPointer< const Self > ConstPointer
Definition itkGPUDataManager.h:75
itk::GPUDataManager::Update
bool Update()
itk::GPUDataManager::m_Context
OpenCLContext * m_Context
Definition itkGPUDataManager.h:185
itk::GPUDataManager::OpenCLKernelManager
friend class OpenCLKernelManager
Definition itkGPUDataManager.h:67
itk::GPUDataManager::ITK_DISALLOW_COPY_AND_MOVE
ITK_DISALLOW_COPY_AND_MOVE(GPUDataManager)
itk::GPUDataManager::UpdateGPUBuffer
virtual void UpdateGPUBuffer()
itk::GPUDataManager::Initialize
virtual void Initialize()
itk::GPUDataManager::GetCPUBufferPointer
void * GetCPUBufferPointer()
itk::GPUDataManager::m_IsCPUBufferDirty
bool m_IsCPUBufferDirty
Definition itkGPUDataManager.h:196
itk::GPUDataManager::GetBufferSize
unsigned int GetBufferSize()
Definition itkGPUDataManager.h:90
itk::GPUDataManager::Superclass
Object Superclass
Definition itkGPUDataManager.h:73
itk::GPUDataManager::m_CPUBufferLock
bool m_CPUBufferLock
Definition itkGPUDataManager.h:199
itk::GPUDataManager::PrintSelf
void PrintSelf(std::ostream &os, Indent indent) const override
itk::GPUDataManager::Graft
virtual void Graft(const GPUDataManager *data)
itk::GPUDataManager::GetGPUBufferPointer
cl_mem * GetGPUBufferPointer()
itk::GPUDataManager::SetCPUDirtyFlag
void SetCPUDirtyFlag(bool isDirty)
itk::GPUDataManager::UpdateCPUBuffer
virtual void UpdateCPUBuffer()
itk::GPUDataManager::SetBufferFlag
void SetBufferFlag(cl_mem_flags flags)
itk::GPUDataManager::SetGPUDirtyFlag
void SetGPUDirtyFlag(bool isDirty)
itk::GPUDataManager::~GPUDataManager
~GPUDataManager() override
itk::GPUDataManager::MutexHolderType
std::lock_guard< std::mutex > MutexHolderType
Definition itkGPUDataManager.h:83
itk::GPUDataManager::m_GPUBuffer
cl_mem m_GPUBuffer
Definition itkGPUDataManager.h:191
itk::GPUDataManager::m_IsGPUBufferDirty
bool m_IsGPUBufferDirty
Definition itkGPUDataManager.h:195
itk::GPUDataManager::SetCPUBufferDirty
void SetCPUBufferDirty()
itk::GPUDataManager::m_BufferSize
unsigned int m_BufferSize
Definition itkGPUDataManager.h:183
itk::GPUDataManager::m_CPUBuffer
void * m_CPUBuffer
Definition itkGPUDataManager.h:192
itk::GPUDataManager::Self
GPUDataManager Self
Definition itkGPUDataManager.h:72
itk::OpenCLContext
The OpenCLContext class represents an OpenCL context.
Definition itkOpenCLContext.h:77
itkOpenCLContext.h
ITKOpenCL_EXPORT
#define ITKOpenCL_EXPORT
Definition itkOpenCLExport.h:33
itk
Definition itkAdvancedImageToImageMetric.h:43

Generated on 1768596610 for elastix by 1.15.0 |