来源: http://blog.csdn.net/daaikuaichuan/article/details/61414219

配置Makefile.config(参考:http://blog.csdn.net/autocyz/article/details/51783857   )
    折腾到这一步,离成功就不远了,接下来就是配置之前搁置的Makefile.config,进入caffe根目录,使用vim编辑器打开Makefile.config。
    在打开的Makefile.config修改如下内容(我自己的配置):

    USE_OPENCV := 1
USE_LEVELDB := 1
USE_LMDB := 1
CUSTOM_CXX := g++
CUDA_DIR := /usr/local/cuda-7.5
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 := atlas
MATLAB_DIR := /home/eric/MATLAB2014/R2014a
PYTHON_INCLUDE := /usr/include/python2.7 \
/usr/lib/python2.7/dist-packages/numpy/core/include
PYTHON_LIB := /usr/local/lib
WITH_PYTHON_LAYER := 1
INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/include/hdf5/serial
LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib /usr/lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu/hdf5/serial
BUILD_DIR := build
DISTRIBUTE_DIR := distribute

9、make所有文件
    进入caffe根目录,输入如下命令:

    sudo make clean
sudo make all -j4
sudo make test -j4
sudo make runtest -j4
sudo make pycaffe -j4
sudo make matcaffe -j4

在命令行下输入Python,会出现Python的一些信息,然后输入import caffe,没有报错说明配置成功。在命令行下输入matlab,会打开MATLAB软件。
    如果前面所有的配置过程都没有问题的话,最后一步应该是不会出错的。至此,caffe所有的配置项都完成了,接下来就可以愉快地使用这个强大的深度学习框架了。

下面的是我的实际用的:

## Refer to http://caffe.berkeleyvision.org/installation.html
# Contributions simplifying and improving our build system are welcome! BUILD_PYTHON:=
BUILD_MATLAB:=
BUILD_docs:=
BUILD_SHARELIB:= # cuDNN acceleration switch (uncomment to build with cuDNN).
USE_CUDNN := # CPU-only switch (uncomment to build without GPU support).
# CPU_ONLY := # uncomment to disable IO dependencies and corresponding data layers
USE_OPENCV :=
USE_LEVELDB :=
USE_LMDB := # 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 := # 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 through *_61 lines for compatibility.
# For CUDA < 8.0, comment the *_60 and *_61 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_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 for ATLAS (default)
# mkl for MKL
# open for OpenBlas
BLAS := atlas
# Custom (MKL/ATLAS/OpenBLAS) include and lib directories.
# Leave commented to accept the defaults for your choice of BLAS
# (which should work)!
BLAS_INCLUDE := /usr/include
BLAS_LIB := /usr/lib # 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 # 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/R2016b
# 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 #PYTHON_LIB:=/usr/lib/x86_64-linux-gnu/libpython2.7.so
# 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 # Uncomment to use Python (default is Python )
# PYTHON_LIBRARIES := boost_python3 python3.5m
# PYTHON_INCLUDE := /usr/include/python3.5m \
# /usr/lib/python3.5/dist-packages/numpy/core/include # We need to be able to find libpythonX.X.so or .dylib.
PYTHON_LIB := /usr/lib /usr/local/lib /usr/lib/x86_64-linux-gnu/
# 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 := # 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 # NCCL acceleration switch (uncomment to build with NCCL)
# https://github.com/NVIDIA/nccl (last tested version: v1.2.3-1+cuda8.0)
# USE_NCCL := # 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 := # N.B. both build and distribute dirs are cleared on `make clean`
BUILD_DIR := build
DISTRIBUTE_DIR := distribute # Uncomment for debugging. Does not work on OSX due to https://github.com/BVLC/caffe/issues/171
# DEBUG := # The ID of the GPU that 'make runtest' will use to run unit tests.
TEST_GPUID := # enable pretty build (comment to see full commands)
Q ?= @ #INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/include/hdf5/serial/
INCLUDE_DIRS := $(INCLUDE_DIRS) /usr/local/include /usr/include/hdf5/serial/
LIBRARIES += glog gflags protobuf boost_system boost_filesystem m hdf5_serial_hl hdf5_serial LIBRARY_DIRS:=$(LIBRARIES_DIRS) /usr/lib/x86_64-linux-gnu/hdf5/serial
sea@sea-X550JK:~/caffeM/caffe$ ll  matlab/+caffe/
总用量 76
drwxrwxr-x 5 sea sea 4096 11月 9 17:26 ./
drwxrwxr-x 5 sea sea 4096 11月 9 17:26 ../
-rw-rw-r-- 1 sea sea 2930 11月 9 17:26 Blob.m
-rw-rw-r-- 1 sea sea 1207 11月 9 17:26 get_net.m
-rw-rw-r-- 1 sea sea 298 11月 9 17:26 get_solver.m
drwxrwxr-x 2 sea sea 4096 11月 9 17:26 imagenet/
-rw-rw-r-- 1 sea sea 1742 11月 9 17:26 io.m
-rw-rw-r-- 1 sea sea 841 11月 9 17:26 Layer.m
-rw-rw-r-- 1 sea sea 4912 11月 9 17:26 Net.m
drwxrwxr-x 2 sea sea 4096 11月 10 19:48 private/
-rw-rw-r-- 1 sea sea 172 11月 9 17:26 reset_all.m
-rw-rw-r-- 1 sea sea 393 11月 9 17:26 run_tests.m
-rw-rw-r-- 1 sea sea 250 11月 9 17:26 set_device.m
-rw-rw-r-- 1 sea sea 97 11月 9 17:26 set_mode_cpu.m
-rw-rw-r-- 1 sea sea 97 11月 9 17:26 set_mode_gpu.m
-rw-rw-r-- 1 sea sea 1872 11月 9 17:26 Solver.m
drwxrwxr-x 2 sea sea 4096 11月 9 17:26 +test/
-rw-rw-r-- 1 sea sea 110 11月 9 17:26 version.m
sea@sea-X550JK:~/caffeM/caffe$
# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...). if [ "$PS1" ]; then
if [ "$BASH" ] && [ "$BASH" != "/bin/sh" ]; then
# The file bash.bashrc already sets the default PS1.
# PS1='\h:\w\$ '
if [ -f /etc/bash.bashrc ]; then
. /etc/bash.bashrc
fi
else
if [ "`id -u`" -eq 0 ]; then
PS1='# '
else
PS1='$ '
fi
fi
fi if [ -d /etc/profile.d ]; then
for i in /etc/profile.d/*.sh; do
if [ -r $i ]; then
. $i
fi
done
unset i
fi export PYTHONPATH=/usr/local:$PYTHONPATH
export PYTHONPATH=$PYTHONPATH:/home/sea/caffe2/build export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH export PYTHONPATH=/home/sea/caffeM/caffe/python:$PYTHONPATH export PATH=$PATH:/home/sea/caffeM/caffe/build/tools/:/usr/local/cuda-8.0/bin
export LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib:$LD_LIBRARY_PATH export PYTHONPATH=$PYTHONPATH:/home/sea/caffeM/caffe/python export PATH=$PATH:/usr/local/MATLAB/R2016b/bin export MATLABDIR=/usr/local/MATLAB/R2016b
export Matlab_mex=/usr/local/MATLAB/R2016b/bin/mex
export Matlab_mexext=/usr/local/MATLAB/R2016b/bin/mexext

caffe配置Makefile.config----ubuntu16.04--重点是matlab的编译的更多相关文章

  1. Ubuntu16.04+cuda9.0+matlab+opencv3.3+caffe服务器配置(问题汇总)

    Ubuntu16.04+cuda9.0+matlab+opencv3.3+caffe服务器配置(附遇到的错误和解决方法) 1.具体安装前需要的依赖包: ubuntu dependency: sudo ...

  2. MySql5.7免安装版配置过程(ubuntu16.04)

    MySql5.7免安装版配置过程(ubuntu16.04) 原创 2017年02月07日 16:58:24 标签: 1001 编辑 删除 一.安装环境: 操作系统:ubuntu16.04 数据库:my ...

  3. Ubuntu16.04下安装MATLAB 2016b!完美运行

    目录 1.下载MATLAB 2016b 2.挂载iso 3.安装MATLAB 4.破解 5.快捷键与运行 1.下载MATLAB 2016b 下载matlab 2016b for linux(可以百度搜 ...

  4. caffe学习一:ubuntu16.04下跑Faster R-CNN demo (基于caffe). (亲测有效,记录经历两天的吐血经历)

    兜兜转转,兜兜转转; 一次有一次,这次终于把Faster R-CNN 跑通了. 重要提示1:在开始跑Faster R-CNN之前一定要搞清楚用的是Python2 还是Python3. 不然你会无限次陷 ...

  5. Ubuntu16.04下的modules模块编译加载

    一.首先编写对应的驱动程序的相关内容:(最简单的hello.c程序) #include<linux/init.h> #include<linux/module.h> MODUL ...

  6. caffe学习二:py-faster-rcnn配置运行faster_rcnn_end2end-VGG_CNN_M_1024 (Ubuntu16.04)

    本文的主要目的是学习记录. 原文连接:https://blog.csdn.net/samylee/article/details/51099508 本博客中我将对py-faster-rcnn配置运行f ...

  7. caffe中Makefile.config详解

    ## Refer to http://caffe.berkeleyvision.org/installation.html # Contributions simplifying and improv ...

  8. 配置YOLO2(ubuntu16.04+cuda8.0+opencv3.1.0)

    要求已经安装好了CUDA 8.0 以及OpenCV3.1.0 YOLO官方网站 配置darknet git clone https://github.com/pjreddie/darknet cd d ...

  9. tensorflow学习笔记一------下载安装,配置环境(基于ubuntu16.04 pycharm)

    一,安装TensorFlow 安装所有必备工具 sudo apt-get install python-pip python-dev python-virtualenv 安装TensorFlow su ...

随机推荐

  1. 【bzoj1907】树的路径覆盖 树形dp

    题目描述 输入 输出 样例输入 1 7 1 2 2 3 2 4 4 6 5 6 6 7 样例输出 3 题解 树形dp 设f[x]表示以x为根的子树完成路径覆盖,且x为某条路径的一端(可以向上延伸)的最 ...

  2. 【bzoj1778】[Usaco2010 Hol]Dotp 驱逐猪猡 矩阵乘法+概率dp+高斯消元

    题目描述 奶牛们建立了一个随机化的臭气炸弹来驱逐猪猡.猪猡的文明包含1到N (2 <= N <= 300)一共N个猪城.这些城市由M (1 <= M <= 44,850)条由两 ...

  3. NOJ——1658平方和(自然数平方和公式和取模法则)

    [1658] 平方和 时间限制: 1000 ms 内存限制: 65535 K 问题描述 给你两个数n和m,求从6开始到6*n的等差数列(差值为6)的每一项的平方的和除6模m的值 (例如n=2,m=3, ...

  4. [CODEVS1911] 孤岛营救问题(分层图最短路)

    传送门 吐槽:神tm网络流... 用持有的钥匙分层,状态压缩,用 2 进制表示持有的钥匙集合. dis[i][j][k] 表示持有的钥匙集合为 k,到达点 (i, j) 的最短路径. 分层图的最短路听 ...

  5. 刷题总结——拆网线(noip模拟 贪心)

    题目: 给定一颗树··在保证有k个点与其它点连接的情况下问最少保留多少条边···· 树的节点树n和k均小于100000: 题解: 很容易看出来我们要尽量保留那种一条边连两个节点的情况···· 然后考试 ...

  6. [BZOJ4260] Codechef REBXOR (01字典树,异或前缀和)

    Description Input 输入数据的第一行包含一个整数N,表示数组中的元素个数. 第二行包含N个整数A1,A2,-,AN. Output 输出一行包含给定表达式可能的最大值. Sample ...

  7. [POJ2417]Discrete Logging(指数级同余方程)

    Discrete Logging Given a prime P, 2 <= P < 2 31, an integer B, 2 <= B < P, and an intege ...

  8. hdu 3320 计算几何(三维图形几何变换)

    openGL Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Subm ...

  9. 洛谷 P 1514 引水入城==Codevs 1066

    题目描述 在一个遥远的国度,一侧是风景秀美的湖泊,另一侧则是漫无边际的沙漠.该国的行政区划十分特殊,刚好构成一个N 行M 列的矩形,如上图所示,其中每个格子都代表一座城市,每座城市都有一个海拔高度. ...

  10. unix网络编程第2章

    time_wait状态  可靠地实现tcp全双工连接的终止; (假设客户端先关闭).服务端再关闭,服务端将发送fin ,客户端此时进入time_wait状态.客户端接收到fin.将回一个ack.如果这 ...