Accessing OpenBLAS from Python

205 views
Skip to first unread message

SixString

unread,
Mar 4, 2015, 2:46:41 PM3/4/15
to winp...@googlegroups.com
After experimenting with GPU libraries, I learned that the CPU is faster for processing dot products on large vectors.  I am presently using on WinPython SciPy's BLAS function ddot() on the CPU.  I found it about 10% faster than using dot() in Numpy.  carlkl referenced this article documenting a speedup of 5.8X or more for GFortran's library dsdot() over NumPy:
http://iamtrask.github.io/2014/11/23/cython-blas-fortran/

Is OpenBLAS' speed comparable to GFortran's BLAS library?  Would you expect a similar speedup going from SciPy in WinPython to OpenBLAS?  5.8X makes it worth my effort.

I understand that I would use Cython to interface to the libopenblas.dll library.  This post suggests that this would work with WinPython distribution and not work with the Anaconda distribution:
https://github.com/ContinuumIO/anaconda-issues/issues/271

I hesitate to go with this path because my code is no longer portable between Python distributions, and I have to recompile for each new Python version (and hope that nothing breaks the compilation process).  I don't think the problems are reduced by keeping up with MS Visual Studio as the compiler instead.  Also, with the latest 64-bit WinPython, I can have a Julia interface or a Cython interface to OpenBLAS, but not both.

Another option I have is to do the function in the Julia language, whose standard libraries are built on OpenBLAS.  I hesitate to move all of my development to Julia because then I don't have a graphical debugger and variable explorer as with Spyder.  So I could implement just the functions I need in Julia and access them from Python with pyjulia.  99% of the CPU time is spent in one simple dot product function.  My complex code then remains in Python.  Doing it this way, I need only update my Python and Julia installations (with no compilation).

I see that OpenBLAS has been merged to the NumPy master branch:
https://github.com/numpy/numpy/pull/5614

Will the next release of NumPy include OpenBLAS?  If so, that may be easiest way for me to get the same speedup.  Did I overlook something?
Reply all
Reply to author
Forward
0 new messages