来源: 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修改如下内容(我自己的配置):

  1. USE_OPENCV := 1
  2. USE_LEVELDB := 1
  3. USE_LMDB := 1
  4. CUSTOM_CXX := g++
  5. CUDA_DIR := /usr/local/cuda-7.5
  6. CUDA_ARCH := -gencode arch=compute_20,code=sm_20 \
  7. -gencode arch=compute_20,code=sm_21 \
  8. -gencode arch=compute_30,code=sm_30 \
  9. -gencode arch=compute_35,code=sm_35 \
  10. -gencode arch=compute_50,code=sm_50 \
  11. -gencode arch=compute_50,code=compute_50
  12. BLAS := atlas
  13. MATLAB_DIR := /home/eric/MATLAB2014/R2014a
  14. PYTHON_INCLUDE := /usr/include/python2.7 \
  15. /usr/lib/python2.7/dist-packages/numpy/core/include
  16. PYTHON_LIB := /usr/local/lib
  17. WITH_PYTHON_LAYER := 1
  18. INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/include/hdf5/serial
  19. LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib /usr/lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu/hdf5/serial
  20. BUILD_DIR := build
  21. DISTRIBUTE_DIR := distribute

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

  1. sudo make clean
  2. sudo make all -j4
  3. sudo make test -j4
  4. sudo make runtest -j4
  5. sudo make pycaffe -j4
  6. sudo make matcaffe -j4

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

