2

I am using ubuntu 14.04 with theano 0.8.2 installed. When I ran import theano in my gpu_tesy.py, there came ~5300 lines of codes and:

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

5368

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

In file included from :0:0: /usr/include/stdc-predef.h:59:1: fatal error: cuda_runtime.h: No such file or directory

#endif

^ compilation terminated.

['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'] ERROR (theano.sandbox.cuda): Failed to compile 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')


which nvcc: /usr/local/cuda-7.0/bin/nvcc

CUDA_HOME=/usr/local/cuda-7.0

LD_LIBRARY_PATH=/usr/local/cuda/lib64:/usr/local/lib/lib:/opt/intel/mkl/lib/intel64::/usr/local/cuda-7.0/lib64

DYLD_LIBRARY_PATH=:/usr/local/cuda-7.0/lib


Several versions of cuDNN and CUDA are installed in the same machine. I am not sure how I should them into the correct path though. Appreciate any help!

talonmies
  • 70,661
  • 34
  • 192
  • 269
Alex Wenxin Xu
  • 311
  • 1
  • 2
  • 8

1 Answers1

0

I was stuck on this problem for a few days. Basically, I had multiple versions of python and I think multiple versions of nvcc installed. I could import Theano successfully using python 2, but when I tried to do the same with python 3, I would get the error you have posted.

Eventually I solved it thanks to the first comment on this post: 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'.

You should add this to your .theanorc file:

[nvcc]
flags=-D_FORCE_INLINES

You can do this in one line from the terminal in Ubuntu:

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

After doing this I was getting other errors when trying to import Theano with python 3, which I fixed by upgrading to the latest version of Theano. Again from the ubuntu terminal:

pip install --upgrade https://github.com/Theano/Theano/archive/master.zip
Community
  • 1
  • 1
user2861759
  • 176
  • 1
  • 8