compilation with no cuda re factored

This commit is contained in:
Anatoly Baksheev
2010-07-19 09:31:12 +00:00
parent 20e2dc84b0
commit 07825bad1e
15 changed files with 555 additions and 587 deletions

View File

@@ -45,15 +45,18 @@
using namespace cv;
using namespace cv::gpu;
#ifndef HAVE_CUDA
#if !defined (HAVE_CUDA)
CV_EXPORTS int cv::gpu::getCudaEnabledDeviceCount() { return 0; }
CV_EXPORTS string cv::gpu::getDeviceName(int /*device*/) { cudaSafeCall(0); return 0; }
CV_EXPORTS void cv::gpu::setDevice(int /*device*/) { cudaSafeCall(0); }
CV_EXPORTS void cv::gpu::getComputeCapability(int /*device*/, int* /*major*/, int* /*minor*/) { cudaSafeCall(0); }
CV_EXPORTS int cv::gpu::getNumberOfSMs(int /*device*/) { cudaSafeCall(0); 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 int cv::gpu::getDevice() { throw_nogpu(); return 0; }
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; }
#else
#else /* !defined (HAVE_CUDA) */
CV_EXPORTS int cv::gpu::getCudaEnabledDeviceCount()
{
@@ -73,6 +76,12 @@ CV_EXPORTS void cv::gpu::setDevice(int device)
{
cudaSafeCall( cudaSetDevice( device ) );
}
CV_EXPORTS int cv::gpu::getDevice()
{
int device;
cudaSafeCall( cudaGetDevice( &device ) );
return device;
}
CV_EXPORTS void cv::gpu::getComputeCapability(int device, int* major, int* minor)
{
@@ -90,4 +99,5 @@ CV_EXPORTS int cv::gpu::getNumberOfSMs(int device)
return prop.multiProcessorCount;
}
#endif
#endif