Install CUDA on Ubuntu 16.04

For the record, my graphic card is a GTX 870M.

  1. Install Nvidia recommended drivers. You can find it out by using the command ubuntu-devices drivers. It will tell you the recommended driver you should install via apt-get (I installed nvidia-361).


3.Download CUDA Toolkit from here or Direct link to version 5.7.18 I used

  1. Run the file


Make sure to say yes to everything EXCEPT the prompt that reads:

Install NVIDIA Accelerated Graphics Driver for Linux-x86_64 352.39? ((y)es/(n)o/(q)uit): n

  1. Run the tests. Go to the folder you installed the Nvidia tests (default is /~/NVIDIA_CUDA-7.5_Samples). Then change one line (

  2. Install Theano

`pip install theano┬┤

  1. Add CUDA PATHS to .bashrc:
export PATH="/usr/local/cuda-7.5/bin:$PATH"  
export LD_LIBRARY_PATH="/usr/local/cuda-7.5/lib64:$LD_LIBRARY_PATH"  
export GLPATH=/usr/lib  
  1. Run the theano test:
THEANO_FLAGS="mode=FAST_RUN,device=gpu,floatX=float32,nvcc.flags=-D_FORCE_INLINES" python  


Show Comments