Skip to content

Latest commit

 

History

History
73 lines (63 loc) · 4.7 KB

INSTALL.md

File metadata and controls

73 lines (63 loc) · 4.7 KB

Installation

The following is a brief summary of installation instructions. For more details, please see Caffe's original instructions in the appendix below.

The installation instructions for Ubuntu 14.04 can be summarized as follows (the instructions for other Linux versions may be similar).

  1. Pre-requisites
  • It is recommended to us a Linux machine (Ubuntu 14.04 or Ubuntu 16.04 for example)
  • Anaconda Python 2.7 is recommended, but other Python packages might also work just fine. Please install Anaconda2 (which is described as Anacoda for Python 2.7 int he download page). We have seen compilation issues if you install Anaconda3. If other packages that you work with (eg. tensorflow or pytorch) require Python 3.x, one can always create conda environments for it in Anaconda2.
  • One or more graphics cards (GPU) supporting NVIDIA CUDA. GTX10xx series cards are great, but GTX9xx series or Titan series cards are fine too.
  1. Preparation
  • copy Makefile.config.example into Makefile.config
  • In Makefile.config, uncomment the line that says WITH_PYTHON_LAYER
  • Uncomment the line that says USE_CUDNN
  • If more than one GPUs are available, uncommenting USE_NCCL will help us to enable multi gpu training.
  1. Install all the pre-requisites - (mostly taken from http://caffe.berkeleyvision.org/install_apt.html)
  • Change directory to the folder where caffe source code is placed.
    sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev protobuf-compiler
    sudo apt-get install --no-install-recommends libboost-all-dev
    sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev
    sudo apt-get install libopenblas-dev
    sudo apt-get install libturbojpeg-dev
  • Install CUDNN
  • Install NCCL
  • Install the python packages required. (this portion is not tested and might need tweaking) For Anaconda Python:
    for req in $(cat python/requirements.txt); do conda install $req; done
    For System default Python:
    for req in $(cat python/requirements.txt); do pip install $req; done
  • There may be other dependencies that are discovered as one goes through with the compilation process. The installation procedure will be similar to above.
  1. Compilation
  • make (Instead, one can also do make -j50 to speed up the compilaiton)
  • make pycaffe (To compile the python bindings)
  1. Notes:
  • If you get compilation error related to libturbojpeg, create the missing symbolic link as explained here:
    -- OpenKinect/libfreenect2#36
    -- sudo ln -s /usr/lib/x86_64-linux-gnu/libturbojpeg.so.0.0.0 /usr/lib/x86_64-linux-gnu/libturbojpeg.so
  1. Building on Ubuntu 18.04 - use the following instructions to easily build on Ubuntu 18.04
  • Downloand and install the latest Anaconda3. Do not use Anaconda2 on Ubuntu18.04 as some libraries (especially OpenCV) may produce link errors.

  • Create a python 2.7 environment in Anaconda3 and activate it. Here we are assuming that the name of the environment is caffe - although this is not necessary.

    conda create -n caffe python=2.7 
    conda activate caffe
  • Now install additional packages.

    conda install cmake numpy opencv protobuf libprotobuf hdf5 numpy scikit-image
    
  • In the Makefile.confg, make the following changes.
    -- Since the default opencv version in Anaconda is now 3.x, uncomment the line OPENCV_VERSION := 3
    -- Add additional include folders to the line INCLUDE_DIRS. We need to add the full paths to the directories envs/caffe/include envs/caffe/include/python2.7 and envs/caffe/lib/python2.7/site-packages/numpy/core/include located inside the Anaconda installation.
    -- Add additional lib folders to the line LIBRARY_DIRS. We need to add the full paths to the directories envs/caffe/lib and envs/caffe/lib/python2.7 located inside the Anaconda installation.

  • At import time or runtime, if there is an issue in finding shared objects (.so files), we may need to specify additional paths into LD_LIBRARY_PATH. Note: This is required only if there is an issue in finding a .so file. The exact path that we may need to add may also be different. export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/user/a0393608/files/apps/anaconda3/envs/caffe/lib

  • After these installations, do cmake and make as explained before.

  1. Appendix: Caffe's original instructions