getCudaEnabledDeviceCount should return 0 instead of throwing an exception (Feature #1280)


Added by Yvonnic MM over 13 years ago. Updated over 13 years ago.


Status:Done Start date:
Priority:Normal Due date:
Assignee:Anatoly Baksheev % Done:

0%

Category:gpu (cuda)
Target version:-
Difficulty: Pull request:

Description

getCudaEnabledDeviceCount should return 0 instead of throwing an exception when no device are found, just like "#if !defined (HAVE_CUDA)".
And maybe getCudaEnabledDeviceCount should return -1 if drivers are too old.
cv::gpu::getCudaEnabledDeviceCount() in OpenCV\modules\gpu\src\initialization.cpp

int cv::gpu::getCudaEnabledDeviceCount()
{
    int count;
    cudaError_t error = cudaGetDeviceCount( &count );
    if (error == cudaErrorNoDevice)
    {
        count = 0;
    }
    else if (error == cudaErrorInsufficientDriver)
    {
        count = -1;
    }
    else //should never happen
    {
        cudaSafeCall(error);
    }
    return count;
}

Associated revisions

Revision 7e2fffb1
Added by Anatoly Baksheev over 13 years ago

ticket #1280

Revision e8f85903
Added by Roman Donchenko over 11 years ago

Merge pull request #1280 from asmorkalov:winrt_detect_fix

History

Updated by Anatoly Baksheev over 13 years ago

fixed in r6349

  • Status changed from Open to Done
  • (deleted custom field) set to fixed

Updated by Yvonnic MM over 13 years ago

thanks !
maybe it should be passed on OpenCV23 branche

Updated by Anatoly Baksheev over 13 years ago

done

Also available in: Atom PDF