Ask Your Question
1

OpenCV for Windows (2.4.1): Cuda-enabled app won't load on non-nVidia systems

asked 2012-07-06 17:34:27 -0500

JAT gravatar image

For simplicity of build and installation of our OpenCV-based appliction, we would like a single build of code to run on any Windows PC and take advantage of CUDA when it is available. So the code falls back on slower OpenCV calls when the PC doesn't have nVidia hardware. However, if you set WITHCUDA, the opencvcore241.dll tries to load "nvcuda.dll" which is distributed with the driver and hence not available. That prevents our app from successfully loading and running, even though we would not have executed any CUDA code on that non-nVidia machine.

Is the only solution to have two builds of our app, one using CUDA-enabled OpenCV DLLs, and one without?

edit retag flag offensive close merge delete

Comments

I am having a similar problem, it tries to open file 'opencv_cudaobjdetect310.lib', which does not exist in my non-NVIDIA machine. However, I don't know how to disable this call.

mhaghighat gravatar imagemhaghighat ( 2016-09-28 17:53:18 -0500 )edit

1 answer

Sort by » oldest newest most voted
1

answered 2012-07-24 10:00:08 -0500

Gábor Bernát gravatar image

Well, there is another option although not so easy to do it.

Now you are linking the libraries at the build time, therefore they must be present at runtime. The alternative is to link and load the libraries at runtime. The disadvantage of this is that you'll no longer know that what function is where inside the library. Therefore you will need to perform an additional step to check it. Furthermore, the runtime library loading is different per platform. Nevertheless, the Poco C++ libraries do a nice job in abstracting this away. Read this tutorial and you'll get the idea.

The basic idea is to build both the CUDA and non-CUDA versions. At runtime just check what you need and load that (still, you'll probably need to pack both DLLs).

edit flag offensive delete link more

Comments

I'm having the same problem (except for me it's OpenCV 2.4.4 which I built with the 5.0 toolkit, so I'm having problems with cudart_32_50_35.dll not being present on other computers that I want to install my app onto).

What's the point of cv::gpu::getCudaEnabledDeviceCount(), if not to enable you to write code which will work on both CUDA and non-CUDA machines?

Are there linker commands or visual studio switches that will statically link opencv_gpu.dll with the necessary cuda.dll (I understand "statically link" as "roll into")? Do I need to include the cuda runtime dll with my install (checking dependencies with dumpbin, I think I might also need to include cudafft.dll etc)

RubeRad gravatar imageRubeRad ( 2013-05-30 18:28:00 -0500 )edit

...ran out of characters to ask questions...

Note some of my asterisks in the previous comment were interpreted as markup for italics. Let me know if you are confused.

Another question; if I do need to go the dual-build route, will I be able to just deal with two different versions of opencv_gpu.dll? Or is it two different versions of everything? I do recall when building OpenCV, before kicking off the whole build I did a test of just opencv_core.vcproj, and that did involve some gpu matrix stuff, so I'm thinking maybe the answer is no.

Would the files cudart32_50_35.dll, cublas32_50_35.dll, cufft32_50_35.dll, etc, be considered "drivers" that I could reasonably expect my end users to download and install before installing my stuff? (Even if they don't have NVIDIA cards?)

RubeRad gravatar imageRubeRad ( 2013-05-30 18:35:57 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2012-07-06 17:34:27 -0500

Seen: 1,082 times

Last updated: Jul 24 '12