A handy Ubuntu+caffe configuration note

Source: Internet
Author: User
Tags hp z820

Main references:

https://github.com/lbzhang/dl-setuphttp://ouxinyu.github.io/Blogs/20151108001.htmlhttp://www.cnblogs.com/ Sandykid/p/5397554.html these three are relatively new, integrated to complete the HP Z820 on the Caffe environment configuration Environment: Ubuntu 14.04 Desktop, CUDA 7.5Basics is mainly part of the preparation work
sudo apt-get updatesudo apt-get upgradesudoinstall build-  Essentialsudo apt-get autoremove

Install Git
sudo Install git
Nvidia DriversDescription
    • Now the graphics driver installation, CUDA installation does not need to close the graphical interface can also be achieved;
    • Nor, as many bloggers have said, can not be updated before the Cuda, otherwise it may crash or something;
    • The installation of Nvidia drivers can be implemented via additional drivers in the "Software and updates" that comes with Ubuntu;
    • or in accordance with the method provided in the Web site to achieve driver installation;
    • Another argument is now Cuda Integrated drive, in the case of turning off the graphical interface to install Cuda can automatically put the driver also installed, this may be through the online installation, incidentally installed dependency implementation, the offline installation package may be small;
    • Recommended 352, not the latest 361.42, the newest is not necessarily the most suitable
To view the video card model:
grep -I. nvidia

Online Installation:

sudo add-apt-repository ppa:graphics-drivers/ppasudo apt-get updatesudo  Install nvidia-352

or download the website from the installation package, install

Or, as I said, using Ubuntu's own software and choosing the right driver for the new option is easier; reboot the system:
sudo shutdown-r now

To view the driver version:

Cat /proc/driver/nvidia/version
CUDAAlso download the offline installation package, which uses CUDA version 7.5:
sudo dpkg-i cuda-repo-ubuntu1404*amd64.debsudo apt-get updatesudo Install Cuda

To add a path:

Echo ' export Path=/usr/local/cuda/bin: $PATH ' >> ~/bashrcecho'export ld_library_path=/usr/local/cuda/lib64: $LD _library_path' >> ~/~/.BASHRC

To check the Cuda version:

Nvcc-v

Restart the system:

sudo shutdown-r now
CuDNNThe latest version is CuDNN V5, but after trying, V5In the process of compiling a problem, recommend CuDNN V4 for LinuxJump to the path where CUDNN is located, unzip the installation:
CD ~/downloads/tar xvf cudnn*tgzcd cudasudocp * /* * * libcudnn*/usr/local/cuda/lib64/sudochmod a+r/usr/local/cuda/lib64/libcudnn*

Here is actually copying the relevant files to the Cuda directory, it is strange why Cuda does not integrate CUDNN, it may have been self-brought, did not verify;

Link CUDNN library file, I wonder if it must:
sudo Ln -sf/usr/local/lib/libcudnn.so. 4.0. 7 /usr/local/lib/libcudnn.so. 4 sudo Ln -sf/usr/local/lib/libcudnn.so. 4 /usr/local/lib/libcudnn.so

Check:

Nvidia-smi

OpenblasCUDNN and Openblas only install one to complete the Caffe compilation, optional operation
mkdir ~/~/gitgit clone https://github.com/xianyi/openblas.gitCD Openblasmake1)]sudomakeinstall

To add a path:

Echo ' export ld_library_path=/usr/local/lib: $LD _library_path ' >> ~/.BASHRC

Common Tools
    • For related python dependencies, you can refer to the given URL attempt, or you can install Anaconda2 one step directly, just pay attention to adding additional environment variables:
    • Of course also can not install Anaconda2 direct installation;
    • Run for a minute and check to make sure the dependencies are there;
sudo Install -y libfreetype6-devlibpng12-Install -u matplotlib ipython[all] Jupyter Pandas Scikit-image

There are also some caffe dependency packages:

sudo Install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev protobuf-Compiler  sudoinstall --no-install-recommends libboost-all-devsudo  Install Libgflags-dev Libgoogle-glog-dev Liblmdb-dev

OpenCV

Recommended installation, often need to use: Download the installation package, switch to the File save folder, install dependencies:
sudo SH Ubuntu/dependencies. SH

Enter Ubuntu\3.0\ install OPENCV 3.0.0:

sudo sh opencv3_0_0. SH

If a successful installation should not have any error prompts:

Use a useful command to view the version:
pkg-config --modversion OpenCV
CaffeTo download the installation package:
CD ~/gitgit clone https://github.com/bvlc/caffe.gitCD CaffeCP Makefile.config.example Makefile.config

The main is to create a new git folder, download the Caffe installation package into the GIT path:

The last command is to copy a configuration file, the source file is left as a backup, we want to modify this configuration file, open and modify;
sudo gedit/caffe/makefile.configuse_cudnn:1include_dirs:= $ (python_include)/ usr/local/include/usr/lib/x86_64-linux-gnu/hdf5/serial/includelibrary_dirs:= $ (python_lib)/usr/local/ lib/usr/lib/usr/lib/x86_64-linux-gnu/hdf5/serial# enabled by default openblaspython_lib:=/usr/local/Lib # PYTHN Library Matlab_dir:=/usr/local/matlab/=3 # OpenCV

Just list the modified section, if you use the Anaconda configuration file has related changes, only need to uncomment it, and modify the path for their own anaconda installation path;

Compile Caffe:
 make all –j16 make test –j16 make Runtest-j16

Adding "-16" is faster for compiling with multi-core;

Compile pythn and Matlab for Caffe
 make Pycaffe-j16 make Matcaffe-j16
The test is described at the end of the second URL:)

A handy Ubuntu+caffe configuration note

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.