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
2b3c140f
Unverified
Commit
2b3c140f
authored
Dec 28, 2017
by
Alexander Alekhin
Committed by
GitHub
Dec 28, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #10436 from alalek:test_threads
parents
ec32022b
9b131b5f
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
13 additions
and
16 deletions
+13
-16
perf_convolution.cpp
modules/dnn/perf/opencl/perf_convolution.cpp
+1
-3
perf_convolution.cpp
modules/dnn/perf/perf_convolution.cpp
+1
-3
test_layers.cpp
modules/dnn/test/test_layers.cpp
+0
-4
ts_ext.hpp
modules/ts/include/opencv2/ts/ts_ext.hpp
+3
-1
ts.cpp
modules/ts/src/ts.cpp
+4
-0
ts_perf.cpp
modules/ts/src/ts_perf.cpp
+4
-5
No files found.
modules/dnn/perf/opencl/perf_convolution.cpp
View file @
2b3c140f
...
...
@@ -77,8 +77,6 @@ OCL_PERF_TEST_P( ConvolutionPerfTest, perf, Combine(
std
::
vector
<
Mat
*>
inpBlobs
(
1
,
&
inpBlob
);
std
::
vector
<
Mat
>
outBlobs
,
internalBlobs
;
cv
::
setNumThreads
(
cv
::
getNumberOfCPUs
());
Ptr
<
Layer
>
layer
=
cv
::
dnn
::
LayerFactory
::
createLayerInstance
(
"Convolution"
,
lp
);
std
::
vector
<
MatShape
>
inputShapes
(
1
,
shape
(
inpBlob
)),
outShapes
,
internals
;
layer
->
getMemoryShapes
(
inputShapes
,
0
,
outShapes
,
internals
);
...
...
@@ -99,7 +97,7 @@ OCL_PERF_TEST_P( ConvolutionPerfTest, perf, Combine(
Mat
inpBlob2D
=
inpBlob
.
reshape
(
1
,
outCn
);
Mat
wgtBlob2D
=
wgtBlob
.
reshape
(
1
,
outCn
*
(
inpCn
/
groups
));
Mat
outBlob2D
=
outBlobs
[
0
].
reshape
(
1
,
outBlobs
[
0
].
size
[
0
]);
declare
.
in
(
inpBlob2D
,
wgtBlob2D
,
WARMUP_RNG
).
out
(
outBlob2D
)
.
tbb_threads
(
cv
::
getNumThreads
())
;
declare
.
in
(
inpBlob2D
,
wgtBlob2D
,
WARMUP_RNG
).
out
(
outBlob2D
);
// warmup
layer
->
forward
(
inpBlobs
,
outBlobs
,
internalBlobs
);
...
...
modules/dnn/perf/perf_convolution.cpp
View file @
2b3c140f
...
...
@@ -60,8 +60,6 @@ PERF_TEST_P( ConvolutionPerfTest, perf, Combine(
std
::
vector
<
Mat
*>
inpBlobs
(
1
,
&
inpBlob
);
std
::
vector
<
Mat
>
outBlobs
,
internalBlobs
;
cv
::
setNumThreads
(
cv
::
getNumberOfCPUs
());
Ptr
<
Layer
>
layer
=
cv
::
dnn
::
LayerFactory
::
createLayerInstance
(
"Convolution"
,
lp
);
std
::
vector
<
MatShape
>
inputShapes
(
1
,
shape
(
inpBlob
)),
outShapes
,
internals
;
layer
->
getMemoryShapes
(
inputShapes
,
0
,
outShapes
,
internals
);
...
...
@@ -81,7 +79,7 @@ PERF_TEST_P( ConvolutionPerfTest, perf, Combine(
Mat
inpBlob2D
=
inpBlob
.
reshape
(
1
,
outCn
);
Mat
wgtBlob2D
=
wgtBlob
.
reshape
(
1
,
outCn
*
(
inpCn
/
groups
));
Mat
outBlob2D
=
outBlobs
[
0
].
reshape
(
1
,
outBlobs
[
0
].
size
[
0
]);
declare
.
in
(
inpBlob2D
,
wgtBlob2D
,
WARMUP_RNG
).
out
(
outBlob2D
)
.
tbb_threads
(
cv
::
getNumThreads
())
;
declare
.
in
(
inpBlob2D
,
wgtBlob2D
,
WARMUP_RNG
).
out
(
outBlob2D
);
layer
->
forward
(
inpBlobs
,
outBlobs
,
internalBlobs
);
/// warmup
...
...
modules/dnn/test/test_layers.cpp
View file @
2b3c140f
...
...
@@ -107,8 +107,6 @@ void testLayerUsingCaffeModels(String basename, int targetId = DNN_TARGET_CPU,
String
inpfile
=
(
useCommonInputBlob
)
?
_tf
(
"blob.npy"
)
:
_tf
(
basename
+
".input.npy"
);
String
outfile
=
_tf
(
basename
+
".npy"
);
cv
::
setNumThreads
(
cv
::
getNumberOfCPUs
());
Net
net
=
readNetFromCaffe
(
prototxt
,
(
useCaffeModel
)
?
caffemodel
:
String
());
ASSERT_FALSE
(
net
.
empty
());
...
...
@@ -537,8 +535,6 @@ void testLayerUsingDarknetModels(String basename, bool useDarknetModel = false,
String
inpfile
=
(
useCommonInputBlob
)
?
_tf
(
"blob.npy"
)
:
_tf
(
basename
+
".input.npy"
);
String
outfile
=
_tf
(
basename
+
".npy"
);
cv
::
setNumThreads
(
cv
::
getNumberOfCPUs
());
Net
net
=
readNetFromDarknet
(
cfg
,
(
useDarknetModel
)
?
weights
:
String
());
ASSERT_FALSE
(
net
.
empty
());
...
...
modules/ts/include/opencv2/ts/ts_ext.hpp
View file @
2b3c140f
...
...
@@ -11,11 +11,13 @@
namespace
cvtest
{
void
checkIppStatus
();
extern
bool
skipUnstableTests
;
extern
int
testThreads
;
}
#define CV__TEST_INIT \
cv::ipp::setIppStatus(0); \
cv::theRNG().state = cvtest::param_seed;
cv::theRNG().state = cvtest::param_seed; \
cv::setNumThreads(cvtest::testThreads);
#define CV__TEST_CLEANUP ::cvtest::checkIppStatus();
#define CV__TEST_BODY_IMPL(name) \
{ \
...
...
modules/ts/src/ts.cpp
View file @
2b3c140f
...
...
@@ -695,12 +695,14 @@ void checkIppStatus()
}
bool
skipUnstableTests
=
false
;
int
testThreads
=
0
;
void
parseCustomOptions
(
int
argc
,
char
**
argv
)
{
const
char
*
const
command_line_keys
=
"{ ipp test_ipp_check |false |check whether IPP works without failures }"
"{ test_seed |809564 |seed for random numbers generator }"
"{ test_threads |-1 |the number of worker threads, if parallel execution is enabled}"
"{ skip_unstable |false |skip unstable tests }"
"{ h help |false |print help info }"
;
...
...
@@ -721,6 +723,8 @@ void parseCustomOptions(int argc, char **argv)
param_seed
=
parser
.
get
<
unsigned
int
>
(
"test_seed"
);
testThreads
=
parser
.
get
<
int
>
(
"test_threads"
);
skipUnstableTests
=
parser
.
get
<
bool
>
(
"skip_unstable"
);
}
...
...
modules/ts/src/ts_perf.cpp
View file @
2b3c140f
...
...
@@ -39,7 +39,6 @@ static double param_max_deviation;
static
unsigned
int
param_min_samples
;
static
unsigned
int
param_force_samples
;
static
double
param_time_limit
;
static
int
param_threads
;
static
bool
param_write_sanity
;
static
bool
param_verify_sanity
;
#ifdef CV_COLLECT_IMPL_DATA
...
...
@@ -1042,7 +1041,7 @@ void TestBase::Init(const std::vector<std::string> & availableImpls,
#ifdef HAVE_IPP
test_ipp_check
=
!
args
.
get
<
bool
>
(
"perf_ipp_check"
)
?
getenv
(
"OPENCV_IPP_CHECK"
)
!=
NULL
:
true
;
#endif
param_threads
=
args
.
get
<
int
>
(
"perf_threads"
);
testThreads
=
args
.
get
<
int
>
(
"perf_threads"
);
#ifdef CV_COLLECT_IMPL_DATA
param_collect_impl
=
args
.
get
<
bool
>
(
"perf_collect_impl"
);
#endif
...
...
@@ -1160,7 +1159,7 @@ void TestBase::Init(const std::vector<std::string> & availableImpls,
void
TestBase
::
RecordRunParameters
()
{
::
testing
::
Test
::
RecordProperty
(
"cv_implementation"
,
param_impl
);
::
testing
::
Test
::
RecordProperty
(
"cv_num_threads"
,
param_t
hreads
);
::
testing
::
Test
::
RecordProperty
(
"cv_num_threads"
,
testT
hreads
);
#ifdef HAVE_CUDA
if
(
param_impl
==
"cuda"
)
...
...
@@ -1851,8 +1850,8 @@ void TestBase::SetUp()
{
cv
::
theRNG
().
state
=
param_seed
;
// this rng should generate same numbers for each run
if
(
param_t
hreads
>=
0
)
cv
::
setNumThreads
(
param_t
hreads
);
if
(
testT
hreads
>=
0
)
cv
::
setNumThreads
(
testT
hreads
);
else
cv
::
setNumThreads
(
-
1
);
...
...
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