OpenCV is built with CUDA but gpu::getCudaEnableDeviceCount() returns 0
Building OpenCV, the cmake output is
General configuration for OpenCV 2.4.11 ===================================== Version control: unknown
Platform:
Host: Linux 3.13.0-79-generic x86_64
CMake: 2.8.7
CMake generator: Unix Makefiles
CMake build tool: /usr/bin/make
Configuration: RELEASE
C/C++:
Built as dynamic libs?: YES
C++ Compiler: /usr/bin/c++ (ver 4.6)
C++ flags (Release): -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffast-math -msse -msse2 -msse3 -ffunction-sections -O3 -DNDEBUG -DNDEBUG
C++ flags (Debug): -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffast-math -msse -msse2 -msse3 -ffunction-sections -g -O0 -DDEBUG -D_DEBUG
C Compiler: /usr/bin/gcc
C flags (Release): -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffast-math -msse -msse2 -msse3 -ffunction-sections -O3 -DNDEBUG -DNDEBUG
C flags (Debug): -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffast-math -msse -msse2 -msse3 -ffunction-sections -g -O0 -DDEBUG -D_DEBUG
Linker flags (Release):
Linker flags (Debug):
Precompiled headers: YES
OpenCV modules:
To be built: core flann imgproc highgui features2d calib3d ml video legacy objdetect photo gpu ocl nonfree contrib python stitching superres ts videostab
Disabled: world
Disabled by dependency: -
Unavailable: androidcamera dynamicuda java viz
GUI:
QT 4.x: YES (ver 4.8.1 EDITION = OpenSource)
QT OpenGL support: YES (/usr/lib/x86_64-linux-gnu/libQtOpenGL.so)
OpenGL support: YES (/usr/lib/libGLU.so /usr/lib/x86_64-linux-gnu/libGL.so /usr/lib/x86_64-linux-gnu/libSM.so /usr/lib/x86_64-linux-gnu/libICE.so /usr/lib/libX11.so /usr/lib/x86_64-linux-gnu/libXext.so)
VTK support: NO
Media I/O:
ZLib: /usr/lib/x86_64-linux-gnu/libz.so (ver 1.2.3.4)
JPEG: /usr/lib/x86_64-linux-gnu/libjpeg.so (ver )
PNG: /usr/lib/x86_64-linux-gnu/libpng.so (ver 1.2.46)
TIFF: /usr/lib/x86_64-linux-gnu/libtiff.so (ver 42 - 3.9.5)
JPEG 2000: /usr/lib/x86_64-linux-gnu/libjasper.so (ver 1.900.1)
OpenEXR: build (ver 1.7.1)
Video I/O:
DC1394 1.x: NO
DC1394 2.x: YES (ver 2.2.0)
FFMPEG: YES
codec: YES (ver 53.35.0)
format: YES (ver 53.21.1)
util: YES (ver 51.22.3)
swscale: YES (ver 2.1.0)
gentoo-style: YES
GStreamer: NO
OpenNI: NO
OpenNI PrimeSensor Modules: NO
PvAPI: NO
GigEVisionSDK: NO
UniCap: NO
UniCap ucil: NO
V4L/V4L2: NO/YES
XIMEA: NO
Xine: NO
Other third-party libraries:
Use IPP: NO
Use Eigen: NO
Use TBB: YES (ver 4.0 interface 6000)
Use OpenMP: NO
Use GCD NO
Use Concurrency NO
Use C=: NO
Use Cuda: YES (ver 5.5)
Use OpenCL: YES
NVIDIA CUDA
Use CUFFT: YES
Use CUBLAS: YES
USE NVCUVID: NO
NVIDIA GPU arch: 11 12 13 20 21 30 35
NVIDIA PTX archs: 30
Use fast math: YES
OpenCL:
Version: dynamic
Include path: /home/ubu1204/Documents/Software/opencv-2.4.11/3rdparty ...
Just checking, but you do have a CUDA capable device with appropriate drivers in your computer, right?
whats your GPU? "NVIDIA GPU arch" and "NVIDIA PTX archs" depends on your GPU.
I followed this tutorial (http://pastebin.com/fDpqvSi5) to add the NVIDIA drivers for 12.04, because the standard drivers intallation with the .run file downloaded from nvidia website fails. Btw, I have already enabled CUDA on OpenCV in the past on this pc, but I was on Ubuntu 14.04. Now I need to work on Ubuntu 12.04 and I met this problem, so yes, I have a CUDA capable device. My GPU is an NVIDIA GeForce GTX 850M
Second question. Did you install from the pre-built stuff online, or did you build from source?
The documentation for getCudaEnableDeviceCount() says "If OpenCV is compiled without GPU support, this function returns 0."
If you refer to opencv, I built the 2.4.11 version available on the website, I did not download it from git, if this is what you asked. This is the point: CMake output tells me that CUDA is detected, but when I run some program that should use gpu, the execution fails as it was not present
Can you run the CUDA demo programs that come with CUDA? There seems to be a problem somewhere between OpenCV and the card. Some sort of driver problem, maybe. If you can run the CUDA demo programs though, then it might be OpenCV. If they don't run, you know it's not OpenCV.