Caffe is a fast high performance Deep neural network library. It requires Nvidia GPU with CUDA support.
Download CUDA for Linux from here: (https://developer.nvidia.com/cuda-downloads). For me, I download runfile (local)
sudo sh cuda_7.5.18_linux.run. Follow instructions.
Then, you may encounter this error: “You appear to be running an X server”. Follow this link to fix it: (http://askubuntu.com/questions/149206/how-to-install-nvidia-run)
- Hit CTRL+ALT+F1 and login using your credentials.
- Kill your current X server session by typing sudo service lightdm stop or sudo stop lightdm
- Enter runlevel 3 by typing sudo init 3 and install your *.run file.
- You might be required to reboot when the installation finishes. If not, run sudo service lightdm start or sudo start lightdm to start your X server again.
cuDNN is used by caffe for GPU acceleration, provided by CUDA, very much recommended for speed. Go to (https://developer.nvidia.com/cuDNN), download .tar.gz file and extract. There are 2 things to do with this.
- Copy all the files, (except cudnn.h) to /usr/local/cuda-6.5/lib64
- Copy the cudnn.h to /usr/local/cuda-6.5/include
Again, you may have an error here: “ImportError: libcudart.so.7.0: cannot open shared object file: No such file or directory”.
Run the following command:
sudo ldconfig /usr/local/cuda/lib64
- Clone Caffe from GitHub (https://github.com/BVLC/caffe) and follow the installation instructions (http://caffe.berkeleyvision.org/installation.html)
- Install all the dependencies and libraries
sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libboost-all-dev libhdf5-serial-dev
sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev protobuf-compiler
- Edit config file
USE_CUDNN := 1
- Compile caffe
- Build also python module and distribution libraries.
- Check out important examples