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
48aeb8f1
Commit
48aeb8f1
authored
Jan 26, 2011
by
Alexey Spizhevoy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more GPU perf. tests refactoring, added singular maps into remap test
parent
79ba160c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
18 deletions
+54
-18
performance.cpp
samples/gpu/performance/performance.cpp
+31
-14
performance.h
samples/gpu/performance/performance.h
+4
-0
tests.cpp
samples/gpu/performance/tests.cpp
+19
-4
No files found.
samples/gpu/performance/performance.cpp
View file @
48aeb8f1
...
@@ -13,11 +13,7 @@ void TestSystem::run()
...
@@ -13,11 +13,7 @@ void TestSystem::run()
(
*
it
)
->
run
();
(
*
it
)
->
run
();
}
}
cout
<<
setiosflags
(
ios_base
::
left
);
printHeading
();
cout
<<
TAB
<<
setw
(
10
)
<<
"CPU, ms"
<<
setw
(
10
)
<<
"GPU, ms"
<<
setw
(
10
)
<<
"SPEEDUP"
<<
"DESCRIPTION
\n
"
;
cout
<<
resetiosflags
(
ios_base
::
left
);
// Run tests
// Run tests
it
=
tests_
.
begin
();
it
=
tests_
.
begin
();
...
@@ -35,11 +31,7 @@ void TestSystem::run()
...
@@ -35,11 +31,7 @@ void TestSystem::run()
}
}
}
}
cout
<<
setiosflags
(
ios_base
::
fixed
);
printSummary
();
cout
<<
"
\n
average GPU speedup: x"
<<
setprecision
(
3
)
<<
speedup_total_
/
num_subtests_called_
<<
endl
;
cout
<<
resetiosflags
(
ios_base
::
fixed
);
}
}
...
@@ -54,8 +46,36 @@ void TestSystem::flushSubtestData()
...
@@ -54,8 +46,36 @@ void TestSystem::flushSubtestData()
double
speedup
=
static_cast
<
double
>
(
cpu_time
)
/
std
::
max
(
1
,
gpu_time
);
double
speedup
=
static_cast
<
double
>
(
cpu_time
)
/
std
::
max
(
1
,
gpu_time
);
speedup_total_
+=
speedup
;
speedup_total_
+=
speedup
;
cout
<<
TAB
<<
setiosflags
(
ios_base
::
left
);
printItem
(
cpu_time
,
gpu_time
,
speedup
);
num_subtests_called_
++
;
resetSubtestData
();
}
void
TestSystem
::
printHeading
()
{
cout
<<
setiosflags
(
ios_base
::
left
);
cout
<<
TAB
<<
setw
(
10
)
<<
"CPU, ms"
<<
setw
(
10
)
<<
"GPU, ms"
<<
setw
(
10
)
<<
"SPEEDUP"
<<
"DESCRIPTION
\n
"
;
cout
<<
resetiosflags
(
ios_base
::
left
);
}
void
TestSystem
::
printSummary
()
{
cout
<<
setiosflags
(
ios_base
::
fixed
);
cout
<<
"
\n
average GPU speedup: x"
<<
setprecision
(
3
)
<<
speedup_total_
/
num_subtests_called_
<<
endl
;
cout
<<
resetiosflags
(
ios_base
::
fixed
);
}
void
TestSystem
::
printItem
(
double
cpu_time
,
double
gpu_time
,
double
speedup
)
{
cout
<<
TAB
<<
setiosflags
(
ios_base
::
left
);
stringstream
stream
;
stringstream
stream
;
stream
<<
cpu_time
;
stream
<<
cpu_time
;
...
@@ -71,9 +91,6 @@ void TestSystem::flushSubtestData()
...
@@ -71,9 +91,6 @@ void TestSystem::flushSubtestData()
cout
<<
description_
.
str
();
cout
<<
description_
.
str
();
cout
<<
resetiosflags
(
ios_base
::
left
)
<<
endl
;
cout
<<
resetiosflags
(
ios_base
::
left
)
<<
endl
;
num_subtests_called_
++
;
resetSubtestData
();
}
}
...
...
samples/gpu/performance/performance.h
View file @
48aeb8f1
...
@@ -77,6 +77,10 @@ private:
...
@@ -77,6 +77,10 @@ private:
can_flush_
=
false
;
can_flush_
=
false
;
}
}
void
printHeading
();
void
printSummary
();
void
printItem
(
double
cpu_time
,
double
gpu_time
,
double
speedup
);
std
::
vector
<
Runnable
*>
inits_
;
std
::
vector
<
Runnable
*>
inits_
;
std
::
vector
<
Runnable
*>
tests_
;
std
::
vector
<
Runnable
*>
tests_
;
...
...
samples/gpu/performance/tests.cpp
View file @
48aeb8f1
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/gpu/gpu.hpp>
#include <opencv2/gpu/gpu.hpp>
#include "performance.h"
#include "performance.h"
...
@@ -79,7 +78,7 @@ TEST(remap)
...
@@ -79,7 +78,7 @@ TEST(remap)
for
(
int
size
=
1000
;
size
<=
8000
;
size
*=
2
)
for
(
int
size
=
1000
;
size
<=
8000
;
size
*=
2
)
{
{
SUBTEST
<<
"src "
<<
size
<<
" and 8U
C1, 32FC1
maps"
;
SUBTEST
<<
"src "
<<
size
<<
" and 8U
, 32F
maps"
;
gen
(
src
,
size
,
size
,
CV_8UC1
,
0
,
256
);
gen
(
src
,
size
,
size
,
CV_8UC1
,
0
,
256
);
gen
(
xmap
,
size
,
size
,
CV_32F
,
0
,
size
);
gen
(
xmap
,
size
,
size
,
CV_32F
,
0
,
size
);
...
@@ -98,6 +97,22 @@ TEST(remap)
...
@@ -98,6 +97,22 @@ TEST(remap)
GPU_ON
;
GPU_ON
;
gpu
::
remap
(
d_src
,
d_dst
,
d_xmap
,
d_ymap
);
gpu
::
remap
(
d_src
,
d_dst
,
d_xmap
,
d_ymap
);
GPU_OFF
;
GPU_OFF
;
SUBTEST
<<
"src "
<<
size
<<
" and 8U, 32F singular maps"
;
gen
(
xmap
,
size
,
size
,
CV_32F
,
0
,
0
);
gen
(
ymap
,
size
,
size
,
CV_32F
,
0
,
0
);
CPU_ON
;
remap
(
src
,
dst
,
xmap
,
ymap
,
INTER_LINEAR
);
CPU_OFF
;
d_xmap
=
xmap
;
d_ymap
=
ymap
;
GPU_ON
;
gpu
::
remap
(
d_src
,
d_dst
,
d_xmap
,
d_ymap
);
GPU_OFF
;
}
}
}
}
...
@@ -135,7 +150,7 @@ TEST(cornerHarris)
...
@@ -135,7 +150,7 @@ TEST(cornerHarris)
for
(
int
size
=
2000
;
size
<=
4000
;
size
*=
2
)
for
(
int
size
=
2000
;
size
<=
4000
;
size
*=
2
)
{
{
SUBTEST
<<
"size "
<<
size
<<
", 32F
C1
"
;
SUBTEST
<<
"size "
<<
size
<<
", 32F"
;
gen
(
src
,
size
,
size
,
CV_32F
,
0
,
1
);
gen
(
src
,
size
,
size
,
CV_32F
,
0
,
1
);
dst
.
create
(
src
.
size
(),
src
.
type
());
dst
.
create
(
src
.
size
(),
src
.
type
());
...
@@ -148,7 +163,7 @@ TEST(cornerHarris)
...
@@ -148,7 +163,7 @@ TEST(cornerHarris)
d_dst
.
create
(
src
.
size
(),
src
.
type
());
d_dst
.
create
(
src
.
size
(),
src
.
type
());
GPU_ON
;
GPU_ON
;
gpu
::
cornerHarris
(
d_src
,
d_dst
,
5
,
7
,
0.1
);
gpu
::
cornerHarris
(
d_src
,
d_dst
,
5
,
7
,
0.1
,
BORDER_REFLECT101
);
GPU_OFF
;
GPU_OFF
;
}
}
}
}
...
...
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