20150421

Linux Mint 17.1, Nvidia, CUDA, and cuDNN

I recently replaced a Titan X, which was on loan, with a GTX 980. After messing with drivers for nearly a day I was able to get my dual monitor setup running again. Unfortunately whatever i did freaked out Theano yielding the error:
dustin@Cortex ~ $ ipython
Python 2.7.6 (default, Mar 22 2014, 22:59:56) 
Type "copyright", "credits" or "license" for more information.

IPython 1.2.1 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: import theano
WARNING (theano.sandbox.cuda): CUDA is installed, but device gpu0 \
  is not available (error: Unable to get the number of gpus available: \
  unknown error) 
I tried upgrading the Nvidia driver to 346.59 and CUDA from 6.5 to 7.0 with no luck. So I decided to start fresh since I had been wanting to upgrade from Linux Mint 17 to 17.1 anyway. Following are the steps I used to get my system running Theano again. I have not replicated these results so hopefully I am not overlooking any major steps.

Nvidia Driver

I used the xorg-edgers PPA to install Nvidia drivers 346.59 as described on Noobs Lab. In short, add the new repository:
sudo add-apt-repository ppa:xorg-edgers/ppa
Update to get the list of available packages:
sudo apt-get update
Install 346:
sudo apt-get install nvidia-346 nvidia-settings
I have a dual monitor setup that require I execute nvidia-settings to Enable Xinerama via the X Server Display Configuration page.

CUDA

I found some helpful instructions for installing CUDA. In short, start by installing the GNU Compiler Collection tools with:
sudo apt-get install build-essential
Download the Nvidia CUDA 7.0 DEB. Though I'm running Linux Mint 17.1 I used the Ubuntu 14.04 Network DEB. Install it:
sudo dpkg -i cuda-repo-ubuntu1404_6.5-14_amd64.deb
Update to get the list of packages:
sudo apt-get update
Install CUDA:
sudo apt-get install cuda
Finally alter your .bashrc to add CUDA to your PATH and LD_LIBRARY_PATH environment variables. Theano will also want to know where CUDA is located so now is a good time to setup the CUDA_ROOT environment variables as well.
export PATH=/usr/local/cuda-7.0/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda-7.0/lib64:$LD_LIBRARY_PATH
export CUDA_ROOT=/usr/local/cuda-7.0

cuDNN

Installing cuDNN for use with Theano can be found on the cuDNN page of deeplearning.net. I used the first method currently suggested on that page which is to copy *.h to $CUDA_ROOT/includes and *.so* to $CUDA_ROOT/lib64.

4 comments:

  1. Thanks for these installation instructions, very helpful!

    I found that by installing CUDA, the 346 video drivers are automatically installed, so the first steps involving the ppa repository can be skipped.

    Also I did not separately install the build-essential packages, but it was installed after installing CUDA. So either it's installed with Linux Mint 17.1 or the CUDA installation takes care of that.

    (I used the Ubuntu 14.04 Local Package Installer DEB instead of the Network version, so perhaps there's a difference there.)

    ReplyDelete
  2. This comment has been removed by a blog administrator.

    ReplyDelete
  3. Thanks! very straight forward approach. Much easier than other methods.

    ReplyDelete
  4. If network installer did not work properly with "apt-get install", use "aptitude install" instead.
    Thanks for the guide.

    ReplyDelete