这里我们安装openblas主要有两种方法:
- 通过git代码到本地并安装
- 通过brew来安装
git到本地编译安装.
- git代码到本地并安装
git clone https://github.com/xianyi/OpenBLAS.git
cd OpenBLAS
make -j4
make install
- 修改Caffe的
Makefile.config
BLAS := open
BLAS_INCLUDE := /opt/OpenBLAS/include
BLAS_LIB := /opt/OpenBLAS/lib
- caffe重新make
make clean
make pycaffe
make all -j4
make test && runtest
使用brew进行安装
brew uninstall openblas; brew install --fresh -vd openblas.
运行上面命令安装openblas- 更改
Makefile.config
# 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
- 重新编译
如果有些人遇到了这种错误
In file included from src/caffe/util/blocking_queue.cpp:5:
In file included from ./include/caffe/layers/base_data_layer.hpp:9:
In file included from ./include/caffe/layer.hpp:12:
In file included from ./include/caffe/util/math_functions.hpp:11:
./include/caffe/util/mkl_alternate.hpp:14:10: fatal error: 'cblas.h' file not found
#include <cblas.h>
^
1 error generated.
make: *** [.build_release/src/caffe/util/blocking_queue.o] Error 1
可以试试这个命令:
cmake -DCMAKE_CXX_FLAGS=-I/usr/local/opt/openblas/include ..