Search code examples
pythoncudascikits

cusolver library not found


I am trying to use skcuda in my python code but whenever i want to use it, it rises the following exception:

Traceback (most recent call last):
File "/home/rohola/Projects/Python/wordnetwork/s.py", line 6, in     <module>
from skcuda import cusolver
File "/home/rohola/anaconda3/lib/python3.4/site-     packages/skcuda/cusolver.py", line 51, in <module>
raise OSError('cusolver library not found')
OSError: cusolver library not found

i was just tried to use skcuda

from skcuda import cusolver
handle = cusolver.cusolverDnCreate()

i installed pycuda, NVIDIA CUDA Toolkit. What's wrong about my code or dependencies?


Solution

  • I finally found a solution to my problem. Firstly, i searched for libcusolver.so with

    locate libcusolver.so
    

    and then changed the following code in cusolver.py from:

    _libcusolver = ctypes.cdll.LoadLibrary(_libcusolver_libname)
    

    to:

    _libcusolver = ctypes.cdll.LoadLibrary("/usr/local/cuda-7.5/targets/x86_64-linux/lib/"+_libcusolver_libname)
    

    now the following code:

    from skcuda import cusolver
    handle = cusolver.cusolverDnCreate()
    

    works without any error.

    UPDATE:

    If you have installed cuda8.0 or 9.0 the best way to solve the problem is to find this line in cusolver.py:

    _libcusolver = ctypes.cdll.LoadLibrary(_libcusolver_libname)
    

    and add this line before it: ctypes.CDLL('libgomp.so.1', mode=ctypes.RTLD_GLOBAL)

    You have to make sure that you already installed libgomp.