Setting up caffe on Ubuntu

Setting up caffe on ubuntu1404 LTS +CUDA7.5 and ubuntu1604 LTS +CUDA8.0

@(sinbad)[360sinbad@gmail.com]

Prepare nVidia driver and CUDA Toolkit

  • Download cuda toolkit 7.5( support ubuntu 1404) or 8.0(support ubuntu 1604) on nvidia web. Now the download page is shown the latest version of cuda toolkit, you should find CUDA Toolkit Archive folder or else you only see current latest version, and choose the compatable version with your system link like as below:
    https://developer.nvidia.com/cuda-75-downloads-archive

    Now the latest version of CUDA is CUDA 9.0, there are some errors after installing CUDA 9.0 with ubuntu1604 LTS. So i suggest CUDA 8.0 for your choose.Download resource please search Baidu cloud.

  • Download GPU Graphics driver on web: http://www.geforce.cn/drivers/results/105888#, choose version depend on your graphics card.

Install CUDA driver and config system env

Step 1. nVidia Graphics Driver and CUDA Toolkit
Forbid nouveau.
sudo gedit /etc/modprobe.d/disable-nouveau.conf
Appending two lines as below.
blacklist nouveau
options nouveau modeset=0
then save and exit: (:wq)
Note: excute lspci | grep nouveau check if nouveau was forbid. If there is nothing to show, you can ignore step above.
Enter TTY Ctrl + Alt +F1 and close GUI
sudo stop lightdm
sudo chmod -x NVIDIA_XXX.run
sudo ./NVIDIA_XXX.run

CUDA Toolkit install
Installation Instructions:
1. sudo dpkg -i cuda-repo-ubuntu1404-7-5-local_7.5-18_amd64.deb
2. sudo apt-get update
3. sudo apt-get install cuda

**Step 2.Set up system env for CUDA **
sudo gedit /etc/profile
Appending two lines as below.
export PATH=/usr/local/cuda/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PAT

After saving, create a linkfile through
sudo gedit /etc/ld.so.conf.d/cuda.conf
Add cuda path in the end.
/usr/local/cuda/lib64
Save and reboot the computer.

Download Caffe

After such preparation, now let us start installing caffe.
Download Caffe from ithub.
git clone https://github.com/BVLC/caffe.git
Install several dependencies for caffe
sudo apt-get install build-essential
sudo apt-get install cmake
sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libboost-all-dev libhdf5-serial-dev libgflags-dev libgoogle-glog-dev liblmdb-dev protobuf-compiler

Install Python

The main requirements are bumpy and boost.python (provided by boost).
You can install the dependencies with
cd caffe/python/
for req in $(cat requirements.txt); do pip install $req; done
it may meet permission problem.so, try the other command:
cd ~/caffe
sudo pip install -r ./python/requirements.txt
Maybe you install pip first.
sudo apt-get install python-pip
Note: You can use #sudo apt-get install python-numpy python-skimage python-matplotlib if above step failed.

To import the caffe Python module after completing the installation, add the module directory to your $PYTHONPATH by
export PYTHONPATH=/path/to/caffe/python:$PYTHONPATH

Install Matlab 2015b

  • Download Matlab 2015b for Linux
    Link: http://pan.baidu.com/s/1i5BO0eh password: hraf
  • Mount ISO file
    sudo mkdir /MATLAB
    sudo mount -o loop R2015b_glnxa64.so /MATLAB
  • Excute instal without connect Internet. Note: Choose install standalone
    cd /MATLAB
    sudo ./inatall
  • Copy /crack/bin to usr/local/MATLAB/R2015b/bin after installing matlab
    sudo cp /[Your crack directory]/R2015b/bin/glnxa64/* /usr/local/MATLAB/R2015b/bin/glnxa64
  • Run matlab
    cd /usr/local/MATLAB/R2015b/bin
    sudo ./matlab
  • Umount ISO
    sudo umount /matlab

Build Caffe follow the caffe installation instructions here:

posted @ 2017-02-26 20:58  sinbad.dev  阅读(437)  评论(0编辑  收藏  举报