在使用skcuda,运行以下代码时
import skcuda.linalg as linalg
报错:
File "C:\Users\victo\Anaconda3\envs\spikesorting_tsne\lib\site-packages\skcuda\linalg.py", line 21, in
from . import cublas
File "C:\Users\victo\Anaconda3\envs\spikesorting_tsne\lib\site-packages\skcuda\cublas.py", line 55, in
raise OSError('cublas library not found')
OSError: cublas library not found
我的解决方案: 用everything,搜索cublas,找到cublas**.dll,比如cublas64_10.dll,然后将报错的cublas.py中的以下部分:
if 'linux' in sys.platform:
_libcublas_libname_list = ['libcublas.so'] + \
['libcublas.so.%s' % v for v in _linux_version_list]
elif sys.platform == 'darwin':
_libcublas_libname_list = ['libcublas.dylib']
elif sys.platform == 'win32':
if sys.maxsize > 2**32:
_libcublas_libname_list = ['cublas.dll'] + \
['cublas64_%s.dll' % v for v in _win32_version_list]
else:
_libcublas_libname_list = ['cublas.dll'] + \
['cublas32_%s.dll' % v for v in _win32_version_list]
else:
raise RuntimeError('unsupported platform')
修改为(因为我是在windows上运行的所以只改了一部分):
if 'linux' in sys.platform:
_libcublas_libname_list = ['libcublas.so'] + \
['libcublas.so.%s' % v for v in _linux_version_list]
elif sys.platform == 'darwin':
_libcublas_libname_list = ['libcublas.dylib']
elif sys.platform == 'win32':
if sys.maxsize > 2**32:
_libcublas_libname_list = ['cublas64_10.dll'] + \
['cublas64_%s.dll' % v for v in _win32_version_list]
else:
_libcublas_libname_list = ['cublas.dll'] + \
['cublas32_%s.dll' % v for v in _win32_version_list]
else:
raise RuntimeError('unsupported platform')
这样报错就取消了!
|