2

WARNING (theano.sandbox.cuda): CUDA is installed, but device gpu is not available (error: cuda unavailable)

I get this error when trying to run any sample Theano program.

I have tried all the suggested fixes provided in this thread.

nvcc --version output:

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2015 NVIDIA Corporation
Built on Tue_Aug_11_14:27:32_CDT_2015
Cuda compilation tools, release 7.5, V7.5.17

nvidia-smi output:

Sat Dec 10 00:46:14 2016       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 367.57                 Driver Version: 367.57                    |
|-------------------------------+----------------------+----------------------+
| 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 1070    Off  | 0000:01:00.0     Off |                  N/A |
|  0%   37C    P0    33W / 151W |      0MiB /  8112MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID  Type  Process name                               Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+

gcc version:

(venv) rgalbo@blueberry:~$ gcc --version
gcc (Ubuntu 4.9.3-13ubuntu2) 4.9.3

I have been trying to get this to work for a while now, would like someone to point me in the right direction.

Dhia
  • 10,119
  • 11
  • 58
  • 69
rgalbo
  • 4,186
  • 1
  • 19
  • 29

1 Answers1

1

So I was finally able to get Theano to find the gpu, I went through the steps provided here in order to clean up any corrupt installation that may have occured from my initial installation of CUDA.

After this I ran sudo apt-get install cuda which installed the right driver packages for my nvidia graphics card. I then proceeded to install CUDA 8.0 from the deb and this was able to over-write the 7.5 version that was giving me issues.

This is the output I am now able to get from theano_test.py:

(venv) rgalbo@blueberry:~$ python theano_test.py
Using gpu device 0: GeForce GTX 1070 (CNMeM is disabled, cuDNN 5103)
[GpuElemwise{exp,no_inplace}(<CudaNdarrayType(float32, vector)>), HostFromGpu(GpuElemwise{exp,no_inplace}.0)]
Looping 1000 times took 0.185949 seconds
Result is [ 1.23178029  1.61879349  1.52278066 ...,  2.20771813  2.29967761
  1.62323296]
Used the gpu

and here is my ~/.theanorc file:

(venv) rgalbo@blueberry:~$ cat ~/.theanorc
[global]
floatX = float32
device = gpu

[nvcc]
flags=-D_FORCE_INLINE

[cuda]
root = /usr/local/cuda-8.0

After each separate install I updated and rebooted the server just for good luch, which I found to be helpful.

Community
  • 1
  • 1
rgalbo
  • 4,186
  • 1
  • 19
  • 29
  • I think including the location of cuda in the `~/.theanorc` file was what did the trick. Highly reccomed trying that. – rgalbo Dec 19 '16 at 18:25