'导入theano时无法编译cuda_ndarray.cu',cuda_runtime.h:没有这样的文件或目录'

时间:2016-07-27 00:51:58

标签: python-2.7 theano theano-cuda cudnn

我正在使用安装了theano 0.8.2的ubuntu 14.04。当我在我的gpu_tesy.py中运行import theano时,出现了大约5300行代码并且:

5367 // vim:filetype = cpp:expandtab:shiftwidth = 4:tabstop = 8:softtabstop = 4:textwidth = 79:

5368

===============================

包含在文件中:0:0: /usr/include/stdc-predef.h:59:1:致命错误:cuda_runtime.h:没有这样的文件或目录

#万一

^ 编译终止。

['nvcc','-shared',' - O3',' - m64',' - Xcompiler',' - DCUDA_NDARRAY_CUH = c72d035fdf91890f3b36710688069b2e,-DNPY_NO_DEPRECATED_API = NPY_1_7_API_VERSION,-fPIC,-fvisibility = hidden',' - Xlinker',' - apath,/ home / theory / .theano / compiledir_Linux-3.13 - generic-x86_64-with-Ubuntu-14.04-trusty-x86_64-2.7.6-64 / cuda_ndarray',' - I / home / theory /test_theono/local/lib/python2.7/site-packages/theano/sandbox/cuda',' - I / home / theory / test_theono / local / lib / python2.7 / site-packages / numpy / core / include' ,'-I / usr / include / python2.7',' - I / home / theory / test_theono / local / lib / python2.7 / site-packages / theano / gof',' - o','/ home /理论/ .theano / compiledir_Linux-3.13 - generic-x86_64-with-Ubuntu-14.04-trusty-x86_64-2.7.6-64 / cuda_ndarray / cuda_ndarray.so','mod.cu',' - L / usr / lib ','-lcublas',' - lpython2.7',' - lcudart'] 错误(theano.sandbox.cuda):无法编译cuda_ndarray.cu :('nvcc return status',1,'for cmd','nvcc -shared -O3 -m64 -Xcompiler -DCUDA_NDARRAY_CUH = c72d035fdf91890f3b36710688069b2e,-DNPY_NO_DEPRECATED_API = NPY_1_7_API_VERSION, -fPIC,-fvisibility = hidden -Xlinker -rpath,/ home / theory / .theano / compiledir_Linux-3.13 - generic-x86_64-with-Ubuntu-14.04-trusty-x86_64-2.7.6-64 / cuda_ndarray -I / home /theory/test_theono/local/lib/python2.7/site-packages/theano/sandbox/cuda -I / home / theory / test_theono / local / lib / python2.7 / site-packages / numpy / core / include -I /usr/include/python2.7 -I / home / theory / test_theono / local / lib / python2.7 / site-packages / theano / gof -o /home/theory/.theano/compiledir_Linux-3.13--generic-x86_64 -with-Ubuntu-14.04-trusty-x86_64-2.7.6-64 / cuda_ndarray / cuda_ndarray.so mod.cu -L / usr / lib -lcublas -lpython2.7 -lcudart')

其中nvcc:/usr/local/cuda-7.0/bin/nvcc

CUDA_HOME =的/ usr /本地/ CUDA-7.0

LD_LIBRARY_PATH =的/ usr /本地/ CUDA / lib64下:在/ usr / local / lib目录/ lib中:/选择/英特尔/ MKL / LIB / Intel64位::的/ usr /本地/ CUDA的7.0 / lib64下

DYLD_LIBRARY_PATH =:在/ usr /本地/ CUDA的7.0 / lib中

在同一台计算机上安装了多个版本的cuDNN和CUDA。我不知道如何让他们进入正确的道路。感谢任何帮助!

1 个答案:

答案 0 :(得分:0)

我被困在这个问题上几天了。基本上,我有多个版本的python,我认为安装了多个版本的nvcc。我可以使用python 2成功导入Theano,但是当我尝试用python 3做同样的事情时,我会得到你发布的错误。

最后由于对这篇文章的第一条评论我解决了它: theano.test() fails with nvcc error - nvcc fatal : Don't know what to do with 'NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION,-fPIC'

您应该将其添加到.theanorc文件中:

[nvcc]
flags=-D_FORCE_INLINES

您可以在Ubuntu终端的一行中执行此操作:

echo -e "\n[nvcc]\nflags=-D_FORCE_INLINES\n" >> ~/.theanorc

执行此操作后,我尝试使用python 3导入Theano时遇到其他错误,我通过升级到Theano的最新版本来修复。再次来自ubuntu终端:

pip install --upgrade https://github.com/Theano/Theano/archive/master.zip