moved BufferPool management functions to public
This commit is contained in:
parent
5ea8085220
commit
3b412b51ac
@ -276,6 +276,10 @@ CV_EXPORTS void ensureSizeIsEnough(int rows, int cols, int type, OutputArray arr
|
|||||||
|
|
||||||
CV_EXPORTS GpuMat allocMatFromBuf(int rows, int cols, int type, GpuMat& mat);
|
CV_EXPORTS GpuMat allocMatFromBuf(int rows, int cols, int type, GpuMat& mat);
|
||||||
|
|
||||||
|
//! BufferPool management (must be called before Stream creation)
|
||||||
|
CV_EXPORTS void setBufferPoolUsage(bool on);
|
||||||
|
CV_EXPORTS void setBufferPoolConfig(int deviceId, size_t stackSize, int stackCount);
|
||||||
|
|
||||||
//////////////////////////////// CudaMem ////////////////////////////////
|
//////////////////////////////// CudaMem ////////////////////////////////
|
||||||
|
|
||||||
// CudaMem is limited cv::Mat with page locked memory allocation.
|
// CudaMem is limited cv::Mat with page locked memory allocation.
|
||||||
|
@ -122,9 +122,6 @@ namespace cv { namespace cuda
|
|||||||
GpuMat::Allocator* allocator_;
|
GpuMat::Allocator* allocator_;
|
||||||
};
|
};
|
||||||
|
|
||||||
CV_EXPORTS void setBufferAllocatorUsage(bool on);
|
|
||||||
CV_EXPORTS void allocateMemoryPool(int deviceId, size_t stackSize, int stackCount);
|
|
||||||
|
|
||||||
static inline void checkNppError(int code, const char* file, const int line, const char* func)
|
static inline void checkNppError(int code, const char* file, const int line, const char* func)
|
||||||
{
|
{
|
||||||
if (code < 0)
|
if (code < 0)
|
||||||
|
@ -378,12 +378,12 @@ void cv::cuda::StackAllocator::free(uchar* devPtr, int* refcount)
|
|||||||
fastFree(refcount);
|
fastFree(refcount);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cv::cuda::setBufferAllocatorUsage(bool on)
|
void cv::cuda::setBufferPoolUsage(bool on)
|
||||||
{
|
{
|
||||||
enableMemoryPool = on;
|
enableMemoryPool = on;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cv::cuda::allocateMemoryPool(int deviceId, size_t stackSize, int stackCount)
|
void cv::cuda::setBufferPoolConfig(int deviceId, size_t stackSize, int stackCount)
|
||||||
{
|
{
|
||||||
const int currentDevice = getDevice();
|
const int currentDevice = getDevice();
|
||||||
|
|
||||||
|
@ -95,10 +95,10 @@ PERF_TEST_P(Sz, BufferPool, CUDA_TYPICAL_MAT_SIZES)
|
|||||||
GpuMat src1(host_src), src2(host_src);
|
GpuMat src1(host_src), src2(host_src);
|
||||||
GpuMat dst;
|
GpuMat dst;
|
||||||
|
|
||||||
setBufferAllocatorUsage(useBufferPool);
|
setBufferPoolUsage(useBufferPool);
|
||||||
if (useBufferPool && first)
|
if (useBufferPool && first)
|
||||||
{
|
{
|
||||||
allocateMemoryPool(-1, 25 * 1024 * 1024, 2);
|
setBufferPoolConfig(-1, 25 * 1024 * 1024, 2);
|
||||||
first = false;
|
first = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user