[Numpy-discussion] numarray and ATLAS

Francesc Alted falted at pytables.org
Sat Oct 16 04:29:02 CDT 2004


A Divendres 15 Octubre 2004 19:03, Francesc Alted va escriure:
> >>> import timeit
> >>> t1 = timeit.Timer("m3=numarray.dot(m1,m2)", "import numarray;dim1=500;m1=numarray.arange(dim1*dim1,shape=(dim1,dim1), type=numarray.Float32);m2=numarray.arange(dim1*dim1,shape=(dim1,dim1), type=numarray.Float32)")
> >>> t1.repeat(3,10)
> [3.7274820804595947, 3.8542821407318115, 3.7117569446563721]
> 
> However, Numeric seems to get it:
> 
> >>> t3 = timeit.Timer("m3=Numeric.dot(m1,m2)", "import Numeric;dim1=500;m1=Numeric.arange(dim1*dim1, typecode='f');Numeric.reshape(m1, (dim1,dim1));m2=Numeric.arange(dim1*dim1,typecode='f');Numeric.reshape(m2,(dim1,dim1))")
> >>> t3.repeat(3,10)
> [0.0093162059783935547, 0.0096318721771240234, 0.0092968940734863281]
> 
> i.e. almost 300 faster than numarray

Ooops! The Numeric test had a bug on it. The correct test would be:

>>> t3 = timeit.Timer("m3=Numeric.dot(m1,m2)", "import Numeric;dim1=500;m1=Numeric.arange(dim1*dim1, typecode='f');m1=Numeric.reshape(m1, (dim1,dim1));m2=Numeric.arange(dim1*dim1,typecode='f');m2=Numeric.reshape(m2,(dim1,dim1))")
>>> t3.repeat(3,10)
[0.47363090515136719, 0.47403502464294434, 0.47770595550537109]

which is 8 times faster, more or less, than numarray (or Numeric) without
ATLAS.

Just to clarify things ;)

-- 
Francesc Alted





More information about the Numpy-discussion mailing list