From 68957b27571507aab033f4a5e3bf704e656c2679 Mon Sep 17 00:00:00 2001 From: Ilya Lavrenov Date: Sat, 1 Mar 2014 20:08:58 +0400 Subject: [PATCH] added some new performance tests --- modules/core/perf/opencl/perf_gemm.cpp | 3 +- modules/core/perf/opencl/perf_matop.cpp | 84 +++++++++++++++++++++++++++++++++ modules/ts/src/ts_perf.cpp | 2 +- 3 files changed, 87 insertions(+), 2 deletions(-) create mode 100644 modules/core/perf/opencl/perf_matop.cpp diff --git a/modules/core/perf/opencl/perf_gemm.cpp b/modules/core/perf/opencl/perf_gemm.cpp index 3aa87d6..700f380 100644 --- a/modules/core/perf/opencl/perf_gemm.cpp +++ b/modules/core/perf/opencl/perf_gemm.cpp @@ -59,7 +59,8 @@ typedef TestBaseWithParam GemmFixture; OCL_PERF_TEST_P(GemmFixture, Gemm, ::testing::Combine( ::testing::Values(Size(1000, 1000), Size(1500, 1500)), - Values((int)cv::GEMM_3_T, (int)cv::GEMM_3_T | (int)cv::GEMM_2_T))) + Values((int)cv::GEMM_3_T, (int)cv::GEMM_3_T | (int)cv::GEMM_2_T, + (int)cv::GEMM_1_T, (int)cv::GEMM_1_T | (int)cv::GEMM_2_T))) { GemmParams params = GetParam(); const Size srcSize = get<0>(params); diff --git a/modules/core/perf/opencl/perf_matop.cpp b/modules/core/perf/opencl/perf_matop.cpp new file mode 100644 index 0000000..a3b2674 --- /dev/null +++ b/modules/core/perf/opencl/perf_matop.cpp @@ -0,0 +1,84 @@ +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. + +// Copyright (C) 2014, Advanced Micro Devices, Inc., all rights reserved. +// Third party copyrights are property of their respective owners. + +#include "perf_precomp.hpp" +#include "opencv2/ts/ocl_perf.hpp" + +#ifdef HAVE_OPENCL + +namespace cvtest { +namespace ocl { + +///////////// SetTo //////////////////////// + +typedef Size_MatType SetToFixture; + +OCL_PERF_TEST_P(SetToFixture, SetTo, + ::testing::Combine(OCL_TEST_SIZES, OCL_TEST_TYPES)) +{ + const Size_MatType_t params = GetParam(); + const Size srcSize = get<0>(params); + const int type = get<1>(params); + const Scalar s = Scalar::all(17); + + checkDeviceMaxMemoryAllocSize(srcSize, type); + + UMat src(srcSize, type); + declare.in(src, WARMUP_RNG).out(src); + + OCL_TEST_CYCLE() src.setTo(s); + + SANITY_CHECK(src); +} + +///////////// ConvertTo //////////////////////// + +typedef Size_MatType ConvertToFixture; + +OCL_PERF_TEST_P(ConvertToFixture, ConvertTo, + ::testing::Combine(OCL_TEST_SIZES, OCL_TEST_TYPES)) +{ + const Size_MatType_t params = GetParam(); + const Size srcSize = get<0>(params); + const int type = get<1>(params), ddepth = CV_MAT_DEPTH(type) == CV_8U ? CV_32F : CV_8U, + cn = CV_MAT_CN(type), dtype = CV_MAKE_TYPE(ddepth, cn); + + checkDeviceMaxMemoryAllocSize(srcSize, type); + checkDeviceMaxMemoryAllocSize(srcSize, dtype); + + UMat src(srcSize, type), dst(srcSize, dtype); + declare.in(src, WARMUP_RNG).out(dst); + + OCL_TEST_CYCLE() src.convertTo(dst, dtype); + + SANITY_CHECK(dst); +} + +///////////// CopyTo //////////////////////// + +typedef Size_MatType CopyToFixture; + +OCL_PERF_TEST_P(CopyToFixture, CopyTo, + ::testing::Combine(OCL_TEST_SIZES, OCL_TEST_TYPES)) +{ + const Size_MatType_t params = GetParam(); + const Size srcSize = get<0>(params); + const int type = get<1>(params); + + checkDeviceMaxMemoryAllocSize(srcSize, type); + + UMat src(srcSize, type), dst(srcSize, type); + declare.in(src, WARMUP_RNG).out(dst); + + OCL_TEST_CYCLE() src.copyTo(dst); + + SANITY_CHECK(dst); +} + +} } // namespace cvtest::ocl + +#endif // HAVE_OPENCL diff --git a/modules/ts/src/ts_perf.cpp b/modules/ts/src/ts_perf.cpp index 8060e27..f1403b9 100644 --- a/modules/ts/src/ts_perf.cpp +++ b/modules/ts/src/ts_perf.cpp @@ -1618,7 +1618,7 @@ namespace cv { void PrintTo(const String& str, ::std::ostream* os) { - *os << str; + *os << "\"" << str << "\""; } void PrintTo(const Size& sz, ::std::ostream* os) -- 2.7.4