環(huán)境
操作系統(tǒng):OS X EI Capitan 10.11.6
圖形卡:Intel HD Graphics 4000 1536 MB
因此不能使用nvidia的cuda和cudnn的GPU加速功能,只能使用CPU進(jìn)行計(jì)算
安裝homebrew
最好清除干凈/usr/local/Cellar文件夾下的所有內(nèi)容,安裝最新版的homebrew,不然后期會(huì)有些問題
安裝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
執(zhí)行編譯
# -j 表示多線程編譯,利用所有可以用的CPU,加快便以速度
# -j8 表示開啟8個(gè)線程編譯
make -j
問題
安裝過程中提示找不到atlas
BLAS(Basic Linear Algebra Subprograms)基礎(chǔ)線性代數(shù)子程序庫有三個(gè)版本Atlas, MLK, OpenBLAS
- Atlas(Automatic Tuned Linear Algebra Software),在Mac本上其實(shí)就是Framework,但實(shí)際上好像我的Mac本并沒有安裝
- MLK,Intel的產(chǎn)品,據(jù)說速度最快,為了快速入手,先安裝了OpenBLAS
安裝OpenBLAS
$ brew install openblas
修改Makefile.config中關(guān)于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