getCudaEnabledDeviceCount return 0

asked 2015-07-07 21:29:11 -0600

joonho1145 gravatar image

updated 2015-07-08 02:08:08 -0600

thdrksdfthmn gravatar image

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
}
edit retag flag offensive close merge delete

Comments

If you have seen that count has value 1, then you should check what's the value of cudaErrorInsufficientDriver and cudaErrorNoDevice. But it seems that cudaErrorNoDevice 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)?

thdrksdfthmn gravatar imagethdrksdfthmn ( 2015-07-08 02:16:57 -0600 )edit
1

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.

ubehagelig gravatar imageubehagelig ( 2015-07-08 02:49:56 -0600 )edit