this part records the process of installing opencv and caffe on ubuntu 16.04 with gtx1080 gpu.
- Installing ubuntu16.04
since we didn’t succeed in installing ubuntu14.04 on this server, so we installed the ubuntu16.04. - Installing the nvidia driver
- check what driver should we install
sudo ubuntu-drivers devices
- add the repository
sudo add-apt-repository ppa:graphics-drivers
- install driver (change the driver num according to your own server)
sudo apt-get update
sudo apt-get install nvidia-367 mesa-common-dev freeglut3-dev - reboot to effect the driver
- test the driver by
nvidia-smi
- check what driver should we install
Installing cuda8.0
- download the cuda8.0 from the NVIDIA official website, recommend the run file instead of deb
- install the cuda, e.g.
sh cuda_8.0.27_linux.run
, notice that:
- DON’T INSTALL THE DRIVER IN THE RUN FILE, it will overide the driver we installed just now.
- DON’T INSTALL THE OPENGL LIB, you cannot log in even with the correct password.
add the cuda/bin and lib to the PATH AND PROFILE
sudo vim /etc/profile
export PATH=/usr/local/cuda/bin:$PATHsudo vim /etc/ld.so.conf.d/cuda.conf
/usr/local/cuda/lib64test the example in
~/NVIDIA *
. note that the gcc/g++ version in ubuntu 16.04 is >=5.3, maybe cause some errors, so we modified the/usr/local/cuda/include/host_config.h
to support 5.3 version gcc/g++.sudo vim /usr/local/cuda/include/host_config.h
find theif _GNUC_ > 5
, change the 5 to 6
cd ~/Nvidia(tab)
make -j16
cd bin/…/
./deviceQuery
if you get the pass result, install corectly.
Installing Opencv3.0
there are two things we need to pay attention to in installing opencv3.0:- build opencv without rebuilding the tiff lib
- modified src file to support cuda8.0
Installing steps are summarized below:
- download the installing shell script from private cloud disk(code: wysa)
- install dependencies
sudo sh dependencies.sh
- run the opencv3_0_0.sh to get src file
sudo sh opencv3_0_0.sh
, note that maybe we will stop at the downloading ippcv, we can pre-download this file from here and put it in OpenCV-master/3rdparty/ippicv/downloads/Linux-xxxx/ - since in ubuntu16.04, the libtiff version is 5, not 4. so we need to modified the opencv3_0_0.sh to ignore the installation of libtiff4-dev as follows. simply delete the libtiff4-dev and add -D WITH_TIFF=ON in cmake command
original opencv3_0_0.sh
arch=$(uname -m) if [ "$arch" == "i686" -o "$arch" == "i386" -o "$arch" == "i486" -o "$arch" == "i586" ]; then flag=1 else flag=0 fi echo "Installing OpenCV 3.0.0" mkdir OpenCV cd OpenCV echo "Removing any pre-installed ffmpeg and x264" sudo