Deep Learning Learning Summary (i)--caffe Ubuntu14.04 CUDA 6.5 Configuration

Source: Internet
Author: User
Tags cuda toolkit gtx

Caffe (convolution Architecture for Feature Extraction) as a very hot framework for deep learning CNN, for Beginners, Build Linux under the Caffe platform is a key step in learning deep learning, its process is more cumbersome, recalled the original toss of those days, then summed up the Ubuntu14.04 configuration process, convenient later novice can be less detours.

1. Installing Build-essentials

Install some basic packages needed for development

sudo apt-get install build-essential

2. Installing the NVIDIA Driver

Enter the following command to add the drive source

sudo add-apt-repository ppa:xorg-edgers/ppasudo apt-get update

Install version 340 driver (depending on the model of the computer graphics card, detailed to the Nvidia official website to view)

sudo apt-get install nvidia-340

After the installation is complete, continue to install the following packages

sudo apt-get install NVIDIA-340-UVM

Installation drive complete, reboot.

3. Installing Cuda 6.5

Cuda's Deb package installation is simple, according to the official website process, pre-installed the necessary library

sudo apt-get install Freeglut3-dev build-essential libx11-dev libxmu-dev libxi-dev LIBGL1-MESA-GLX Libglu1-mesa Libglu1-mesa-dev

3.1 Installing Cuda

Then get Ubuntu 14.04 Cuda related repository package with the following command

$ sudo dpkg-i cuda-repo-ubuntu1404_6.5-14_amd64.deb $ sudo apt-get update

Then start installing Cuda Toolkit

$ sudo apt-get install Cuda

You need to download a long time, the slow speed of the middle can go out to eat a meal ~

3.2 Environment Configuration

After Cuda installation is complete, you need to add a command to the. BASHRC to configure the environment

Export cuda_home=/usr/local/cuda-6.5 export ld_library_path=${cuda_home}/lib64  Path=${cuda_home}/bin:${path} Export PATH

3.3 Installing Cuda SAMPLE

Complete the entire compilation process by copying the SDK samples to the home directory

$ cuda-install-samples-6.5.sh  ~ $ cd ~/nvidia_cuda-6.5_samples $ make

If the above process is successful, you can verify it by running the devicequery under Bin/x86_64/linux/release. If the following information is present, the driver and the video card installation is successful

./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. Installing Blas

Caffe's Blas can have three choices, namely Atlas, MKL, and Openblas. For the MKL can be downloaded to the Intel official website, unzip the completion of a install_gui.sh file, the execution of the file will appear the graphical installation interface, follow the instructions step by step implementation.

Openblas source code can also be compiled, but GCC and Gfortran and other related compilers are required. Personally think the more convenient is Atlas, on the Caffe official website has the relevant introduction, for Ubuntu, through the following command can download atlas

sudo apt-get install Libatlas-base-dev

5. Installing OPENCV

OpenCV Library installation can be downloaded from a script written online: Https://github.com/jayrambhia/Install-OpenCV

After extracting the document, enter ubuntu/2.4 to add executable permissions to all shell scripts

chmod +x *.sh

Then do opencv2_4_9.sh install the latest version, note that OpenCV 2.4.9 does not support gcc-4.9 above the compiler!!

6. Install additional Dependencies

For Ubuntu 14.04, execute the following command to download other dependent library files

sudo apt-get install Libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libboost-all-dev Libhdf5-serial-dev
sudo apt-get install Libgflags-dev libgoogle-glog-dev liblmdb-dev Protobuf-compiler

7. Install Python and matlab

First install PIP and Python–dev

Python-dev Python-pip

and the additional packages required by Caffe Python wrapper

sudo pip install-r/path/to/caffe/python/requirements.txt

Matlab interface requires additional MATLAB program installation

Last Shot---compile Caffe

Complete all the environment configuration, finally can compile Caffe, through the official website download Caffe source code, into the root directory caffe-master, first copy a makefile

CP Makefile.config.example Makefile.config

And then modify the content inside, mainly:

Cpu_only whether to use CPU mode, otherwise choose CUDNN (here Cudnn need to download in Nvidia-cudnn, and through email registration application to pass the audit)

Blas:=atlas (can also be open or MKL)

Debug if debug mode is required

Matlab_dir If you need to use MATLAB interface

After the configuration is complete, you can compile the

Make All-j4make Testmake runtest
Finally if all can be normal, prove caffe inside all the example program can run, rest assured run Cifar, mnist and imagenet bar ~ ~

Deep Learning Learning Summary (i)--caffe Ubuntu14.04 CUDA 6.5 Configuration

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.