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
1980aad8
Commit
1980aad8
authored
Oct 11, 2013
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ocl: dump device info in tests
parent
171e0e62
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
158 additions
and
164 deletions
+158
-164
opencl_dumpinfo.hpp
modules/ocl/include/opencv2/ocl/private/opencl_dumpinfo.hpp
+104
-0
main.cpp
modules/ocl/perf/main.cpp
+16
-54
main.cpp
modules/ocl/test/main.cpp
+13
-98
ts.hpp
modules/ts/include/opencv2/ts/ts.hpp
+13
-2
ts_perf.hpp
modules/ts/include/opencv2/ts/ts_perf.hpp
+12
-10
No files found.
modules/ocl/include/opencv2/ocl/private/opencl_dumpinfo.hpp
0 → 100644
View file @
1980aad8
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2010-2013, Advanced Micro Devices, Inc., all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other oclMaterials provided with the distribution.
//
// * The name of the copyright holders may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
#if !defined(DUMP_INFO_STDOUT) && !defined(DUMP_INFO_XML)
#error Invalid usage
#endif
#if !defined(DUMP_INFO_STDOUT)
#define DUMP_INFO_STDOUT(...)
#endif
#if !defined(DUMP_INFO_XML)
#define DUMP_INFO_XML(...)
#endif
static
void
dumpOpenCLDevice
()
{
using
namespace
cv
::
ocl
;
try
{
const
cv
::
ocl
::
DeviceInfo
&
deviceInfo
=
cv
::
ocl
::
Context
::
getContext
()
->
getDeviceInfo
();
const
char
*
deviceTypeStr
=
deviceInfo
.
deviceType
==
CVCL_DEVICE_TYPE_CPU
?
"CPU"
:
(
deviceInfo
.
deviceType
==
CVCL_DEVICE_TYPE_GPU
?
"GPU"
:
"unknown"
);
DUMP_INFO_STDOUT
(
"Device type"
,
deviceTypeStr
);
DUMP_INFO_XML
(
"cv_ocl_deviceType"
,
deviceTypeStr
);
DUMP_INFO_STDOUT
(
"Platform name"
,
deviceInfo
.
platform
->
platformName
);
DUMP_INFO_XML
(
"cv_ocl_platformName"
,
deviceInfo
.
platform
->
platformName
);
DUMP_INFO_STDOUT
(
"Device name"
,
deviceInfo
.
deviceName
);
DUMP_INFO_XML
(
"cv_ocl_deviceName"
,
deviceInfo
.
deviceName
);
DUMP_INFO_STDOUT
(
"Device version"
,
deviceInfo
.
deviceVersion
);
DUMP_INFO_XML
(
"cv_ocl_deviceVersion"
,
deviceInfo
.
deviceVersion
);
DUMP_INFO_STDOUT
(
"Compute units"
,
deviceInfo
.
maxComputeUnits
);
DUMP_INFO_XML
(
"cv_ocl_maxComputeUnits"
,
deviceInfo
.
maxComputeUnits
);
DUMP_INFO_STDOUT
(
"Max work group size"
,
deviceInfo
.
maxWorkGroupSize
);
DUMP_INFO_XML
(
"cv_ocl_maxWorkGroupSize"
,
deviceInfo
.
maxWorkGroupSize
);
DUMP_INFO_STDOUT
(
"Local memory size"
,
deviceInfo
.
localMemorySize
);
DUMP_INFO_XML
(
"cv_ocl_localMemorySize"
,
deviceInfo
.
localMemorySize
);
DUMP_INFO_STDOUT
(
"Max memory allocation size"
,
deviceInfo
.
maxMemAllocSize
);
DUMP_INFO_XML
(
"cv_ocl_maxMemAllocSize"
,
deviceInfo
.
maxMemAllocSize
);
const
char
*
doubleSupportStr
=
deviceInfo
.
haveDoubleSupport
?
"Yes"
:
"No"
;
DUMP_INFO_STDOUT
(
"Double support"
,
doubleSupportStr
);
DUMP_INFO_XML
(
"cv_ocl_haveDoubleSupport"
,
deviceInfo
.
haveDoubleSupport
);
const
char
*
isUnifiedMemoryStr
=
deviceInfo
.
isUnifiedMemory
?
"Yes"
:
"No"
;
DUMP_INFO_STDOUT
(
"Unified memory"
,
isUnifiedMemoryStr
);
DUMP_INFO_XML
(
"cv_ocl_isUnifiedMemory"
,
deviceInfo
.
isUnifiedMemory
);
}
catch
(...)
{
DUMP_INFO_STDOUT
(
"OpenCL device"
,
"not available"
);
DUMP_INFO_XML
(
"cv_ocl"
,
"not available"
);
}
}
#undef DUMP_INFO_STDOUT
#undef DUMP_INFO_XML
modules/ocl/perf/main.cpp
View file @
1980aad8
...
...
@@ -13,7 +13,7 @@
// Copyright (C) 2010-2012, Multicoreware, Inc., all rights reserved.
// Copyright (C) 2010-2012, Advanced Micro Devices, Inc., all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
...
...
@@ -42,7 +42,20 @@
#include "perf_precomp.hpp"
const
char
*
impls
[]
=
#define DUMP_INFO_STDOUT(propertyDisplayName, propertyValue) \
do { \
std::cout << (propertyDisplayName) << ": " << (propertyValue) << std::endl; \
} while (false)
#define DUMP_INFO_XML(propertyXMLName, propertyValue) \
do { \
std::stringstream ss; ss << propertyValue; \
::testing::Test::RecordProperty((propertyXMLName), ss.str()); \
} while (false)
#include "opencv2/ocl/private/opencl_dumpinfo.hpp"
static
const
char
*
impls
[]
=
{
IMPL_OCL
,
IMPL_PLAIN
,
...
...
@@ -51,59 +64,8 @@ const char * impls[] =
#endif
};
using
namespace
cv
::
ocl
;
int
main
(
int
argc
,
char
**
argv
)
{
const
char
*
keys
=
"{ h | help | false | print help message }"
"{ t | type | gpu | set device type:cpu or gpu}"
"{ p | platform | -1 | set platform id }"
"{ d | device | 0 | set device id }"
;
if
(
getenv
(
"OPENCV_OPENCL_DEVICE"
)
==
NULL
)
// TODO Remove this after buildbot updates
{
CommandLineParser
cmd
(
argc
,
argv
,
keys
);
if
(
cmd
.
get
<
bool
>
(
"help"
))
{
cout
<<
"Available options besides google test option:"
<<
endl
;
cmd
.
printParams
();
return
0
;
}
string
type
=
cmd
.
get
<
string
>
(
"type"
);
int
pid
=
cmd
.
get
<
int
>
(
"platform"
);
int
device
=
cmd
.
get
<
int
>
(
"device"
);
int
flag
=
type
==
"cpu"
?
cv
::
ocl
::
CVCL_DEVICE_TYPE_CPU
:
cv
::
ocl
::
CVCL_DEVICE_TYPE_GPU
;
cv
::
ocl
::
PlatformsInfo
platformsInfo
;
cv
::
ocl
::
getOpenCLPlatforms
(
platformsInfo
);
if
(
pid
>=
(
int
)
platformsInfo
.
size
())
{
std
::
cout
<<
"platform is invalid
\n
"
;
return
1
;
}
cv
::
ocl
::
DevicesInfo
devicesInfo
;
int
devnums
=
cv
::
ocl
::
getOpenCLDevices
(
devicesInfo
,
flag
,
(
pid
<
0
)
?
NULL
:
platformsInfo
[
pid
]);
if
(
device
<
0
||
device
>=
devnums
)
{
std
::
cout
<<
"device/platform invalid
\n
"
;
return
1
;
}
cv
::
ocl
::
setDevice
(
devicesInfo
[
device
]);
}
const
DeviceInfo
&
deviceInfo
=
cv
::
ocl
::
Context
::
getContext
()
->
getDeviceInfo
();
cout
<<
"Device type: "
<<
(
deviceInfo
.
deviceType
==
CVCL_DEVICE_TYPE_CPU
?
"CPU"
:
(
deviceInfo
.
deviceType
==
CVCL_DEVICE_TYPE_GPU
?
"GPU"
:
"unknown"
))
<<
endl
<<
"Platform name: "
<<
deviceInfo
.
platform
->
platformName
<<
endl
<<
"Device name: "
<<
deviceInfo
.
deviceName
<<
endl
;
CV_PERF_TEST_MAIN_INTERNALS
(
ocl
,
impls
)
CV_PERF_TEST_MAIN_INTERNALS
(
ocl
,
impls
,
dumpOpenCLDevice
())
}
modules/ocl/test/main.cpp
View file @
1980aad8
...
...
@@ -10,7 +10,8 @@
// Intel License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2000, Intel Corporation, all rights reserved.
// Copyright (C) 2010-2012, Multicoreware, Inc., all rights reserved.
// Copyright (C) 2010-2012, Advanced Micro Devices, Inc., all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
...
...
@@ -41,104 +42,18 @@
#include "test_precomp.hpp"
#ifdef HAVE_OPENCL
#define DUMP_INFO_STDOUT(propertyDisplayName, propertyValue) \
do { \
std::cout << (propertyDisplayName) << ": " << (propertyValue) << std::endl; \
} while (false)
using
namespace
std
;
using
namespace
cv
;
using
namespace
cv
::
ocl
;
using
namespace
cvtest
;
using
namespace
testing
;
#define DUMP_INFO_XML(propertyXMLName, propertyValue) \
do { \
std::stringstream ss; ss << propertyValue; \
::testing::Test::RecordProperty((propertyXMLName), ss.str()); \
} while (false)
void
print_info
()
{
printf
(
"
\n
"
);
#if defined _WIN32
# if defined _WIN64
puts
(
"OS: Windows 64"
);
# else
puts
(
"OS: Windows 32"
);
# endif
#elif defined linux
# if defined _LP64
puts
(
"OS: Linux 64"
);
# else
puts
(
"OS: Linux 32"
);
# endif
#elif defined __APPLE__
# if defined _LP64
puts
(
"OS: Apple 64"
);
# else
puts
(
"OS: Apple 32"
);
# endif
#endif
#include "opencv2/ocl/private/opencl_dumpinfo.hpp"
}
int
main
(
int
argc
,
char
**
argv
)
{
TS
::
ptr
()
->
init
(
"."
);
InitGoogleTest
(
&
argc
,
argv
);
const
char
*
keys
=
"{ h | help | false | print help message }"
"{ t | type | gpu | set device type:cpu or gpu}"
"{ p | platform | -1 | set platform id }"
"{ d | device | 0 | set device id }"
;
if
(
getenv
(
"OPENCV_OPENCL_DEVICE"
)
==
NULL
)
// TODO Remove this after buildbot updates
{
CommandLineParser
cmd
(
argc
,
argv
,
keys
);
if
(
cmd
.
get
<
bool
>
(
"help"
))
{
cout
<<
"Available options besides google test option:"
<<
endl
;
cmd
.
printParams
();
return
0
;
}
string
type
=
cmd
.
get
<
string
>
(
"type"
);
int
pid
=
cmd
.
get
<
int
>
(
"platform"
);
int
device
=
cmd
.
get
<
int
>
(
"device"
);
print_info
();
int
flag
=
CVCL_DEVICE_TYPE_GPU
;
if
(
type
==
"cpu"
)
{
flag
=
CVCL_DEVICE_TYPE_CPU
;
}
cv
::
ocl
::
PlatformsInfo
platformsInfo
;
cv
::
ocl
::
getOpenCLPlatforms
(
platformsInfo
);
if
(
pid
>=
(
int
)
platformsInfo
.
size
())
{
std
::
cout
<<
"platform is invalid
\n
"
;
return
1
;
}
cv
::
ocl
::
DevicesInfo
devicesInfo
;
int
devnums
=
cv
::
ocl
::
getOpenCLDevices
(
devicesInfo
,
flag
,
(
pid
<
0
)
?
NULL
:
platformsInfo
[
pid
]);
if
(
device
<
0
||
device
>=
devnums
)
{
std
::
cout
<<
"device/platform invalid
\n
"
;
return
1
;
}
cv
::
ocl
::
setDevice
(
devicesInfo
[
device
]);
}
const
DeviceInfo
&
deviceInfo
=
cv
::
ocl
::
Context
::
getContext
()
->
getDeviceInfo
();
cout
<<
"Device type: "
<<
(
deviceInfo
.
deviceType
==
CVCL_DEVICE_TYPE_CPU
?
"CPU"
:
(
deviceInfo
.
deviceType
==
CVCL_DEVICE_TYPE_GPU
?
"GPU"
:
"unknown"
))
<<
endl
<<
"Platform name: "
<<
deviceInfo
.
platform
->
platformName
<<
endl
<<
"Device name: "
<<
deviceInfo
.
deviceName
<<
endl
;
return
RUN_ALL_TESTS
();
}
#else // DON'T HAVE_OPENCL
int
main
()
{
printf
(
"OpenCV was built without OpenCL support
\n
"
);
return
0
;
}
#endif // HAVE_OPENCL
CV_TEST_MAIN
(
"."
,
dumpOpenCLDevice
())
modules/ts/include/opencv2/ts/ts.hpp
View file @
1980aad8
...
...
@@ -564,12 +564,23 @@ CV_EXPORTS void cvTsConvert( const CvMat* src, CvMat* dst );
CV_EXPORTS
void
cvTsGEMM
(
const
CvMat
*
a
,
const
CvMat
*
b
,
double
alpha
,
const
CvMat
*
c
,
double
beta
,
CvMat
*
d
,
int
flags
);
#define CV_TEST_MAIN(resourcesubdir) \
#ifndef __CV_TEST_EXEC_ARGS
#if defined(_MSC_VER) && (_MSC_VER <= 1400)
#define __CV_TEST_EXEC_ARGS(...) \
while (++argc >= (--argc,-1)) {__VA_ARGS__; break;}
/*this ugly construction is needed for VS 2005*/
#else
#define __CV_TEST_EXEC_ARGS(...) \
__VA_ARGS__;
#endif
#endif
#define CV_TEST_MAIN(resourcesubdir, ...) \
int main(int argc, char **argv) \
{ \
cvtest::TS::ptr()->init(resourcesubdir); \
::testing::InitGoogleTest(&argc, argv); \
cvtest::printVersionInfo();\
cvtest::printVersionInfo(); \
__CV_TEST_EXEC_ARGS(__VA_ARGS__) \
return RUN_ALL_TESTS(); \
}
...
...
modules/ts/include/opencv2/ts/ts_perf.hpp
View file @
1980aad8
...
...
@@ -477,23 +477,25 @@ CV_EXPORTS void PrintTo(const Size& sz, ::std::ostream* os);
INSTANTIATE_TEST_CASE_P(
/*none*/
, fixture##_##name, params);\
void fixture##_##name::PerfTestBody()
#ifndef __CV_TEST_EXEC_ARGS
#if defined(_MSC_VER) && (_MSC_VER <= 1400)
#define
CV_PERF_TEST_MAIN_INTERNALS_ARGS(...)
\
#define
__CV_TEST_EXEC_ARGS(...)
\
while (++argc >= (--argc,-1)) {__VA_ARGS__; break;}
/*this ugly construction is needed for VS 2005*/
#else
#define
CV_PERF_TEST_MAIN_INTERNALS_ARGS(...)
\
#define
__CV_TEST_EXEC_ARGS(...)
\
__VA_ARGS__;
#endif
#endif
#define CV_PERF_TEST_MAIN_INTERNALS(modulename, impls, ...) \
CV_PERF_TEST_MAIN_INTERNALS_ARGS(__VA_ARGS__)
\
::perf::
Regression::Init(#modulename);
\
::perf::TestBase::Init(std::vector<std::string>(impls, impls + sizeof impls / sizeof *impls),
\
argc, argv);
\
::testing::InitGoogleTest(&argc, argv);
\
cvtest::printVersionInfo();
\
::
testing::Test::RecordProperty("cv_module_name", #modulename);
\
::perf::TestBase::RecordRunParameters();
\
::perf::Regression::Init(#modulename);
\
::perf::
TestBase::Init(std::vector<std::string>(impls, impls + sizeof impls / sizeof *impls),
\
argc, argv);
\
::testing::InitGoogleTest(&argc, argv);
\
cvtest::printVersionInfo();
\
::testing::Test::RecordProperty("cv_module_name", #modulename);
\
::
perf::TestBase::RecordRunParameters();
\
__CV_TEST_EXEC_ARGS(__VA_ARGS__)
\
return RUN_ALL_TESTS();
// impls must be an array, not a pointer; "plain" should always be one of the implementations
...
...
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