Ubuntu 16.04 + Matlab 2014a + caffe 配置

caffe在Ubuntu 16.04下的配置,可以参考官网说明https://github.com/BVLC/caffe/wiki/Ubuntu-16.04-or-15.10-Installation-Guide

但要配置matcaffe就有点麻烦,因为matlab即使是2016a的版本也只支持gcc 4.7,而Ubuntu 16.04已经是gcc 5.3.因此需要先安装gcc-4.7旧版本,然后配置及编译matcaffe

具体配置步骤如下:

Matlab 2014a --2016a needs version 4.7 to compile MEX files.
To solve the problem 
(1)just install the older compilers (gcc-4.7 )

 sudo apt-get install gcc-4.7 g++-4.7 g++-4.7-multilib gcc-4.7-multilib

and then change the
Name="g++"
ShortName="g++"
tags in ~/.matlab/R2014a/mex_C++_glnxa64.xml and ~/.matlab/R2014a/mex_C++_glnxa64.xml, e.g. to
Name="g++-4.7"
ShortName="g++-4.7"
Finally, run
mex -setup C -f ~/.matlab/R2014a/mex_C_glnxa64.xml and mex -setup C++ -f ~/.matlab/R2014a/mex_C++_glnxa64.xml.


(2) enter caffe-master and compile matcaffe
make -j 8 matcaffe


(3) relink libstdc++.so.6 in the matlab director
cd /opt/MATLAB/R2014a/sys/os/glnxa64
sudo rm libstdc++.so.6
sudo ln -s /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21  libstdc++.so.6


(4) add matcaffe path to Matlab


enjoy matcaffe

你可能感兴趣的:(计算机)