Ask Your Question
0

Which OpenCV and CUDA versions are compatible?

asked 2020-04-21 13:10:39 -0600

strwbrrymlk gravatar image

Hello, I want to make custom CUDA kernels that will use images read as Mat types using OpenCV. I have some questions about compatibility of CUDA, OpenCV and my device’s compute capability. I’ve read from many places but I have not had a clear answer. Device: Name: Tesla C2070 Compute capability: 2.0

CUDA version: 9.1

OpenCV version: 3.4

Now, while running a simple CUDA example I came across this error: terminate called after throwing an instance of 'cv::Exception' what(): OpenCV(3.4.10-dev) /opt/opencv/modules/cudev/include/opencv2/cudev/grid/detail/transform.hpp:334: error: (-217:Gpu API call) no kernel image is available for execution on the device in function 'call'

I read here it’s because CUDA 9 doesn’t support compute capability 2 (source: https://stackoverflow.com/questions/5... ).

To me, it seems I need to find an appropriate version of CUDA that is both compatible with OpenCV and my device’s compute capability I could find a list of versions of CUDA compatible with a certain compute capability here: https://en.wikipedia.org/wiki/CUDA. However, I see no list saying which CUDA and OpenCV versions are compatible. Is there any such thing? And is this my only option left?

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
0

answered 2020-04-22 11:55:41 -0600

OpenCV "should" be compatible with all CUDA versions, however due to the age (2011) of compute-capability 2.0 devices I am not surprised that there are some issues compiling certain versions of CUDA against more recent versions of OpenCV. For example I had to remove compute capability 2.0 (-DCUDA_ARCH_BIN=3.0,3.5,3.7,5.0,5.2,6.0,6.1) in order to compile OpenCV 4.3.0 against CUDA 8.0 even though CUDA 8.0 supports that device.

Given that you have a compute-capability 2.0 device you need to compile OpenCV with a version of CUDA which is compatible with that compute-capability, CUDA SDK 3.0-8.0. As you have discovered CUDA 9.0 won't work.

I can confirm that you should be able to compile OpenCV 3.4.0 with CUDA 8.0 and that should support your device. That said your GPU will be quite slow by modern standards with a quarter the floating point compute of a mid range modern but not current generation GTX 1060. Additionally your card has significantly memory bandwidth when you take into account your card has 8GB and the GTX 1060 has 3GB.

edit flag offensive delete link more

Comments

Thank you for your response! I now installed CUDA 7.5 to work with OpenCV 3.2.

strwbrrymlk gravatar imagestrwbrrymlk ( 2020-05-01 14:26:05 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2020-04-21 13:10:39 -0600

Seen: 12,271 times

Last updated: Apr 22 '20