This commit is contained in:
Anatoly Baksheev 2011-08-06 09:59:51 +00:00
parent 6fdbf15aed
commit 7e2fffb194

View File

@ -177,8 +177,16 @@ void cv::gpu::DeviceInfo::queryMemory(size_t&, size_t&) const { throw_nogpu(); }
int cv::gpu::getCudaEnabledDeviceCount()
{
int count;
cudaSafeCall( cudaGetDeviceCount( &count ) );
return count;
cudaError_t error = cudaGetDeviceCount( &count );
if (error == cudaErrorInsufficientDriver)
return -1;
if (error == cudaErrorNoDevice)
return 0;
cudaSafeCall(error);
return count;
}