Ask Your Question
0

OpenCV is built with CUDA but gpu::getCudaEnableDeviceCount() returns 0

asked 2016-02-26 12:04:00 -0600

Marcofe gravatar image

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 ...
(more)
edit retag flag offensive close merge delete

Comments

Just checking, but you do have a CUDA capable device with appropriate drivers in your computer, right?

Tetragramm gravatar imageTetragramm ( 2016-02-26 14:16:25 -0600 )edit
1

whats your GPU? "NVIDIA GPU arch" and "NVIDIA PTX archs" depends on your GPU.

amir_pro gravatar imageamir_pro ( 2016-02-27 05:24:11 -0600 )edit

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

Marcofe gravatar imageMarcofe ( 2016-02-28 05:07:07 -0600 )edit

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."

Tetragramm gravatar imageTetragramm ( 2016-02-28 08:01:10 -0600 )edit

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

Marcofe gravatar imageMarcofe ( 2016-02-29 07:50:22 -0600 )edit

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.

Tetragramm gravatar imageTetragramm ( 2016-02-29 18:08:31 -0600 )edit

2 answers

Sort by ยป oldest newest most voted
0

answered 2016-02-29 05:14:29 -0600

MarKS9 gravatar image

You need to install CUDA toolkit SDK and then try running a CUDA sample like deviceQuery if it runs fine then your CUDA is configured correctly.

edit flag offensive delete link more

Comments

Yeah, I tried, it's not. Running deviceQuery this is the output message:

./deviceQuery Starting...

CUDA Device Query (Runtime API) version (CUDART static linking)

cudaGetDeviceCount returned 38 -> no CUDA-capable device is detected Result = FAIL

Marcofe gravatar imageMarcofe ( 2016-02-29 07:32:37 -0600 )edit
0

answered 2016-02-27 03:29:15 -0600

zshn25 gravatar image

I guess updating your graphics card drivers might help.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2016-02-26 12:04:00 -0600

Seen: 1,562 times

Last updated: Feb 29 '16