From CsWiki
Jump to: navigation, search

Global caffe installation in CS

Caffe is installed globally on the latest linux distribution in


As there are no versions (yet?), current is a symlink to the date caffe was checkout/compiled.

This version was compiled with gpu support. Machines with nvidia graphic cards can use it with gpu. Machines without nvidia can still use it but it will crash if tried to use the gpu.


Executables are in



To link against libcaffe, one needs to add

-L/usr/local/caffe/current/lib -lcaffe

to the compiler/linker. There are both static and dynamic libraries.


To use pycaffe, /usr/local/caffe/current/python needs to be added to the path, this can either be done by setting the environment variable PYTHONPATH to /usr/local/caffe/current/python or, from within python updating sys.path

import sys


Matlab binding is installed in


matcaffe_demo should work. Note that using the gpu on machines without nvidia driver will result in the whole matlab crashing.


Examples and data are installed (some of them), but are not usable directly. To use them, they need to be copied and updated such that the paths inside them will point to the correct location.

Compiling your own caffe on CS machines

To compile your own version of caffe, download it normally and add the following lines to the end of Makefile.config (after copied from Makefile.config.example)

BLAS := open
CUDA_DIR := /usr/local/nvidia/cuda/7.0
CXXFLAGS += $(shell pkg-config --cflags hdf5)
NVCCFLAGS += $(shell pkg-config --cflags hdf5)
LDFLAGS += $(shell pkg-config --libs --cflags hdf5) -Wl,-rpath=$(CUDA_DIR)/lib64 -Wl,-rpath=$(ORIGIN)/../lib -L$(LIB_BUILD_DIR)

To compile the matlab binding, also add:

MATLAB_DIR := /usr/local/matlab/2018a
CC := gcc-4.7
CXX := g++-4.7

To compile without GPU, also add

CPU_ONLY := 1 

And then continue with:



make mat


make py


make everything