Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cublas library not found #269

Closed
cegprakash opened this issue Nov 12, 2018 · 27 comments
Closed

cublas library not found #269

cegprakash opened this issue Nov 12, 2018 · 27 comments

Comments

@cegprakash
Copy link

Problem

step 1: install scikit-cuda==0.5.2
step 2: Just do import skcuda.linalg as linalg

Error

File "C:\Users\cegprakash.virtualenvs\similarity_articles-JuZA6FGA\lib\site-packages\skcuda\linalg.py", line 23, in
from . import cublas
File "C:\Users\cegprakash.virtualenvs\similarity_articles-JuZA6FGA\lib\site-packages\skcuda\cublas.py", line 55, in
raise OSError('cublas library not found')
OSError: cublas library not found

Environment

@cegprakash
Copy link
Author

related closed issues #202 #179

@cegprakash
Copy link
Author

cegprakash commented Nov 12, 2018

I also tried
CUDA version : V8.0.60

I got a similar error

  File "C:\Users\cegprakash\.virtualenvs\similarity-JuZA6FGA\lib\site-packages\skcuda\linalg.py", line 11, in <module>
    from pycuda.tools import context_dependent_memoize
  File "C:\Users\cegprakash\.virtualenvs\similarity-JuZA6FGA\lib\site-packages\pycuda\tools.py", line 34, in <module>
    import pycuda.driver as cuda
  File "C:\Users\cegprakash\.virtualenvs\similarity-JuZA6FGA\lib\site-packages\pycuda\driver.py", line 5, in <module>
    from pycuda._driver import *  # noqa
ImportError: DLL load failed: The specified module could not be found.

@cegprakash
Copy link
Author

tried 'scikit-cuda==0.5.1'
same issue persists : cublas library not found

@lebedov
Copy link
Owner

lebedov commented Nov 13, 2018

Re the error you obtained with CUDA 10, try the latest revision on GitHub. If that doesn't work, check your CUDA installation; skcuda uses Python ctypes' built-in shared library loader to look for libraries - if a library isn't found, it may need to be added to whatever path or registry entry Win10 uses to search for libraries.

The error you obtained with CUDA 8 is a pycuda error which suggests that pycuda wasn't built/installed properly.

@cegprakash
Copy link
Author

cegprakash commented Nov 13, 2018

What is the system path of cublas?

@lebedov
Copy link
Owner

lebedov commented Nov 13, 2018

According to NVIDIA's online docs for Windows, the default CUDA installation path is C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0 (the actual path may differ on your system depending on how you installed it) - the libraries might be in a subfolder. Unfortunately, I don't have a Win10 system with a GPU in it to confirm.

@cegprakash
Copy link
Author

Cublas.h is available here C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\include and
cublas64_80.dll is available in C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\bin
I also have cublas.lib here C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\lib\x64

What else could be the problem?

@cegprakash
Copy link
Author

if anyone made it work on windows 10, plz let me know python version, cuda version and scikit-cuda version

@lebedov
Copy link
Owner

lebedov commented Nov 14, 2018

For Win10, try adding C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\lib\x64 to your PATH environmental variable (assuming that CUDA 10 was installed in the default location).

@cegprakash
Copy link
Author

I face the same error even after adding this path to environment variable

@lebedov
Copy link
Owner

lebedov commented Nov 14, 2018

I assume that the CUBLAS dll files are actually located in C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\lib\x64 ? If so, not sure why Python can't see them.

@cegprakash
Copy link
Author

the dll was that there in 8.0 version (as I uninstalled 10.0). I removed that comment as soon as I found it. But even after adding environment variable I got the same error.

@cegprakash
Copy link
Author

if anyone made it work on windows 10, plz let me know python version, cuda version and scikit-cuda version

@lebedov
Copy link
Owner

lebedov commented Nov 15, 2018

You may wish to inquire on stackoverflow or some similar forum, as the failure of Python ctypes to find a shared library is not specific to skcuda.

@cegprakash
Copy link
Author

This issue is only windows specific. (Just tested in Ubuntu + Nvidia where it runs fine)

@ataudt
Copy link

ataudt commented Dec 17, 2018

