2016-07-27 93 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 
相關問題