Caffe编译 Mnist训练测试

Caffe编译

进入目录/caffe-master/,输入下列命令编译整个caffe工程

make clean
make all 

补充说明:很多添加编译选项,据说是为利用cpu的4个核并行编译加快编译效率,然而这里编译时报错所以就make all。其实make all 编译些什么可以看同目录下的Makefile文件。
补充说明:在make all 之前需要修改Makefile.config.example文件具体修改说明如下:

## 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
//CuDNN是NVIDIA 出的专门针对Deep Learning框架设计的一套GPU计算加速库,用于实现高性能的并行计算。在有GPU并且安装cudnn的情况下可以打开即将注释去掉。

# CPU-only switch (uncomment to build without GPU support).
#CPU_ONLY := 1
//表示是否用gpu如果只有cpu这里要打开,如果只有一个gpu建议不要打开,测试过只有一个gpu的情况下,速度并未得到提升反而更慢,当然可以打开gpu尝试下啦~

# uncomment to disable IO dependencies and corresponding data layers
USE_OPENCV := 1
# USE_LEVELDB := 0
# USE_LMDB := 0
//因为要用到opencv库所以要打开,下面这两个选项表示是选择caffe的数据管理第三方库,两者都不打开 caffe默认用的是LMDB,这两者均是嵌入式数据库管理系统编程库,详细介绍:http://www.cnblogs.com/yymn/p/4479216.html

# 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
//打开这个注释是当需要读取LMDB文件时,默认不打开,所以不取消注释

# Uncomment if you're using OpenCV 3
OPENCV_VERSION := 2.4.10
//用pkg-config --modversion opencv命令查看opencv版本
# 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++
//linux系统一般用得都是g++编译器

# CUDA directory contains bin/ and lib/ directories that we need.
CUDA_DIR := /usr/local/cuda
//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
//这些是指gpu的计算能力,6.0以下的版本不支持×_50的计算能力,这里有个链接介绍:http://www.tuicool.com/articles/qUN322z

# BLAS choice:
# atlas for ATLAS (default)
# mkl for MKL
# open for OpenBlas
BLAS := open
//BLAS这个值如果用的是atlas计算库则赋值ATLAS,mkl计算库则用MKL赋值,OpenBlas则赋值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 := /usr/local/OpenBlas/include
BLAS_LIB := /usr/local/OpenBlas/lib
//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
//如果不是安装在标准路径则要指明

# 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
//matlab安装库的目录

# 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安装目录
# 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 \
  • 3
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值