According to some of my posts, such as Neural Networks and Convolutional Networks - Reading List or Recognizing Handwritten Digits using a Two-Layer Perceptron and the MNIST Dataset as well as my seminar papers Understanding Convolutional Neural Networks and Introduction to Neural Networks, I should already have experimented with Caffe, the deep learning framework from the Berkeley Vision and Learning Center. Caffe does even provide pre-trained models to easily test performance on new datasets and apply convolutional neural networks to new tasks. However, due to my seminar paper inspired by Babenko et al. , I finally decided to try Caffe and conduct some experiments for image retrieval (see ).
Having a GeForce GTX 660 installed (mainly for gaming purposes), the first challenge is installing CUDA. In the following, I briefly want to share my experience with installing CUDA and Caffe on Ubuntu 14.04 64 bit.
Installing CUDA on Ubuntu 14.04
Update. To check which Nvidida graphic gards support CUDA, see here.
The CUDA 7 Runtime Installer for Linux 64 bit can be found here. Although, as I realized later, this is not the ideal way to install the Nvidia driver, I am not sure whether CUDA 7 will run on Nvidia drivers installed differently. To get started, we need to install build essentials and extract the downloaded runtime installer:
sudo apt-get install build-essential cd ~/Downloads # Path has to be absolute, execution rights might be necessary: ./cuda_7.0.28_linux.run -ectract=~/Downloads/nvidia_insallers;
To be sure, I removed everything from nvidia previously installed on my machine:
sudo apt-get ---purge remove nvidia-*
Then, I disabled the Nouveau driver (the installation will not continue when Nouveau kernel drivers are running). Open
/etc/modprobe.d/blacklist.conf and add
blacklist nouveau at the end. Now reboot.
After rebooting, I directly switched to the terminal (using
F1) and killed the X server to install the Nvidida driver:
sudo service lightdm stop sudo ./NVIDIA-Linux-x86_64-346.46.run
After accepting the End-User License Agreement, the pre-install script may fail which was not a problem for me. I also let Nvidia update the Xorg configuration files. After the installation, I activated the Nvidia driver and installed CUDA and the CUDA examples:
sudo modprobe nvidia sudo ./cuda-linux64-rel-7.0.28-19326674.run sudo ./cuda-samples-linux-7.0.28-19326674
To test the installation, I compiled the following example:
cd /usr/local/cuda/samples sudo chown -R david cd 1_utilities/deviceQuery make ./deviceQuery
Now, the X server can be started again:
sudo service lightdm start
I also added CUDA to the PATH variable (this line can also be added to
Note: It seems that this is not the proper way to install the Nvidia driver. Every time Ubuntu gets updated, the driver will fail. This manifests in a broken login screen (the login loop). In this case, the driver needs to be reinstalled. So I kept the
NVIDIA-Linux-x86_64-346.46.run file and can reinstall the driver (reinstalling CUDA is not required) if necessary.
Installing Caffe was simple. I downloaded the source from GitHub and ran:
cd ~/caffe mkdir build cd build cmake .. make all make runtest
-  Y. Jia and E. Shelhamer and J. Donahue and S. Karayev and J Long and R. Girshick and S. Guadarrama, T. Darrell. Caffe: Convolutional Architecture for Fast Feature Embedding. arXiv preprint arXiv:1408.5093, 2014.
-  A. Babenko, A. Slesarev, A. Chigorin, V. S. Lempitsky. Neural Codes for Image Retrieval. Computing Research Repository abs/1404.1777, 2014.