ubuntu16.04 installing Caffe Cuda related processes

Source: Internet
Author: User
Tags git clone

Not much to say, experienced a lot of inexplicable errors finally installed, directly put the installation script:

#!/bin/bash# installation should be aware that some libraries may fail to install and install Caffe and PROTOBUF related errors may need to re-make the ProtobufInstallCD/home/zw/Softwares #需要事先下载对应版本的cudasudoDpkg-i cuda-repo-ubuntu1604-8-0-local-ga2_8.0.61-1_amd64.debsudoapt-Get updatesudoApt-getInstallCUDACD/home/zw/git_home/#我存放git项目的目录git clone https://Github.com/google/protobuf.gitsudoApt-getInstallautoconf Automake Libtool Curl Makeg++UnzipCD protobuf./autogen.SH./configure--prefix=/usr Make-J8 MakeCheck-J8sudo  Make Install-J8sudoLdconfig # Refresh shared library cache.cd/home/zw/git_home/git clone https://Github.com/bvlc/caffe.gitCD CaffesudoApt-getInstallLibprotobuf-dev libleveldb-dev Libsnappy-dev Libopencv-dev libhdf5-serial-dev protobuf-compilersudoApt-getInstall--no-Install-recommends libboost-all-DevsudoApt-getInstalllibatlas-base-DevsudoApt-getInstallLibgflags-dev Libgoogle-glog-dev liblmdb-DevCPMakefile.config.example makefile.config #config中如果启用anaconda目录改成anaconda2 (default name at installation), otherwise sudo MakePycaffe failed to compile successfully. However, it is recommended that you do not need to enable the Anaconda directory, as this is not necessary, as long as you add Caffe and install Protobuf in the Pythonpath path. Also, if you have installed opencv3.0 in advance, you need to modify the corresponding option in Makefile.cinfig read-RSP $'Change your makefile.config, complete post Press any key to continue...\n'-N1 Key MakeAll-J8 MakeTest-J8 Makeruntest MakePycaffe-J8CD/home/zw/git_home/protobuf/python~/anaconda2/bin/python setup.pyInstall #安装对应版本的protobuf, it is important to note that if you use Conda to install the latest version of Protobuf, there may be incompatibility problems, because the above Caffe is compiled with this version of PROTOBUF, remember! This is my own attempt, it took a lot of time#Echo "export Pythonpath=~/git_home/protobuf/python: $PYTHONPATH">> ~/. BASHRC #如果你用的时zsh, then you should import to ~/.ZSHRCEcho "export Pythonpath=~/git_home/caffe/python: $PYTHONPATH">> ~/. BASHRCEcho "export path=~/git_home/caffe/build/tools: $PATH">> ~/.BASHRC

Makefile.config as follows:

