andersbll / cudarray

CUDA-based NumPy
MIT License
234 stars 61 forks source link

CUDA back-end not available even though toolkit is installed and setup.py was ran with no parameters. #39

Open Vatyx opened 8 years ago

Vatyx commented 8 years ago

I can import cudarray after installing everything but for some reason, I still can't use the CUDA back-end I know I have. Any help?

I get errors like these: g++ -O3 -fPIC -Wall -Wfatal-errors -I./include -I/mnt/cuda-7.5/include -c -o src/nnet/conv_bc01_matmul.o src/nnet/conv_bc01_matmul.cpp nvcc -gencode arch=compute_20,code=sm_20 -gencode arch=compute_20,code=compute_20 -gencode arch=compute_30,code=sm_30 -gencode arch=compute_30,code=compute_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_35,code=compute_35 -O3 --compiler-options '-O3 -fPIC -Wall -Wfatal-errors' --ftz=true --prec-div=false -prec-sqrt=false --fmad=true -I./include -I/mnt/cuda-7.5/include -c -o src/nnet/pool_b01.o src/nnet/pool_b01.cu g++ -O3 -fPIC -Wall -Wfatal-errors -I./include -I/mnt/cuda-7.5/include -c -o src/nnet/cudnn.o src/nnet/cudnn.cpp

when I run make.

Ok so if I manually switch to the CUDA back-end, it says it can't find a file called libcudart.sc

andersbll commented 8 years ago

Hi, have you seen this: http://andersbll.github.io/deeppy-website/installation-guide.html#verify-cuda-back-end ?

The error you post above doesn't seem like an error to me, so the installation of libcudarray might be fine. Have you remembered to update LD_LIBRARY_PATH to point to where libcudarray is installed?

Vatyx commented 8 years ago

I'm pointing to that but it's saying that it can't find libcudart.sc.7.5. How do I specify this? I know the file exists.

andersbll commented 8 years ago

You may also need to add the path to the cuda libraries to LD_LIBRARY_PATH.

Vatyx commented 8 years ago

How come I am getting this while others aren't?

On Sun, Feb 21, 2016 at 4:36 AM, Anders Boesen Lindbo Larsen < notifications@github.com> wrote:

You may also need to add the path to the cuda libraries to LD_LIBRARY_PATH.

— Reply to this email directly or view it on GitHub https://github.com/andersbll/cudarray/issues/39#issuecomment-186793081.

andersbll commented 8 years ago

Don't know, I'm not even sure what your precise error message is.

Vatyx commented 8 years ago

When I run the python repl in the Shell and type "import cudarray", I get an error saying that it is unable to find the file libcudart.sc.7.5 Hie do I fix this error

andersbll commented 8 years ago

and by libcudart.sc.7.5 you mean libcudart.so.7.5? If you are on Linux, then try running ldd <path to libcudarray.so> in the command line. If it cannot locate libcudart.so.7.5, it probably means that your LD_LIBRARY_PATH doesn't contain the right path to your CUDA libraries.

Vatyx commented 8 years ago

That solved it. Thank you. I was at this for hours.

Vatyx commented 8 years ago

Solved it. Once again thanks for your help. Had to do with environment variables changing.

andersbll commented 8 years ago

Good to hear! :)

nresnick commented 8 years ago

@Vatyx what command did you end up writing to get this to work? I'm on a Mac, and have tried

echo 'export DYLD_LIBRARY_PATH=/Developer/NVIDIA/CUDA-7.5/lib:$DYLD_LIBRARY_PATH' >> ~/.bashrc as well as

echo 'export DYLD_LIBRARY_PATH=/Developer/NVIDIA/CUDA-7.5/lib:$DYLD_LIBRARY_PATH' >> ~/.bash_profile

and have not been able to get rid of the error that you mention.

andersbll commented 8 years ago

Are you instaling with sudo? In that case make sure the environment variables are also set for the root user.

nresnick commented 8 years ago

solved it following these steps. Looks like Mac users on El Capitan need to disable SIP to change the library path.

I have run into yet another issue that has me at a loss. I think this should be the final issue before I'm up and running. In this block:

if _backend == 'cuda': try: from .cudarray import from .base import from .linalg import from .elementwise import from .reduction import * from . import random from . import nnet from . import batch from . import extra wrap.cudart.initialize(_gpu_id) except: if _force_backend: print('CUDArray: Failed to load CUDA back-end.') raise else: print('CUDArray: CUDA back-end not available, using NumPy.')

Try NumPy instead

        _backend = 'bumpy'

I'm getting this error for each of the last 4 imports:

ImportError: cannot import name random ImportError: cannot import name nnet etc.

What is the from . import * doing? Can i replace the period with something that tells it exactly where to extract the file?

andersbll commented 8 years ago

Great job solving the previous issue. Regarding the new problem: What version of Python version are you using? It seems like a problem with circular dependent imports (which is strange since I do not have that problem).

yhangf commented 8 years ago

How to install windows