Ubuntu14.04 Installation Caffe Summary

Source: Internet
Author: User
Tags intel mkl nvcc

Turn-picked HTTP://WEIBO.COM/P/2304189DB078090102VDVX

Although the deep learning has not been anything new, but for the reason of the equipment, I have not been involved. It was a pleasure to replace a workstation with a GPU the other day. So eagerly installed an Ubuntu system, began to configure the Deeplearning framework Caffe. It took about two days before and after, and finally it was well-equipped. With all these years of software, Caffe should be one of the most complex software I have ever had. Finally know why with Caffe so many people, personally to match it with so few people. The following is a step-by-step process of configuring Caffe, hoping to help beginners a little. PS: Although the official website http://caffe.berkeleyvision.org/installation.html gives the process of configuration, but very general, look at it does not know what to do.

I. Installation of NVIDIA driver and Cudatoolkit

    1. Issues to be aware of before installation:
      1. Check if your GPU supports cuda,linux the following commands can be used to view the GPU model:

Lspci | Grep–i nvidia

As long as the GPU model can be found in Https://developer.nvidia.com/cuda-gpus, it is CUDA-enabled, such as my GPU model is: GEFORCEGTX Titan

    1. To check if your operating system is CUDA-supported, you can enter the following command:

Uname-m && Cat/etc/*release

Cuda supported operating systems can be found at the following URL http://docs.nvidia.com/cuda/cuda-toolkit-release-notes/#overview

    1. To check if GCC is installed on the operating system, use the following command

Gcc–version

Many operating systems are pre-installed with GCC, and if you don't, install them first.

    1. Go to https://developer.nvidia.com/cuda-downloads Download the latest version of Cuda, is currently 6.5. Here are the options to match your machine and operating system (for example, my 64-bit Ubuntu14.04). Friendly reminder: The file is a bit large, about 1G, the network is not good students please wait patiently.

    1. Verify that the downloaded Cuda is valid:

Md5sum installation package name >

After executing the above command, a string of MD5 values will appear, for example mine is: 90b1b8f77313600cc294d9271741f4da, see https://developer.nvidia.com/cuda-downloads/ If you can find your MD5 value in the checksums list, if you can't find it, it means you have a problem with the previous installation package and you want to download it again.

    1. Deal with version conflict issues, the first installation can skip this. If you have previously installed Nvidia drivers and Cuda, to uninstall clean, specific unloading method see Http://developer.download.nvidia.com/compute/cuda/6_5/rel/docs/CUDA_ Getting_started_linux.pdf

    1. Issues to be aware of when installing:
      1. To exit the GUI interface, proceed as follows: Ctrl+alt+f1 (F2-F6), switch to tty1-6 command line mode. After exiting GUI interface, you need to enter username and password to login. Turn off desktop Services after logging in:

sudo stop LIGHTDM

This step is very important, directly installed in the GUI interface will definitely fail!

    1. The official website says interaction with Nouveau is required before installation, because Nouveau is an open-source graphics driver, Ubuntu14.04 is installed by default, but it may affect the installation of Nvidia drivers. I skipped this step directly, which proved to be of no effect. (The students can not rest assured that the official website Http://developer.download.nvidia.com/compute/cuda/6_5/rel/docs/CUDA_Getting_Started_Linux.pdf as much as a few steps.) )

    1. You can now start the installation. Switch to the location where the Cuda installation package is located and execute the following command:

sudo sh cuda_6.5.14_linux_64.run

This way, Accept-yes-enter.

After execution, the following results appear:

Driver:installed Requirereboot

Toolkit:installskip

Samples:installskip

See, this CUDA installation package actually contains the Driver,toolkit and samples three parts, the first time the installation of the driver loaded, but to restart. restarted, or as above, exit the GUI and re-execute the following command:

sudo sh cuda_6.5.14_linux_64.run

The results are as follows:

Driver:installed

Toolkit:installed in/usr/local/cuda-6.5

Samples:installed In/home/changzhi, but missing recommendedlibraries

The installation was successful this time, but some recommended libraries are missing.

    1. This step is obviously to install the recommended libraries, nothing to say, according to the official website recommended, you need to install the following libraries:

sudo apt-get install Freeglut3-dev build-essential libx11-devlibxmu-dev Libxi-dev LIBGL1-MESA-GLX Libglu1-mesalibglu1-mesa-dev

    1. After loading, you can go back to the GUI interface and execute

sudo start LIGHTDM

    1. According to the official website Http://caffe.berkeleyvision.org/installation.html#prerequisites requirements, also need to install some dependencies, My system is Ubuntu14.04, so I need to do the following two steps:

sudo apt-get install Libprotobuf-dev libleveldb-dev libsnappy-devlibopencv-dev Libboost-all-dev Libhdf5-serial-dev

sudo apt-get install Libgflags-dev libgoogle-glog-dev liblmdb-devprotobuf-compiler

    1. Issues to be aware of after installation:
      1. Set Environment variables:

Add a sentence on the last side of the/etc/profile (can not be added to the root user)

Export path= $PATH:/usr/local/cuda-6.5/bin

After saving, execute the following command, the environment variable takes effect immediately

Source/etc/profile

    1. Add Lib Library path

In/etc/ld.so.conf.d join file cuda.conf, write

/usr/local/cuda-6.5/lib64

Similarly, execute the following command to make it effective immediately

sudo ldconfig

    1. Verifying the installation Results

    1. Verifying the driver version, similar to the above GCC, is verifying the driver and there is no problem

Cat/proc/driver/nvidia/version

    1. Compiling examples

First look at the compiler version and execute

Nvcc–v

No accident, here will prompt NVCC not installed, in fact, before the installation of the Nvidia-cuda-toolkit compiler is not complete, according to the prompt installation is good:

Sudoapt-get Install Nvidia-cuda-toolkit

This installation also takes a long time, please wait patiently. After installation, we can compile the example, the example is installed by default in/home/username/nvidia_cuda-6.5_samples, enter this directory, execute

Make

The process is also lengthy, please wait patiently.

    1. Running the binaries.

After all compilation play, go to/home/username/nvidia_cuda-6.5_samples/bin/x86_64/linux/release, execute

sudo./devicequery

If the following information appears, the driver and the video card are installed successfully:



Note: The following green sections can be skipped if everyone installs the same Cuda driver version and runtimeversion as the first time.

The first time I installed, the "Cuda driver version isinsufficient for Cudaruntime" error, is the default installation of Cuda version is 6.5, but the driver version is still 5.5. The solution to this problem must be to install a 6.5 version of the Cuda driver on the line. But the problem is not that simple. I from the official website under the 6.5 Cuda drive, after installation, don't say solve problems, even the Ubuntu system can not get into. Power on the upper left corner of a small horizontal line in a flash, and nothing can be entered, really can put people to death! Later on the web found the solution is as follows:

Login the system using root recover Mode,execute:

sudo apt-get purge nvidia*

sudo apt-get install nvidia-current

Sudoreboot

The system can not start the cause is the video card driver conflict, so we just uninstall clean the previous driver, only one of the latest version of the driver. This recovermode can be accessed by holding down the SHIFT key on the left when booting.

At this point, the installation of Nvidia drivers and Cudatoolkit is complete.

Second, the installation of Blas

This choice is a lot of users recommend Intel MKL, this is the fee software, but students can apply for free use, apply for address https://software.intel.com/en-us/intel-education-offerings# pid-2460-93, here to choose their own version of the operating system, but also to apply for Edu mailbox only. This software is very large, 3g+, download can choose to install online or offline download, it is strongly recommended to download and install offline, because I was online installation problems, and then uninstall re-offline installation. I am a linux system, so download is parallel_studio_xe_2015_update1.tgz, unzip it into the directory, execute

sudo./install_gui.sh

This is the GUI interface installation, like Windows, follow the prompts step by step to install the line, the path of what the choice of default is good. Installed after the need to add the library path, the specific operation is to create a new file under the/etc/ld.so.conf.d/intel_mkl.conf, do not have permission to switch to the root user to operate, built and added in the file:

/opt/intel/lib/intel64

/opt/intel/mkl/lib/intel64

If you do not select the default path when installing MKL, remember to replace it with your own installation path. When you have finished adding content, execute the following command to make it effective immediately.

sudo ldconfig

Third, the installation of OPENCV

Try not to install it manually, someone on GitHub has already written the full installation script: Https://github.com/jayrambhia/Install-OpenCV, unzip it after downloading, then go to the directory, choose your own operating system, For example, my is Ubuntu, execute

sudo./dependencies.sh

sudo./open2_4_9.sh

The first step is to install the dependencies, the second is to install the OPENCV, the process is about twenty or thirty minutes, slowly wait.

Iv. installation and compilation of Caffe

Caffe:https://github.com/bvlc/caffe

After downloading, go to the Caffe directory to execute

CP Makefile.config.example Makefile.config

Then modify the Blas:= atlas in Makefile.config to Blas: = Mkl, Save the exit on the line.

Finally, compile and execute the following three commands:

Make all

Make Test

Make Runtest

The first two steps are sure to be no problem, the third runtest, the last two will not pass, but still pass, do not affect, should be not installed Python reasons. If you don't need to use Caffe under Python, you can ignore it.

This caffe installation is complete!

Ubuntu14.04 Installation Caffe Summary

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.