导入theano时出现未知的CUDA错误

时间:2016-07-14 01:33:11

标签: python cuda ubuntu-14.04 theano-cuda

在python中,导入theano后,我得到以下内容:

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)

我在ubuntu 14.04上运行此操作并且我有一个旧的gpu:GeForce GTX280

我的nvidia司机:

$ 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                                               |
+-----------------------------------------------------------------------------+

我不确定为什么它说'不支持'但似乎这可能不像DS18B20 sensors

那样是个问题

此外,CUDA版本:

$ 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

我能得到的任何帮助都会很棒。我整天都在这里......

2 个答案:

答案 0 :(得分:1)

我感觉到你的痛苦。我花了几天时间来解决所有与CUDA相关的错误。

首先,更新到更新的驱动程序。例如,361。(清洁安装它!)然后用你的硬盘完全擦拭cuda和cudnn

sudo rm -rf /usr/local/cuda

或者你安装它的任何地方,然后安装cuda 7.5(严重的,这个特定版本)和cuDNN v4(再次,这个特定版本)

您可以运行以下命令来解决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

按照说明操作,当他们要求您安装350驱动程序时说“不”。而你应该被设定。

对于cudnn,没有与wget的直接链接,因此您必须从https://developer.nvidia.com/cudnn获取安装程序并运行以下命令:

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

现在在GPU上处理Theano:

nano ~/.theanorc

添加以下行:

[global]
floatX = float32
device = gpu0

如果您收到nvcc错误,请改为:

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

答案 1 :(得分:0)

我有同样的问题,能够通过做两件事来解决我的问题:

  • 安装gcc-5并将/ usr / bin / gcc链接到/ usr / bin / gcc-5以及/ usr / bin / g ++连接到/ usr / bin / g ++ - 5(PS:我正在使用cuda 8 )
  • 将此标志标志= -D_FORCE_INLINES添加到nvcc下的文件〜/ .theanorc,因为显然glibc 2.23中的错误会导致此问题