环境
操作系统:OS X EI Capitan 10.11.6
图形卡:Intel HD Graphics 4000 1536 MB
因此不能使用nvidia的cuda和cudnn的GPU加速功能,只能使用CPU进行计算
安装homebrew
最好清除干净/usr/local/Cellar文件夹下的所有内容,安装最新版的homebrew,不然后期会有些问题
安装Caffe依赖包
$ brew install -vd snappy leveldb lmdb gflags glog szip
$ brew tap homebrew/science
$ brew install hdf5 opencv
$ brew install protobuf boost wget
下载Caffe源码
$ git clone https://github.com/bvlc/caffe.git
$ cd caffe/
$ mv Makefile.config.example Makefile.config
修改Makefile.config
使用CPU模式
CPU_ONLY := 1
执行编译
# -j 表示多线程编译,利用所有可以用的CPU,加快便以速度
# -j8 表示开启8个线程编译
make -j
问题
安装过程中提示找不到atlas
BLAS(Basic Linear Algebra Subprograms)基础线性代数子程序库有三个版本Atlas, MLK, OpenBLAS
- Atlas(Automatic Tuned Linear Algebra Software),在Mac本上其实就是Framework,但实际上好像我的Mac本并没有安装
- MLK,Intel的产品,据说速度最快,为了快速入手,先安装了OpenBLAS
安装OpenBLAS
$ brew install openblas
修改Makefile.config中关于BLAS的配置
BLAS := open BLAS_INCLUDE := /usr/local/Cellar/openblas/0.2.18_2/include BLAS_LIB := /usr/local/Cellar/openblas/0.2.18_2/lib