Home
|
Main Page
|
Modules
|
Namespace List
|
Class Hierarchy
|
Alphabetical List
|
Data Structures
|
File List
|
Namespace Members
|
Data Fields
|
Globals
|
Related Pages
Src
E
elastix
Common
OpenCL
ITKimprovements
itkGPUDataManager.h
Go to the documentation of this file.
1
/*=========================================================================
2
*
3
* Copyright UMC Utrecht and contributors
4
*
5
* Licensed under the Apache License, Version 2.0 (the "License");
6
* you may not use this file except in compliance with the License.
7
* You may obtain a copy of the License at
8
*
9
* http://www.apache.org/licenses/LICENSE-2.0.txt
10
*
11
* Unless required by applicable law or agreed to in writing, software
12
* distributed under the License is distributed on an "AS IS" BASIS,
13
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
* See the License for the specific language governing permissions and
15
* limitations under the License.
16
*
17
*=========================================================================*/
18
/*=========================================================================
19
*
20
* Copyright Insight Software Consortium
21
*
22
* Licensed under the Apache License, Version 2.0 (the "License");
23
* you may not use this file except in compliance with the License.
24
* You may obtain a copy of the License at
25
*
26
* http://www.apache.org/licenses/LICENSE-2.0.txt
27
*
28
* Unless required by applicable law or agreed to in writing, software
29
* distributed under the License is distributed on an "AS IS" BASIS,
30
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
31
* See the License for the specific language governing permissions and
32
* limitations under the License.
33
*
34
*=========================================================================*/
35
#ifndef itkGPUDataManager_h
36
#define itkGPUDataManager_h
37
38
#include "itkObject.h"
39
#include "itkDataObject.h"
40
#include "itkObjectFactory.h"
41
#include "
itkOpenCLContext.h
"
42
#include <mutex>
43
44
namespace
itk
45
{
64
class
ITKOpenCL_EXPORT
GPUDataManager
:
public
Object
// DataObject//
65
{
67
friend
class
OpenCLKernelManager
;
68
69
public
:
70
ITK_DISALLOW_COPY_AND_MOVE
(
GPUDataManager
);
71
72
using
Self
=
GPUDataManager
;
73
using
Superclass
= Object;
74
using
Pointer
= SmartPointer<Self>;
75
using
ConstPointer
= SmartPointer<const Self>;
76
78
itkNewMacro(
Self
);
79
81
itkTypeMacro(
GPUDataManager
, Object);
82
83
using
MutexHolderType
= std::lock_guard<std::mutex>;
84
86
void
87
SetBufferSize
(
unsigned
int
num);
88
89
unsigned
int
90
GetBufferSize
()
91
{
92
return
m_BufferSize;
93
}
94
95
void
96
SetBufferFlag
(cl_mem_flags flags);
97
98
void
99
SetCPUBufferPointer
(
void
* ptr);
100
101
void
102
SetCPUDirtyFlag
(
bool
isDirty);
103
104
void
105
SetGPUDirtyFlag
(
bool
isDirty);
106
109
void
110
SetCPUBufferDirty
();
111
114
void
115
SetGPUBufferDirty
();
116
117
bool
118
IsCPUBufferDirty
()
119
{
120
return
m_IsCPUBufferDirty;
121
}
122
123
bool
124
IsGPUBufferDirty
()
125
{
126
return
m_IsGPUBufferDirty;
127
}
128
130
virtual
void
131
UpdateCPUBuffer
();
132
134
virtual
void
135
UpdateGPUBuffer
();
136
137
void
138
Allocate
();
139
141
bool
142
Update
();
143
145
virtual
void
146
Graft
(
const
GPUDataManager
* data);
147
149
virtual
void
150
Initialize
();
151
153
cl_mem *
154
GetGPUBufferPointer
();
155
157
void
*
158
GetCPUBufferPointer
();
159
161
void
162
SetCPUBufferLock
(
const
bool
v)
163
{
164
this->m_CPUBufferLock = v;
165
}
166
itkGetConstReferenceMacro(CPUBufferLock,
bool
);
167
169
void
170
SetGPUBufferLock
(
const
bool
v)
171
{
172
this->m_GPUBufferLock = v;
173
}
174
itkGetConstReferenceMacro(GPUBufferLock,
bool
);
175
176
protected
:
177
GPUDataManager
();
178
~GPUDataManager
()
override
;
179
void
180
PrintSelf
(std::ostream & os, Indent indent)
const override
;
181
182
protected
:
183
unsigned
int
m_BufferSize{};
// # of bytes
184
185
OpenCLContext
* m_Context{};
186
188
cl_mem_flags m_MemFlags{};
189
191
cl_mem m_GPUBuffer{};
192
void
* m_CPUBuffer{};
193
195
bool
m_IsGPUBufferDirty{};
196
bool
m_IsCPUBufferDirty{};
197
199
bool
m_CPUBufferLock{};
200
bool
m_GPUBufferLock{};
201
203
std::mutex m_Mutex{};
204
};
205
206
}
// namespace itk
207
208
#endif
SmartPointer< Self >
itk::GPUDataManager
GPU memory manager implemented using OpenCL. Required by GPUImage class.
Definition
itkGPUDataManager.h:65
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::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::ConstPointer
SmartPointer< const Self > ConstPointer
Definition
itkGPUDataManager.h:75
itk::GPUDataManager::Update
bool Update()
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::GetBufferSize
unsigned int GetBufferSize()
Definition
itkGPUDataManager.h:90
itk::GPUDataManager::Superclass
Object Superclass
Definition
itkGPUDataManager.h:73
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::SetCPUBufferDirty
void SetCPUBufferDirty()
itk::OpenCLContext
The OpenCLContext class represents an OpenCL context.
Definition
itkOpenCLContext.h:77
itk::OpenCLKernelManager
OpenCL kernel manager implemented using OpenCL.
Definition
itkOpenCLKernelManager.h:68
itkOpenCLContext.h
ITKOpenCL_EXPORT
#define ITKOpenCL_EXPORT
Definition
itkOpenCLExport.h:33
itk
Definition
itkAdvancedImageToImageMetric.h:43
Generated on 2024-07-17 for elastix by
1.11.0 (9b424b03c9833626cd435af22a444888fbbb192d)