X86平台下,Caffe_MKL安装详解
Posted Dream_yz
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了X86平台下,Caffe_MKL安装详解相关的知识,希望对你有一定的参考价值。
X86平台下,Caffe_MKL安装详解
安装相关依赖
ffmpeg安装
1) 下载
ffmpeg-3.3.9.tar.bz2
2) 配置
./configure --enable-swscale --enable-avresample–enable-gpl --enable-shared --prefix=/home/yzhang/env/ffmpeg
3) 编译
make -j
4) 安装
make install
5) 配置:
vim ~/.basrc,添加如下配置:
export LD_LIBRARY_PATH=/home/yzhang/env/ffmpeg/lib:$ LD_LIBRARY_PATH
export PATH=/home/yzhang/env/ffmpeg/bin:$PATH
export PKG_CONFIG_PATH=/home/yzhang/env/ffmpeg/lib/pkgconfig:$PKG_CONFIG_PATH
Opencv安装
1) 下载
opencv-3.4.3_1.zip
opencv_contrib-3.4.3_1.zip
face_landmark_model.dat
ippicv_2017u3_lnx_intel64_general_20180518.tgz
2) 配置
vim ./opencv-3.4.3/3rdparty/ippicv/ippicv.cmake
修改47行
改成file://对应路径
vim ./opencv_contrib-3.4.3/modules/face/CMakeLists.txt
修改19行
改成file://对应路径
mkdir build
cd build
cmake-DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/home/yzhang/env/opencv -DOPENCV_EXTRA_MODULES_PATH=/home/yzhang/sf/opencv_contrib-3.4.3/modules/ -DOPENCV_ENABLE_NONFREE:BOOL=ON …
3) 编译
make j
4) 安装
make install
5) 配置
vim ~/.basrc,添加如下配置:
export LD_LIBRARY_PATH=/home/yzhang/env/opencv/lib64: $LD_LIBRARY_PATH
boost库安装
1) 下载
boost_1_68_0_1.tar.gz
2) 配置
./bootstrap.sh --with-libraries=all --with-toolset=gcc
3) 编译
./b2 toolset=gcc
4) 安装
./b2 install --prefix=/home/yzhang/env/boost
5) 配置
vim ~/.basrc,添加如下配置:
export LD_LIBRARY_PATH=/home/yzhang/env/boost/lib:$ LD_LIBRARY_PATH
cmake-3.12安装
1) 下载
cmake-3.12.2.tar.gz
2) 配置
./configure –prefix=/home/yzhang/env/cmake
3) 编译
make -j
4) 安装
make install
5) 配置
vim ~/.basrc,添加如下配置:
export PATH= /home/yzhang/env/cmake/bin:$PATH
MKL安装
1) 下载
l_mkl_2019.3.199.tgz
2) 配置
vim silent.cfg
修改如下
原来:PSET_INSTALL_DIR=/opt/intel
改后:PSET_INSTALL_DIR=/home/yzhang/env/mkl
3) 编译与安装
./install.sh,默认选项安装即可
4) 配置
export LD_LIBRARY_PATH= /home/yzhang/env/mkl/intel/lib/intel64:/home/yzhang/env/mkl/intel/mkl/lib/intel64:$LD_LIBRARY_PATH
export PATH=/home/yzhang/env/mkl/intel/bin:$PATH
gflags安装
1) 下载
git clone https://github.com/gflags/gflags
2) 配置
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=/home/yzhang/env/gflags -D BUILD_SHARED_LIBS=on …
3) 编译
make -j
4) 安装
make install
5) 配置
vim ~/.basrc,添加如下配置:
export LD_LIBRARY_PATH=/home/yzhang/env/gflags/lib:$ LD_LIBRARY_PATH
glogs安装
1) 下载
git clone https://github.com/google/glog.git
2) 配置
./configure –prefix=/home/yzhang/env/glog
3) 编译
make -j
4) 安装
make install
5) 配置
vim ~/.basrc,添加如下配置:
export LD_LIBRARY_PATH=/home/yzhang/env/glog/lib:$ LD_LIBRARY_PATH
hdf5安装
1) 下载
hdf5-1.10.4.tar.gz
2) 配置
./configure –prefix=/home/yzhang/env/hdf5
3) 编译
make -j
4) 安装
make install
5) 配置
vim ~/.basrc,添加如下配置:
export LD_LIBRARY_PATH=/home/yzhang/env/hdf5/lib:$ LD_LIBRARY_PATH
export PATH=/home/yzhang/env/proto/bin:$PATH
lmdb安装
1) 安装
git clone https://github.com/LMDB/lmdb.git
2) 配置
vim Makefile
修改prefix = /home/yzhang/env/lmdb
3) 编译
make -j
4) 安装
make install
5) 配置
vim ~/.basrc,添加如下配置:
export LD_LIBRARY_PATH=/home/yzhang/env/lmdb/lib:$ LD_LIBRARY_PATH
leveldb安装
1) 安装
leveldb-1.20.zip
2) 编译
make -j
3) 安装
cp .-r /include /home/yzhang/env/leveldb/
cp ./lib/out-shared/libleveldb.so.1.20 /home/yzhang/env/leveldb/lib
ln -s /home/yzhang/env/leveldb/lib/libleveldb.so.1.20 /home/yzhang/env/leveldb/lib/libleveldb.so.1
ln -s /home/yzhang/env/leveldb/lib/libleveldb.so.1.20 /home/yzhang/env/leveldb/lib/libleveldb.so
4) 配置
vim ~/.basrc,添加如下配置:
export LD_LIBRARY_PATH=/home/yzhang/env/leveldb/lib:$ LD_LIBRARY_PATH
snappy安装
1) 下载
git clone https://github.com/google/snappy
2) 配置
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=/home/yzhang/env/snappy -D BUILD_SHARED_LIBS=on …
3) 编译
make -j
4) 安装
make install
5) 配置
vim ~/.basrc,添加如下配置:
export LD_LIBRARY_PATH=/home/yzhang/env/snappy/lib64:$ LD_LIBRARY_PATH
protobuf安装
1) 下载
protobuf-all-3.6.1.tar.gz
2) 配置
./configure –prefix=/home/yzhang/env/proto
3) 编译
make -j
make check -j
4) 安装
make install
5) 配置
vim ~/.basrc,添加如下配置:
export LD_LIBRARY_PATH=/home/yzhang/env/proto/lib:$ LD_LIBRARY_PATH
Caffe安装
1) 下载
git clone https://github.com/BVLC/caffe.git
2) 配置
cp Makefile.configure.example Makefile.configure
修改对应内容如下:
CPU_ONLY := 1
OPENCV_VERSION := 3
BLAS := mkl
BLAS_INCLUDE := /home/yzhang/env/mkl/intel/mkl/include
BLAS_LIB := /home/yzhang/env/mkl/intel/mkl/lib/intel64
INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/include /home/yzhang/env/hdf5/include /home/yzhang/env/mkl/intel/mkl/intel/include /home/yzhang/env/opencv/include /home/yzhang/env/proto/include /home/yzhang/env/snapy/include /home/yzhang/env/lmdb/include /home/yzhang/env/leveldb/include /home/yzhang/env/boost/include /home/yzhang/env/gflags/include /home/yzhang/env/glog/include /home/yzhang/env/leveldb/include /home/yzhang/env/
LIBRARY_DIRS := $(PYTHON_LIB) /usr/lib /home/yzhang/env/hdf5/lib /home/yzhang/env/mkl/intel/lib/intel64 /home/yzhang/env/mkl/intel/mkl/lib/intel64 /home/yzhang/env/opencv/lib64 /home/yzhang/env/proto/lib /home/yzhang/env/snapy/lib64 /home/yzhang/env/lmdb/lib /home/yzhang/env/leveldb/lib /home/yzhang/env/glog/lib /home/yzhang/env/gflags/lib /home/yzhang/env/boost/lib
修改Makefile(g++4.8.5会报protobuf对应c++11错误):
对应422~428行,对其中CXXFLAGS、NVCCFLAGS、LINKFLAG后面加上-std=c++11
3) 编译
make -j
make all -j
make runtest
以上是关于X86平台下,Caffe_MKL安装详解的主要内容,如果未能解决你的问题,请参考以下文章
Ubuntu14.04下搭建Bochs仿真平台,同时用该平台安装Linux0.11内核
模块计算机类型“X86”与目标计算机类型“x64”冲突,用的是vs2010