Learning in Ubuntu Caffe Series (1): Installation configuration Ubuntu14.04+cuda7.5+caffe+cudnn

Source: Internet
Author: User

First, version

Linux system: Ubuntu 14.04 (64-bit)

Graphics: Nvidia k20c

Cuda:cuda_7.5.18_linux.run

Cudnn:cudnn-7.0-linux-x64-v4.0-rc

Second, download

Ubuntu 14.04:http://www.ubuntu.com/download/desktop (64bit)

cuda7.5:https://developer.nvidia.com/cuda-downloads/, download the corresponding operating system and version cuda_7.5.18_linux.run, put it in the ~ root directory

CUDNN Download Address: HTTPS://DEVELOPER.NVIDIA.COM/CUDNN, need to register, and through the audit to download, download the corresponding file cudnn-7.0-linux-x64-v4.0-rc.tgz, put to ~ Root directory. Audit generally a two days, can not wait for the students to Http://pan.baidu.com/s/1bnOKBO download

Three, start the installation

1, the installation of Ubuntu, this article is not concerned about.

2. Disable Nouveau drive

Press CTRL+ALT+F1 to enter the command prompt to create a new blacklist file

# sudo vi/etc/modprobe.d/blacklist-nouveau.conf

Input

blacklist nouveauoptions nouveau modset=0

Save exit (: Wq)

And then execute

# sudo update-initramfs-u

Executive Lspci | grep nouveau See if there is content

# Lspci | grep nouveau

If there is no content, the description is disabled successfully, if there is content, reboot and then view

# sudo reboot

After restarting, enter the login screen, do not log into the desktop, directly press CTRL+ALT+F1 to enter the command prompt.

3, installation Cuda 7.5

Install some common software first, and note that the whole process requires networking

# sudo service lightdm stop # sudo apt-get install g++ # sudo apt-get install git # sudo apt-get install Freeglut3-dev

Next go to-install Cuda 7.5 According to the directory

# CD # sudo sh cude_7.5.18_linux.run

When installing, to let you look at a bunch of text (EULA), we press SPACEBAR to 100%, and then enter a bunch of accept,yes,yes or carriage return to install.

After the installation is complete, reboot and use LS to see if there are four or so folders that start with Nvidia

# ls/dev/nvidia*

If there is, the installation is successful, if not, may not succeed, need to unload load. The uninstall command is as follows:

# sudo/usr/local/cuda-7.5/bin/uninstall_cuda_7.5.pl # Sudo/usr/bin/nvidia-uninstall

If you are not sure if the installation is successful, please refer to the other tutorials to compile samples for testing.

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 at the end, and if you don't edit with VI, please Baidu

Export path=/usr/local/cuda-7.5/bin: $PATHexport ld_library_path=/usr/local/cuda-7.5/lib64: $LD _library_ PATH

Save exit until Cuda 7.5 is installed.

4, installation Caffe

Download Caffe First

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

Then install a bunch of third-party libraries

#sudo apt-get install Libatlas-base-dev#sudo apt-get install Libprotobuf-dev#sudo apt-get install Libleveldb-dev#sudo apt-get install Libsnappy-dev#sudo apt-get install Libopencv-dev#sudo apt-get install Libboost-all-dev#sudo apt-get install Libhdf5-serial-dev#sudo apt-get install Libgflags-dev#sudo apt-get install Libgoogle-glog-dev#sudo apt-get install Liblmdb-dev#sudo apt-get install Protobuf-compiler

Next, install the OPENCV

# CD Caffe # sudo git clone https://github.com/jayambhia/Install-OpenCV # CD Install-opencv/ubuntu # sudo sh dependencies.sh # CD 2.4 # sudo sh opencv2_4_10.sh

Next, compile the Caffe

# CD ~/caffe # sudo cp Makefile.config.example makefile.config #  make all

At this point, the Caffe installation is complete.

5. Test Caffe

Download Mnist data

# CD ~/caffe # sudo sh data/mnist/get_mnist.sh # sudo sh examples/mnist/create_mnist.sh

At runtime, if you have a GPU, you do not need to modify the configuration file, and if you do not have a GPU, you need to modify the configuration file Lenet_solver.prototxt

# sudo vi examples/mnist/lenet_solver.prototxt

Change the last line's Solver_mode:gpu to Solver_mode:cpu

Once configured, you are ready to run the

# sudo sh examples/mnist/train_lenet.sh

Note that when you run the Caffe program, you must be in the root directory of the Caffe, or you will get an error

6, install CUDNN to accelerate

Suppose you have already downloaded the cudnn-7.0-linux-x64-v4.0-rc.tgz to the ~ root directory.

#CD#sudo tar xvf cudnn-7.0-linux-x64-v4.0-rc.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.4#sudo ln-sf libcudnn.so.4.0.4 libcudnn.so.4#sudo ln-sf libcudnn.so.4 libcudnn.so#sudo ldconfig

Remove the comments from the USE_CUDNN line in Makefile.config in the Caffek root directory and recompile.

# CD ~/caffe # sudo vi makefile.config

Remove the comment symbol # for the USE_CUDNN line, i.e. use_cudnn: = 1

and then recompile

# sudo make clean # sudo make all

Here, all installation is complete.

If you do not have a GPU, you cannot use CUDNN.

Learning in Ubuntu Caffe Series (1): Installation configuration Ubuntu14.04+cuda7.5+caffe+cudnn

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.