caffe安装的过程(ubuntu16.04+GTX1060),以及问题分析

安装过程参考 下面路径

http://blog.csdn.net/darren2015zdc/article/details/53980038

以下内容是杂乱的集合,没有来得及整理。

matlab  opencv的安装 暂时缺

初涉深度学习, 安装caffe,一路跌跌撞撞,掉了不少坑,但终于还是实现了,做个纪念吧。   2016年12月11日。

电脑配置:i5 6500, 8G 内存, 显卡GTX1060  6G,   系统:ubuntu 16.04 .


参考:

1. http://blog.csdn.net/v_july_v/article/details/52810219

教你从头到尾利用DQN自动玩flappy bird(全程命令提示,GPU+CPU版)

2. https://www.zybuluo.com/hanxiaoyang/note/364737

linux(ubuntu)下的caffe编译安装

http://blog.csdn.net/v_july_v/article/details/52658965

教你从头到尾利用DL学梵高作画:GTX 1070 cuda 8.0 tensorflow gpu版




http://www.cnblogs.com/clockwork/p/6138356.html

Upgrade Bash on Ubuntu from 14.04 to 16.04

http://blog.csdn.net/xue_wenyuan/article/details/52037121

caffe 编译中出现的错误——fatal error: hdf5.h: 没有那个文件或目录

http://blog.csdn.net/xiaxiazls/article/details/52039473

Caffe 环境搭建中应注意的问题

http://blog.csdn.net/thesby/article/details/50791469

python caffe libcaffe.so.1.0.0-rc3: cannot open shared object file

http://blog.csdn.net/kaka20080622/article/details/40706813

error while loading shared libraries: libcudart.so.6.5: cannot open shared object file: No such file

https://my.oschina.net/peterlie/blog/661994

安装caffe过程记录

http://www.cnblogs.com/Anker/p/3209876.html

error while loading shared libraries: xxx.so.x" 错误的原因和解决办法

http://blog.csdn.net/v_july_v/article/details/53086367

手把手教你搭建caffe及手写数字识别(Ubuntu下且附mac、纯小白教程)

其中protobuf是用来定义layers的,leveldb是训练时存储图片数据的数据库,opencv是图像处理库,boost是通用C++库,等等...
http://caffe.berkeleyvision.org/install_apt.html

sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev protobuf-compiler
sudo apt-get install --no-install-recommends libboost-all-dev

CUDA: Install by apt-get or the NVIDIA .run package. 
The NVIDIA package tends to follow more recent library and driver versions, but the installation is more manual. If installing from packages, install the library and latest driver separately; the driver bundled with the library is usually out-of-date. This can be skipped for CPU-only installation.
BLAS: install ATLAS by sudo apt-get install libatlas-base-dev or install OpenBLAS or MKL for better CPU performance.
Python (optional): if you use the default Python you will need to sudo apt-get install the python-devpackage to have the Python headers for building the pycaffe interface.
Compatibility notes, 16.04
CUDA 8 is required on Ubuntu 16.04.
Remaining dependencies, 14.04
Everything is packaged in 14.04.
    sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev

.安装科学计算和python所需的部分库

sudo apt-get install openblas-dev numpy scipy matplotlib lapack-dev freetype-dev libpng-dev openblas-dev

5.安装其余依赖

sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev

6.安装git,拉取源码

apt-get install git

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

7.安装python的pip和easy_install,方便安装软件包

wget --no-check-certificate https://bootstrap.pypa.io/ez_setup.py 
python ez_setup.py --insecure

wget https://bootstrap.pypa.io/get-pip.py

python get-pip.py

8.安装python依赖(路径根据自己的目录可能要调一下)

cd caffe/python

执行 
for req in $(cat requirements.txt); do pip install $req; done

这步安装也有点慢,别急,等会儿,先去干点别的 ^_^

9.编辑caffe所需的Makefile文件

cd caffe 
cp Makefile.config.example Makefile.config 
vim Makefile.config 
Makefile.config里面有依赖库的路径,及各种编译配置,如果是没有GPU的情况下,可以参照我下面帮你改的配置文件内容:

## Refer to http://caffe.berkeleyvision.org/installation.html
# Contributions simplifying and improving our build system are 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 (only if necessary)
#       You should not set this flag if you will be reading LMDBs with any
#       possibility of simultaneous read and write
# ALLOW_LMDB_NOLOCK := 1
# Uncomment if you're using OpenCV 3
# OPENCV_VERSION := 3
# To customize your choice of compiler, uncomment and set the following.
# N.B. the default for Linux is g++ and the default for OSX is clang++
# CUSTOM_CXX := g++
# CUDA directory contains bin/ and lib/ directories that we need.
CUDA_DIR := /usr/local/cuda
# On Ubuntu 14.04, if cuda tools are installed via
# "sudo apt-get install nvidia-cuda-toolkit" then use this instead:
# CUDA_DIR := /usr
# CUDA architecture setting: going with all of them.
# For CUDA < 6.0, comment the *_50 lines for compatibility.
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_50,code=compute_50
# BLAS choice:
# atlas for ATLAS (default)
# mkl for MKL
# open for OpenBlas
#BLAS := atlas
BLAS := open
# Custom (MKL/ATLAS/OpenBLAS) include and lib directories.
# Leave commented to accept the defaults for your choice of BLAS
# (which should work)!
# BLAS_INCLUDE := /path/to/your/blas
# BLAS_LIB := /path/to/your/blas
# Homebrew puts openblas in a directory that is not on the standard search path
# BLAS_INCLUDE := $(shell brew --prefix openblas)/include
# BLAS_LIB := $(shell brew --prefix openblas)/lib
BLAS_INCLUDE := /usr/include/openblas
# This is required only if you will compile the matlab interface.
# MATLAB directory should contain the mex binary in /bin.
# MATLAB_DIR := /usr/local
# MATLAB_DIR := /Applications/MATLAB_R2012b.app
# NOTE: this is required only if you will compile the python interface.
# We need to be able to find Python.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)/anaconda
# PYTHON_INCLUDE := $(ANACONDA_HOME)/include \
                # $(ANACONDA_HOME)/include/python2.7 \
                # $(ANACONDA_HOME)/lib/python2.7/site-packages/numpy/core/include \
