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
6db776f9
Commit
6db776f9
authored
Jun 25, 2013
by
yao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add "-c" for cpu ocl mode in perf tests
parent
c244f000
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
29 deletions
+32
-29
main.cpp
modules/ocl/perf/main.cpp
+32
-29
No files found.
modules/ocl/perf/main.cpp
View file @
6db776f9
...
...
@@ -44,43 +44,21 @@
int
main
(
int
argc
,
const
char
*
argv
[])
{
vector
<
ocl
::
Info
>
oclinfo
;
int
num_devices
=
getDevice
(
oclinfo
);
if
(
num_devices
<
1
)
{
cerr
<<
"no device found
\n
"
;
return
-
1
;
}
// set this to overwrite binary cache every time the test starts
ocl
::
setBinaryDiskCache
(
ocl
::
CACHE_UPDATE
);
int
devidx
=
0
;
for
(
size_t
i
=
0
;
i
<
oclinfo
.
size
();
i
++
)
{
for
(
size_t
j
=
0
;
j
<
oclinfo
[
i
].
DeviceName
.
size
();
j
++
)
{
printf
(
"device %d: %s
\n
"
,
devidx
++
,
oclinfo
[
i
].
DeviceName
[
j
].
c_str
());
}
}
redirectError
(
cvErrorCallback
);
const
char
*
keys
=
"{ h | help | false | print help message }"
"{ f | filter | | filter for test }"
"{ w | workdir | | set working directory }"
"{ l | list | false | show all tests }"
"{ d | device | 0 | device id }"
"{ c | cpu_ocl | false | use cpu as ocl device}"
"{ i | iters | 10 | iteration count }"
"{ m | warmup | 1 | gpu warm up iteration count}"
"{ t | xtop | 1.1
| xfactor top boundary}"
"{ b | xbottom | 0.9
| xfactor bottom boundary}"
"{ t | xtop | 1.1
| xfactor top boundary}"
"{ b | xbottom | 0.9
| xfactor bottom boundary}"
"{ v | verify | false | only run gpu once to verify if problems occur}"
;
redirectError
(
cvErrorCallback
);
CommandLineParser
cmd
(
argc
,
argv
,
keys
);
if
(
cmd
.
get
<
bool
>
(
"help"
))
{
cout
<<
"Avaible options:"
<<
endl
;
...
...
@@ -88,14 +66,40 @@ int main(int argc, const char *argv[])
return
0
;
}
int
device
=
cmd
.
get
<
int
>
(
"device"
);
// get ocl devices
bool
use_cpu
=
cmd
.
get
<
bool
>
(
"c"
);
vector
<
ocl
::
Info
>
oclinfo
;
int
num_devices
=
0
;
if
(
use_cpu
)
num_devices
=
getDevice
(
oclinfo
,
ocl
::
CVCL_DEVICE_TYPE_CPU
);
else
num_devices
=
getDevice
(
oclinfo
);
if
(
num_devices
<
1
)
{
cerr
<<
"no device found
\n
"
;
return
-
1
;
}
// show device info
int
devidx
=
0
;
for
(
size_t
i
=
0
;
i
<
oclinfo
.
size
();
i
++
)
{
for
(
size_t
j
=
0
;
j
<
oclinfo
[
i
].
DeviceName
.
size
();
j
++
)
{
cout
<<
"device "
<<
devidx
++
<<
": "
<<
oclinfo
[
i
].
DeviceName
[
j
]
<<
endl
;
}
}
int
device
=
cmd
.
get
<
int
>
(
"device"
);
if
(
device
<
0
||
device
>=
num_devices
)
{
cerr
<<
"Invalid device ID"
<<
endl
;
return
-
1
;
}
// set this to overwrite binary cache every time the test starts
ocl
::
setBinaryDiskCache
(
ocl
::
CACHE_UPDATE
);
if
(
cmd
.
get
<
bool
>
(
"verify"
))
{
TestSystem
::
instance
().
setNumIters
(
1
);
...
...
@@ -104,7 +108,6 @@ int main(int argc, const char *argv[])
}
devidx
=
0
;
for
(
size_t
i
=
0
;
i
<
oclinfo
.
size
();
i
++
)
{
for
(
size_t
j
=
0
;
j
<
oclinfo
[
i
].
DeviceName
.
size
();
j
++
,
devidx
++
)
...
...
@@ -113,7 +116,7 @@ int main(int argc, const char *argv[])
{
ocl
::
setDevice
(
oclinfo
[
i
],
(
int
)
j
);
TestSystem
::
instance
().
setRecordName
(
oclinfo
[
i
].
DeviceName
[
j
]);
printf
(
"
\n
use %d: %s
\n
"
,
devidx
,
oclinfo
[
i
].
DeviceName
[
j
].
c_str
())
;
cout
<<
"use "
<<
devidx
<<
": "
<<
oclinfo
[
i
].
DeviceName
[
j
]
<<
endl
;
goto
END_DEV
;
}
}
...
...
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