getCudaEnabledDeviceCount return 0
I use cuda.
cudaError_t error = cudaGetDeviceCount(&count);
count
is 1
and getCudaEnabledDeviceCount()
returns 0 and I do not understand why...
Is it linked to HAVE_CUDA
?
I have build OpenCV with CMake WITH_CUDA checked.
//cuda_info.cpp
int cv::cuda::getCudaEnabledDeviceCount()
{
#ifndef HAVE_CUDA
return 0;
#else
int count;
cudaError_t error = cudaGetDeviceCount(&count);
if (error == cudaErrorInsufficientDriver)
return -1;
if (error == cudaErrorNoDevice)
return 0;
cudaSafeCall( error );
return count;
#endif
}
If you have seen that
count
has value 1, then you should check what's the value ofcudaErrorInsufficientDriver
andcudaErrorNoDevice
. But it seems thatcudaErrorNoDevice
is 1, because you have a return value of 0. So you hve no device... Have you put the right paths to the CUDA of your machine (like here)?Which GPU do you have? I remember having a lot of problems getting CUDA to work the last time I used it. Check out my old thread and solution. It may help you with setting up CUDA.