-
-
Notifications
You must be signed in to change notification settings - Fork 56.5k
Delayed loading of CUDA third party DLLs #13509
Description
System information (version)
- OpenCV >= 4.0
- Operating System / Platform Windows 64 Bit
- Compiler >= VS 2015
Detailed description
I noticed the following problem whenever OpenCV is compiled with CUDA support enabled. To execute the CUDA functions, there is a couple of CUDA DLLs required. I would like to enable CUDA dynamically on the respective executing device, i.e. if CUDA is supported, use it and otherwise stick with (potentially slower) CPU implementations.
Any binary that uses this feature ideally should be able to use a delayed load for the CUDA DLLs such that it can be executed on non-CUDA devices without distributing the CUDA DLLs to them. Currently this is not possible. Whenever a binary links to one OpenCV CUDA module, all CUDA libraries must be shipped, too.
Fixing this issue would be possible by configuring the CUDA dependencies as delayed load. But since this has to be manually performed after CMake for each project every time, I would appreciate a CMake option to directly enable delayed loading of all CUDA DLLs in CMake (i.e. something like CUDA_EnableDelayedLoad true/false).
Thanks in advance!
Steps to reproduce
- Compile OpenCV with CUDA enabled and installed
- create a binary that optionally uses CUDA (i.e links to one of the OpenCV cuda modules)
- use that binary on a PC without CUDA support libraries, even if no CUDA function is called