Skip to main content

Ubuntu 14.04 CUDA install

For Ubuntu 16.04 Users:

sudo apt-get -y install nvidia-361-updates-dev nvidia-prime nvidia-profiler \
  nvidia-settings nvidia-visual-profiler \
  nvidia-cuda-dev nvidia-cuda-toolkit nvidia-opencl-dev

And, that's it!

For Ubuntu 14.04 Users

Update your system

sudo apt-get update  
sudo apt-get upgrade  
sudo apt-get install build-essential cmake g++ gfortran git pkg-config python-dev software-properties-common wget

Download cuda deb

official website: https://developer.nvidia.com/cuda-downloads

wget -c "http://developer.download.nvidia.com/compute/cuda/7.5/Prod/local_installers/cuda-repo-ubuntu1404-7-5-local_7.5-18_amd64.deb"
sudo dpkg -i cuda-repo-ubuntu1404*amd64.deb
sudo apt-get update
sudo apt-get install cuda

(The md5sum of the deb is: 5cf65b8139d70270d9234d5ff4d697c7)

Check that cuda is installed:

nvcc --version

Get CuDNN from

Website: https://developer.nvidia.com/cudnn

You should register and download the archive

tar xvf cudnn*.tgz
cd cuda
sudo cp */*.h /usr/local/cuda/include/
sudo cp */libcudnn* /usr/local/cuda/lib64/
sudo chmod a+r /usr/local/cuda/lib64/libcudnn*

Install Caffee (Optional)

Website: http://caffe.berkeleyvision.org/install_apt.html

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
git clone https://github.com/BVLC/caffe.git
cd caffe
cp Makefile.config.example Makefile.config

Turn on CuDNN, and OpenBlas

sed -i 's/# USE_CUDNN := 1/USE_CUDNN := 1/' Makefile.config
sed -i 's/BLAS := atlas/BLAS := open/' Makefile.config

Install python dependencies:

sudo pip install -r python/requirements.txt
make all -j $(nproc)
make test -j $(nproc)
make runtest -j $(nproc)

Build pycaffe:

make pycaffe -j $(nproc)

Add PYTHONPATH:

echo 'export CAFFE_ROOT=$(pwd)' >> ~/.bashrc
echo 'export PYTHONPATH=$CAFFE_ROOT/python:$PYTHONPATH' >> ~/.bashrc
source ~/.bashrc

Check it:

python -c "import caffe"

Comments

Comments powered by Disqus