Giter Club home page Giter Club logo

Comments (20)

lebedov avatar lebedov commented on July 20, 2024

Try setting the DYLD_LIBRARY_PATH env variable to whatever path contains the CUDA libraries on your system before starting Python.

from scikit-cuda.

kartheekmedathati avatar kartheekmedathati commented on July 20, 2024

I have set up the path correctly but I am facing few more issues, then the following script was attempting to load a 'libdl.so' file on mac and I changed it to 'libdl.dylib'

--scikits/cuda/utils.py

After changing that when I attempt to load scikits.cuda.fft I again receive the following error

Python 2.7.5 (default, Aug 1 2013, 01:01:17)
[GCC 4.2.1 Compatible Apple Clang 4.1 ((tags/Apple/clang-421.11.66))] on darwin
Type "help", "copyright", "credits" or "license" for more information.

import pycuda.autoinit
import scikits.cuda.fft as s
Traceback (most recent call last):
File "", line 1, in
File "scikits/cuda/fft.py", line 19, in
import misc
File "scikits/cuda/misc.py", line 17, in
import cublas
File "scikits/cuda/cublas.py", line 226, in
utils.get_soname(utils.find_lib_path(_libcublas.cublasGetVersion_v2))).group(1) + '000')
File "scikits/cuda/utils.py", line 41, in get_soname
raise RuntimeError('error executing objdump')
RuntimeError: error executing objdump

Please let me know how I can sort this out. Also on a side note, easy_install of scikits.cuda is attempting to freshly install pycuda with out good configuration even though I have pycuda already installed and working on my system.

from scikit-cuda.

lebedov avatar lebedov commented on July 20, 2024

The latest revision of scikits.cuda in Github doesn't use libdl anymore (I changed this in response to one of your earlier bug reports). The objdump issue was observed by another user who submitted a number of MacOSX compatibility improvements that appear to address the problem and others; I'll try to integrate them this coming week.

from scikit-cuda.

lebedov avatar lebedov commented on July 20, 2024

MacOSX-related changes integrated (sorry about the delay). If problems persist, please let me know.

from scikit-cuda.

Leonhalt3141 avatar Leonhalt3141 commented on July 20, 2024

I tried to use chainer which is a deep learning framework for Python.
When I performed import chainer under ipython interactive mode, I got following error.

OSError: CUDA driver library not found

My environment is
Mac OS X version: 10.10.3
Python version: 2.7.9
CUDA version: 7.0.36

When I installed scikits.cuda, pycuda and chainer,
I reflected following path.

export PATH="/usr/local/cuda/bin:${PATH}"
export DYLD_LIBRARY_PATH=/usr/local/cuda/lib:$HOME/pool/lib:${DYLD_LIBRARY_PATH}

Also, I got the following error when I performed
import scikits.cuda.cublas

Does Mac OSX not support CUDA perfectly?
I did not have any error without CUDA environment.

Please let me know how to solve this error.

---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
<ipython-input-7-3eeab81855f7> in <module>()
----> 1 import scikits.cuda.cublas

/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scikits/cuda/cublas.py in <module>()
     17 from string import Template
     18
---> 19 import cuda
     20 import utils
     21

/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scikits/cuda/cuda.py in <module>()
      6
      7 from cudart import *
----> 8 from cudadrv import *
      9

/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scikits/cuda/cudadrv.py in <module>()
     27         break
     28 if _libcuda == None:
---> 29     raise OSError('CUDA driver library not found')
     30
     31

