Configure Cuda_caffe_cudnn_anaconda_digits on the ubuntu14.04

Source: Internet
Author: User
Tags git clone

Refer to many websites on the internet to this article mainly:http://blog.csdn.net/yhl_leo/article/details/50961542

This is the beginning of a summary series of my own study of Caffe. First, because the Caffe Dependency is more, the configuration is also more troublesome. This is a more detailed Caffe of the various relevant configuration to clarify. Reprint please indicate the source.

recommended ubuntu14.04 version, because digits support is better. Graphics support GPU acceleration to make it clear ah, do not support the full use of CPU , do not waste time to toss cuda .

We basically follow the official tutorial. But the official tutorial some pits are not point out, this article is also listed.

first, the graphics card the installation

disabling The nouveau driver,nouveau is an open source driver for Nivida that comes with Ubuntu , There is a problem with installing nvidia 's official driver, so disable it first.

Press Ctrl+alt+f1 Enter tty1 console, enter

sudo vim/etc/modprobe.d/blacklist-nouveau.conf

Write it in there.

Blacklist nouveau

Options Nouveau modeset=0

Press ESC to enter : Wq Save Exit

Ps:vim Editor is very useful ah, will not be small partners to seize the time to learn AH.

Perform

Lspci | grep nouveau

Query The PCI bus for Nouveau, andgrep followed by regular expression filtering.

Nothing has been stated to disable success.

when you log in after restarting, you may have to fill in the login password, not enter the system, press Ctrl+alt+f1, login,

To uninstall the graphics card method:

sudo apt-get remove--purge nvidia*

To install the video driver:

$ sudo add-apt-repository Ppa:xorg-edgers/ppa

$ sudo apt-get update

$ sudo apt-get install nvidia-352

Execute sudo start lightdm Enter the password to see the desktop is OK

PS: After the graphics card driver hangs, it is likely that you will not see the system interface, after starting the display darkness, in fact, the system is running. My practice is to first install the ssh service, in this case, through another computer ssh login into the installation drive.

Second,CUDA installation

CUDA official website download. Actually should download good first, if did not have time to use the GUI to download, use wget, curl what download also same. It is said that the driver of 331 has a pit, do not use that drive. The following installs some dependencies /

sudo service LIGHTDM stop

sudo apt-get install g++

sudo apt-get install git

sudo apt-get install Freeglut3-dev

First download the installation files on the official website (the link has been provided earlier):

i downloaded the deb Local installation file, and after the download is complete, follow the instructions in the documentation to install it:

sudo dpkg-i cuda-repo-ubuntu1404-7-5-local_7.5-18_amd64.deb

sudo apt-get update

sudo apt-get install Cuda

Download the below Installation guide for Linux, which has a setup method for environment variables:

If so, the installation is successful. There is no way to uninstall as follows:

Sudo/usr/local/cuda-7.5/bin/uninstall_cuda_7.5.plsudo/usr/bin/nvidia-uninstall

Finally, configure the environment variables, we put directly in the system configuration file profile , first open the profile file

sudo vi/etc/profile

Add two lines of code on the last side:

Export Path=/usr/local/cuda-7.5/bin: $PATH

Export ld_library_path=/usr/local/cuda-7.5/lib64: $LD _library_path

Execute source/etc/profile to make environment variables effective

This cuda installation is complete

Third, CUDNN Installation

CUDNN is for CUDA acceleration. CuDNN is a Library of GPU-accelerated computational deep neural networks . Download Cudnn website. Seemingly download to register first, the audit will take a few days time. Download it and unzip it later.

Execute the following command:

sudo tar xvf cudnn-7.0-linux-x64-v4.0-prod.tgz && cd cuda/include && sudo cp *.h/usr/local/include/& & CD. /lib64 && sudo cp lib*/usr/local/lib/&& cd/usr/local/lib && sudo chmod +r libcudnn.so.4.0.7 &am p;& sudo ln-sf libcudnn.so.4.0.7 libcudnn.so.4 && sudo ln-sf libcudnn.so.4 libcudnn.so && sudo ldcon Fig

this CUDNN installation is complete, is not very simple AH.

Iv. installation of Anaconda

to https://www.continuum.io/downloads download Anaconda, it is recommended to use the Linux version of python 2.7 version, because Some things in TensorFlow do not support python3.5 ( such as cpickle) .

after the download succeeds, the terminal executes (2.7 version):

# bash anaconda2-4.1.1-linux-x86_64.sh

or 3.5 version:

# bash anaconda3-4.1.1-linux-x86_64.sh

During the installation process, you will be asked to install the path, directly enter the default on it. There's a place to ask if you want to add the Anaconda installation path to the environment variable (. BASHRC) , you must enter Yes

after successful installation, there will be a Anaconda2 folder in the root directory of the current user , which is the installed content. In the terminal you can enter

Conda Info to query installation information

