Caffe the fastest installation in Ubuntu 14.04 64bit

Source: Internet
Author: User
Tags gtx

Recently for various reasons, loaded many times caffe, installation process a lot of pits, in order to save the time of novice, hereby summarizes the entire installation process.

About the Ubuntu version of the choice, it is recommended to use 14.04 this relatively stable version, but do not use Kylin version!!! A lot worse than the original experience!!!

Caffe installation process, the basic adoption of this article and then slightly changed, skip the Tai hang.

Caffe + Ubuntu 14.04 64bit + CUDA 6.5 configuration Instructions http://www.linuxidc.com/Linux/2015-04/116444.htm

1. Install the development dependency package
sudo apt-get install build-essentialsudo apt-get install vim cmake gitsudo 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
2. Installing Cuda

General computers have dual graphics cards: Intel's integrated graphics + Nvidia's discrete graphics card. To run the two video cards simultaneously, you need to turn off the LIGHTDM service.

2.1 Download the installer here, choose the Ubuntu 14.04 under Linux x86, the Local package Installer, download the file as

Cuda-repo-ubuntu1404-7-0-local_7.0-28_amd64.deb

2.2 Select the Intel graphics card to display or use as the primary display device in the BIOS setup

2.3 Enter Ubuntu, press CTRL+ALT+F1, log in to your account, and enter the following command

sudo service LIGHTDM stop

2.4 Install CUDA,CD to the installation package directory, enter the following command:

sudo dpkg-i cuda-repo-ubuntu1404-7-0-local_7.0-28_amd64.debsudo apt-get updatesudo apt-get Install Cuda

Restart your computer when you are finished installing it.

3. Installing CUDNN

3.1 To register here to download, seemingly registration verification to take one or two days look, too troublesome can be directly to the Linux commune resource station download

Resource Bundle :

------------------------------------------Split Line------------------------------------------

FTP Address: ftp://ftp1.linuxidc.com

User name: ftp1.linuxidc.com

Password: www.linuxidc.com

Installed in 2015 linuxidc.com\7 month \caffe in Ubuntu 14.04 64bit

Download method See http://www.linuxidc.com/Linux/2013-10/91140.htm

------------------------------------------Split Line------------------------------------------

3.2 After completing the download directory, perform the following command to install

TAR-ZXVF CUDNN-6.5-LINUX-X64-V2.TGZCD cudnn-6.5-linux-x64-v2sudo CP lib*/usr/local/cuda/lib64/sudo CP cudnn.h/usr/ local/cuda/include/

Re-update the soft connection

Cd/usr/local/cuda/lib64/sudo rm-rf libcudnn.so libcudnn.so.6.5sudo ln-s libcudnn.so.6.5.48 Libcudnn.so.6.5sudo ln-s li bcudnn.so.6.5 libcudnn.so

3.3 Setting environment variables

Gedit/etc/profile

At the end of the open file, add

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

After saving, execute the following command to make it effective

Source/etc/profile

Create the following files at the same time

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

Content is

/usr/local/cuda/lib64

After saving, make it effective

sudo ldconfig
4. Installing Cuda Sample and ATLAS

4.1 Build Sample

Cd/usr/local/cuda/samplessudo make All-j8

My computer is eight-core, so make time with-j8 parameters, we change according to the situation, the whole process is a bit long, about 10 minutes.

4.2 See if the driver is installed successfully

CD Bin/x86_64/linux/release./devicequery

The following message appears to succeed

./devicequery starting ... Cuda device Query (Runtime API) version (Cudart static linking) detected 1 CUDA capable device (s) device 0: "GeForce GTX 670 "Cuda Driver version/runtime version 6.5/6.5 CUDA Capability major/minor version number:3.0 Total amo UNT of global memory:4095 MBytes (4294246400 bytes) (7) Multiprocessors, (192) CUDA cores/mp:1344                             CUDA cores GPU clock rate:1098 MHz (1.10 GHz) Memory Clock rate: 3105 Mhz Memory Bus width:256-bit L2 Cache size:5242 Bytes Maximum Texture Dimension Size (x, Y, z) 1d= (65536), 2d= (65536, 65536), 3d= (4096, 4096, 4096) Maximum Lay Ered 1D Texture size, (num) layers 1d= (16384), 2048 layers Maximum layered 2D Texture Size, (num) layers 2d= (16384, 163  (+), 2048 layers total amount of constant memory:65536 bytes All amount of shared memory per block:     49152 Bytes Total number of registers available per block:65536 Warp size:32 Maximum number of threads per multiprocessor:2048 Maximum number of threads per block:1024 Max dimension s  Ize of a thread block (x, Y, z): Max dimension size of a grid size (x, Y, z): (2147483647, 65535, 65535)   Maximum memory pitch:2147483647 bytes Texture alignment:512 bytes                     Concurrent copy and kernel Execution:yes with 1 copy engine (s) Run time limit on kernels: Yes Integrated GPU Sharing host Memory:no support Host page-locked Memory mapping:yes Alignment req Uirement for surfaces:yes device have ECC support:disabled device supports Unified Ad Dressing (UVA): Yes Device PCI Bus id/pci location id:1/0 Compute Mode: < Default (multiple H OST threads can use:: CUDasetdevice () with device simultaneously) >devicequery, cuda Driver = Cudart, cuda Driver Version = 6.5, Cuda Runtime V Ersion = 6.5, Numdevs = 1, Device0 = GeForce GTX 670Result = PASS

4.3 Installing atlas

Atlas is a linear algebra operation, and there are two options: one is Intel's MKL, this charge, and the other is Openblas, which is more troublesome; but operational efficiency Atlas < Openblas < MKL

I'll use Atlas:

sudo apt-get install Libatlas-base-dev
5. Install the Python package required by Caffe

Online introduction with the existing anaconda, I do not recommend, because the path set trouble, very easy to make mistakes, and their own installation is very simple and quite fast.

First you need to install PIP

sudo apt-get install Python-pip

Download Caffe again, I put Caffe in the user directory

Cdgit Clone Https://github.com/BVLC/caffe.git

Then go to Caffe's Python directory and install scipy

CD caffe/pythonsudo apt-get install python-numpy python-scipy python-matplotlib ipython ipython-notebook Python-pandas Python-sympy Python-nose

Finally install requirement inside the package, need root permission

sudo sufor req in $ (cat requirements.txt); do pip install $req; Done

If the prompt error, usually is missing the necessary package caused, directly according to the hint pip install <package-name> on the line.

Quit root When you are finished installing

Exit

6. Compiling Caffe

First modify the configuration file, go back to the Caffe directory

CD ~/CAFFECP Makefile.config.example Makefile.configgedit makefile.config

Only two changes are needed here:

i) using CUDNN

Remove # here, uncomment as

II) modify the Python package directory, this sentence

Python_include: =/usr/include/python2.7/usr/lib/python2.7/dist-packages/numpy/core/include

Switch

Python_include: =/usr/include/python2.7/usr/local/lib/python2.7/dist-packages/numpy/core/include

Because the newly installed Python package directory is here:/usr/local/lib/python2.7/dist-packages/

It's going to be a good thing, direct make.

Make All-j4make testmake runtestmake Pycaffe

At this time CD to Caffe under the Python directory, try Caffe Python wrapper installation is not:

Pythonimport Caffe

If you do not have an error, then the installation is good.



Caffe the fastest installation in Ubuntu 14.04 64bit

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.