Build Opencv on device with cuda compatibility 7.5 and use it on device with cuda compatibility 8.6

I have a general question. As mentioned above I have windows machine with cuda compatibitlity 7.5. So If I build + compile opencv_contrib from source can I use the same on another windows machine where cuda compatibility is 8.6?
Or in general can opencv be build without graphics card?

related:

https://stackoverflow.com/questions/73880223/build-opencv-with-cuda-compatibilityc-c-7-5-and-use-it-on-device-with-c-c-8-6

building never requires a graphics card. the build process happens entirely on the CPU.

OpenCV does not require CUDA at runtime. the CUDA modules live in the contrib repository. they are optional.

OpenCV can use OpenCL, which runs on any GPU. that is deeply built into OpenCV, enabled by default (can be disabled), but also not required at runtime.

I can’t say anything about CUDA compute capabilities. you’ll probably get a good answer on that shortly.

So this is also true for opencv_contrib(all built happens on CPU)?
If yes then that answers my question. Because while building it in CMAKE we have to specifiy cuda architecture 5.3 or 7.2 and so on

Sure you can just specify

CUDA_ARCH_BIN=7.5,8.6

and you will build binary code for both architechtures. If you think you may get a RTX 4000 series GPU in the very near future you could even specify

CUDA_ARCH_PTX=8.6

so the cuda code will be JIT compiled on that device as well.

You don’t have to specify and architecture, the default behaviour is to build binary code for all architechtures supported by the version of the CUDA SDK you have installed.

2 Likes