OSError: CUDA driver library not found```

from scikit-cuda.

lebedov avatar lebedov commented on July 20, 2024

Can you please check whether the driver library libcuda.dylib is in /usr/local/cuda/lib and is actually a shared library (or a link to it)? (I don't have access to a MacOSX system with an NVIDIA GPU.)

from scikit-cuda.

Leonhalt3141 avatar Leonhalt3141 commented on July 20, 2024

Thank you for your response.

Yes, I found libcuda.dylib in /usr/local/cuda/lib. It is not �a shared library.

Other libraries are shared libraries.

lrwxr-xr-x  1 root  wheel    50B  6 23 16:46 libcublas.7.0.dylib -> /Developer/NVIDIA/CUDA-7.0/lib/libcublas.7.0.dylib
lrwxr-xr-x  1 root  wheel    46B  6 23 16:46 libcublas.dylib -> /Developer/NVIDIA/CUDA-7.0/lib/libcublas.dylib
lrwxr-xr-x  1 root  wheel    49B  6 23 16:46 libcublas_device.a -> /Developer/NVIDIA/CUDA-7.0/lib/libcublas_device.a
lrwxr-xr-x  1 root  wheel    49B  6 23 16:46 libcublas_static.a -> /Developer/NVIDIA/CUDA-7.0/lib/libcublas_static.a
-rwxr-xr-x  1 root  wheel    12K  4  3 05:15 libcuda.dylib
lrwxr-xr-x  1 root  wheel    45B  6 23 16:46 libcudadevrt.a -> /Developer/NVIDIA/CUDA-7.0/lib/libcudadevrt.a
lrwxr-xr-x  1 root  wheel    50B  6 23 16:46 libcudart.7.0.dylib -> /Developer/NVIDIA/CUDA-7.0/lib/libcudart.7.0.dylib
lrwxr-xr-x  1 root  wheel    46B  6 23 16:46 libcudart.dylib -> /Developer/NVIDIA/CUDA-7.0/lib/libcudart.dylib
....

from scikit-cuda.

lebedov avatar lebedov commented on July 20, 2024

What type of file is libcuda.dylib on your system? Also, can you please post the list of all of the files in /Library/Frameworks/CUDA.framework and its subdirectories on your system?

from scikit-cuda.

Leonhalt3141 avatar Leonhalt3141 commented on July 20, 2024

Thank you again for your quick response.

libcuda.dylib is a dynamic link library for Max OS X.
(Do I answer correctly to your question?)

I posted a tree of directories.

/Library/Frameworks/CUDA.framework/
├── CUDA -> Versions/Current/CUDA
├── Headers -> Versions/Current/Headers
├── Libraries -> Versions/Current/Libraries
├── Resources -> Versions/Current/Resources
└── Versions
    ├── A
    │   ├── CUDA
    │   ├── Headers
    │   │   ├── cuda.h
    │   │   ├── cudaGL.h
    │   │   ├── cudaProfiler.h
    │   │   └── cudadebugger.h
    │   ├── Libraries
    │   │   ├── libcuda_310.40.05_mercury.dylib
    │   │   ├── libcuda_310.40.15_mercury.dylib
    │   │   ├── libcuda_310.40.25_mercury.dylib
    │   │   ├── libcuda_310.40.35_mercury.dylib
    │   │   ├── libcuda_310.40.45_mercury.dylib
    │   │   ├── libcuda_310.40.55_mercury.dylib
    │   │   ├── libcuda_310.41.05_mercury.dylib
    │   │   ├── libcuda_310.41.15_mercury.dylib
    │   │   ├── libcuda_310.41.25_mercury.dylib
    │   │   ├── libcuda_331.01.01_mercury.dylib
    │   │   ├── libcuda_334.01.01_mercury.dylib
    │   │   ├── libcuda_334.01.02_mercury.dylib
    │   │   ├── libcuda_334.01.03_mercury.dylib
    │   │   ├── libcuda_334.01.20_mercury.dylib
    │   │   ├── libcuda_343.01.01_mercury.dylib
    │   │   ├── libcuda_343.01.02_mercury.dylib
    │   │   ├── libcuda_343.02.01_mercury.dylib
    │   │   ├── libcuda_343.02.02_mercury.dylib
    │   │   ├── libcuda_343.02.03_mercury.dylib
    │   │   ├── libcuda_346.01.01_mercury.dylib
    │   │   ├── libcuda_346.01.02_mercury.dylib
    │   │   └── libgpgpucomp.dylib
    │   └── Resources
    │       ├── Info.plist
    │       └── compatibility_check
    └── Current -> A

from scikit-cuda.

lebedov avatar lebedov commented on July 20, 2024

What happens if you run the following code in Python on your system? If an exception is raised, please post it.

import ctypes
ctypes.cdll.LoadLibrary('/usr/local/cuda/lib/libcuda.dylib')

from scikit-cuda.

Leonhalt3141 avatar Leonhalt3141 commented on July 20, 2024

I run the code and there is no error.

In [1]: import ctypes

In [2]: ctypes.cdll.LoadLibrary('/usr/local/cuda/lib/libcuda.dylib')
Out[2]: <CDLL '/usr/local/cuda/lib/libcuda.dylib', handle 100760330 at 104688b90>

from scikit-cuda.

lebedov avatar lebedov commented on July 20, 2024

Does the following fail even when DYLD_LIBRARY_PATH is set to /usr/local/cuda/lib?

import ctypes
ctypes.cdll.LoadLibrary('libcuda.dylib')

If so, I'm not sure what is going on; you could manually work around the problem by modifying cudadrv.py in whatever directory scikits.cuda was installed in to load the full path to libcuda.dylib.

from scikit-cuda.

Leonhalt3141 avatar Leonhalt3141 commented on July 20, 2024

When I performed following code

export LD_LIBRARY_PATH=/usr/local/cuda/lib
ipython
import ctypes
ctypes.cdll.LoadLibrary('libcuda.dylib')
import scikits.cuda.cublas

I got following error.
I tried to find libdl.so by using find command, but cannot find it.

OSError                                   Traceback (most recent call last)
<ipython-input-3-3eeab81855f7> in <module>()
----> 1 import scikits.cuda.cublas

/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scikits/cuda/cublas.py in <module>()
     18
     19 import cuda
---> 20 import utils
     21
     22

/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scikits/cuda/utils.py in <module>()
    112                 ('dli_sname', ctypes.c_char_p),
    113                 ('dli_saddr', ctypes.c_void_p)]
--> 114 libdl = ctypes.cdll.LoadLibrary('libdl.so')
    115 libdl.dladdr.restype = int
    116 libdl.dladdr.argtypes = [ctypes.c_void_p,

/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ctypes/__init__.pyc in LoadLibrary(self, name)
    441
    442     def LoadLibrary(self, name):
--> 443         return self._dlltype(name)
    444
    445 cdll = LibraryLoader(CDLL)

/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ctypes/__init__.pyc in __init__(self, name, mode, handle, use_errno, use_last_error)
    363
    364         if handle is None:
--> 365             self._handle = _dlopen(self._name, mode)
    366         else:
    367             self._handle = handle

OSError: dlopen(libdl.so, 6): image not found

from scikit-cuda.

lebedov avatar lebedov commented on July 20, 2024

Don't use LD_LIBRARY_PATH. What happens when you just set DYLD_LIBRARY_PATH and run the code in my last comment?

from scikit-cuda.

Leonhalt3141 avatar Leonhalt3141 commented on July 20, 2024

Sorry for late reply...

I set '/usr/local/cuda/lib' for DYLD_LIBRARY_PATH,
but same error when I tried import scikits.cuda.cublas

But, I have no error following.

In [1]: import ctypes

In [2]: ctypes.cdll.LoadLibrary('libcuda.dylib')
Out[2]: <CDLL 'libcuda.dylib', handle 10295bba0 at 1040c8b90>

from scikit-cuda.

lebedov avatar lebedov commented on July 20, 2024

Assuming that you have the latest code from Github installed and DYLD_LIBRARY_PATH=/usr/local/cuda/lib, if you replace lines 22..30 in cudadrv.py with

    _libcuda = ctypes.cdll.LoadLibrary(_libcuda_libname)

(i.e., remove the try..except) and try to import scikits.cuda.cublas, what happens?

from scikit-cuda.

Leonhalt3141 avatar Leonhalt3141 commented on July 20, 2024

I tried what you mentioned, but got same error...

In [3]: import scikits.cuda.cublas
---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
<ipython-input-3-3eeab81855f7> in <module>()
----> 1 import scikits.cuda.cublas

/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scikits/cuda/cublas.py in <module>()
     18
     19 import cuda
---> 20 import utils
     21
     22

/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scikits/cuda/utils.py in <module>()
    112                 ('dli_sname', ctypes.c_char_p),
    113                 ('dli_saddr', ctypes.c_void_p)]
--> 114 libdl = ctypes.cdll.LoadLibrary('libdl.so')
    115 libdl.dladdr.restype = int
    116 libdl.dladdr.argtypes = [ctypes.c_void_p,

/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ctypes/__init__.pyc in LoadLibrary(self, name)
    441
    442     def LoadLibrary(self, name):
--> 443         return self._dlltype(name)
    444
    445 cdll = LibraryLoader(CDLL)

/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ctypes/__init__.pyc in __init__(self, name, mode, handle, use_errno, use_last_error)
    363
    364         if handle is None:
--> 365             self._handle = _dlopen(self._name, mode)
    366         else:
    367             self._handle = handle

OSError: dlopen(libdl.so, 6): image not found

from scikit-cuda.

lebedov avatar lebedov commented on July 20, 2024

You are using an old version of scikits.cuda that had a known problem with MacOSX (see this comment). Can you please try the latest code from GitHub?

from scikit-cuda.

Leonhalt3141 avatar Leonhalt3141 commented on July 20, 2024

Thank you for your kind help!

I installed the latest scikits.cuda from GitHub by

pip install git+https://github.com/lebedov/scikit-cuda.git

and modified /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/skcuda/cudadrv.py as you mentioned.

I set path export DYLD_LIBRARY_PATH=/usr/local/cuda/lib

and finally, I could import scikits.cuda.cublas

python -c "import scikits.cuda.cublas"

Thanks a lot!

from scikit-cuda.

lebedov avatar lebedov commented on July 20, 2024

Great (although if everything is working, you don't need the cudadrv.py modification - I suggested that simply in order to debug the problem).

from scikit-cuda.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.