Basic Image AlgorithmS Library
2.8.0
Main Page
Related Pages
Modules
Classes
Examples
All
Classes
Namespaces
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Groups
Pages
OpenCLFramework
Algorithm
clfAlgorithm.cpp
1
/*
2
* clfAlgorithm.cpp
3
*
4
* Created on: Nov 1, 2011
5
* Author: fkellner
6
*/
7
8
#include <OpenCLFramework/Algorithm/clfAlgorithm.hh>
9
#include <Base/Common/BIASpragma.hh>
10
11
namespace
BIAS {
12
13
clfAlgorithm::clfAlgorithm
() {
14
context_
= NULL;
15
programCL_
= NULL;
16
isSharedGL_
=
false
;
17
ownContext_
=
false
;
18
device_
= 0;
19
maxComputeUnits_
= 0;
20
}
21
22
clfAlgorithm::clfAlgorithm
(
clfContext
*ctx,
bool
sharedGL,
unsigned
int
device) {
23
InitInternal_
(ctx, sharedGL, device);
24
}
25
26
clfAlgorithm::~clfAlgorithm
() {
27
delete
programCL_
;
28
if
(
ownContext_
) {
29
delete
context_
;
30
}
31
}
32
33
void
clfAlgorithm::InitInternal_
(
clfContext
*ctx,
bool
sharedGL,
unsigned
int
device) {
34
if
(ctx == NULL) {
35
ownContext_
=
true
;
36
context_
=
new
clfContext
(sharedGL);
37
if
(device < context_->GetNumDevices()) {
38
context_
->
SetActiveDevice
(device);
39
}
else
{
40
device = 0;
41
}
42
}
else
{
43
context_
= ctx;
44
sharedGL =
context_
->
IsSharedGLContext
();
45
ownContext_
=
false
;
46
}
47
isSharedGL_
= sharedGL;
48
maxComputeUnits_
=
context_
->
GetDeviceInfo
().
maxComputeUnits
;
49
programCL_
=
context_
->
CreateProgram
();
50
device_
= device;
51
}
52
53
void
clfAlgorithm::getlocsize
(
const
unsigned
int
val,
unsigned
int
&result) {
54
result=
clfAlgorithm::getlocsize
(val);
55
}
56
57
unsigned
int
clfAlgorithm::getlocsize
(
const
unsigned
int
val) {
58
//if (val%32==0) return 32;
59
if
(val%16==0)
return
16;
60
if
(val%8==0)
return
8;
61
return
0;
62
}
63
64
65
}
/* namespace BIAS */
BIAS::clfAlgorithm::programCL_
clfProgram * programCL_
Definition:
clfAlgorithm.hh:35
BIAS::clfAlgorithm::device_
int device_
Definition:
clfAlgorithm.hh:39
BIAS::clfAlgorithm::InitInternal_
void InitInternal_(clfContext *ctx, bool sharedGL, unsigned int device)
Definition:
clfAlgorithm.cpp:33
BIAS::clfAlgorithm::isSharedGL_
bool isSharedGL_
Definition:
clfAlgorithm.hh:37
BIAS::clfContext::CreateProgram
clfProgram * CreateProgram()
create program object
Definition:
clfContext.hh:71
BIAS::clfContext
OpenCL Context wrapper.
Definition:
clfContext.hh:49
BIAS::clfAlgorithm::getlocsize
static void getlocsize(const unsigned int val, unsigned int &result)
Definition:
clfAlgorithm.cpp:53
BIAS::clfContext::GetDeviceInfo
clfDeviceInfo GetDeviceInfo(unsigned int device=0)
Definition:
clfContext.hh:141
BIAS::clfAlgorithm::ownContext_
bool ownContext_
Definition:
clfAlgorithm.hh:36
clfDeviceInfo::maxComputeUnits
int maxComputeUnits
Definition:
clfDeviceInfo.hh:37
BIAS::clfContext::IsSharedGLContext
bool IsSharedGLContext()
Definition:
clfContext.hh:145
BIAS::clfAlgorithm::maxComputeUnits_
int maxComputeUnits_
Definition:
clfAlgorithm.hh:38
BIAS::clfAlgorithm::context_
clfContext * context_
Definition:
clfAlgorithm.hh:34
BIAS::clfAlgorithm::clfAlgorithm
clfAlgorithm()
Definition:
clfAlgorithm.cpp:13
BIAS::clfAlgorithm::~clfAlgorithm
virtual ~clfAlgorithm()
Definition:
clfAlgorithm.cpp:26
BIAS::clfContext::SetActiveDevice
void SetActiveDevice(unsigned int device)
Definition:
clfContext.cpp:403
Generated on Tue Feb 6 2018 02:01:42 for Basic Image AlgorithmS Library by
1.8.5