Sunday, 4 December 2016

Installation of OpenCV 2.4.11 along with CUDA 8.0 (Ubuntu 14.04)

This is a short blog on how to install OpenCV 2.4.11 along with CUDA 8.0 . Although CUDA can be skipped but I will prefer everyone to install it along with CUDA. This helps in using GPUs along with OpenCV . You can follow CUDA installation from this post(till step 15) .

The script to install OpenCV is given here. You might get different errors while installing OpenCV along with CUDA. I will mention solution to some of the error I encountered. For people installing OpenCV without CUDA should not face any errors while installation .


1) While running the cmake command , I got "nvcc fatal : Unsupported gpu architecture 'compute_11' "
error. To deal with such error just add "-D CUDA_GENERATION=Kepler " before '..' and run the cmake once again. This should solve your problems regarding GPU architecture.

2) I have CUDA 8.0 version installed in my laptop. While running the cmake ,one might get "error: ‘NppiGraphcutState’ has not been declared " error. It took me some time to get the solution for this error. The Problem here is that  Opencv doesn't know about CUDA 8.0 and so one has to mention it explicitly . Moreover graphcuts is not directly supported by CUDA 8.0 anymore.

a) $ gedit /home/<user name>/opencv-2.4.11/modules/cudalegacy/src/graphcuts.cpp 
Now search for this specific line .
#if !defined (HAVE_CUDA) || defined (CUDA_DISABLER)

Replace the line with this line .
#if !defined (HAVE_CUDA) || defined (CUDA_DISABLER) || (CUDART_VERSION >= 8000) 

b) Rerun the cmake statement and you shouldn't be getting the same error .

I faced these errors and thus provided a solution to it. In case of any other errors please refer to this link

Other Links