[SciPy-user] Re: BLAS optimized matrix multiplication

Pearu Peterson pearu at scipy.org
Tue Jun 1 13:57:21 CDT 2004

On Tue, 1 Jun 2004, Kirill Lapshin wrote:

> Pearu Peterson wrote:
> > 
> > Scipy 0.3 win32 installer should use ATLAS 3.6.0 that is optimized for 
> > PIII. Note that scipy.dot refers to Numeric/dotblas.dot function:
> > 
> > In [1]: import scipy
> > 
> > In [2]: scipy.dot.__module__
> > Out[2]: 'dotblas'
> > 
> > (at least on my debian box).
> Well not on my Windows box. It says 'Numeric' here. I am using binary 
> install from scipy.org, the one which claims that it comes with ATLAS 
> 3.6.0. I guess the problem is that Numeric binary package distributed by 
> Numeric guys does not have dotblas compiled. That's what I was trying to 
> say -- Numeric comes without ATLAS so they did not include dotblas, but 
> you do distribute ATLAS on windows, so it would be natural for you to 
> add dotblas in SciPy. I know that I can recompile Numeric and SciPy, but 
> it would be nice if default install would do the right thing.

I agree. We need then dotblas implementation that uses linalg, testing 
site as well as some benchmarks. Any takers?

> BTW, since you are using Debian, is there Debian package for SciPy? 
> Looks like there is no official one yet, but maybe someone maintains 
> unofficial? Any plans on official package?

Yes, Jose Fonseca has packaged Scipy for debian. See


Basically, a debian sponsor is needed for getting Scipy to official 
Debian but no one has responed since March according to the above debian 
bug issue.

> > Scipy has linalg that contains wrappers to blas/lapack libraries and use 
> > ATLAS when available. See 
> > 
> >   dir(scipy.linalg.cblas)
> >   dir(scipy.linalg.fblas)
> >   dir(scipy.linalg.clapack)
> >   dir(scipy.linalg.flapack)
> Cool, thanks. x = scipy.linalg.fblas.dgemm(1,a,b) is much much faster 
> than x = dot(a,b).
> BTW, why cblas module is almost empty and fblas has all the wrappers? Is 
> it safe to assume that fblas has the same set of routines on all 
> platforms, or is it configuration specific?

Ideally, one should use blas/lapack functions returned by


These hooks take into account the type and data-ordering of input 
arrays and return optimal routine for a particular task, see linalg 
functions for example usages. For example,

In [25]: gemm, = 

In [26]: gemm.typecode
Out[26]: 'f'

In [27]: gemm, = 

In [28]: gemm.typecode

cblas and fblas differ for several reasons (for 1-d arrays it 
doesn't matter whether you use cblas or fblas, cblas requires additional 
wrappers, etc) and at the moment it is not safe to assume that they will 
contain the same set of functions.

> > Yes, I think we should release 0.3.1 before summer.
> It is summer already :)
> Oh, wait, did you mean summer 2005? Just kidding.

Well, in Estonia we still have spring;-) Summer starts in June 23.


More information about the SciPy-user mailing list