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
1be1a289
Commit
1be1a289
authored
Dec 19, 2014
by
Vladislav Vinogradov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move CUDA core tests to core module
parent
53862687
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
88 additions
and
198 deletions
+88
-198
perf_gpumat.cpp
modules/core/perf/cuda/perf_gpumat.cpp
+20
-21
test_buffer_pool.cpp
modules/core/test/cuda/test_buffer_pool.cpp
+41
-42
test_gpumat.cpp
modules/core/test/cuda/test_gpumat.cpp
+19
-16
test_opengl.cpp
modules/core/test/cuda/test_opengl.cpp
+5
-1
test_stream.cpp
modules/core/test/cuda/test_stream.cpp
+3
-4
perf_buffer_pool.cpp
modules/cuda/perf/perf_buffer_pool.cpp
+0
-114
No files found.
modules/c
uda/perf/perf_matop
.cpp
→
modules/c
ore/perf/cuda/perf_gpumat
.cpp
View file @
1be1a289
...
...
@@ -40,7 +40,12 @@
//
//M*/
#include "perf_precomp.hpp"
#include "../perf_precomp.hpp"
#ifdef HAVE_CUDA
#include "opencv2/core/cuda.hpp"
#include "opencv2/ts/cuda_perf.hpp"
using
namespace
std
;
using
namespace
testing
;
...
...
@@ -49,7 +54,7 @@ using namespace perf;
//////////////////////////////////////////////////////////////////////
// SetTo
PERF_TEST_P
(
Sz_Depth_Cn
,
MatOp
_SetTo
,
PERF_TEST_P
(
Sz_Depth_Cn
,
CUDA_GpuMat
_SetTo
,
Combine
(
CUDA_TYPICAL_MAT_SIZES
,
Values
(
CV_8U
,
CV_16U
,
CV_32F
,
CV_64F
),
CUDA_CHANNELS_1_3_4
))
...
...
@@ -67,23 +72,21 @@ PERF_TEST_P(Sz_Depth_Cn, MatOp_SetTo,
cv
::
cuda
::
GpuMat
dst
(
size
,
type
);
TEST_CYCLE
()
dst
.
setTo
(
val
);
CUDA_SANITY_CHECK
(
dst
);
}
else
{
cv
::
Mat
dst
(
size
,
type
);
TEST_CYCLE
()
dst
.
setTo
(
val
);
CPU_SANITY_CHECK
(
dst
);
}
SANITY_CHECK_NOTHING
();
}
//////////////////////////////////////////////////////////////////////
// SetToMasked
PERF_TEST_P
(
Sz_Depth_Cn
,
MatOp
_SetToMasked
,
PERF_TEST_P
(
Sz_Depth_Cn
,
CUDA_GpuMat
_SetToMasked
,
Combine
(
CUDA_TYPICAL_MAT_SIZES
,
Values
(
CV_8U
,
CV_16U
,
CV_32F
,
CV_64F
),
CUDA_CHANNELS_1_3_4
))
...
...
@@ -106,23 +109,21 @@ PERF_TEST_P(Sz_Depth_Cn, MatOp_SetToMasked,
const
cv
::
cuda
::
GpuMat
d_mask
(
mask
);
TEST_CYCLE
()
dst
.
setTo
(
val
,
d_mask
);
CUDA_SANITY_CHECK
(
dst
,
1e-10
);
}
else
{
cv
::
Mat
dst
=
src
;
TEST_CYCLE
()
dst
.
setTo
(
val
,
mask
);
CPU_SANITY_CHECK
(
dst
);
}
SANITY_CHECK_NOTHING
();
}
//////////////////////////////////////////////////////////////////////
// CopyToMasked
PERF_TEST_P
(
Sz_Depth_Cn
,
MatOp
_CopyToMasked
,
PERF_TEST_P
(
Sz_Depth_Cn
,
CUDA_GpuMat
_CopyToMasked
,
Combine
(
CUDA_TYPICAL_MAT_SIZES
,
Values
(
CV_8U
,
CV_16U
,
CV_32F
,
CV_64F
),
CUDA_CHANNELS_1_3_4
))
...
...
@@ -144,17 +145,15 @@ PERF_TEST_P(Sz_Depth_Cn, MatOp_CopyToMasked,
cv
::
cuda
::
GpuMat
dst
(
d_src
.
size
(),
d_src
.
type
(),
cv
::
Scalar
::
all
(
0
));
TEST_CYCLE
()
d_src
.
copyTo
(
dst
,
d_mask
);
CUDA_SANITY_CHECK
(
dst
,
1e-10
);
}
else
{
cv
::
Mat
dst
(
src
.
size
(),
src
.
type
(),
cv
::
Scalar
::
all
(
0
));
TEST_CYCLE
()
src
.
copyTo
(
dst
,
mask
);
CPU_SANITY_CHECK
(
dst
);
}
SANITY_CHECK_NOTHING
();
}
//////////////////////////////////////////////////////////////////////
...
...
@@ -162,7 +161,7 @@ PERF_TEST_P(Sz_Depth_Cn, MatOp_CopyToMasked,
DEF_PARAM_TEST
(
Sz_2Depth
,
cv
::
Size
,
MatDepth
,
MatDepth
);
PERF_TEST_P
(
Sz_2Depth
,
MatOp
_ConvertTo
,
PERF_TEST_P
(
Sz_2Depth
,
CUDA_GpuMat
_ConvertTo
,
Combine
(
CUDA_TYPICAL_MAT_SIZES
,
Values
(
CV_8U
,
CV_16U
,
CV_32F
,
CV_64F
),
Values
(
CV_8U
,
CV_16U
,
CV_32F
,
CV_64F
)))
...
...
@@ -183,15 +182,15 @@ PERF_TEST_P(Sz_2Depth, MatOp_ConvertTo,
cv
::
cuda
::
GpuMat
dst
;
TEST_CYCLE
()
d_src
.
convertTo
(
dst
,
depth2
,
a
,
b
);
CUDA_SANITY_CHECK
(
dst
,
1e-10
);
}
else
{
cv
::
Mat
dst
;
TEST_CYCLE
()
src
.
convertTo
(
dst
,
depth2
,
a
,
b
);
CPU_SANITY_CHECK
(
dst
);
}
SANITY_CHECK_NOTHING
();
}
#endif
modules/c
uda/test
/test_buffer_pool.cpp
→
modules/c
ore/test/cuda
/test_buffer_pool.cpp
View file @
1be1a289
...
...
@@ -40,13 +40,13 @@
//
//M*/
#include "test_precomp.hpp"
#include "
../
test_precomp.hpp"
#ifdef HAVE_CUDA
#include "opencv2/cudaarithm.hpp"
#include "opencv2/cudawarping.hpp"
#include "opencv2/core/cuda.hpp"
#include "opencv2/core/private.cuda.hpp"
#include "opencv2/ts/cuda_test.hpp"
using
namespace
testing
;
using
namespace
cv
;
...
...
@@ -54,65 +54,64 @@ using namespace cv::cuda;
struct
BufferPoolTest
:
TestWithParam
<
DeviceInfo
>
{
};
namespace
{
void
func1
(
const
GpuMat
&
src
,
GpuMat
&
dst
,
Stream
&
stream
)
void
RunSimpleTest
(
Stream
&
stream
,
HostMem
&
dst_1
,
HostMem
&
dst_2
)
{
BufferPool
pool
(
stream
);
GpuMat
buf
=
pool
.
getBuffer
(
src
.
size
(),
CV_32FC
(
src
.
channels
()));
src
.
convertTo
(
buf
,
CV_32F
,
1.0
/
255.0
,
stream
);
{
GpuMat
buf0
=
pool
.
getBuffer
(
Size
(
640
,
480
),
CV_8UC1
);
EXPECT_FALSE
(
buf0
.
empty
()
);
cuda
::
exp
(
buf
,
dst
,
stream
);
}
void
func2
(
const
GpuMat
&
src
,
GpuMat
&
dst
,
Stream
&
stream
)
{
BufferPool
pool
(
stream
);
buf0
.
setTo
(
Scalar
::
all
(
0
),
stream
);
GpuMat
buf1
=
pool
.
getBuffer
(
saturate_cast
<
int
>
(
src
.
rows
*
0.5
),
saturate_cast
<
int
>
(
src
.
cols
*
0.5
),
src
.
type
());
GpuMat
buf1
=
pool
.
getBuffer
(
Size
(
640
,
480
),
CV_8UC1
);
EXPECT_FALSE
(
buf1
.
empty
()
);
cuda
::
resize
(
src
,
buf1
,
Size
(),
0.5
,
0.5
,
cv
::
INTER_NEAREST
,
stream
);
buf0
.
convertTo
(
buf1
,
buf1
.
type
(),
1.0
,
1.0
,
stream
);
GpuMat
buf2
=
pool
.
getBuffer
(
buf1
.
size
(),
CV_32FC
(
buf1
.
channels
()));
buf1
.
download
(
dst_1
,
stream
);
}
func1
(
buf1
,
buf2
,
stream
);
{
GpuMat
buf2
=
pool
.
getBuffer
(
Size
(
1280
,
1024
),
CV_32SC1
);
EXPECT_FALSE
(
buf2
.
empty
()
);
GpuMat
buf3
=
pool
.
getBuffer
(
src
.
size
(),
buf2
.
type
()
);
buf2
.
setTo
(
Scalar
::
all
(
2
),
stream
);
cuda
::
resize
(
buf2
,
buf3
,
src
.
size
(),
0
,
0
,
cv
::
INTER_NEAREST
,
stream
);
buf2
.
download
(
dst_2
,
stream
);
}
}
buf3
.
convertTo
(
dst
,
CV_8U
,
stream
);
void
CheckSimpleTest
(
HostMem
&
dst_1
,
HostMem
&
dst_2
)
{
EXPECT_MAT_NEAR
(
Mat
(
Size
(
640
,
480
),
CV_8UC1
,
Scalar
::
all
(
1
)),
dst_1
,
0.0
);
EXPECT_MAT_NEAR
(
Mat
(
Size
(
1280
,
1024
),
CV_32SC1
,
Scalar
::
all
(
2
)),
dst_2
,
0.0
);
}
}
}
;
CUDA_TEST_P
(
BufferPoolTest
,
SimpleUsage
)
CUDA_TEST_P
(
BufferPoolTest
,
FromNullStream
)
{
DeviceInfo
devInfo
=
GetParam
();
setDevice
(
devInfo
.
deviceID
());
HostMem
dst_1
,
dst_2
;
GpuMat
src
(
200
,
200
,
CV_8UC1
);
GpuMat
dst
;
RunSimpleTest
(
Stream
::
Null
(),
dst_1
,
dst_2
);
Stream
stream
;
func2
(
src
,
dst
,
stream
);
CheckSimpleTest
(
dst_1
,
dst_2
);
}
stream
.
waitForCompletion
();
CUDA_TEST_P
(
BufferPoolTest
,
From2Streams
)
{
HostMem
dst1_1
,
dst1_2
;
HostMem
dst2_1
,
dst2_2
;
GpuMat
buf
,
buf1
,
buf2
,
buf3
;
GpuMat
dst_gold
;
Stream
stream1
,
stream2
;
RunSimpleTest
(
stream1
,
dst1_1
,
dst1_2
);
RunSimpleTest
(
stream2
,
dst2_1
,
dst2_2
);
cuda
::
resize
(
src
,
buf1
,
Size
(),
0.5
,
0.5
,
cv
::
INTER_NEAREST
);
buf1
.
convertTo
(
buf
,
CV_32F
,
1.0
/
255.0
);
cuda
::
exp
(
buf
,
buf2
);
cuda
::
resize
(
buf2
,
buf3
,
src
.
size
(),
0
,
0
,
cv
::
INTER_NEAREST
);
buf3
.
convertTo
(
dst_gold
,
CV_8U
);
stream1
.
waitForCompletion
();
stream2
.
waitForCompletion
();
ASSERT_MAT_NEAR
(
dst_gold
,
dst
,
0
);
CheckSimpleTest
(
dst1_1
,
dst1_2
);
CheckSimpleTest
(
dst2_1
,
dst2_2
);
}
INSTANTIATE_TEST_CASE_P
(
CUDA_Stream
,
BufferPoolTest
,
ALL_DEVICES
);
...
...
modules/c
uda/test
/test_gpumat.cpp
→
modules/c
ore/test/cuda
/test_gpumat.cpp
View file @
1be1a289
...
...
@@ -40,16 +40,19 @@
//
//M*/
#include "test_precomp.hpp"
#include "
../
test_precomp.hpp"
#ifdef HAVE_CUDA
#include "opencv2/core/cuda.hpp"
#include "opencv2/ts/cuda_test.hpp"
using
namespace
cvtest
;
////////////////////////////////////////////////////////////////////////////////
// SetTo
PARAM_TEST_CASE
(
SetTo
,
cv
::
cuda
::
DeviceInfo
,
cv
::
Size
,
MatType
,
UseRoi
)
PARAM_TEST_CASE
(
GpuMat_
SetTo
,
cv
::
cuda
::
DeviceInfo
,
cv
::
Size
,
MatType
,
UseRoi
)
{
cv
::
cuda
::
DeviceInfo
devInfo
;
cv
::
Size
size
;
...
...
@@ -67,7 +70,7 @@ PARAM_TEST_CASE(SetTo, cv::cuda::DeviceInfo, cv::Size, MatType, UseRoi)
}
};
CUDA_TEST_P
(
SetTo
,
Zero
)
CUDA_TEST_P
(
GpuMat_
SetTo
,
Zero
)
{
cv
::
Scalar
zero
=
cv
::
Scalar
::
all
(
0
);
...
...
@@ -77,7 +80,7 @@ CUDA_TEST_P(SetTo, Zero)
EXPECT_MAT_NEAR
(
cv
::
Mat
::
zeros
(
size
,
type
),
mat
,
0.0
);
}
CUDA_TEST_P
(
SetTo
,
SameVal
)
CUDA_TEST_P
(
GpuMat_
SetTo
,
SameVal
)
{
cv
::
Scalar
val
=
cv
::
Scalar
::
all
(
randomDouble
(
0.0
,
255.0
));
...
...
@@ -102,7 +105,7 @@ CUDA_TEST_P(SetTo, SameVal)
}
}
CUDA_TEST_P
(
SetTo
,
DifferentVal
)
CUDA_TEST_P
(
GpuMat_
SetTo
,
DifferentVal
)
{
cv
::
Scalar
val
=
randomScalar
(
0.0
,
255.0
);
...
...
@@ -127,7 +130,7 @@ CUDA_TEST_P(SetTo, DifferentVal)
}
}
CUDA_TEST_P
(
SetTo
,
Masked
)
CUDA_TEST_P
(
GpuMat_
SetTo
,
Masked
)
{
cv
::
Scalar
val
=
randomScalar
(
0.0
,
255.0
);
cv
::
Mat
mat_gold
=
randomMat
(
size
,
type
);
...
...
@@ -156,7 +159,7 @@ CUDA_TEST_P(SetTo, Masked)
}
}
INSTANTIATE_TEST_CASE_P
(
CUDA
_GpuMat
,
SetTo
,
testing
::
Combine
(
INSTANTIATE_TEST_CASE_P
(
CUDA
,
GpuMat_
SetTo
,
testing
::
Combine
(
ALL_DEVICES
,
DIFFERENT_SIZES
,
ALL_TYPES
,
...
...
@@ -165,7 +168,7 @@ INSTANTIATE_TEST_CASE_P(CUDA_GpuMat, SetTo, testing::Combine(
////////////////////////////////////////////////////////////////////////////////
// CopyTo
PARAM_TEST_CASE
(
CopyTo
,
cv
::
cuda
::
DeviceInfo
,
cv
::
Size
,
MatType
,
UseRoi
)
PARAM_TEST_CASE
(
GpuMat_
CopyTo
,
cv
::
cuda
::
DeviceInfo
,
cv
::
Size
,
MatType
,
UseRoi
)
{
cv
::
cuda
::
DeviceInfo
devInfo
;
cv
::
Size
size
;
...
...
@@ -184,7 +187,7 @@ PARAM_TEST_CASE(CopyTo, cv::cuda::DeviceInfo, cv::Size, MatType, UseRoi)
}
};
CUDA_TEST_P
(
CopyTo
,
WithOutMask
)
CUDA_TEST_P
(
GpuMat_
CopyTo
,
WithOutMask
)
{
cv
::
Mat
src
=
randomMat
(
size
,
type
);
...
...
@@ -195,7 +198,7 @@ CUDA_TEST_P(CopyTo, WithOutMask)
EXPECT_MAT_NEAR
(
src
,
dst
,
0.0
);
}
CUDA_TEST_P
(
CopyTo
,
Masked
)
CUDA_TEST_P
(
GpuMat_
CopyTo
,
Masked
)
{
cv
::
Mat
src
=
randomMat
(
size
,
type
);
cv
::
Mat
mask
=
randomMat
(
size
,
CV_8UC1
,
0.0
,
2.0
);
...
...
@@ -226,7 +229,7 @@ CUDA_TEST_P(CopyTo, Masked)
}
}
INSTANTIATE_TEST_CASE_P
(
CUDA
_GpuMat
,
CopyTo
,
testing
::
Combine
(
INSTANTIATE_TEST_CASE_P
(
CUDA
,
GpuMat_
CopyTo
,
testing
::
Combine
(
ALL_DEVICES
,
DIFFERENT_SIZES
,
ALL_TYPES
,
...
...
@@ -235,7 +238,7 @@ INSTANTIATE_TEST_CASE_P(CUDA_GpuMat, CopyTo, testing::Combine(
////////////////////////////////////////////////////////////////////////////////
// ConvertTo
PARAM_TEST_CASE
(
ConvertTo
,
cv
::
cuda
::
DeviceInfo
,
cv
::
Size
,
MatDepth
,
MatDepth
,
UseRoi
)
PARAM_TEST_CASE
(
GpuMat_
ConvertTo
,
cv
::
cuda
::
DeviceInfo
,
cv
::
Size
,
MatDepth
,
MatDepth
,
UseRoi
)
{
cv
::
cuda
::
DeviceInfo
devInfo
;
cv
::
Size
size
;
...
...
@@ -255,7 +258,7 @@ PARAM_TEST_CASE(ConvertTo, cv::cuda::DeviceInfo, cv::Size, MatDepth, MatDepth, U
}
};
CUDA_TEST_P
(
ConvertTo
,
WithOutScaling
)
CUDA_TEST_P
(
GpuMat_
ConvertTo
,
WithOutScaling
)
{
cv
::
Mat
src
=
randomMat
(
size
,
depth1
);
...
...
@@ -285,7 +288,7 @@ CUDA_TEST_P(ConvertTo, WithOutScaling)
}
}
CUDA_TEST_P
(
ConvertTo
,
WithScaling
)
CUDA_TEST_P
(
GpuMat_
ConvertTo
,
WithScaling
)
{
cv
::
Mat
src
=
randomMat
(
size
,
depth1
);
double
a
=
randomDouble
(
0.0
,
1.0
);
...
...
@@ -317,7 +320,7 @@ CUDA_TEST_P(ConvertTo, WithScaling)
}
}
INSTANTIATE_TEST_CASE_P
(
CUDA
_GpuMat
,
ConvertTo
,
testing
::
Combine
(
INSTANTIATE_TEST_CASE_P
(
CUDA
,
GpuMat_
ConvertTo
,
testing
::
Combine
(
ALL_DEVICES
,
DIFFERENT_SIZES
,
ALL_DEPTH
,
...
...
@@ -356,6 +359,6 @@ CUDA_TEST_P(EnsureSizeIsEnough, BufferReuse)
EXPECT_EQ
(
reinterpret_cast
<
intptr_t
>
(
old
.
data
),
reinterpret_cast
<
intptr_t
>
(
buffer
.
data
));
}
INSTANTIATE_TEST_CASE_P
(
CUDA
_GpuMat
,
EnsureSizeIsEnough
,
ALL_DEVICES
);
INSTANTIATE_TEST_CASE_P
(
CUDA
,
EnsureSizeIsEnough
,
ALL_DEVICES
);
#endif // HAVE_CUDA
modules/c
uda/test
/test_opengl.cpp
→
modules/c
ore/test/cuda
/test_opengl.cpp
View file @
1be1a289
...
...
@@ -40,10 +40,14 @@
//
//M*/
#include "test_precomp.hpp"
#include "
../
test_precomp.hpp"
#if defined(HAVE_CUDA) && defined(HAVE_OPENGL)
#include "opencv2/core/cuda.hpp"
#include "opencv2/core/opengl.hpp"
#include "opencv2/ts/cuda_test.hpp"
using
namespace
cvtest
;
/////////////////////////////////////////////
...
...
modules/c
uda/test
/test_stream.cpp
→
modules/c
ore/test/cuda
/test_stream.cpp
View file @
1be1a289
...
...
@@ -40,13 +40,14 @@
//
//M*/
#include "test_precomp.hpp"
#include "
../
test_precomp.hpp"
#ifdef HAVE_CUDA
#include <cuda_runtime.h>
#if CUDART_VERSION >= 5000
#include "opencv2/core/cuda.hpp"
#include "opencv2/ts/cuda_test.hpp"
using
namespace
cvtest
;
...
...
@@ -130,6 +131,4 @@ CUDA_TEST_P(Async, Convert)
INSTANTIATE_TEST_CASE_P
(
CUDA_Stream
,
Async
,
ALL_DEVICES
);
#endif // CUDART_VERSION >= 5000
#endif // HAVE_CUDA
modules/cuda/perf/perf_buffer_pool.cpp
deleted
100644 → 0
View file @
53862687
/*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) 2000-2008, Intel Corporation, all rights reserved.
// Copyright (C) 2009, Willow Garage 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 materials 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 the Intel Corporation or 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*/
#include "perf_precomp.hpp"
#ifdef HAVE_CUDA
#include "opencv2/cudaarithm.hpp"
#include "opencv2/core/private.cuda.hpp"
using
namespace
testing
;
using
namespace
perf
;
using
namespace
cv
;
using
namespace
cv
::
cuda
;
namespace
{
void
func1
(
const
GpuMat
&
src
,
GpuMat
&
dst
,
Stream
&
stream
)
{
BufferPool
pool
(
stream
);
GpuMat
buf
=
pool
.
getBuffer
(
src
.
size
(),
CV_32FC
(
src
.
channels
()));
src
.
convertTo
(
buf
,
CV_32F
,
1.0
/
255.0
,
stream
);
cuda
::
exp
(
buf
,
dst
,
stream
);
}
void
func2
(
const
GpuMat
&
src1
,
const
GpuMat
&
src2
,
GpuMat
&
dst
,
Stream
&
stream
)
{
BufferPool
pool
(
stream
);
GpuMat
buf1
=
pool
.
getBuffer
(
src1
.
size
(),
CV_32FC
(
src1
.
channels
()));
func1
(
src1
,
buf1
,
stream
);
GpuMat
buf2
=
pool
.
getBuffer
(
src2
.
size
(),
CV_32FC
(
src2
.
channels
()));
func1
(
src2
,
buf2
,
stream
);
cuda
::
add
(
buf1
,
buf2
,
dst
,
noArray
(),
-
1
,
stream
);
}
}
PERF_TEST_P
(
Sz
,
BufferPool
,
CUDA_TYPICAL_MAT_SIZES
)
{
static
bool
first
=
true
;
const
Size
size
=
GetParam
();
const
bool
useBufferPool
=
PERF_RUN_CUDA
();
Mat
host_src
(
size
,
CV_8UC1
);
declare
.
in
(
host_src
,
WARMUP_RNG
);
GpuMat
src1
(
host_src
),
src2
(
host_src
);
GpuMat
dst
;
setBufferPoolUsage
(
useBufferPool
);
if
(
useBufferPool
&&
first
)
{
setBufferPoolConfig
(
-
1
,
25
*
1024
*
1024
,
2
);
first
=
false
;
}
TEST_CYCLE
()
{
func2
(
src1
,
src2
,
dst
,
Stream
::
Null
());
}
Mat
h_dst
(
dst
);
SANITY_CHECK
(
h_dst
);
}
#endif
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