2016-07-27 91 views
2

我使用安装了theano 0.8.2的ubuntu 14.04。当我在gpu_tesy.py中运行导入theano时,出现〜5300行代码,并且:'导入theano时无法编译cuda_ndarray.cu','cuda_runtime.h:没有这样的文件或目录'

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

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

在文件包括来自: 0:0: /usr/include/stdc-predef.h:59:1:致命错误:cuda_runtime.h:没有此文件或目录

#endif

^ 编译终止。

[ 'NVCC', '-shared', '-O3', '-m64', '-Xcompiler', '-DCUDA_NDARRAY_CUH = c72d035fdf91890f3b36710688069b2e,-DNPY_NO_DEPRECATED_API = NPY_1_7_API_VERSION,-fPIC,-fvisibility =隐藏',' -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 /理论/ 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/('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 /本地/反刍一个-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的几个版本都安装在同一台机器。我不知道我应该如何将他们带入正确的道路。感谢任何帮助!

+0

我有这个相同的问题。你弄明白了吗? – user2861759

回答

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 
相关问题