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
9acca12d
Commit
9acca12d
authored
Oct 21, 2013
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ocl: workaround for ProgramCache cleanup issue, use RAII to print kernel build error
parent
a54d36bd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
19 deletions
+23
-19
cl_programcache.cpp
modules/ocl/src/cl_programcache.cpp
+23
-18
cl_programcache.hpp
modules/ocl/src/cl_programcache.hpp
+0
-1
No files found.
modules/ocl/src/cl_programcache.cpp
View file @
9acca12d
...
...
@@ -61,12 +61,16 @@ namespace cv { namespace ocl {
cv
::
Mutex
ProgramCache
::
mutexFiles
;
cv
::
Mutex
ProgramCache
::
mutexCache
;
std
::
auto_ptr
<
ProgramCache
>
_programCache
;
ProgramCache
*
_programCache
=
NULL
;
ProgramCache
*
ProgramCache
::
getProgramCache
()
{
if
(
NULL
==
_programCache
.
get
())
_programCache
.
reset
(
new
ProgramCache
());
return
_programCache
.
get
();
if
(
NULL
==
_programCache
)
{
cv
::
AutoLock
lock
(
getInitializationMutex
());
if
(
NULL
==
_programCache
)
_programCache
=
new
ProgramCache
();
}
return
_programCache
;
}
ProgramCache
::
ProgramCache
()
...
...
@@ -78,6 +82,12 @@ ProgramCache::ProgramCache()
ProgramCache
::~
ProgramCache
()
{
releaseProgram
();
if
(
this
==
_programCache
)
{
cv
::
AutoLock
lock
(
getInitializationMutex
());
if
(
this
==
_programCache
)
_programCache
=
NULL
;
}
}
cl_program
ProgramCache
::
progLookup
(
const
string
&
srcsign
)
...
...
@@ -420,22 +430,17 @@ struct ProgramFileCache
{
if
(
status
==
CL_BUILD_PROGRAM_FAILURE
)
{
cl_int
logStatus
;
char
*
buildLog
=
NULL
;
size_t
buildLogSize
=
0
;
logStatus
=
clGetProgramBuildInfo
(
program
,
getClDeviceID
(
ctx
),
CL_PROGRAM_BUILD_LOG
,
buildLogSize
,
buildLog
,
&
buildLogSize
);
if
(
logStatus
!=
CL_SUCCESS
)
std
::
cout
<<
"Failed to build the program and get the build info."
<<
endl
;
buildLog
=
new
char
[
buildLogSize
];
CV_DbgAssert
(
!!
buildLog
);
memset
(
buildLog
,
0
,
buildLogSize
);
openCLSafeCall
(
clGetProgramBuildInfo
(
program
,
getClDeviceID
(
ctx
),
CL_PROGRAM_BUILD_LOG
,
buildLogSize
,
buildLog
,
NULL
));
std
::
cout
<<
"
\n
BUILD LOG: "
<<
options
<<
"
\n
"
;
std
::
cout
<<
buildLog
<<
endl
;
delete
[]
buildLog
;
CL_PROGRAM_BUILD_LOG
,
0
,
NULL
,
&
buildLogSize
));
std
::
vector
<
char
>
buildLog
;
buildLog
.
resize
(
buildLogSize
);
memset
(
&
buildLog
[
0
],
0
,
buildLogSize
);
openCLSafeCall
(
clGetProgramBuildInfo
(
program
,
getClDeviceID
(
ctx
),
CL_PROGRAM_BUILD_LOG
,
buildLogSize
,
&
buildLog
[
0
],
NULL
));
std
::
cout
<<
std
::
endl
<<
"BUILD LOG: "
<<
(
source
->
name
?
source
->
name
:
"dynamic program"
)
<<
": "
<<
options
<<
"
\n
"
;
std
::
cout
<<
&
buildLog
[
0
]
<<
endl
;
}
openCLVerifyCall
(
status
);
}
...
...
modules/ocl/src/cl_programcache.hpp
View file @
9acca12d
...
...
@@ -52,7 +52,6 @@ class ProgramCache
protected
:
ProgramCache
();
~
ProgramCache
();
friend
class
std
::
auto_ptr
<
ProgramCache
>
;
public
:
static
ProgramCache
*
getProgramCache
();
...
...
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