0

I'm trying to compile OpenCV 2.4.13 from source with CUDA 9.0, CUDNN 7.0,as suggested by the repo called "MonocularTotalCapture" that you can find here :

https://github.com/CMU-Perceptual-Computing-Lab/MonocularTotalCapture

I've installed Ubuntu 16.04 on a GTX 1060 GPU machine. I installed cuda 9 and CUDNN 7. Now I'm trying to install OpenCV 2.4.13,but I'm getting CMake Error:

CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
CUDA_nppi_LIBRARY (ADVANCED)

And then a very long list of targets like so:

 linked by target "opencv_core" in directory /home/ziom/Scrivania/MonocularTotalCapture/opencv-2.4.13.6/modules/core

I know that a question like mine has been already solved here :

CMake Error: Variables are set to NOTFOUND

and I tried to follow the suggestions given there,but I haven't been able to fix my isse,maybe because I have a little different scenario. Anyway,I followed the suggestion of @A. B. M. Nazibullah :

Replacing FindCUDA.cmake and OpenCVDetectCUDA.cmake from https://github.com/opencv/opencv/tree/master/cmake (master branch- opencv 3.4.1) works for me for opencv_2.4.13 with NVIDIA TitanXP graphics card of Pascal Architecture and with cuda-9.0 on Ubuntu 16.04.

Infact,the first file to modify,called "FindCUDA.cmake" has been modified correctly,according with the suggestion of @api55. Infact this piece of code has been added at the place of the old one :

if(CUDA_VERSION VERSION_GREATER "5.0")
  # In CUDA 5.5 NPP was splitted onto 3 separate libraries.
  find_cuda_helper_libs(nppc)
  #find_cuda_helper_libs(nppi)
  find_cuda_helper_libs(nppial)
  find_cuda_helper_libs(nppicc)
  find_cuda_helper_libs(nppicom)
  find_cuda_helper_libs(nppidei)
  find_cuda_helper_libs(nppif)
  find_cuda_helper_libs(nppig)
  find_cuda_helper_libs(nppim)
  find_cuda_helper_libs(nppist)
  find_cuda_helper_libs(nppisu)
  find_cuda_helper_libs(nppitc)
  find_cuda_helper_libs(npps)
  #set(CUDA_npp_LIBRARY "${CUDA_nppc_LIBRARY};${CUDA_nppi_LIBRARY};${CUDA_npps_LIBRARY}")
  set(CUDA_npp_LIBRARY "${CUDA_nppc_LIBRARY};${CUDA_nppial_LIBRARY};${CUDA_nppicc_LIBRARY};${CUDA_nppicom_LIBRARY};${CUDA_nppidei_LIBRARY};${CUDA_nppif_LIBRARY};${CUDA_nppig$
elseif(NOT CUDA_VERSION VERSION_LESS "4.0")
  find_cuda_helper_libs(npp)
endif()
if(NOT CUDA_VERSION VERSION_LESS "7.0")
  # cusolver showed up in version 7.0
  find_cuda_helper_libs(cusolver)
endif()

and also this piece of code replaced the old one :

set(CUDA_npp_LIBRARY "${CUDA_nppc_LIBRARY};${CUDA_nppial_LIBRARY};${CUDA_nppicc_LIBRARY};${CUDA_nppicom_LIBRARY};${CUDA_nppidei_LIBRARY};${CUDA_nppif_LIBRARY};${CUDA_nppig_LIBRARY};${CUDA_nppim_LIBRARY};${CUDA_nppist_LIBRARY};${CUDA_nppisu_LIBRARY};${CUDA_nppitc_LIBRARY};${CUDA_npps_LIBRARY}")

also this code replaced the old one :

unset(CUDA_nppial_LIBRARY CACHE)
  unset(CUDA_nppicc_LIBRARY CACHE)
  unset(CUDA_nppicom_LIBRARY CACHE)
  unset(CUDA_nppidei_LIBRARY CACHE)
  unset(CUDA_nppif_LIBRARY CACHE)
  unset(CUDA_nppig_LIBRARY CACHE)
  unset(CUDA_nppim_LIBRARY CACHE)
  unset(CUDA_nppist_LIBRARY CACHE)
  unset(CUDA_nppisu_LIBRARY CACHE)
  unset(CUDA_nppitc_LIBRARY CACHE)
  unset(CUDA_npps_LIBRARY CACHE)
  unset(CUDA_nvcuvenc_LIBRARY CACHE)
  unset(CUDA_nvcuvid_LIBRARY CACHE)

Regarding the other file,called "OpenCVDetectCUDA.cmake",I have also modified it exactly like explained there.

In the end,I have also added this line :

#include <cuda_fp16.h>

to this header file

/home/ziom/Scrivania/MonocularTotalCapture/opencv-2.4.13.6/modules/gpu/include/opencv2/gpu/device/common.hpp

but the error persists.

talonmies
  • 70,661
  • 34
  • 192
  • 269
john_connor
  • 165
  • 2
  • 2
  • 15
  • that version of openCV probably won't support CUDA 9 without modification https://medium.com/@mengjiunchiou/build-opencv-caffe-with-cuda-9-0-on-ubuntu-16-04-b2794a41612d – talonmies Mar 08 '20 at 11:28
  • which kind of modifications are u talking about ? maybe you mean "that version of openCV probably won't support CUDA 9 with modification" ? because I applied the modifications,but I don't know if they are the same that you are talking about. Anyway,Im not sure if I can use a newer version of openCV,since if the author suggests to use that version,there should be a reason. what u suggest to me to do ? – Marietto Mar 08 '20 at 14:33

0 Answers0