Caffe Ubuntu14.04 + CUDA 8 (supports Pascal architecture graphics like GTX1080 1070)

Source: Internet
Author: User
Tags git clone intel mkl

1. Preface

The system used in this tutorial is Ubuntu 14.04 LTS 64-bit, which uses a cuda version of 8.

Theoretically this tutorial supports Pascal architecture graphics, such as game cards GeForce GTX1070,GTX 1080, new Titan X, and just released the computational card Tesla P100.

If you are using a compute card for GPU acceleration while installing, and the video card used to display is not an Nvidia video card, it could cause the graphical interface to be automatically loaded when the Nvidia driver is installed. You can use the server version of Ubuntu, or replace it with CentOS.

2. Installing the underlying dependencies

sudo apt-get install build-essential
sudo apt-get install cmake git

3. Installing Cuda

First you need to close the graphical interface.

Use CTRL+ALT+F1 to enter the Virtual Console and enter your username and password to log in. Then close LIGHTDM:

SUDO/ETC/INIT.D/LIGHTDM stop

CUDA 8 requires the registration of accelerated Computing Developer program, which can then be downloaded for free.

Register and download at the following address:

Click here

When the download is complete, go to the specified directory and execute:

sudo dpkg-i cuda-repo-ubuntu1404-8-0-rc_8.0.27-1_amd64.deb
sudo apt-get update
sudo apt-get install Cuda

After the installation is complete, restart your computer:

sudo reboot

After you open terminal, add the environment variable. Use Gedit to open the following document:

sudo gedit/etc/profile

Add at the end of the file:

Path=/usr/local/cuda/bin: $PATHexport PATH

Once the save is complete, execute the following command to make the environment variable effective immediately:

Source/etc/profile

You will then need to add the path to the Lib:

sudo gedit/etc/ld.so.conf.d/cuda.conf

Write the following in the file and save:

/usr/local/cuda/lib64

Then execute the following command to make it effective:

sudo ldconfig

After performing these operations, you can also install Cuda samples to detect if Cuda is working properly, as this is not a cuda programming tutorial, this tutorial is not covered.

4. Install some other dependencies

sudo apt-get install Freeglut3-dev libx11-dev libxmu-dev Libxi-dev Libglu1-mesa-dev
sudo apt-get install 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 libdc139 4-22-dev
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

PS: Copy and paste too long command can be due to the browser cause the input of extra line characters, if you copy and paste the command with a newline character into the terminal, will be treated as two commands to execute, be sure to note this.

5. Install Atlas

This step can be replaced with Openblas or Intel Mkl. I tested these three libraries on the e5-2690v2+gtx780 platform, which is similar in performance, and describes one of them:

sudo apt-get install Libatlas-base-dev

Then the automatic installation is complete.

Intel MKL is currently a premium software and Openblas can be downloaded and installed free of charge. If you use these two libraries, make the corresponding changes in Makefile.config when compiling Caffe.

6. Download Caffe

Download the latest version of Caffe directly from GitHub

git clone https://github.com/BVLC/caffe.git

You can also download the historical version of Caffe from the Caffe GitHub project:

Https://github.com/BVLC/caffe

7. Install Python

Install related dependencies First

sudo apt-get install Python-dev python-pip

Go to the directory of the downloaded Caffe and go to the Python directory

CD python

Execute the following command:

For req in $ (cat requirements.txt); Do sudo pip install $req; Done

Wait for it to install automatically.

8. Compiling Caffe

Under the Caffe directory, execute:

CP Makefile.config.example Makefile.config

Then open makefile.config, modify the relevant parameters according to your own needs.

To compile:

Make All-j10
Make Test
Make Runtest

Ps:-j10 refers to 10 threads compile at the same time, according to the characteristics of their own CPU to adjust the parameters, if you do not know their CPU, directly execute make.

The Pycaffe can then be compiled on demand:

Make Matcaffe
Make Pycaffe

Then the Caffe is finished.

9. Run Minist Demo

Go to the Caffe directory

SH data/mnist/get_mnist.sh
SH examples/mnist/create_mnist.sh
SH examples/mnist/train_lenet.sh

If it works, Caffe will work properly.

If you need to configure MATLAB and CUDNN, you can refer to this tutorial: click here

This tutorial is written in the following tutorials, which are hereby acknowledged: http://www.cnblogs.com/platero/p/3993877.html

The official website of Caffe is http://caffe.berkeleyvision.org/

If you have any questions, you can contact me:[email protected]

Last Updated on 2016-09-09 13:33:06

Caffe Ubuntu14.04 + CUDA 8 (supports Pascal architecture graphics like GTX1080 1070)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.