added gpu::count_non_zero version for CC1.0, refactored gpu module a little

This commit is contained in:
Alexey Spizhevoy
2010-11-29 07:18:11 +00:00
parent 120a3b75fc
commit 72f020a8f3
5 changed files with 117 additions and 35 deletions

View File

@@ -55,6 +55,8 @@ 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; }
CV_EXPORTS void cv::gpu::getGpuMemInfo(size_t& /*free*/, size_t& /*total*/) { throw_nogpu(); }
CV_EXPORTS bool cv::gpu::hasNativeDoubleSupport(int /*device*/) { throw_nogpu(); return false; }
CV_EXPORTS bool cv::gpu::hasAtomicsSupport(int /*device*/) { throw_nogpu(); return false; }
#else /* !defined (HAVE_CUDA) */
@@ -106,5 +108,19 @@ CV_EXPORTS void cv::gpu::getGpuMemInfo(size_t& free, size_t& total)
cudaSafeCall( cudaMemGetInfo( &free, &total ) );
}
CV_EXPORTS bool cv::gpu::hasNativeDoubleSupport(int device)
{
int major, minor;
getComputeCapability(device, major, minor);
return major > 1 || (major == 1 && minor >= 3);
}
CV_EXPORTS bool cv::gpu::hasAtomicsSupport(int device)
{
int major, minor;
getComputeCapability(device, major, minor);
return major > 1 || (major == 1 && minor >= 1);
}
#endif