Caffe installation on Ubuntu 14.04

Standard

[EDIT: I’ve updated the site to include information about setting up Caffe on Ubuntu 14.04 for laptop (no GPU), on Ubuntu 14.04 that has a GPU, and on Ubuntu 14.04 Server]

Below is the installation procedure I used to set up my NVIDIA Titan Z and Caffe. You can request a GPU by filling out an Academic Hardware Grant Request Form.

  1. I started with a fresh install of Ubuntu 14.04 which installed Third-party software (install with internet connection). (on my laptop I did not start with a fresh system)
  2. Install Titan Z in the tower. It requires a lot of power, so needs the power from the motherboard and 2 8-pin PEG connectors. (clearly not needed for non-GPU system)
  3. Install the python suite (a standard list): sudo apt-get install python-numpy python-scipy python-dev python-pip python-nose
  4. Install the pre-reqs on Caffe’s site:
    1. Download CUDA 6.5 and install (including adding necessary paths to your .bashrc file) – this is not needed if you are not using a GPU
    2. Install OpenBLAS: sudo apt-get install libopenblas-dev
    3. Install OpenCV 2.4.9
      1. fossies took 2.4.9 off their server, but you can use this link: http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.4.9/opencv-2.4.9.zip/download
      2. If you are installing opencv to use with a GPU, during step 5 (before ‘make’), you will run into issues. Use this fix to resolve the issue. Specifically, in /path/to/opencv-2.4.9/modules/gpu/src/nvidia/core, remove the ‘{static}’ characters from NCVPixelOperations.hpp that are identified in the code on the fix site. (Alternatively, you can use the code here, which has already removed those characters. Note: I tried this and it seemed to fail.)
      3. On Ubuntu 14.04 Server, I had to fix an issue due to an error during the ‘make’ step (Unsupported gpu architecture ‘compute_11’). I used the following fix: http://stackoverflow.com/questions/28010399/build-opencv-with-cuda-support
      4. After the above steps, it was impossible to sign into Ubuntu Server until the video was set to the Titan Z. Once that was done, it was possible to continue.
    4. Unzip Boost 1.55 in /usr/local/ (or unzip it elsewhere and move it there)
    5. More pre-reqs: sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libboost-all-dev libhdf5-serial-dev
    6. More pre-reqs: sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev protobuf-compiler git
  5. Download Caffe
  6. sudo pip install -r /path/to/caffe/python/requirements.txt
  7. Compile Caffe
    1. On Ubuntu Server I received an error while loading shared libraries. This command solved the problem: sudo ldconfig /usr/local/cuda/lib64 (for 64-bit Ubuntu)
  8. Add python folder to your .bashrc file (from Caffe’s site)
  9. Other necessary packages: sudo pip install pandas sklearn scikit-image

Advertisements