# # Refer to http://caffe.berkeleyvision.org/installation.html# Contributions simplifying and improving our build system is welcome!# CuDNN Acceleration switch (uncomment to build with CuDNN). USE_CUDNN:=1# CPU-Only switch (uncomment to build without GPU support). # Cpu_only:=1# Uncomment to disable IO dependencies and corresponding data layers# USE_OPENCV:=0# Use_leveldb:=0# Use_lmdb:=0# Uncomment to allow Mdb_nolock when reading LMDB files ( onlyifnecessary) # You should no set this flagifYou'll be reading Lmdbs with any# possibility of simultaneous read andWrite# Allow_lmdb_nolock:=1# UncommentifYou're using OpenCV 3Opencv_version: =3 #事先安装了使用了opencv3, here to enable# To customize your choice of compiler, uncomment and set the following.# n.b. The default forLinux is g++ and the default forOSX is clang++# Custom_cxx:= g++# CUDA directory contains bin/And lib/directories that we need. Cuda_dir:=/usr/local/Cuda #使用了cuda, here to enable # on Ubuntu14.04,ifCuda Tools is installed via#"sudo apt-get install Nvidia-cuda-toolkit"  ThenUse this instead:# cuda_dir:= /usr# cuda Architecture setting:going with all of them.# for CUDA<6.0, comment The *_50 through *_61 lines forcompatibility.# for CUDA<8.0, comment The *_60 and *_61 lines forcompatibility. Cuda_arch:=-gencode arch=compute_20,code=sm_20-gencode arch=compute_20,code=sm_21-gencode arch=compute_30,code=sm_30-gencode arch=compute_35,code=sm_35-gencode arch=compute_50,code=sm_50-gencode arch=compute_52,code=sm_52-gencode arch=compute_60,code=sm_60-gencode arch=compute_61,code=sm_61-gencode arch=compute_61,code=compute_61# BLAS choice:# Atlas forATLAS (default) # MKL formkl# Open forOpenblasblas:=atlas# Custom (MKL/atlas/Openblas) include and Lib directories.# Leave commented to accept the defaults forYour choice of blas# (whichshould work)!# Blas_include:=/path/to/your/blas# blas_lib:=/path/to/your/blas# Homebrew puts OpenblasinchA directory that's not on the standard search path# blas_include:= $ (Shell brew--prefix openblas)/include# blas_lib:= $ (Shell brew--prefix openblas)/lib# This was required onlyifYou'll compile the matlab interface.# matlab directory should contain the MEX binaryinch/bin.# Matlab_dir:=/usr/local# Matlab_dir:=/applications/matlab_r2012b.app# Note:this is required onlyifYou'll compile the Python interface.# We need to being able toFindPython.h and numpy/Arrayobject.h.python_include:=/usr/include/python2.7         /usr/lib/python2.7/dist-packages/numpy/core/include# Anaconda Python distribution is quite popular. Include path:# Verify Anaconda location, sometimes it's in root.#ANACONDA_HOME: = $ (HOME)/anaconda2 #PYTHON_INCLUDE:= $ (anaconda_home)/include # $ (anaconda_home)/include/python2.7# $ (anaconda_home)/lib/python2.7/site-packages/numpy/core/include# Uncomment to use Python3(Default is Python2) # Python_libraries:=boost_python3 python3.5m# python_include:=/usr/include/Python3.5m #/usr/lib/python3.5/dist-packages/numpy/core/include# We need to being able toFindlibpythonx.x.so or. Dylib. Python_lib:=/usr/lib# python_lib:= $ (anaconda_home)/lib# Homebrew installs NumPyincha non standard path (keg only) # Python_include+= $(dir$ (Shell python-c'import numpy.core; print (numpy.core.__file__)'))/include# Python_lib+ = $ (Shell brew--prefix numpy)/lib# uncomment to support layers writteninchpython (would link against Python libs) With_python_layer:=1# WhateverElseYouFindneed goes here. #INCLUDE_DIRS:= $ (python_include)/usr/local/Include#library_dirs:= $ (python_lib)/usr/local/lib/usr/Libinclude_dirs:= $ (python_include)/usr/local/include/usr/include/hdf5/Seriallibrary_dirs:= $ (python_lib)/usr/local/lib/usr/lib/usr/lib/x86_64-linux-gnu/usr/lib/x86_64-linux-gnu/hdf5/serial# If Homebrew is installed at a non forExample your home directory) and use it forGeneral dependencies# Include_dirs+ = $ (Shell brew--prefix)/include# Library_dirs+ = $ (Shell brew--prefix)/lib# NCCL acceleration switch (uncomment to build with NCCL) # https://GITHUB.COM/NVIDIA/NCCL (last tested version:v1.2.3-1+cuda8.0)# USE_NCCL: =1# Uncomment to use 'Pkg-config' to specify OpenCV library paths.# (usually not necessary--OpenCV libraries is normally installedinchOne of the above $LIBRARY _dirs.) # Use_pkg_config:=1# n.b. Both build and distribute dirs is cleared on ' MakeClean ' Build_dir:=Builddistribute_dir:=distribute# Uncomment forDebugging. Does not work on OS X due to https://github.com/bvlc/caffe/issues/171# DEBUG: =1# The ID of the GPU that'Make runtest'Would use the to run unit tests. Test_gpuid:=0# Enable pretty build (comment to see full commands) Q?= @

ubuntu16.04 installing Caffe Cuda related processes

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.