I had the same error on similar specs:
OSError: cublas library not found

  • Windows 10
  • python 3.7.0
  • CUDA (nvcc) V10.0.130
  • pycuda==2018.1.1

and got it running by installing scikit-cuda-0.5.3 from github. The cublas DLL was called cublas64_100.dll and this was not expected in scikit-cuda-0.5.2

@lebedov
Copy link
Owner

lebedov commented Dec 19, 2018

@ataudt Yes - that's why I suggested the latest GitHub revision. That said, I'm not sure why adding the path to the dll on the Windows system @cegprakash described to PATH didn't fix the problem on his system; is there a CUDA-related path in your system's PATH variable?

@bryantChhun
Copy link

Could someone provide instructions on how to get version 0.5.3 from github? I'd very much prefer not to build from source.

@lebedov
Copy link
Owner

lebedov commented Dec 21, 2018

@bryantChhun If you have setuptools installed, you can install the latest version from GitHub as follows:

pip install -e git://github.com/lebedov/scikit-cuda#egg=scikit-cuda

Or, just clone the repository and install as follows:

git clone https://github.com/lebedov/scikit-cuda
cd scikit-cuda
python setup.py install

@bryantChhun
Copy link

FYI, installing latest version (0.5.3) solved this problem for me.

@ystallonne
Copy link

scikit-cuda version : 0.5.3
CUDA v10.1
Windows 10
PyCUDA version : 2018.1.1
Python 3.7.3

raise OSError('cublas library not found')
facing this issue again...

It is trying to load cublas64_40.dll, but I have cublas64_10.dll.

@lebedov
Copy link
Owner

lebedov commented May 12, 2019

@ystallonne Not sure why NVIDIA decided to name the Windows CUBLAS library the way they did - updated cublas.py to look for cublas64_10.dll. Try the latest revision on GitHub.

@lebedov lebedov closed this as completed May 12, 2019
@ystallonne
Copy link

ystallonne commented May 12, 2019

Thank you, @lebedov
I got the latest revision, the cublas is solved, but now I get an error for the cusolver library:
raise OSError('cusolver library not found')
I have cusolver64_10.dll and it is looking for cusolver64_70.dll.

I ran "python setup.py test" and I see that cufft is probably next:
raise OSError('cufft library not found')

@lebedov
Copy link
Owner

lebedov commented May 12, 2019

@ystallonne Ah, yes - updated cusolver.py, cufft.py, and cusparse.py accordingly.

@zengzhi2015
Copy link

zengzhi2015 commented May 15, 2019

Hei, I find out a bug in 'cublus.py'.

        _libcublas_libname_list = ['cublas.dll'] + \
            ['cublas64_%s.dll' % (int(v) if v >= 10 else int(10*v)) for v in _version_list]

When I print out the list, I get the following:

['cublas.dll', 'cublas64_10.dll', 'cublas64_10.dll', 'cublas64_92.dll', 'cublas64_91.dll', 'cublas64_90.dll', 'cublas64_80.dll', 'cublas64_75.dll', 'cublas64_70.dll', 'cublas64_65.dll', 'cublas64_60.dll', 'cublas64_55.dll', 'cublas64_50.dll', 'cublas64_40.dll']

But what I really have in windows is 'cublas64_100.dll'. So, it is adviced that the code should be changed to

        _libcublas_libname_list = ['cublas.dll'] + \
            ['cublas64_%s.dll' % int(10*v) for v in _version_list]

By the way, this error also exists in 'cusolver.py' and maybe other files...

@lebedov
Copy link
Owner

lebedov commented May 17, 2019

@zengzhi2015 You presumably are using CUDA 10.0. It seems that the shared library was named cublas64_100.dll in CUDA 10.0 and cublas64_10.dll in CUDA 10.1. I updated the files to explicitly list the shared library file names used on Linux and Windows.

@lebedov
Copy link
Owner

lebedov commented May 17, 2019

I'm locking this issue because folks keep on tagging on comments to it; this complicates debugging because each scenario may potentially be different. For users who encounter problems that seem similar to this one in the future, please submit a new issue.

Repository owner locked and limited conversation to collaborators May 17, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants