added cv::gpu::resetDevice to RunPerfTestBody
This commit is contained in:
parent
1a76242d99
commit
660d23aa04
@ -9,9 +9,9 @@
|
||||
virtual void __gpu();\
|
||||
virtual void PerfTestBody();\
|
||||
};\
|
||||
TEST_P(fixture##_##name, name /*perf*/){ RunPerfTestBody(); if (PERF_RUN_GPU()) __gpu(); else __cpu();}\
|
||||
TEST_P(fixture##_##name, name /*perf*/){ RunPerfTestBody(); }\
|
||||
INSTANTIATE_TEST_CASE_P(/*none*/, fixture##_##name, params);\
|
||||
void fixture##_##name::PerfTestBody()
|
||||
void fixture##_##name::PerfTestBody() { if (PERF_RUN_GPU()) __gpu(); else __cpu(); }
|
||||
|
||||
#define RUN_CPU(fixture, name)\
|
||||
void fixture##_##name::__cpu()
|
||||
@ -56,7 +56,6 @@ GPU_PERF_TEST_P(SCascadeTest, detect,
|
||||
testing::Combine(
|
||||
testing::Values(std::string("cv/cascadeandhog/sc_cvpr_2012_to_opencv.xml")),
|
||||
testing::Values(std::string("cv/cascadeandhog/bahnhof/image_00000000_0.png"))))
|
||||
{ }
|
||||
|
||||
RUN_GPU(SCascadeTest, detect)
|
||||
{
|
||||
@ -114,7 +113,6 @@ GPU_PERF_TEST_P(SCascadeTestRoi, detectInRoi,
|
||||
testing::Values(std::string("cv/cascadeandhog/sc_cvpr_2012_to_opencv.xml")),
|
||||
testing::Values(std::string("cv/cascadeandhog/bahnhof/image_00000000_0.png")),
|
||||
testing::Range(0, 5)))
|
||||
{}
|
||||
|
||||
RUN_GPU(SCascadeTestRoi, detectInRoi)
|
||||
{
|
||||
@ -159,7 +157,6 @@ GPU_PERF_TEST_P(SCascadeTestRoi, detectEachRoi,
|
||||
testing::Values(std::string("cv/cascadeandhog/sc_cvpr_2012_to_opencv.xml")),
|
||||
testing::Values(std::string("cv/cascadeandhog/bahnhof/image_00000000_0.png")),
|
||||
testing::Range(0, 10)))
|
||||
{}
|
||||
|
||||
RUN_GPU(SCascadeTestRoi, detectEachRoi)
|
||||
{
|
||||
@ -198,14 +195,13 @@ GPU_PERF_TEST_P(SCascadeTest, detectOnIntegral,
|
||||
testing::Combine(
|
||||
testing::Values(std::string("cv/cascadeandhog/sc_cvpr_2012_to_opencv.xml")),
|
||||
testing::Values(std::string("cv/cascadeandhog/integrals.xml"))))
|
||||
{ }
|
||||
|
||||
static std::string itoa(long i)
|
||||
{
|
||||
static char s[65];
|
||||
sprintf(s, "%ld", i);
|
||||
return std::string(s);
|
||||
}
|
||||
static std::string itoa(long i)
|
||||
{
|
||||
static char s[65];
|
||||
sprintf(s, "%ld", i);
|
||||
return std::string(s);
|
||||
}
|
||||
|
||||
RUN_GPU(SCascadeTest, detectOnIntegral)
|
||||
{
|
||||
@ -247,7 +243,6 @@ GPU_PERF_TEST_P(SCascadeTest, detectStream,
|
||||
testing::Combine(
|
||||
testing::Values(std::string("cv/cascadeandhog/sc_cvpr_2012_to_opencv.xml")),
|
||||
testing::Values(std::string("cv/cascadeandhog/bahnhof/image_00000000_0.png"))))
|
||||
{ }
|
||||
|
||||
RUN_GPU(SCascadeTest, detectStream)
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
#ifndef __OPENCV_GTESTCV_HPP__
|
||||
#define __OPENCV_GTESTCV_HPP__
|
||||
|
||||
#if HAVE_CVCONFIG_H
|
||||
#ifdef HAVE_CVCONFIG_H
|
||||
#include "cvconfig.h"
|
||||
#endif
|
||||
#ifndef GTEST_CREATE_SHARED_LIBRARY
|
||||
|
@ -1,5 +1,9 @@
|
||||
#include "precomp.hpp"
|
||||
|
||||
#ifdef HAVE_CUDA
|
||||
#include "opencv2/core/gpumat.hpp"
|
||||
#endif
|
||||
|
||||
#ifdef ANDROID
|
||||
# include <sys/time.h>
|
||||
#endif
|
||||
@ -1145,6 +1149,10 @@ void TestBase::RunPerfTestBody()
|
||||
catch(cv::Exception e)
|
||||
{
|
||||
metrics.terminationReason = performance_metrics::TERM_EXCEPTION;
|
||||
#ifdef HAVE_CUDA
|
||||
if (e.code == CV_GpuApiCallError)
|
||||
cv::gpu::resetDevice();
|
||||
#endif
|
||||
FAIL() << "Expected: PerfTestBody() doesn't throw an exception.\n Actual: it throws:\n " << e.what();
|
||||
}
|
||||
catch(...)
|
||||
|
Loading…
x
Reference in New Issue
Block a user