From 4716f63444e95a96148687242edb7e01c75df805 Mon Sep 17 00:00:00 2001 From: Vladislav Vinogradov Date: Tue, 16 Jul 2013 15:43:04 +0400 Subject: [PATCH] fixed gpu performance tests: used new CV_PERF_TEST_MAIN_WITH_IMPLS mechanism --- modules/gpu/perf/perf_main.cpp | 9 +-------- modules/gpu/perf4au/main.cpp | 11 +---------- modules/gpuarithm/perf/perf_main.cpp | 2 +- modules/gpubgsegm/perf/perf_main.cpp | 2 +- modules/gpucodec/perf/perf_main.cpp | 2 +- modules/gpufeatures2d/perf/perf_main.cpp | 2 +- modules/gpufilters/perf/perf_main.cpp | 2 +- modules/gpuimgproc/perf/perf_main.cpp | 2 +- modules/gpuoptflow/perf/perf_main.cpp | 2 +- modules/gpustereo/perf/perf_main.cpp | 2 +- modules/gpuwarping/perf/perf_main.cpp | 2 +- modules/photo/perf/perf_main.cpp | 10 +++++++++- modules/softcascade/perf/perf_main.cpp | 10 +++++++++- modules/ts/include/opencv2/ts/gpu_perf.hpp | 16 ++++++++++++++++ 14 files changed, 45 insertions(+), 29 deletions(-) diff --git a/modules/gpu/perf/perf_main.cpp b/modules/gpu/perf/perf_main.cpp index 53a19ca41..802d559af 100644 --- a/modules/gpu/perf/perf_main.cpp +++ b/modules/gpu/perf/perf_main.cpp @@ -44,11 +44,4 @@ using namespace perf; -static const char * impls[] = { -#ifdef HAVE_CUDA - "cuda", -#endif - "plain" -}; - -CV_PERF_TEST_MAIN_WITH_IMPLS(gpu, impls, printCudaInfo()) +CV_PERF_TEST_CUDA_MAIN(gpu) diff --git a/modules/gpu/perf4au/main.cpp b/modules/gpu/perf4au/main.cpp index d86f7b8f3..69c281f32 100644 --- a/modules/gpu/perf4au/main.cpp +++ b/modules/gpu/perf4au/main.cpp @@ -52,16 +52,7 @@ #include "opencv2/ts.hpp" #include "opencv2/ts/gpu_perf.hpp" -int main(int argc, char* argv[]) -{ - perf::printCudaInfo(); - - perf::Regression::Init("gpu_perf4au"); - perf::TestBase::Init(argc, argv); - testing::InitGoogleTest(&argc, argv); - - return RUN_ALL_TESTS(); -} +CV_PERF_TEST_CUDA_MAIN(gpu_perf4au) ////////////////////////////////////////////////////////// // HoughLinesP diff --git a/modules/gpuarithm/perf/perf_main.cpp b/modules/gpuarithm/perf/perf_main.cpp index b35791cda..552cf5c16 100644 --- a/modules/gpuarithm/perf/perf_main.cpp +++ b/modules/gpuarithm/perf/perf_main.cpp @@ -44,4 +44,4 @@ using namespace perf; -CV_PERF_TEST_MAIN(gpuarithm, printCudaInfo()) +CV_PERF_TEST_CUDA_MAIN(gpuarithm) diff --git a/modules/gpubgsegm/perf/perf_main.cpp b/modules/gpubgsegm/perf/perf_main.cpp index 99066f450..f69d0ea8f 100644 --- a/modules/gpubgsegm/perf/perf_main.cpp +++ b/modules/gpubgsegm/perf/perf_main.cpp @@ -44,4 +44,4 @@ using namespace perf; -CV_PERF_TEST_MAIN(gpubgsegm, printCudaInfo()) +CV_PERF_TEST_CUDA_MAIN(gpubgsegm) diff --git a/modules/gpucodec/perf/perf_main.cpp b/modules/gpucodec/perf/perf_main.cpp index 2f4110b87..783965357 100644 --- a/modules/gpucodec/perf/perf_main.cpp +++ b/modules/gpucodec/perf/perf_main.cpp @@ -44,4 +44,4 @@ using namespace perf; -CV_PERF_TEST_MAIN(gpucodec, printCudaInfo()) +CV_PERF_TEST_CUDA_MAIN(gpucodec) diff --git a/modules/gpufeatures2d/perf/perf_main.cpp b/modules/gpufeatures2d/perf/perf_main.cpp index 0fd79fde3..5e7fb1b8b 100644 --- a/modules/gpufeatures2d/perf/perf_main.cpp +++ b/modules/gpufeatures2d/perf/perf_main.cpp @@ -44,4 +44,4 @@ using namespace perf; -CV_PERF_TEST_MAIN(gpufeatures2d, printCudaInfo()) +CV_PERF_TEST_CUDA_MAIN(gpufeatures2d) diff --git a/modules/gpufilters/perf/perf_main.cpp b/modules/gpufilters/perf/perf_main.cpp index b5a3eda40..44b3129e1 100644 --- a/modules/gpufilters/perf/perf_main.cpp +++ b/modules/gpufilters/perf/perf_main.cpp @@ -44,4 +44,4 @@ using namespace perf; -CV_PERF_TEST_MAIN(gpufilters, printCudaInfo()) +CV_PERF_TEST_CUDA_MAIN(gpufilters) diff --git a/modules/gpuimgproc/perf/perf_main.cpp b/modules/gpuimgproc/perf/perf_main.cpp index 6b3bec5f8..8eb27a27b 100644 --- a/modules/gpuimgproc/perf/perf_main.cpp +++ b/modules/gpuimgproc/perf/perf_main.cpp @@ -44,4 +44,4 @@ using namespace perf; -CV_PERF_TEST_MAIN(gpuimgproc, printCudaInfo()) +CV_PERF_TEST_CUDA_MAIN(gpuimgproc) diff --git a/modules/gpuoptflow/perf/perf_main.cpp b/modules/gpuoptflow/perf/perf_main.cpp index dad5e52bb..e261932f8 100644 --- a/modules/gpuoptflow/perf/perf_main.cpp +++ b/modules/gpuoptflow/perf/perf_main.cpp @@ -44,4 +44,4 @@ using namespace perf; -CV_PERF_TEST_MAIN(gpuoptflow, printCudaInfo()) +CV_PERF_TEST_CUDA_MAIN(gpuoptflow) diff --git a/modules/gpustereo/perf/perf_main.cpp b/modules/gpustereo/perf/perf_main.cpp index d681cdb4d..0766ccf05 100644 --- a/modules/gpustereo/perf/perf_main.cpp +++ b/modules/gpustereo/perf/perf_main.cpp @@ -44,4 +44,4 @@ using namespace perf; -CV_PERF_TEST_MAIN(gpustereo, printCudaInfo()) +CV_PERF_TEST_CUDA_MAIN(gpustereo) diff --git a/modules/gpuwarping/perf/perf_main.cpp b/modules/gpuwarping/perf/perf_main.cpp index a7c1d5c85..8566b097d 100644 --- a/modules/gpuwarping/perf/perf_main.cpp +++ b/modules/gpuwarping/perf/perf_main.cpp @@ -44,4 +44,4 @@ using namespace perf; -CV_PERF_TEST_MAIN(gpuwarping, printCudaInfo()) +CV_PERF_TEST_CUDA_MAIN(gpuwarping) diff --git a/modules/photo/perf/perf_main.cpp b/modules/photo/perf/perf_main.cpp index f5863c197..fd3781212 100644 --- a/modules/photo/perf/perf_main.cpp +++ b/modules/photo/perf/perf_main.cpp @@ -1,3 +1,11 @@ #include "perf_precomp.hpp" +#include "opencv2/ts/gpu_perf.hpp" -CV_PERF_TEST_MAIN(photo) +static const char * impls[] = { +#ifdef HAVE_CUDA + "cuda", +#endif + "plain" +}; + +CV_PERF_TEST_MAIN_WITH_IMPLS(photo, impls, perf::printCudaInfo()) diff --git a/modules/softcascade/perf/perf_main.cpp b/modules/softcascade/perf/perf_main.cpp index f045c4b46..9a3869f5e 100644 --- a/modules/softcascade/perf/perf_main.cpp +++ b/modules/softcascade/perf/perf_main.cpp @@ -41,5 +41,13 @@ //M*/ #include "perf_precomp.hpp" +#include "opencv2/ts/gpu_perf.hpp" -CV_PERF_TEST_MAIN(softcascade) +static const char * impls[] = { +#ifdef HAVE_CUDA + "cuda", +#endif + "plain" +}; + +CV_PERF_TEST_MAIN_WITH_IMPLS(softcascade, impls, perf::printCudaInfo()) diff --git a/modules/ts/include/opencv2/ts/gpu_perf.hpp b/modules/ts/include/opencv2/ts/gpu_perf.hpp index cff6f8dc6..abc17e994 100644 --- a/modules/ts/include/opencv2/ts/gpu_perf.hpp +++ b/modules/ts/include/opencv2/ts/gpu_perf.hpp @@ -105,6 +105,22 @@ namespace perf CV_EXPORTS void printCudaInfo(); CV_EXPORTS void sortKeyPoints(std::vector& keypoints, cv::InputOutputArray _descriptors = cv::noArray()); + +#ifdef HAVE_CUDA + #define CV_PERF_TEST_CUDA_MAIN(modulename) \ + int main(int argc, char **argv)\ + {\ + const char * impls[] = { "cuda", "plain" };\ + CV_PERF_TEST_MAIN_INTERNALS(modulename, impls, perf::printCudaInfo())\ + } +#else + #define CV_PERF_TEST_CUDA_MAIN(modulename) \ + int main(int argc, char **argv)\ + {\ + const char * plain_only[] = { "plain" };\ + CV_PERF_TEST_MAIN_INTERNALS(modulename, plain_only)\ + } +#endif } #endif // __OPENCV_GPU_PERF_UTILITY_HPP__