So if you’re into computer vision, you are likely dealing with some deep-learning flavoured techniques. This means that you are possibly struggling to compile and run some code written in Caffe. This post lists some of the problems I found in compiling MatCaffe on Mac.
I particular, I am using Matlab R2012b on a Macbook Pro running Mac OS X El Capitan.
First, I followed the official installation guide strictly: I installed CUDA 7.5, and installed all dependencies (no Anaconda Python) using HomeBrew:
No problem here, so I moved to compilation. Let’s start by make all -j8
.
Here I found the following problems:
1 - Missing Protobuf
Solution, install it.
2 - Missing BLAS library
Solution, install it:
And do the following changes in Makefile.config
:
With this I could build make all
and make test
, but I found the following problem when running make runtest
:
3 - CUDA not found
Solution, set the environment variable:
So, next was to build MatCaffe make matcaffe
, for which I had to change:
But when running a test from Matlab I encountered the following problem (even if I had set the correct DYLD_FALLBACK_LIBRARY_PATH
).
4 - CUDA not found from Matlab
And the solution to this was in two fronts. First, Matlab was taking his own CUDA libraries, so I simply renamed them (not sure this affects Matlab in some way…):
And second, it seems that Mac OS X El Capitan implements some type of protection (System Integrity Protection) that clears DYLD_FALLBACK_LIBRARY_PATH
when executing Matlab.
To prevent this, I followed the comment in this thread:
- Boot to Recovery OS by restarting your machine and holding down the
Command
+R
keys at startup. - Launch
Terminal
from theUtilities
menu. - Enter the following command:
csrutil disable
- Restart
Please note that you need to run Matlab from a command line with the correct value for DYLD_FALLBACK_LIBRARY_PATH
by doing:
And with this it worked! Enjoy and comment if this helped you. :)