1

I am runnung Visual Stadio2010, and have build the OpenCV2.4 with Cmake2.8, during the confugration have set :

WITH_CUDA flag on 
CUDA_SDK_ROOT_DIR :C:/ProgramData/NVIDIA Corporation/NVIDIA GPU Computing SDK 4.2
CUDA_TOOLKIT_ROOT_DIR: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v4.2

and then build the whole project in visual studio, successfully. I am using NVIDIA Quadro 5000, and have tested the examples in "OpenCV-2.4.0-GPU-demos-pack-win32", which all of the works without any error. also the core and highgui libraries function works fine too.but I cant run anything related to GPU functions in openCV. this code return me 0 which according to documentation means no device has been find:

int deviceCount =cv::gpu::getCudaEnabledDeviceCount();
  std::cout << "index " << deviceCount <<"\n";

which the same as device number number from the GPUdemopack examples, but any other gpu function shows me the following error:

OpenCV Error: No GPU support in unknown function file c:\slave\wininstallerMegaPack\src\opencv\modules\core\src\gpumat.cpp,line193

any body has any idea? please let me know. Thanks

karlphillip
  • 92,053
  • 36
  • 243
  • 426
user261002
  • 2,182
  • 10
  • 46
  • 73

3 Answers3

1

Run devicequery.exe from the Cuda SDK ( CUDA sdk 4.1\C\bin\win32\Release ) and check the compute capability value of your card.

Then in cmake for opencv, check the CUDA_ARCH_BIN includes this value.

Earlier cards only did 1.1 and don't have ARCH_PTX (the new CUDA binary format) - it's possible to make opencv build only for the new format - which doesn't need as much runtime compilation

Martin Beckett
  • 94,801
  • 28
  • 188
  • 263
  • I just run deviceQuery.exe from this path : C:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK 4.2\C\bin\win32\Release , the CUDA capability is 2.0 and add it to "CUDA_ARCH_BIN", im going to buid the openCV again. hope it will work this time – user261002 Apr 23 '12 at 16:02
1

OpenCV 2.4 is still in beta and is not ready to be used for serious projects. It has several build problems on Windows and Mac OS X as far as I could test.

I suggest you stick with the 2.3.1 which is the last stable release. Don't use the 2.4 unless there's a feature in there that you really really need.

EDIT:

By the way, OpenCV 2.3.1 only supports CUDA 4.0.

karlphillip
  • 92,053
  • 36
  • 243
  • 426
  • thanks for your reply. I was looking forwasd to get an answer from you. do you know if openCV2.3.1 is supporting cuda 4.2 ?? – user261002 Apr 23 '12 at 19:18
  • 1
    Nope, OpenCV 2.3.1 supports only CUDA 4.0. It's best to downgrade to this version if you can. Unfortunately, OpenCV 2.4 is not ready for the world. – karlphillip Apr 23 '12 at 19:31
  • Thank you so much. I will try and will get back to you soon – user261002 Apr 23 '12 at 19:33
  • Hi I have used Cmake again to build the OpenCV 2.3.1 and Cmake recognise the following values, which I didnt change it. CUDA_ARCH_BIN:2.0 2.1 (2.0), CUDA_Arch_PTX : 2.0, CUDA_SDK_ROOT_DIR:C:/ProgramData/NVIDIA Corporation/NVIDIA GPU Computing SDK 4.2/C and CUDA_TOOLKIT_ROOT_DIR:C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v4.0 , I have already checked the CUDA in Visual stutio and im sure cuda is working fine, also I managed to run the gpu_performance example, but couldnt run the rest of the examples and also still the same problem with my tests. – user261002 Apr 24 '12 at 09:30
  • Hi again, I have tested a new project and added all the libraries, now I am getting TBB_debug.dll is missing.I have check the package, tbb.dll exists but, Debug configuration tbb_debug.dll cannot be found. – user261002 Apr 24 '12 at 10:51
  • I just add the tbb_debug.dll as well, the program can recognise the graphic device again, I copied the same code in the Performance test prject from C:\opencv\build\samples\gpu , and it did work. I really dont know what is missing and really need to sort it out ASAP.please help – user261002 Apr 24 '12 at 11:04
  • I find it weird that CMake mentions `NVIDIA GPU Computing SDK 4.2`. The right thing to do is remove all the other CUDA versions and leave only 4.0 installed. Then review your environment variables to make sure they don't have garbage from previous installations of CUDA. – karlphillip Apr 24 '12 at 18:01
  • About tbb_Debug.dll missing, check [this post](http://stackoverflow.com/questions/7293160/c-tbb-debug-dll-missing) – karlphillip Apr 24 '12 at 18:03
  • thanks, i almost gave up and start using CUDA directly, but will try your suggestions today, thank you so much for your help – user261002 Apr 25 '12 at 08:14
  • Any luck? Keep in mind that if you install OpenCV 2.3.1 **32-bits**, you also need CUDA 4.0 **32-bits**. – karlphillip Apr 25 '12 at 19:22
  • 1
    Tanx for your help, I did create everythnig and now opencv2.4 is working and recognized the GPU. thank you :D – user261002 May 10 '12 at 13:21
1
  1. You are saying that you had build OpenCV yourself, but the file path from error message (c:\slave\wininstallerMegaPack\...) clearly indicates that you are using prebuilt OpenCV from sourceforge. If you have really build OpenCV yourself, then you have to troubleshoot your environment and find why wrong binaries are used. (The simplest thing you can do - remove any OpenCV binaries from your PC and make a clean full build of both OpenCV and your app.)

  2. OpenCV 2.4 betas have a packaging bug making gpu-enabled binaries useless. So you have to rebuild the library from source or use OpenCV 2.3.1 (CUDA 4.0 indeed).

  3. GPU demos pack is tricky - it has own copy of all binaries it might need. However it can not be used for development.

  4. Final OpenCV 2.4 release is awaited in few days. Windows package will include working CUDA binaries.

EDIT:

OpenCV 2.4.0 is out!

Andrey Kamaev
  • 29,582
  • 6
  • 94
  • 88