# We need to be able to find libpythonX.X.so or .dylib.
PYTHON_LIB := /usr/lib
# PYTHON_LIB := $(ANACONDA_HOME)/lib
# Homebrew installs numpy in a 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 written in Python (will link against Python libs)
WITH_PYTHON_LAYER := 1
# Whatever else you find you need goes here.
INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include
LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib
# If Homebrew is installed at a non standard location (for example your home directory) and you use it for general dependencies
# INCLUDE_DIRS += $(shell brew --prefix)/include
# LIBRARY_DIRS += $(shell brew --prefix)/lib
# Uncomment to use `pkg-config` to specify OpenCV library paths.
# (Usually not necessary -- OpenCV libraries are normally installed in one of the above $LIBRARY_DIRS.)
# USE_PKG_CONFIG := 1
BUILD_DIR := build
DISTRIBUTE_DIR := distribute
# Uncomment for debugging. Does not work on OSX due to https://github.com/BVLC/caffe/issues/171
# DEBUG := 1
# The ID of the GPU that 'make runtest' will use to run unit tests.
TEST_GPUID := 0
# enable pretty build (comment to see full commands)
Q ?= @

10.编译caffe

make -j4 
编译可能会有点慢,你可以先去干点别的事情

  • 测试一下编译结果 
    make test 
    make runtest

11.编译pycaffe

make pycaffe -j4


第一部分、GPU版教程

1.1NVIDIA驱动、CUDAcudnn安装

下载相应文件,后续 使用,下载地址 : 

  • NVIDIA驱动    http://www.geforce.cn/drivers   (搜索 对应型号)
  • CUDA驱动  https://developer.nvidia.com/cuda-toolkit (搜索对应版本)
  • CUDNN驱动  https://developer.nvidia.com/cudnn

以下操作均使用root账户 

apt-get update (更新源)

apt-get install vim (安装VIM,也可使用 emacs nano

vi /etc/default/grub (进入grub文件)

启用字符界面登录

将这行     GRUB_CMDLINE_LINUX_DEFAULT="quiet"  中的 quiet 修改为 text

GRUB_CMDLINE_LINUX_DEFAULT="text"

保存退出

update-grub2 (更新一下)

reboot (重启)



ubuntu彻底卸载软件

http://blog.csdn.net/u012581999/article/details/52433609

ubuntu16.04 NVIDIA显卡驱动安装

1、打开终端,先删除旧的驱动:

sudo apt-get purge nvidia*


2禁用自带的 nouveau nvidia驱动 (important!)

创建一个文件通过命令 sudo vim /etc/modprobe.d/blacklist-nouveau.conf

并添加如下内容:

blacklist nouveau
options nouveau modeset=0

再更新一下

sudo update-initramfs -u

 
   修改后需要重启系统。确认下Nouveau是已经被你干掉,使用命令: lsmod | grep nouveau 
   


3重启系统至init 3(文本模式),也可先进入图形桌面再运行init 3进入文本模式,再安装下载的驱动就无问题,

首先我们需要结束x-window的服务,否则驱动将无法正常安装

关闭X-Window,很简单:sudo service lightdm stop,然后切换到tty1控制台:Ctrl+Alt+F1即可


4接下来就是最关键的一步了:sudo ./NVIDIA.run开始安装,安装过程比较快,根据提示选择即可

最后安装完毕后,重新启动X-Windowsudo service lightdm start,然后Ctrl+Alt+F7进入图形界面;


如果安装后驱动程序工作不正常,使用下面的命令进行卸载:

sudo sh ~/NVIDIA-Linux-x86_64-367.44.run --uninstall


5

nvidia-smi

nvidia-settings

ppc64

ppc64是 Linux和 GCC开源软件社区内常用的,指向目标架构为64位 PowerPC和Power Architecture处理器,并对此优化的应用程序的标识符,编译源代码时经常使用。
ppc64le是一个已经推出了纯小端模式, POWER8作为首要目标,OpenPower基金会基础的技术,试图使基于x86的 Linux软件的移植工作以最小的工作量进行。
一开始,出现一个问题

转自:http://blog.csdn.net/blueheart20/article/details/51901867   Ubuntu 16.04下安装sogou 拼音输入法的错误问题

sogoupinyin : Depends: libopencc2 but it is not installable or  
libopencc1 but it is not going to be installed  
Depends: fcitx-libs (>= 4.2.7) but it is not going to be installed  
Depends: fcitx-libs-qt (>= 4.2.7) but it is not going to be installed  
Recommends: fonts-droid-fallback but it is not going to be installed or  
fonts-droid but it is not installable  
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).  
大部分的 linux 的安装命令出现这个问题提示

sudo apt remove sogoupinyin 

然后,可以正常使用其他安装命令。









参考:

1. http://blog.csdn.net/v_july_v/article/details/52810219

教你从头到尾利用DQN自动玩flappy bird(全程命令提示,GPU+CPU版)

http://blog.csdn.net/blueheart20/article/details/51901867

Ubuntu 16.04下安装sogou 拼音输入法的错误问题

你可能感兴趣的:(caffe)