Unknown CUDA error when importing theano
Question: In python, after importing theano, I get the following:

    
    
    In [1]: import theano
    WARNING (theano.sandbox.cuda): CUDA is installed, but device gpu is not available  
    (error: Unable to get the number of gpus available: unknown error)
    

I'm running this on ubuntu 14.04 and I have an old gpu: GeForce GTX280

And my nvidia driver:

    
    
    $ nvidia-smi
    Wed Jul 13 21:25:58 2016       
    +------------------------------------------------------+                       
    | NVIDIA-SMI 340.96     Driver Version: 340.96         |                       
    |-------------------------------+----------------------+----------------------+
    | GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
    | Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
    |===============================+======================+======================|
    |   0  GeForce GTX 280     Off  | 0000:02:00.0     N/A |                  N/A |
    | 40%   65C    P0    N/A /  N/A |    638MiB /  1023MiB |     N/A      Default |
    +-------------------------------+----------------------+----------------------+
    
    +-----------------------------------------------------------------------------+
    | Compute processes:                                               GPU Memory |
    |  GPU       PID  Process name                                     Usage      |
    |=============================================================================|
    |    0            Not Supported                                               |
    +-----------------------------------------------------------------------------+
    

I'm not sure why it's saying it's 'Not Supported' but it seems as though that
might not be an issue as said
[here](https://devtalk.nvidia.com/default/topic/697308/compute-processes-not-
supported/)

Also, the CUDA version:

    
    
    $ nvcc -V
    nvcc: NVIDIA (R) Cuda compiler driver
    Copyright (c) 2005-2014 NVIDIA Corporation
    Built on Thu_Jul_17_21:41:27_CDT_2014
    Cuda compilation tools, release 6.5, V6.5.12
    

Any help I can get would be awesome. I've been at this all day...


Answer: I feel your pain. I spent a few days ploughing through all the CUDA related
errors.

Firstly, update to a more recent driver. eg, 361. (CLEAN INSTALL IT!) Then
completely wipe cuda and cudnn from your harddrive with

    
    
    sudo rm -rf /usr/local/cuda
    

or wherever else you installed it, then install cuda 7.5 (seriously, this
specific version) and cuDNN v4 (again, this specific version)

You can run the following commands to settle CUDA.

    
    
    wget http://developer.download.nvidia.com/compute/cuda/7.5/Prod/local_installers/cuda_7.5.18_linux.run
    bash cuda_7.5.18_linux.run --override
    

Follow the instructions, **say NO when they ask you to install the 350
driver**. And you should be set.

For cudnn, there's no direct link to wget, so you have to get the installer
from <https://developer.nvidia.com/cudnn> and run the following commands:

    
    
    tar xvzf cudnn-7.0-linux-x64-v4.0-prod.tgz
    sudo cp cuda/include/cudnn.h /usr/local/cuda-7.5/include
    sudo cp -r cuda/lib64/. /usr/local/cuda-7.5/lib64
    
    echo -e 'export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/cuda-7.5/lib64"\nexport CUDA_HOME=/usr/local/cuda-7.5' >> ~/.bash_profile
    source ~/.bash_profile
    

Now to handle Theano on GPU:

    
    
    nano ~/.theanorc
    

add these lines:

    
    
    [global]
    floatX = float32
    device = gpu0
    

If you get an nvcc error, make it so instead:

    
    
    [global]
    floatX = float32
    device = gpu0
    [nvcc]
    flags=-D_FORCE_INLINES
    