下面的是我的实际用的:

  1. ## Refer to http://caffe.berkeleyvision.org/installation.html
  2. # Contributions simplifying and improving our build system are welcome!
  3.  
  4. BUILD_PYTHON:=
  5. BUILD_MATLAB:=
  6. BUILD_docs:=
  7. BUILD_SHARELIB:=
  8.  
  9. # cuDNN acceleration switch (uncomment to build with cuDNN).
  10. USE_CUDNN :=
  11.  
  12. # CPU-only switch (uncomment to build without GPU support).
  13. # CPU_ONLY :=
  14.  
  15. # uncomment to disable IO dependencies and corresponding data layers
  16. USE_OPENCV :=
  17. USE_LEVELDB :=
  18. USE_LMDB :=
  19.  
  20. # uncomment to allow MDB_NOLOCK when reading LMDB files (only if necessary)
  21. # You should not set this flag if you will be reading LMDBs with any
  22. # possibility of simultaneous read and write
  23. # ALLOW_LMDB_NOLOCK :=
  24.  
  25. # Uncomment if you're using OpenCV 3
  26. # OPENCV_VERSION := 3
  27.  
  28. # To customize your choice of compiler, uncomment and set the following.
  29. # N.B. the default for Linux is g++ and the default for OSX is clang++
  30. CUSTOM_CXX := g++
  31.  
  32. # CUDA directory contains bin/ and lib/ directories that we need.
  33. CUDA_DIR := /usr/local/cuda
  34. # On Ubuntu 14.04, if cuda tools are installed via
  35. # "sudo apt-get install nvidia-cuda-toolkit" then use this instead:
  36. # CUDA_DIR := /usr
  37.  
  38. # CUDA architecture setting: going with all of them.
  39. # For CUDA < 6.0, comment the *_50 through *_61 lines for compatibility.
  40. # For CUDA < 8.0, comment the *_60 and *_61 lines for compatibility.
  41. CUDA_ARCH := -gencode arch=compute_20,code=sm_20 \
  42. -gencode arch=compute_20,code=sm_21 \
  43. -gencode arch=compute_30,code=sm_30 \
  44. -gencode arch=compute_35,code=sm_35 \
  45. -gencode arch=compute_50,code=sm_50 \
  46. -gencode arch=compute_52,code=sm_52 \
  47. -gencode arch=compute_60,code=sm_60 \
  48. -gencode arch=compute_61,code=sm_61 \
  49. -gencode arch=compute_61,code=compute_61
  50.  
  51. # BLAS choice:
  52. # atlas for ATLAS (default)
  53. # mkl for MKL
  54. # open for OpenBlas
  55. BLAS := atlas
  56. # Custom (MKL/ATLAS/OpenBLAS) include and lib directories.
  57. # Leave commented to accept the defaults for your choice of BLAS
  58. # (which should work)!
  59. BLAS_INCLUDE := /usr/include
  60. BLAS_LIB := /usr/lib
  61.  
  62. # Homebrew puts openblas in a directory that is not on the standard search path
  63. # BLAS_INCLUDE := $(shell brew --prefix openblas)/include
  64. # BLAS_LIB := $(shell brew --prefix openblas)/lib
  65.  
  66. # This is required only if you will compile the matlab interface.
  67. # MATLAB directory should contain the mex binary in /bin.
  68. MATLAB_DIR := /usr/local/MATLAB/R2016b
  69. # MATLAB_DIR := /Applications/MATLAB_R2012b.app
  70.  
  71. # NOTE: this is required only if you will compile the python interface.
  72. # We need to be able to find Python.h and numpy/arrayobject.h.
  73. PYTHON_INCLUDE := /usr/include/python2.7 \
  74. /usr/lib/python2.7/dist-packages/numpy/core/include
  75.  
  76. #PYTHON_LIB:=/usr/lib/x86_64-linux-gnu/libpython2.7.so
  77. # Anaconda Python distribution is quite popular. Include path:
  78. # Verify anaconda location, sometimes it's in root.
  79. # ANACONDA_HOME := $(HOME)/anaconda
  80. # PYTHON_INCLUDE := $(ANACONDA_HOME)/include \
  81. # $(ANACONDA_HOME)/include/python2.7 \
  82. # $(ANACONDA_HOME)/lib/python2.7/site-packages/numpy/core/include
  83.  
  84. # Uncomment to use Python (default is Python )
  85. # PYTHON_LIBRARIES := boost_python3 python3.5m
  86. # PYTHON_INCLUDE := /usr/include/python3.5m \
  87. # /usr/lib/python3.5/dist-packages/numpy/core/include
  88.  
  89. # We need to be able to find libpythonX.X.so or .dylib.
  90. PYTHON_LIB := /usr/lib /usr/local/lib /usr/lib/x86_64-linux-gnu/
  91. # PYTHON_LIB := $(ANACONDA_HOME)/lib
  92.  
  93. # Homebrew installs numpy in a non standard path (keg only)
  94. # PYTHON_INCLUDE += $(dir $(shell python -c 'import numpy.core; print(numpy.core.__file__)'))/include
  95. # PYTHON_LIB += $(shell brew --prefix numpy)/lib
  96.  
  97. # Uncomment to support layers written in Python (will link against Python libs)
  98. WITH_PYTHON_LAYER :=
  99.  
  100. # Whatever else you find you need goes here.
  101. INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include
  102. LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib
  103.  
  104. # If Homebrew is installed at a non standard location (for example your home directory) and you use it for general dependencies
  105. # INCLUDE_DIRS += $(shell brew --prefix)/include
  106. # LIBRARY_DIRS += $(shell brew --prefix)/lib
  107.  
  108. # NCCL acceleration switch (uncomment to build with NCCL)
  109. # https://github.com/NVIDIA/nccl (last tested version: v1.2.3-1+cuda8.0)
  110. # USE_NCCL :=
  111.  
  112. # Uncomment to use `pkg-config` to specify OpenCV library paths.
  113. # (Usually not necessary -- OpenCV libraries are normally installed in one of the above $LIBRARY_DIRS.)
  114. # USE_PKG_CONFIG :=
  115.  
  116. # N.B. both build and distribute dirs are cleared on `make clean`
  117. BUILD_DIR := build
  118. DISTRIBUTE_DIR := distribute
  119.  
  120. # Uncomment for debugging. Does not work on OSX due to https://github.com/BVLC/caffe/issues/171
  121. # DEBUG :=
  122.  
  123. # The ID of the GPU that 'make runtest' will use to run unit tests.
  124. TEST_GPUID :=
  125.  
  126. # enable pretty build (comment to see full commands)
  127. Q ?= @
  128.  
  129. #INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/include/hdf5/serial/
  130. INCLUDE_DIRS := $(INCLUDE_DIRS) /usr/local/include /usr/include/hdf5/serial/
  131. LIBRARIES += glog gflags protobuf boost_system boost_filesystem m hdf5_serial_hl hdf5_serial
  132.  
  133. LIBRARY_DIRS:=$(LIBRARIES_DIRS) /usr/lib/x86_64-linux-gnu/hdf5/serial
  1. sea@sea-X550JK:~/caffeM/caffe$ ll matlab/+caffe/
  2. 总用量 76
  3. drwxrwxr-x 5 sea sea 4096 11 9 17:26 ./
  4. drwxrwxr-x 5 sea sea 4096 11 9 17:26 ../
  5. -rw-rw-r-- 1 sea sea 2930 11 9 17:26 Blob.m
  6. -rw-rw-r-- 1 sea sea 1207 11 9 17:26 get_net.m
  7. -rw-rw-r-- 1 sea sea 298 11 9 17:26 get_solver.m
  8. drwxrwxr-x 2 sea sea 4096 11 9 17:26 imagenet/
  9. -rw-rw-r-- 1 sea sea 1742 11 9 17:26 io.m
  10. -rw-rw-r-- 1 sea sea 841 11 9 17:26 Layer.m
  11. -rw-rw-r-- 1 sea sea 4912 11 9 17:26 Net.m
  12. drwxrwxr-x 2 sea sea 4096 11 10 19:48 private/
  13. -rw-rw-r-- 1 sea sea 172 11 9 17:26 reset_all.m
  14. -rw-rw-r-- 1 sea sea 393 11 9 17:26 run_tests.m
  15. -rw-rw-r-- 1 sea sea 250 11 9 17:26 set_device.m
  16. -rw-rw-r-- 1 sea sea 97 11 9 17:26 set_mode_cpu.m
  17. -rw-rw-r-- 1 sea sea 97 11 9 17:26 set_mode_gpu.m
  18. -rw-rw-r-- 1 sea sea 1872 11 9 17:26 Solver.m
  19. drwxrwxr-x 2 sea sea 4096 11 9 17:26 +test/
  20. -rw-rw-r-- 1 sea sea 110 11 9 17:26 version.m
  21. sea@sea-X550JK:~/caffeM/caffe$
  1. # /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
  2. # and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).
  3.  
  4. if [ "$PS1" ]; then
  5. if [ "$BASH" ] && [ "$BASH" != "/bin/sh" ]; then
  6. # The file bash.bashrc already sets the default PS1.
  7. # PS1='\h:\w\$ '
  8. if [ -f /etc/bash.bashrc ]; then
  9. . /etc/bash.bashrc
  10. fi
  11. else
  12. if [ "`id -u`" -eq 0 ]; then
  13. PS1='# '
  14. else
  15. PS1='$ '
  16. fi
  17. fi
  18. fi
  19.  
  20. if [ -d /etc/profile.d ]; then
  21. for i in /etc/profile.d/*.sh; do
  22. if [ -r $i ]; then
  23. . $i
  24. fi
  25. done
  26. unset i
  27. fi
  28.  
  29. export PYTHONPATH=/usr/local:$PYTHONPATH
  30. export PYTHONPATH=$PYTHONPATH:/home/sea/caffe2/build
  31.  
  32. export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
  33.  
  34. export PYTHONPATH=/home/sea/caffeM/caffe/python:$PYTHONPATH
  35.  
  36. export PATH=$PATH:/home/sea/caffeM/caffe/build/tools/:/usr/local/cuda-8.0/bin
  37. export LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib:$LD_LIBRARY_PATH
  38.  
  39. export PYTHONPATH=$PYTHONPATH:/home/sea/caffeM/caffe/python
  40.  
  41. export PATH=$PATH:/usr/local/MATLAB/R2016b/bin
  42.  
  43. export MATLABDIR=/usr/local/MATLAB/R2016b
  44. export Matlab_mex=/usr/local/MATLAB/R2016b/bin/mex
  45. 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. 【bzoj4128】Matrix 矩阵乘法+Hash+BSGS

    题目描述 给定矩阵A,B和模数p,求最小的x满足 A^x = B (mod p) 输入 第一行两个整数n和p,表示矩阵的阶和模数,接下来一个n * n的矩阵A.接下来一个n * n的矩阵B 输出 输出 ...

  2. 【Luogu】P2473奖励关(期望DP)

    题目链接 逆推期望DP.设f[i][j]为1~i-1中吃到的宝物集合为j,在i~k轮能得到的最大期望分数. 如果不吃显然f[i][j]+=f[i+1][j]/n 如果吃就是f[i][j]+=max(f ...

  3. [luoguP2463] [SDOI2008]Sandy的卡片(后缀数组 + st表)

    传送门 很容易想到,题目中的相同是指差分数组相同. 那么可以把差分数组连起来,中间加上一个没有出现过的且字典序小的数 双指针移动,用st表维护height数组中的最小值. 当然用单调队列应该也可以且更 ...

  4. JDBC链接mysql,时间时0000-00-00 00:00:00时报错

    应为mysql默认最小timestamp是0001-01-01 00:00:00,所以查询出来会报错 需要加在链接的url中加入 &zeroDateTimeBehavior=convertTo ...

  5. 关于cookie使用的一些问题

    保存cookie后提取出来发现字符串是被编码过的,需要decodeURIComponent进行下解码才可以 设置cookie setCookie(c_name, value, expiredays) ...

  6. xsy 1845 - GCD

    from NOIP2016模拟题34 Description 给定一个长度\(n\le 10^6\)的序列, 给定\(A, B\) 给出一个序列,要求你通过如下两个操作使得序列中所有数的最大公约数大于 ...

  7. udp 多播

    先来了解下UDP UDP 是UserDatagram Protocol的简称, 中文名是用户数据报协议,是OSI(Open System Interconnection,开放式系统互联) 参考模型中一 ...

  8. select、poll和epoll的区别(转载)

    select,poll,epoll都是IO多路复用的机制.I/O多路复用就通过一种机制,可以监视多个描述符,一旦某个描述符就绪(一般是读就绪或者写就绪),能够通知程序进行相应的读写操作.但select ...

  9. 致命错误:ext/standard/php_smart_str.h:没有那个文件或目录

    致命错误:ext/standard/php_smart_str.h:没有那个文件或目录 参考文章:https://blog.csdn.net/jartins/article/details/80371 ...

  10. Codeforces 600E Lomsat gelral (树上启发式合并)

    题目链接 Lomsat gelral 占坑……等深入理解了再来补题解…… #include <bits/stdc++.h> using namespace std; #define rep ...