Enter Conda list to find out which libraries you have installed now, common python, NumPy, scipy . If you still have what package is not installed on, you can run

Conda Install * * * * for installation (* * * for package name), if a package version is not up-to-date, run conda Update * * .

Five, installation of Caffe

first installed Opencv, recommended 2.4 version. opencv1.x is pure c language written, 2.x C and c++ opencv3 c++ written. For other people to write code can also run normally, or it is recommended to install 2.x

opencv2.4 is easy to install, download it and unzip it, then go to directory make , and sudo make install is done.

Caffe official Download Basic follow the official installation guide,l Another way is to download the command line

Download Caffe:

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

If you don't have it installed Git, read the blog:Ubuntu Git installation and use.

then compile Caffe: Install dependencies First:

sudo apt-get install Libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev Protobuf-compiler

$ sudo apt-get install--no-install-recommends Libboost-all-dev

$ sudo apt-get install Libopenblas-dev liblapack-dev Libatlas-base-dev

$ sudo apt-get install Libgflags-dev libgoogle-glog-dev Liblmdb-dev

Jiayanqing The Great God also said, we must see clearly!

The following begins to configure Caffe and starts compiling.

sudo cp Makefile.config.example Makefile.config

# Adjust Makefile.config (for example, if using Anaconda Python, or if cuDNN are desired) make a test make runtest

There are a few things to note about configuration files:

# CuDNN Acceleration Switch (uncomment to build with CuDNN).

USE_CUDNN: = 1

# cpu-only switch (uncomment to build without GPU support).

# cpu_only: = 1BLAS choice:# atlas for Atlas (default)

# MKL for MKL

# open for Openblasblas: = Atlas

# Custom (Mkl/atlas/openblas) include and Lib directories.

# Leave commented to accept the defaults for your choice of BLAS

# (which should work)!

# Blas_include: =/path/to/your/blas

# Blas_lib: =/path/to/your/blas

These places are chosen according to their own circumstances.

Make all no problem,Caffe even success AH.

To recompile after saving: (if the computer has 8 threads, add -j8 at the back to speed up the compilation)

sudo make clean

sudo make all-j8

sudo make test-j8

sudo make runtest-j8

I compile the last step of the time, there are such errors:

libcudart.so.7.5 cannot open shared object File:no such file or directory

There's a bunch of introductions on the web, how to set the environment variables (we've already set them up), so we can check if we've added environment variables:

$ echo $PATH $ echo $LD _library_path

As you can see, the environment variables have been added well.

The workaround is to copy some files to the/usr/local/lib folder:

sudo cp/usr/local/cuda-7.5/lib64/libcudart.so.7.5/usr/local/lib/libcudart.so.7.5 && sudo ldconfig

sudo cp/usr/local/cuda-7.5/lib64/libcublas.so.7.5/usr/local/lib/libcublas.so.7.5 && sudo ldconfig

sudo cp/usr/local/cuda-7.5/lib64/libcurand.so.7.5/usr/local/lib/libcurand.so.7.5 && sudo ldconfig

again, try the sudo make runtest command, which appears as follows:

at this point, theCaffe installation is complete.

Import the Caffe path into the environment variable and execute the following command:

sudo vi ~/.BASHRC

Add export Pythonpath=/home/***/caffe/python at the end : $PYTHONPATH

Export Caffe_home=/home/***/caffe: $CAFFE _home

then execute sudo ldconfig to take effect

then execute sudo make Pycaffe inside the Caffe, OK with no error , test Caffe is successful,

input python Enter in terminal ,import Caffe no error indicates OK,

if it appears No module named Google.protobuf.internal

Workaround reference Link:http://www.th7.cn/system/lin/201605/164288.shtml

sudo chmod 777-r anaconda2(folder) Change Permissions and then
Conda Install Protobuf

It's done.

six ,DIGITS installation

Reference Links: http://www.cnblogs.com/denny402/p/5136155.html  

First, install digits 3.0

Digits is run on the basis of Cuda and Caffe , so It is no doubt that the first configuration is Cuda+caffe. Not configured yet, please refer to:Caffe Learning Series (1): Installation configuration UBUNTU14.04+CUDA7.5+CAFFE+CUDNN

Open a terminal and run the following command in turn:

Cd

Sudo-s

go to the current user root and switch to Super User (sign from $ to #, don't lose sudo for every sentence )

Cuda_repo_pkg=cuda-repo-ubuntu1404_7.5-18_amd64.deb &&

wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1404/x86_64/$CUDA _repo_pkg &&

sudo dpkg-i $CUDA _repo_pkg

Then

Ml_repo_pkg=nvidia-machine-learning-repo-ubuntu1404_4.0-2_amd64.deb &&

http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1404/x86_64/$ML _repo_pkg &&

sudo dpkg-i $ML _repo_pkg

Apt-get Update

Apt-get Install digits

Configure Cuda_caffe_cudnn_anaconda_digits on the ubuntu14.04

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.