前言
caffe安装时,对GPU环境的搭建和配置。
本文环境为:ubuntu16.04,cuda8.0,cudnn5,opencv3.1。
安装驱动
1
| $sudo service lightdm stop
|
1 2 3 4 5 6
| sudo add-apt-repository ppa:graphics-drivers/ppa sudo apt-get update sudo apt-get install nvidia-367 sudo apt-get install nvidia-settings sudo apt-get install nvidia-prime sudo reboot
|
1 2 3
| sudo add-apt-repository ppa:nilarimogard/webupd8 sudo apt-get update sudo apt-get install prime-indicator
|
cuda8.0安装
1 2
| sudo service lightdm stop sudo sh cuda_8.0.44_linux.run
|
1 2
| export PATH=/usr/local/cuda-8.0/bin:$PATH export LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib64:$LD_LIBRARY_PATH
|
添加如下内容
1
| export PATH=/usr/local/cuda/bin:$PATH
|
创建新文档
1
| sudo gedit /etc/ld.so.conf.d/cuda.conf
|
填写
使命令生效
1 2 3 4 5
| cd /usr/local/cuda-8.0/samples/1_Utilities/deviceQuery
sudo make
sudo ./deviceQuery
|
查看显卡信息
cudnn安装
1 2
| cd ~/cuda/include/ sudo cp cudnn.h /usr/local/cuda/include/
|
1 2
| cd ~/cuda/lib64/ sudo cp lib* /usr/local/cuda/lib64/
|
1
| cd /usr/local/cuda/lib64/
|
1 2 3
| sudo rm -rf libcudnn.so libcudnn.so.5 sudo ln -s libcudnn.so.5.0.5 libcudnn.so.5 sudo ln -s libcudnn.so.5 libcudnn.so
|
opencv-3.1安装
1
| sudo apt-get install --assume-yes libopencv-dev build-essential cmake git libgtk2.0-dev pkg-config python-dev python-numpy libdc1394-22 libdc1394-22-dev libjpeg-dev libpng12-dev libtiff5-dev libjasper-dev libavcodec-dev libavformat-dev libswscale-dev libxine2-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libv4l-dev libtbb-dev libqt4-dev libfaac-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev x264 v4l-utils unzip
|
1
| sudo apt-get install build-essential cmake git
|
1
| sudo apt-get install ffmpeg libopencv-dev libgtk-3-dev python-numpy python3-numpy libdc1394-22 libdc1394-22-dev libjpeg-dev libpng12-dev libtiff5-dev libjasper-dev libavcodec-dev libavformat-dev libswscale-dev libxine2-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libv4l-dev libtbb-dev qtbase5-dev libfaac-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev x264 v4l-utils unzip
|
1 2 3 4
| cd opencv-3.1.0/ mkdir build cd build/ cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D WITH_V4L=ON -D WITH_QT=ON -D WITH_OPENGL=ON -DCUDA_NVCC_FLAGS="-D_FORCE_INLINES" ..
|
ps:版本不支持高版本cuda
1 2
| cd /home/cherrie/opencv-3.1.0/modules/cudalegacy/src/ sudo gedit graphcuts.cpp
|
把
1
| #if !defined (HAVE_CUDA) || defined (CUDA_DISABLER)
|
修改为
1
| #if !defined (HAVE_CUDA) || defined (CUDA_DISABLER) || (CUDART_VERSION >= 8000)
|
1 2 3
| cd opencv-3.1.0/ cd build/ sudo make -j8
|
1 2 3
| sudo make install sudo /bin/bash -c 'echo "/usr/local/lib" > /etc/ld.so.conf.d/opencv.conf' sudo ldconfig
|
anaconda安装