I followed these steps to build and use Caffe2 from source:
If you have a GPU, install CUDA and cuDNN as described here.
Install the package prerequisites:
$ sudo apt install build-essential cmake git libgoogle-glog-dev libprotobuf-dev protobuf-compiler python-dev python-pip libgflags2 libgtest-dev libiomp-dev libleveldb-dev liblmdb-dev libopencv-dev libopenmpi-dev libsnappy-dev openmpi-bin openmpi-doc python-pydot
$ sudo pip install numpy protobuf flask graphviz hypothesis jupyter matplotlib pydot python-nvd3 pyyaml requests scikit-image scipy setuptools tornado
$ git clone git@github.com:caffe2/caffe2.git
$ git tag
$ git co -b v_0_7_0 v0.7.0
build
directory, runs CMake from there and later runs make in a subshell. The child make running from inside a Makefile will not get the MAKEFLAGS
of the parent make. So, you cannot make in parallel by using --jobs
or -j
settings. And believe me building Caffe2 without parallel make takes extremely long! So, I prefer doing the CMake and make myself:$ mkdir build
$ cd build
$ cmake ..
$ make
/usr/local
, which requires superuser privileges. I prefer installing Caffe2 to a local directory, say /home/joe/caffe2_deploy
. To be able to to this:$ cmake -DCMAKE_INSTALL_PREFIX:PATH=/home/joe/caffe2_deploy ..
$ make install
LD_LIBRARY_PATH
:$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/joe/caffe2_deploy/lib
PYTHONPATH
to be able to use Caffe2 from Python:$ export PYTHONPATH=$PYTHONPATH:/home/joe/caffe2_deploy
$ python -m caffe2.python.operator_test.relu_op_test
Tried with: Ubuntu 14.04