Cuda

First of all, it is inevitable to have an external graphics card or one that is integrated into your computer, otherwise it will be impossible to run the program optimally and completely. Otherwise, only CPU execution can be used.CUDA, Qt and OpenCV in Ubuntu

Requirements

  1. GPU that supports CUDA
  2. Ubuntu 14.10 (https://www.virtualbox.org/wiki/Linux_Downloads) or https://www.ubuntu.com/download/alternative-downloads
  3. NVIDIA CUDA Toolkit (available at http://developer.nvidia.com/cuda-downloads)
CUDA, Qt and OpenCV in Ubuntu

Cuda, Qt and OpenCV in Ubuntu 14.04

 Ubuntu 14.10

Pre-checking

 

Before starting the process we have to make sure that the following command causes an error when running it in the terminal:

 nvcc --version 

and that

 locate cuda 

does not return any results. This means that CUDA is not installed. Otherwise, a result similar to the following can be seen on the screen (and therefore steps 2 to 4 are ignored):

nvcc: NVIDIA ® Cuda compiler driver

Copyright © 2005-2015 NVIDIA Corporation

Built on Mon_Feb_16_22:59:02_CST_2015

Cuda compilation tools, release 7.0, V7.0.27

CUDA Repository

Download the package for Ubuntu 14.04 from the CUDA download site from the CUDA repository (CUDA download site) and follow the steps below to install it via the command prompt:

$ sudo dpkg -i cuda-repo-ubuntu1404_7.5-18_amd64.deb
$ sudo apt-get update

Toolkit

The CUDA Toolkit must then be installed using apt-get.

$ sudo apt-get install cuda

Then the operating system has to be rebooted to verify that everything has worked as expected.

 

Environmental variables

As the penultimate step, the following instructions must be entered in the.bashrc file for the CUDA configuration to be performed permanently:

 

export CUDA_HOME=/usr/local/cuda-7.5

export LD_LIBRARY_PATH=${CUDA_HOME}/lib64

PATH=${CUDA_HOME}/bin:${PATH}

export PATH

 

CUDA SDK Samples

 

Finally, you must copy the code samples from the SDK to the main (home) folder. To do this, the following instructions must be executed on the console

 

$ cuda-install-samples-7.5.sh  ~

$ cd ~/NVIDIA_CUDA-7.5_Samples

$ cd 1_Utilities/deviceQuery

$ make

 

In order to verify that everything has gone smoothly, you can run the deviceQuery program within the CUDA examples.

Qt

 

First of all, as in the previous step, we have to make sure which version of Qt exists in the system (if any) by means of the following commands:

$ which qmake

$ qmake -v

The output of the first command informs you where the qmake executable is located. If the output is similar to bash: qmake: command not found, it is possible that:

  1. Qt is not installed (including development tools)
  2. It is installed but the system’s PATH variable does not cover it.

On the contrary, if qmake exists:

$ qmake -v

QMake version 2.01a

Using Qt version 4.8.6 in /usr/lib/x86_64-linux-gnu

 

you will see information about the installed version and then proceed to check if the other tools are on the computer:

$ which moc

/usr/bin/moc

$ which uic

/usr/bin/uic

$ which assistant

/usr/bin/assistant

$ which designer

/usr/bin/designer

 

If these executables are present Qt is ready to be used.

The following is the most immediate (and graphic) way to install Qt and its tools

 

To install Qt, follow the steps described on its website: http://qt-project.org/doc/qt-4.8/installation.html, depending on the platform on which the installation is performed.

 

However, the installation process is very simple. It consists of downloading the appropriate executable from the website: http://qt-project.org/downloads#qt-lib and following the steps indicated in the document. In fact, for this project we downloaded an executable for Ubuntu (.run) (http://download.qt.io/official_releases/online_installers/qt-unified-linux-x64-online.run) that provides a graphical environment that guides the installation step by step.

 

Eclipse

An Eclipse plugin is also required which provides three toolboxes to compile CUDA (NVIDIA) and/or Qt source code and also provides the H header generator from ui files generated by Qt resulting from the interface design.

The following steps must be followed:

  1. Run Eclipse.
  2. Go to Help to Install New Software and add the following URL: http://www.ai3.uni-bayreuth.de/software/eclipsecudaqt/updates/

OpenCV

Finally, it only remains to install OpenCV which is necessary to open the video sequences.

The installation steps are very simple as it can be installed via terminal or graphical application. Listed below are the only three commands needed to do this via console:

$ sudo apt-get install build-essential

$ sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev

$ $ sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev