scikit-cuda
scikit-cuda copied to clipboard
ERROR: libcublas.so: undefined symbol: cublasSgetrsBatched while importing skcuda.linalg
Problem
I was trying to import skcuda.linalg while I received the following error:
import skcuda.linalg
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/rstudent/mitradip/soft/compile/scikit-cuda-master/skcuda/linalg.py", line 23, in <module>
from . import cublas
File "/home/rstudent/mitradip/soft/compile/scikit-cuda-master/skcuda/cublas.py", line 5863, in <module>
_libcublas.cublasSgetrsBatched.restype = int
File "/home/rstudent/mitradip/soft/compile/anaconda3/lib/python3.7/ctypes/__init__.py", line 377, in __getattr__
func = self.__getitem__(name)
File "/home/rstudent/mitradip/soft/compile/anaconda3/lib/python3.7/ctypes/__init__.py", line 382, in __getitem__
func = self._FuncPtr((name_or_ordinal, self))
AttributeError: /usr/local/cuda/lib64/libcublas.so: undefined symbol: cublasSgetrsBatched
Kindly let me know how I can correct it and use skcuda for matrix diagonalization.
Environment
- OS Platform: Scientific Linux 6
- Python Version: 3.7.4 (Anaconda)
- CUDA Version: 5.0.0 (release 5.0, V0.2.1221)
- PyCUDA Version: 2019.1.2 (installed using PIP)
- scikit-cuda Version: 0.5.3 (probably, downloaded from GitHub on Jan 25, 2020 using master branch)
The version of CUDA you are using is quite old; cublasSgetrsBatched probably isn't defined in CUDA 5. If you can't update your CUDA installation (i.e., because you don't have admin access on the computer you are using), you can try installing the cudatoolkit package from Anaconda and manually modifying cublas.py to use the libcublas.so library provided by that package if it isn't automatically found by scikit-cuda.
I just hit the same problem with scikit-cuda=0.5.3 from pypi. In cublas.py then pdb shows _cuda_version=7050
and the machine has nvcc -V
returning version 6.5. I don't know how to look up the right version checks, but just testing if the functions are in the library seems like a plausible strategy:
OPTIONAL = ["cublasSgetrsBatched",
"cublasDgetrsBatched",
"cublasCgetrsBatched",
"cublasZgetrsBatched" ]
for name in OPTIONAL:
if getattr( _libcublas, name, None ) is None:
def f(*a,**k):
raise NotImplementedError("cublas: "+name)
setattr(_libcublas, name, f )
Would you like to get a pull request based on this ?