Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
217b2282
O
Opencv
项目概览
Greenplum
/
Opencv
大约 1 年 前同步成功
通知
7
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
Opencv
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
217b2282
编写于
12月 25, 2013
作者:
A
Alexander Alekhin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fixes
上级
e49065b1
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
37 addition
and
50 deletion
+37
-50
modules/core/include/opencv2/core/utility.hpp
modules/core/include/opencv2/core/utility.hpp
+1
-1
modules/core/src/ocl.cpp
modules/core/src/ocl.cpp
+36
-49
未找到文件。
modules/core/include/opencv2/core/utility.hpp
浏览文件 @
217b2282
...
...
@@ -85,7 +85,7 @@ template<typename _Tp, size_t fixed_size = 1024/sizeof(_Tp)+8> class AutoBuffer
public:
typedef
_Tp
value_type
;
//! the default contructor
//! the default con
s
tructor
AutoBuffer
();
//! constructor taking the real buffer size
AutoBuffer
(
size_t
_size
);
...
...
modules/core/src/ocl.cpp
浏览文件 @
217b2282
...
...
@@ -1919,30 +1919,30 @@ inline cl_int getStringInfo(Functor f, ObjectType obj, cl_uint name, std::string
param
.
clear
();
if
(
required
>
0
)
{
std
::
vector
<
char
>
buf
(
required
+
1
,
char
(
0
));
err
=
f
(
obj
,
name
,
required
,
&
buf
[
0
],
NULL
);
AutoBuffer
<
char
>
buf
(
required
+
1
);
char
*
ptr
=
(
char
*
)
buf
;
// cleanup is not needed
err
=
f
(
obj
,
name
,
required
,
ptr
,
NULL
);
if
(
err
!=
CL_SUCCESS
)
return
err
;
param
=
&
buf
[
0
]
;
param
=
ptr
;
}
return
CL_SUCCESS
;
};
static
void
split
(
const
std
::
string
&
s
,
char
delim
,
std
::
vector
<
std
::
string
>
&
elems
)
{
std
::
stringstream
ss
(
s
);
elems
.
clear
();
if
(
s
.
size
()
==
0
)
return
;
std
::
istringstream
ss
(
s
);
std
::
string
item
;
while
(
std
::
getline
(
ss
,
item
,
delim
))
{
while
(
!
ss
.
eof
())
{
std
::
getline
(
ss
,
item
,
delim
);
elems
.
push_back
(
item
);
}
}
static
std
::
vector
<
std
::
string
>
split
(
const
std
::
string
&
s
,
char
delim
)
{
std
::
vector
<
std
::
string
>
elems
;
split
(
s
,
delim
,
elems
);
return
elems
;
}
// Layout: <Platform>:<CPU|GPU|ACCELERATOR|nothing=GPU/CPU>:<deviceName>
// Sample: AMD:GPU:
// Sample: AMD:GPU:Tahiti
...
...
@@ -1950,40 +1950,23 @@ static std::vector<std::string> split(const std::string &s, char delim) {
static
bool
parseOpenCLDeviceConfiguration
(
const
std
::
string
&
configurationStr
,
std
::
string
&
platform
,
std
::
vector
<
std
::
string
>&
deviceTypes
,
std
::
string
&
deviceNameOrID
)
{
std
::
string
deviceTypesStr
;
s
ize_t
p0
=
configurationStr
.
find
(
':'
);
if
(
p
0
!=
std
::
string
::
npos
)
std
::
vector
<
std
::
string
>
parts
;
s
plit
(
configurationStr
,
':'
,
parts
);
if
(
p
arts
.
size
()
>
3
)
{
size_t
p1
=
configurationStr
.
find
(
':'
,
p0
+
1
);
if
(
p1
!=
std
::
string
::
npos
)
{
size_t
p2
=
configurationStr
.
find
(
':'
,
p1
+
1
);
if
(
p2
!=
std
::
string
::
npos
)
{
std
::
cerr
<<
"ERROR: Invalid configuration string for OpenCL device"
<<
std
::
endl
;
return
false
;
}
else
{
// assume platform + device types + device name/id
platform
=
configurationStr
.
substr
(
0
,
p0
);
deviceTypesStr
=
configurationStr
.
substr
(
p0
+
1
,
p1
-
(
p0
+
1
));
deviceNameOrID
=
configurationStr
.
substr
(
p1
+
1
,
configurationStr
.
length
()
-
(
p1
+
1
));
}
}
else
{
// assume platform + device types
platform
=
configurationStr
.
substr
(
0
,
p0
);
deviceTypesStr
=
configurationStr
.
substr
(
p0
+
1
,
configurationStr
.
length
()
-
(
p0
+
1
));
}
std
::
cerr
<<
"ERROR: Invalid configuration string for OpenCL device"
<<
std
::
endl
;
return
false
;
}
else
if
(
parts
.
size
()
>
2
)
deviceNameOrID
=
parts
[
2
];
if
(
parts
.
size
()
>
1
)
{
split
(
parts
[
1
],
'|'
,
deviceTypes
);
}
if
(
parts
.
size
()
>
0
)
{
// assume only platform
platform
=
configurationStr
;
platform
=
parts
[
0
];
}
deviceTypes
=
split
(
deviceTypesStr
,
'|'
);
return
true
;
}
...
...
@@ -2024,15 +2007,19 @@ static cl_device_id selectOpenCLDevice()
}
}
cl_int
status
=
CL_SUCCESS
;
std
::
vector
<
cl_platform_id
>
platforms
;
cl_uint
numPlatforms
=
0
;
cl_int
status
=
clGetPlatformIDs
(
0
,
NULL
,
&
numPlatforms
);
CV_Assert
(
status
==
CL_SUCCESS
);
if
(
numPlatforms
==
0
)
return
NULL
;
platforms
.
resize
((
size_t
)
numPlatforms
);
status
=
clGetPlatformIDs
(
numPlatforms
,
&
platforms
[
0
],
&
numPlatforms
);
CV_Assert
(
status
==
CL_SUCCESS
);
{
cl_uint
numPlatforms
=
0
;
status
=
clGetPlatformIDs
(
0
,
NULL
,
&
numPlatforms
);
CV_Assert
(
status
==
CL_SUCCESS
);
if
(
numPlatforms
==
0
)
return
NULL
;
platforms
.
resize
((
size_t
)
numPlatforms
);
status
=
clGetPlatformIDs
(
numPlatforms
,
&
platforms
[
0
],
&
numPlatforms
);
CV_Assert
(
status
==
CL_SUCCESS
);
platforms
.
resize
(
numPlatforms
);
}
int
selectedPlatform
=
-
1
;
if
(
platform
.
length
()
>
0
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录