GPU module: minor interface changes
This commit is contained in:
@@ -61,6 +61,8 @@ namespace cv
|
|||||||
T* ptr;
|
T* ptr;
|
||||||
size_t step;
|
size_t step;
|
||||||
|
|
||||||
|
DevMem2D_() : cols(0), rows(0), ptr(0), step(0) {}
|
||||||
|
|
||||||
DevMem2D_(int rows_, int cols_, T *ptr_, size_t step_)
|
DevMem2D_(int rows_, int cols_, T *ptr_, size_t step_)
|
||||||
: cols(cols_), rows(rows_), ptr(ptr_), step(step_) {}
|
: cols(cols_), rows(rows_), ptr(ptr_), step(step_) {}
|
||||||
|
|
||||||
|
@@ -62,10 +62,10 @@ namespace cv
|
|||||||
CV_EXPORTS void setDevice(int device);
|
CV_EXPORTS void setDevice(int device);
|
||||||
CV_EXPORTS int getDevice();
|
CV_EXPORTS int getDevice();
|
||||||
|
|
||||||
CV_EXPORTS void getComputeCapability(int device, int* major, int* minor);
|
CV_EXPORTS void getComputeCapability(int device, int& major, int& minor);
|
||||||
CV_EXPORTS int getNumberOfSMs(int device);
|
CV_EXPORTS int getNumberOfSMs(int device);
|
||||||
|
|
||||||
CV_EXPORTS void getGpuMemInfo(size_t *free, size_t* total);
|
CV_EXPORTS void getGpuMemInfo(size_t& free, size_t& total);
|
||||||
|
|
||||||
//////////////////////////////// GpuMat ////////////////////////////////
|
//////////////////////////////// GpuMat ////////////////////////////////
|
||||||
class Stream;
|
class Stream;
|
||||||
|
@@ -52,9 +52,9 @@ CV_EXPORTS int cv::gpu::getCudaEnabledDeviceCount() { return 0; }
|
|||||||
CV_EXPORTS string cv::gpu::getDeviceName(int /*device*/) { throw_nogpu(); return 0; }
|
CV_EXPORTS string cv::gpu::getDeviceName(int /*device*/) { throw_nogpu(); return 0; }
|
||||||
CV_EXPORTS void cv::gpu::setDevice(int /*device*/) { throw_nogpu(); }
|
CV_EXPORTS void cv::gpu::setDevice(int /*device*/) { throw_nogpu(); }
|
||||||
CV_EXPORTS int cv::gpu::getDevice() { throw_nogpu(); return 0; }
|
CV_EXPORTS int cv::gpu::getDevice() { throw_nogpu(); return 0; }
|
||||||
CV_EXPORTS void cv::gpu::getComputeCapability(int /*device*/, int* /*major*/, int* /*minor*/) { throw_nogpu(); }
|
CV_EXPORTS void cv::gpu::getComputeCapability(int /*device*/, int& /*major*/, int& /*minor*/) { throw_nogpu(); }
|
||||||
CV_EXPORTS int cv::gpu::getNumberOfSMs(int /*device*/) { throw_nogpu(); return 0; }
|
CV_EXPORTS int cv::gpu::getNumberOfSMs(int /*device*/) { throw_nogpu(); return 0; }
|
||||||
CV_EXPORTS void cv::gpu::getGpuMemInfo(size_t* /*free*/, size_t* /*total*/) { throw_nogpu(); }
|
CV_EXPORTS void cv::gpu::getGpuMemInfo(size_t& /*free*/, size_t& /*total*/) { throw_nogpu(); }
|
||||||
|
|
||||||
|
|
||||||
#else /* !defined (HAVE_CUDA) */
|
#else /* !defined (HAVE_CUDA) */
|
||||||
@@ -84,13 +84,13 @@ CV_EXPORTS int cv::gpu::getDevice()
|
|||||||
return device;
|
return device;
|
||||||
}
|
}
|
||||||
|
|
||||||
CV_EXPORTS void cv::gpu::getComputeCapability(int device, int* major, int* minor)
|
CV_EXPORTS void cv::gpu::getComputeCapability(int device, int& major, int& minor)
|
||||||
{
|
{
|
||||||
cudaDeviceProp prop;
|
cudaDeviceProp prop;
|
||||||
cudaSafeCall( cudaGetDeviceProperties( &prop, device) );
|
cudaSafeCall( cudaGetDeviceProperties( &prop, device) );
|
||||||
|
|
||||||
*major = prop.major;
|
major = prop.major;
|
||||||
*minor = prop.minor;
|
minor = prop.minor;
|
||||||
}
|
}
|
||||||
|
|
||||||
CV_EXPORTS int cv::gpu::getNumberOfSMs(int device)
|
CV_EXPORTS int cv::gpu::getNumberOfSMs(int device)
|
||||||
@@ -101,9 +101,9 @@ CV_EXPORTS int cv::gpu::getNumberOfSMs(int device)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
CV_EXPORTS void cv::gpu::getGpuMemInfo(size_t *free, size_t* total)
|
CV_EXPORTS void cv::gpu::getGpuMemInfo(size_t& free, size_t& total)
|
||||||
{
|
{
|
||||||
cudaSafeCall( cudaMemGetInfo( free, total ) );
|
cudaSafeCall( cudaMemGetInfo( &free, &total ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -89,7 +89,7 @@ bool cv::gpu::StereoBM_GPU::checkIfGpuCallReasonable()
|
|||||||
int device = getDevice();
|
int device = getDevice();
|
||||||
|
|
||||||
int minor, major;
|
int minor, major;
|
||||||
getComputeCapability(device, &major, &minor);
|
getComputeCapability(device, major, minor);
|
||||||
int numSM = getNumberOfSMs(device);
|
int numSM = getNumberOfSMs(device);
|
||||||
|
|
||||||
if (major > 1 || numSM > 16)
|
if (major > 1 || numSM > 16)
|
||||||
|
@@ -39,8 +39,8 @@
|
|||||||
//
|
//
|
||||||
//M*/
|
//M*/
|
||||||
|
|
||||||
#ifndef _CXCORE_TEST_H_
|
#ifndef _GPU_TEST_H_
|
||||||
#define _CXCORE_TEST_H_
|
#define _GPU_TEST_H_
|
||||||
|
|
||||||
#if defined WIN32 || defined _WIN32
|
#if defined WIN32 || defined _WIN32
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
@@ -62,10 +62,8 @@
|
|||||||
#pragma warning(disable : 4996) /* deprecated function */
|
#pragma warning(disable : 4996) /* deprecated function */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* _CXCORE_TEST_H_ */
|
|
||||||
|
|
||||||
|
static inline bool check_and_treat_gpu_exception(const cv::Exception& e, CvTS* ts)
|
||||||
inline bool check_and_treat_gpu_exception(const cv::Exception& e, CvTS* ts)
|
|
||||||
{
|
{
|
||||||
switch (e.code)
|
switch (e.code)
|
||||||
{
|
{
|
||||||
@@ -88,4 +86,6 @@ inline bool check_and_treat_gpu_exception(const cv::Exception& e, CvTS* ts)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
/* End of file. */
|
/* End of file. */
|
||||||
|
@@ -132,7 +132,7 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
virtual int test(const Mat& img)
|
virtual int test(const Mat& img)
|
||||||
{
|
{
|
||||||
Mat kernel(3, 3, CV_8U, 1);
|
Mat kernel(3, 3, CV_8U, Scalar(1));
|
||||||
Point anchor(1,1);
|
Point anchor(1,1);
|
||||||
int iters = 3;
|
int iters = 3;
|
||||||
|
|
||||||
@@ -158,7 +158,7 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
virtual int test(const Mat& img)
|
virtual int test(const Mat& img)
|
||||||
{
|
{
|
||||||
Mat kernel(3, 3, CV_8U, 1);
|
Mat kernel(3, 3, CV_8U, Scalar(1));
|
||||||
Point anchor(1,1);
|
Point anchor(1,1);
|
||||||
int iters = 3;
|
int iters = 3;
|
||||||
|
|
||||||
@@ -189,7 +189,7 @@ protected:
|
|||||||
const char *names[] = { "MORPH_OPEN", "CV_MOP_CLOSE", "CV_MOP_GRADIENT", "CV_MOP_TOPHAT", "CV_MOP_BLACKHAT"};
|
const char *names[] = { "MORPH_OPEN", "CV_MOP_CLOSE", "CV_MOP_GRADIENT", "CV_MOP_TOPHAT", "CV_MOP_BLACKHAT"};
|
||||||
int num = sizeof(ops)/sizeof(ops[0]);
|
int num = sizeof(ops)/sizeof(ops[0]);
|
||||||
|
|
||||||
Mat kernel(3, 3, CV_8U, 1);
|
Mat kernel(3, 3, CV_8U, Scalar(1));
|
||||||
Point anchor(1,1);
|
Point anchor(1,1);
|
||||||
int iters = 3;
|
int iters = 3;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user