Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
4eb16122
Commit
4eb16122
authored
Nov 05, 2014
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ocl: change processing of OpenCL failures
disable "unwanted" messages
parent
91a8ea5e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
5 deletions
+14
-5
ocl.cpp
modules/core/src/ocl.cpp
+11
-5
ocl_test.cpp
modules/ts/src/ocl_test.cpp
+3
-0
No files found.
modules/core/src/ocl.cpp
View file @
4eb16122
...
...
@@ -1453,7 +1453,7 @@ bool useOpenCL()
{
try
{
data
->
useOpenCL
=
(
int
)
haveOpenCL
()
&&
Device
::
getDefault
().
ptr
()
!=
NULL
;
data
->
useOpenCL
=
(
int
)
haveOpenCL
()
&&
Device
::
getDefault
().
ptr
()
&&
Device
::
getDefault
().
available
()
;
}
catch
(...)
{
...
...
@@ -2130,7 +2130,8 @@ const Device& Device::getDefault()
{
const
Context
&
ctx
=
Context
::
getDefault
();
int
idx
=
coreTlsData
.
get
()
->
device
;
return
ctx
.
device
(
idx
);
const
Device
&
device
=
ctx
.
device
(
idx
);
return
device
;
}
////////////////////////////////////// Context ///////////////////////////////////////////////////
...
...
@@ -2210,7 +2211,10 @@ static cl_device_id selectOpenCLDevice()
std
::
vector
<
std
::
string
>
deviceTypes
;
const
char
*
configuration
=
getenv
(
"OPENCV_OPENCL_DEVICE"
);
if
(
configuration
&&
!
parseOpenCLDeviceConfiguration
(
std
::
string
(
configuration
),
platform
,
deviceTypes
,
deviceName
))
if
(
configuration
&&
(
strcmp
(
configuration
,
"disabled"
)
==
0
||
!
parseOpenCLDeviceConfiguration
(
std
::
string
(
configuration
),
platform
,
deviceTypes
,
deviceName
)
))
return
NULL
;
bool
isID
=
false
;
...
...
@@ -2339,14 +2343,16 @@ static cl_device_id selectOpenCLDevice()
}
not_found
:
std
::
cerr
<<
"ERROR: Required OpenCL device not found, check configuration: "
<<
(
configuration
==
NULL
?
""
:
configuration
)
<<
std
::
endl
if
(
!
configuration
)
return
NULL
;
// suppress messages on stderr
std
::
cerr
<<
"ERROR: Requested OpenCL device not found, check configuration: "
<<
(
configuration
==
NULL
?
""
:
configuration
)
<<
std
::
endl
<<
" Platform: "
<<
(
platform
.
length
()
==
0
?
"any"
:
platform
)
<<
std
::
endl
<<
" Device types: "
;
for
(
size_t
t
=
0
;
t
<
deviceTypes
.
size
();
t
++
)
std
::
cerr
<<
deviceTypes
[
t
]
<<
" "
;
std
::
cerr
<<
std
::
endl
<<
" Device name: "
<<
(
deviceName
.
length
()
==
0
?
"any"
:
deviceName
)
<<
std
::
endl
;
CV_Error
(
CL_INVALID_DEVICE
,
"Requested OpenCL device is not found"
);
return
NULL
;
}
#endif
...
...
modules/ts/src/ocl_test.cpp
View file @
4eb16122
...
...
@@ -128,6 +128,9 @@ void dumpOpenCLDevice()
}
const
Device
&
device
=
Device
::
getDefault
();
if
(
!
device
.
available
())
CV_ErrorNoReturn
(
CV_OpenCLInitError
,
"OpenCL device is not available"
);
DUMP_MESSAGE_STDOUT
(
"Current OpenCL device: "
);
#if 0
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment