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
087bab6c
Commit
087bab6c
authored
Jul 01, 2013
by
Roman Donchenko
Committed by
OpenCV Buildbot
Jul 01, 2013
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1060 from pengx17:2.4_setbinary_fix
parents
38cf0a69
e858a6c3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
26 deletions
+27
-26
initialization.cpp
modules/ocl/src/initialization.cpp
+27
-26
No files found.
modules/ocl/src/initialization.cpp
View file @
087bab6c
...
...
@@ -123,9 +123,6 @@ namespace cv
codeCache
.
clear
();
cacheSize
=
0
;
}
// not to be exported to dynamic lib
void
setBinaryDiskCacheImpl
(
int
mode
,
String
path
,
Info
::
Impl
*
impl
);
struct
Info
::
Impl
{
cl_platform_id
oclplatform
;
...
...
@@ -143,9 +140,6 @@ namespace cv
char
extra_options
[
512
];
int
double_support
;
int
unified_memory
;
//1 means integrated GPU, otherwise this value is 0
bool
enable_disk_cache
;
bool
update_disk_cache
;
string
binpath
;
int
refcounter
;
Impl
();
...
...
@@ -173,6 +167,16 @@ namespace cv
void
releaseResources
();
};
// global variables to hold binary cache properties
static
int
enable_disk_cache
=
#ifdef _DEBUG
false
;
#else
true
;
#endif
static
int
update_disk_cache
=
false
;
static
String
binpath
=
""
;
Info
::
Impl
::
Impl
()
:
oclplatform
(
0
),
oclcontext
(
0
),
...
...
@@ -183,13 +187,9 @@ namespace cv
maxComputeUnits
(
0
),
double_support
(
0
),
unified_memory
(
0
),
enable_disk_cache
(
false
),
update_disk_cache
(
false
),
binpath
(
"./"
),
refcounter
(
1
)
{
memset
(
extra_options
,
0
,
512
);
setBinaryDiskCacheImpl
(
CACHE_RELEASE
,
String
(
"./"
),
this
);
}
void
Info
::
Impl
::
releaseResources
()
...
...
@@ -505,29 +505,30 @@ namespace cv
return
openCLGetKernelFromSource
(
clCxt
,
source
,
kernelName
,
NULL
);
}
void
setBinaryDiskCache
Impl
(
int
mode
,
String
path
,
Info
::
Impl
*
impl
)
void
setBinaryDiskCache
(
int
mode
,
String
path
)
{
impl
->
update_disk_cache
=
(
mode
&
CACHE_UPDATE
)
==
CACHE_UPDATE
;
impl
->
enable_disk_cache
=
if
(
mode
==
CACHE_NONE
)
{
update_disk_cache
=
0
;
enable_disk_cache
=
0
;
return
;
}
update_disk_cache
|=
(
mode
&
CACHE_UPDATE
)
==
CACHE_UPDATE
;
enable_disk_cache
|=
#ifdef _DEBUG
(
mode
&
CACHE_DEBUG
)
==
CACHE_DEBUG
;
#else
(
mode
&
CACHE_RELEASE
)
==
CACHE_RELEASE
;
#endif
if
(
impl
->
enable_disk_cache
&&
!
path
.
empty
())
if
(
enable_disk_cache
&&
!
path
.
empty
())
{
impl
->
binpath
=
path
;
binpath
=
path
;
}
}
void
setBinaryDiskCache
(
int
mode
,
cv
::
String
path
)
{
setBinaryDiskCacheImpl
(
mode
,
path
,
Context
::
getContext
()
->
impl
);
}
void
setBinpath
(
const
char
*
path
)
{
Context
*
clcxt
=
Context
::
getContext
();
clcxt
->
impl
->
binpath
=
path
;
binpath
=
path
;
}
int
savetofile
(
const
Context
*
,
cl_program
&
program
,
const
char
*
fileName
)
...
...
@@ -595,15 +596,15 @@ namespace cv
strcat
(
all_build_options
,
build_options
);
if
(
all_build_options
!=
NULL
)
{
filename
=
clCxt
->
impl
->
binpath
+
kernelName
+
"_"
+
clCxt
->
impl
->
devName
[
clCxt
->
impl
->
devnum
]
+
all_build_options
+
".clb"
;
filename
=
binpath
+
kernelName
+
"_"
+
clCxt
->
impl
->
devName
[
clCxt
->
impl
->
devnum
]
+
all_build_options
+
".clb"
;
}
else
{
filename
=
clCxt
->
impl
->
binpath
+
kernelName
+
"_"
+
clCxt
->
impl
->
devName
[
clCxt
->
impl
->
devnum
]
+
".clb"
;
filename
=
binpath
+
kernelName
+
"_"
+
clCxt
->
impl
->
devName
[
clCxt
->
impl
->
devnum
]
+
".clb"
;
}
FILE
*
fp
=
clCxt
->
impl
->
enable_disk_cache
?
fopen
(
filename
.
c_str
(),
"rb"
)
:
NULL
;
if
(
fp
==
NULL
||
clCxt
->
impl
->
update_disk_cache
)
FILE
*
fp
=
enable_disk_cache
?
fopen
(
filename
.
c_str
(),
"rb"
)
:
NULL
;
if
(
fp
==
NULL
||
update_disk_cache
)
{
if
(
fp
!=
NULL
)
fclose
(
fp
);
...
...
@@ -612,7 +613,7 @@ namespace cv
clCxt
->
impl
->
oclcontext
,
1
,
source
,
NULL
,
&
status
);
openCLVerifyCall
(
status
);
status
=
clBuildProgram
(
program
,
1
,
&
(
clCxt
->
impl
->
devices
[
clCxt
->
impl
->
devnum
]),
all_build_options
,
NULL
,
NULL
);
if
(
status
==
CL_SUCCESS
&&
clCxt
->
impl
->
enable_disk_cache
)
if
(
status
==
CL_SUCCESS
&&
enable_disk_cache
)
savetofile
(
clCxt
,
program
,
filename
.
c_str
());
}
else
...
...
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