JuliaAttic / CUBLAS.jl

Julia interface to CUBLAS
Other
26 stars 19 forks source link

Proposed fix on finding CUBLAS lib on Windows. #12

Open AngeloCiffa opened 9 years ago

AngeloCiffa commented 9 years ago

Hello,

I have found an issue running CUBLAS on windows using your lib. The file libcuda is called cublas64_75. It requires the user to have CUDA 7.5 installed.

We should find a way to abstract the version in the name of the dll.

Hope that helps,

AngeloCiffa commented 9 years ago

Found this piece of code in a python lib scikit-cuda (https://github.com/lebedov/scikit-cuda/blob/master/skcuda/cublas.py) Line 25 to 40

This is how they achieved getting the proper installed version of the cublas dll on Windows:

#   Load library:
 _version_list = [7.5, 7.0, 6.5, 6.0, 5.5, 5.0, 4.0]
 if 'linux' in sys.platform:
     _libcublas_libname_list = ['libcublas.so'] + \
                               ['libcublas.so.%s' % v for v in _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' % int(10*v) for v in _version_list]
     else:
         _libcublas_libname_list = ['cublas.dll'] + \
                                   ['cublas32_%s.dll' % int(10*v) for v in _version_list]
 else:
     raise RuntimeError('unsupported platform')

Hope that helps