OpenCV 4.3.0 can not detect CUDA 10.2

asked 2020-06-19 07:31:35 -0600

YuriiChernyshov gravatar image

updated 2020-06-19 07:56:26 -0600

To start with, it might be not OpenCV related, but I found OpnCV is the one that does not detect CUDA installation.

Environment:

  • Linux 4.15.0-106-generic #107-Ubuntu SMP Thu Jun 4 11:27:52 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
  • OpenCV 4.3.0
  • CUDA 10.2
  • cuDNN 7.6.5
  • GPU Quadro P2000 NVIDIA-SMI 440.33.01 Driver Version: 440.33.01

OpenCV make command:

cmake -D CMAKE_BUILD_TYPE=RELEASE \ -D CMAKE_INSTALL_PREFIX=/usr/local \ -D INSTALL_PYTHON_EXAMPLES=OFF \ -D INSTALL_C_EXAMPLES=ON \ -D OPENCV_ENABLE_NONFREE=ON \ -D BUILD_opencv_python2=ON \ -D BUILD_opencv_python3=ON \ -D OPENCV_EXTRA_MODULES_PATH=/home/tstone10/dev/opencv_contrib/modules \ -D WITH_CUDNN=ON \ -D OPENCV_DNN_CUDA=ON \ -D ENABLE_FAST_MATH=ON \ -D CUDA_FAST_MATH=ON \ -D CUDA_ARCH_BIN=6.1 \ -D CUDA_ARCH_PTX="" \ -D CUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-10.2 \ -D WITH_CUBLAS=ON \ -D BUILD_opencv_world=ON \ -D CUDA_GENERATION="" \ -D BUILD_EXAMPLES=OFF ..

When make, it states cuDNN NO and there is no CUDA in a list of libraries.

My cuDNN installed at:

/usr/local/cuda/lib64$ ls -la libcudnn*
lrwxrwxrwx 1 root root        13 Jun 19 06:50 libcudnn.so -> libcudnn.so.7
lrwxrwxrwx 1 root root        17 Jun 19 06:50 libcudnn.so.7 -> libcudnn.so.7.6.5
-rwxr-xr-x 1 root root 459633080 Jun 19 06:49 libcudnn.so.7.6.5
-rw-r--r-- 1 root root 432446664 Jun 19 06:50 libcudnn_static.a

I don't know how to attach log files from make command or from CUDA test binaries execution results.

Any help much appreciated.

P.S.

Just did test on YOLO v4 and it detects CUDA fine:

./darknet detector test ./cfg/coco.data ./cfg/yolov4.cfg ./yolov4.weights
 DEBUG=1 
 CUDA-version: 10020 (10020), cuDNN: 7.6.5, CUDNN_HALF=1, GPU count: 2  
 CUDNN_HALF=1 
 OpenCV version: 4.3.0d
 0 : compute_capability = 610, cudnn_half = 0, GPU: Quadro P2000
edit retag flag offensive close merge delete

Comments

Can you check if -D CUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-10.2 is really the root dir of your cuda installation.

Actually cuda should be detected automatically when using -D WITH_CUDA=ON This is missing in your command.
BTW Yolo can really be a b*tch.

holger gravatar imageholger ( 2020-06-19 22:33:56 -0600 )edit
1

Oh ... so silly :-( Missed -D WITH_CUDA=ON, one small mistake and set up screwed.

Thanks a lot!

YuriiChernyshov gravatar imageYuriiChernyshov ( 2020-06-22 12:46:35 -0600 )edit

this can happen when u have 50+ compiler options ^^. Youre Welcome

holger gravatar imageholger ( 2020-06-22 17:44:21 -0600 )edit