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
8644c6f8
Commit
8644c6f8
authored
Jan 25, 2011
by
Alexey Spizhevoy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added minMaxLoc performance tests
parent
6b4047eb
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
16 deletions
+47
-16
performance.cpp
samples/gpu/performance/performance.cpp
+5
-3
performance.h
samples/gpu/performance/performance.h
+7
-7
tests.cpp
samples/gpu/performance/tests.cpp
+35
-6
No files found.
samples/gpu/performance/performance.cpp
View file @
8644c6f8
...
...
@@ -33,9 +33,8 @@ void TestSystem::run()
}
cout
<<
setiosflags
(
ios_base
::
fixed
|
ios_base
::
left
);
cout
<<
"
\n
CPU Total: "
<<
setprecision
(
3
)
<<
cpu_total_
/
getTickFrequency
()
<<
" sec
\n
"
;
cout
<<
"GPU Total: "
<<
setprecision
(
3
)
<<
gpu_total_
/
getTickFrequency
()
<<
" sec (x"
<<
setprecision
(
3
)
<<
static_cast
<
double
>
(
cpu_total_
)
/
gpu_total_
<<
")
\n
"
;
cout
<<
"
\n
Average GPU Speedup: x"
<<
setprecision
(
3
)
<<
speedup_total_
/
num_subtests_called_
<<
endl
;
cout
<<
resetiosflags
(
ios_base
::
fixed
|
ios_base
::
left
);
}
...
...
@@ -47,7 +46,9 @@ void TestSystem::flush()
int
cpu_time
=
static_cast
<
int
>
(
cpu_elapsed_
/
getTickFrequency
()
*
1000.0
);
int
gpu_time
=
static_cast
<
int
>
(
gpu_elapsed_
/
getTickFrequency
()
*
1000.0
);
double
speedup
=
static_cast
<
double
>
(
cpu_time
)
/
gpu_time
;
speedup_total_
+=
speedup
;
cpu_elapsed_
=
0
;
gpu_elapsed_
=
0
;
...
...
@@ -72,6 +73,7 @@ void TestSystem::flush()
cout
<<
resetiosflags
(
ios_base
::
fixed
|
ios_base
::
left
)
<<
endl
;
can_flush_
=
false
;
num_subtests_called_
++
;
}
...
...
samples/gpu/performance/performance.h
View file @
8644c6f8
...
...
@@ -42,7 +42,6 @@ public:
{
int64
delta
=
cv
::
getTickCount
()
-
cpu_started_
;
cpu_elapsed_
+=
delta
;
cpu_total_
+=
delta
;
can_flush_
=
true
;
}
...
...
@@ -52,7 +51,6 @@ public:
{
int64
delta
=
cv
::
getTickCount
()
-
gpu_started_
;
gpu_elapsed_
+=
delta
;
gpu_total_
+=
delta
;
can_flush_
=
true
;
}
...
...
@@ -64,9 +62,8 @@ public:
}
private
:
TestSystem
()
:
can_flush_
(
false
),
cpu_elapsed_
(
0
),
cpu_total_
(
0
),
gpu_elapsed_
(
0
),
gpu_total_
(
0
)
{};
TestSystem
()
:
can_flush_
(
false
),
cpu_elapsed_
(
0
),
gpu_elapsed_
(
0
),
speedup_total_
(
0
.
0
),
num_subtests_called_
(
0
)
{};
void
flush
();
...
...
@@ -77,8 +74,11 @@ private:
bool
can_flush_
;
int64
cpu_started_
,
cpu_elapsed_
,
cpu_total_
;
int64
gpu_started_
,
gpu_elapsed_
,
gpu_total_
;
int64
cpu_started_
,
cpu_elapsed_
;
int64
gpu_started_
,
gpu_elapsed_
;
double
speedup_total_
;
int
num_subtests_called_
;
};
...
...
samples/gpu/performance/tests.cpp
View file @
8644c6f8
...
...
@@ -7,24 +7,52 @@ using namespace cv;
TEST
(
matchTemplate
)
{
Mat
image
,
templ
,
result
;
gen
(
image
,
3000
,
3000
,
CV_8U
);
gpu
::
GpuMat
d_image
(
image
),
d_templ
,
d_result
;
for
(
int
templ_size
=
5
;
templ_size
<=
1000
;
templ_size
*=
2
)
{
SUBTEST
<<
"img 3000, templ "
<<
templ_size
<<
", 8U, SQDIFF"
;
Mat
image
;
gen
(
image
,
3000
,
3000
,
CV_8U
);
Mat
templ
;
gen
(
templ
,
templ_size
,
templ_size
,
CV_8U
);
Mat
result
;
gen
(
templ
,
templ_size
,
templ_size
,
CV_8U
);
CPU_ON
;
matchTemplate
(
image
,
templ
,
result
,
CV_TM_SQDIFF
);
CPU_OFF
;
gpu
::
GpuMat
d_image
(
image
);
gpu
::
GpuMat
d_templ
(
templ
);
gpu
::
GpuMat
d_result
;
d_templ
=
templ
;
GPU_ON
;
gpu
::
matchTemplate
(
d_image
,
d_templ
,
d_result
,
CV_TM_SQDIFF
);
GPU_OFF
;
}
}
TEST
(
minMaxLoc
)
{
Mat
src
;
gpu
::
GpuMat
d_src
;
double
min_val
,
max_val
;
Point
min_loc
,
max_loc
;
for
(
int
size
=
2000
;
size
<=
8000
;
size
*=
2
)
{
SUBTEST
<<
"img "
<<
size
<<
", 32F, no mask"
;
gen
(
src
,
size
,
size
,
CV_32F
);
CPU_ON
;
minMaxLoc
(
src
,
&
min_val
,
&
max_val
,
&
min_loc
,
&
max_loc
);
CPU_OFF
;
d_src
=
src
;
GPU_ON
;
gpu
::
minMaxLoc
(
d_src
,
&
min_val
,
&
max_val
,
&
min_loc
,
&
max_loc
);
GPU_OFF
;
}
}
\ No newline at end of file
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