Home
|
Main Page
|
Modules
|
Namespace List
|
Class Hierarchy
|
Alphabetical List
|
Data Structures
|
File List
|
Namespace Members
|
Data Fields
|
Globals
|
Related Pages
src
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 "itkSimpleFastMutexLock.h"
42
#include "itkMutexLockHolder.h"
43
44
#include "
itkOpenCLContext.h
"
45
46
namespace
itk
47
{
66
class
ITKOpenCL_EXPORT
GPUDataManager
:
public
Object
//DataObject//
67
{
69
friend
class
OpenCLKernelManager
;
70
71
public
:
72
73
typedef
GPUDataManager
Self
;
74
typedef
Object
Superclass
;
75
typedef
SmartPointer< Self >
Pointer
;
76
typedef
SmartPointer< const Self >
ConstPointer
;
77
79
itkNewMacro( Self );
80
82
itkTypeMacro(
GPUDataManager
, Object );
83
84
typedef
MutexLockHolder< SimpleFastMutexLock >
MutexHolderType
;
85
87
void
SetBufferSize(
unsigned
int
num );
88
89
unsigned
int
GetBufferSize
()
90
{
91
return
m_BufferSize;
92
}
93
94
95
void
SetBufferFlag( cl_mem_flags flags );
96
97
void
SetCPUBufferPointer(
void
* ptr );
98
99
void
SetCPUDirtyFlag(
bool
isDirty );
100
101
void
SetGPUDirtyFlag(
bool
isDirty );
102
105
void
SetCPUBufferDirty();
106
109
void
SetGPUBufferDirty();
110
111
bool
IsCPUBufferDirty
()
112
{
113
return
m_IsCPUBufferDirty;
114
}
115
116
117
bool
IsGPUBufferDirty
()
118
{
119
return
m_IsGPUBufferDirty;
120
}
121
122
124
virtual
void
UpdateCPUBuffer();
125
127
virtual
void
UpdateGPUBuffer();
128
129
void
Allocate();
130
132
bool
Update();
133
135
virtual
void
Graft(
const
GPUDataManager
* data );
136
138
virtual
void
Initialize();
139
141
cl_mem * GetGPUBufferPointer();
142
144
void
* GetCPUBufferPointer();
145
147
void
SetCPUBufferLock
(
const
bool
v ) { this->m_CPUBufferLock = v; }
148
itkGetConstReferenceMacro( CPUBufferLock,
bool
);
149
151
void
SetGPUBufferLock
(
const
bool
v ) { this->m_GPUBufferLock = v; }
152
itkGetConstReferenceMacro( GPUBufferLock,
bool
);
153
154
protected
:
155
156
GPUDataManager
();
157
virtual
~
GPUDataManager
();
158
virtual
void
PrintSelf( std::ostream & os, Indent indent )
const
;
159
160
private
:
161
162
GPUDataManager
(
const
Self & );
// purposely not implemented
163
void
operator=(
const
Self & );
// purposely not implemented
164
165
protected
:
166
167
unsigned
int
m_BufferSize
;
// # of bytes
168
169
OpenCLContext
*
m_Context
;
170
172
cl_mem_flags
m_MemFlags
;
173
175
cl_mem
m_GPUBuffer
;
176
void
*
m_CPUBuffer
;
177
179
bool
m_IsGPUBufferDirty
;
180
bool
m_IsCPUBufferDirty
;
181
183
bool
m_CPUBufferLock
;
184
bool
m_GPUBufferLock
;
185
187
SimpleFastMutexLock
m_Mutex
;
188
};
189
190
}
// namespace itk
191
192
#endif
itk::GPUDataManager::m_Mutex
SimpleFastMutexLock m_Mutex
Definition:
itkGPUDataManager.h:187
itk::GPUDataManager::Self
GPUDataManager Self
Definition:
itkGPUDataManager.h:73
SmartPointer< Self >
itk::GPUDataManager::m_IsCPUBufferDirty
bool m_IsCPUBufferDirty
Definition:
itkGPUDataManager.h:180
itk
Definition:
itkAdvancedImageToImageMetric.h:39
itk::GPUDataManager::MutexHolderType
MutexLockHolder< SimpleFastMutexLock > MutexHolderType
Definition:
itkGPUDataManager.h:82
itk::GPUDataManager::m_GPUBuffer
cl_mem m_GPUBuffer
Definition:
itkGPUDataManager.h:175
itk::GPUDataManager::m_Context
OpenCLContext * m_Context
Definition:
itkGPUDataManager.h:169
itk::GPUDataManager::m_MemFlags
cl_mem_flags m_MemFlags
Definition:
itkGPUDataManager.h:172
itk::GPUDataManager
GPU memory manager implemented using OpenCL. Required by GPUImage class.
Definition:
itkGPUDataManager.h:66
itk::OpenCLKernelManager
OpenCL kernel manager implemented using OpenCL.
Definition:
itkOpenCLKernelManager.h:67
itk::OpenCLContext
The OpenCLContext class represents an OpenCL context.
Definition:
itkOpenCLContext.h:76
itk::GPUDataManager::SetGPUBufferLock
void SetGPUBufferLock(const bool v)
Definition:
itkGPUDataManager.h:151
itk::GPUDataManager::m_CPUBufferLock
bool m_CPUBufferLock
Definition:
itkGPUDataManager.h:183
itk::GPUDataManager::Pointer
SmartPointer< Self > Pointer
Definition:
itkGPUDataManager.h:75
itk::GPUDataManager::IsCPUBufferDirty
bool IsCPUBufferDirty()
Definition:
itkGPUDataManager.h:111
itk::GPUDataManager::m_BufferSize
unsigned int m_BufferSize
Definition:
itkGPUDataManager.h:167
itkOpenCLContext.h
itk::GPUDataManager::m_IsGPUBufferDirty
bool m_IsGPUBufferDirty
Definition:
itkGPUDataManager.h:179
itk::GPUDataManager::ConstPointer
SmartPointer< const Self > ConstPointer
Definition:
itkGPUDataManager.h:76
itk::GPUDataManager::SetCPUBufferLock
void SetCPUBufferLock(const bool v)
Definition:
itkGPUDataManager.h:147
itk::GPUDataManager::Superclass
Object Superclass
Definition:
itkGPUDataManager.h:74
itk::GPUDataManager::m_CPUBuffer
void * m_CPUBuffer
Definition:
itkGPUDataManager.h:176
ITKOpenCL_EXPORT
#define ITKOpenCL_EXPORT
Definition:
itkOpenCLExport.h:31
itk::GPUDataManager::m_GPUBufferLock
bool m_GPUBufferLock
Definition:
itkGPUDataManager.h:184
itk::GPUDataManager::IsGPUBufferDirty
bool IsGPUBufferDirty()
Definition:
itkGPUDataManager.h:117
itk::GPUDataManager::GetBufferSize
unsigned int GetBufferSize()
Definition:
itkGPUDataManager.h:89
Generated on 07-03-2016 for elastix by
1.8.11