[Numpy-discussion] Numpy matrix multiplication slow even though ATLAS linked
Jan-Willem van de Meent
vandemeent at damtp.cam.ac.uk
Thu Oct 30 18:19:01 EDT 2008
On Thursday 30 October 2008 18:41:51 Charles R Harris wrote:
> On Thu, Oct 30, 2008 at 5:19 AM, Jan-Willem van de Meent <
>
> vandemeent at damtp.cam.ac.uk> wrote:
> > Dear all,
> >
> > This is my first post to this list. I am having perfomance issues with
> > with numpy/atlas. Doing dot(a,a) for a 2000x2000 matrix takes about
> > 1m40s, even though numpy is appears to link to my atlas libraries:
> >
> > I did a quick benchmark by running the following script:
> >
> > #! /usr/bin/env python
> > import numpy
> > import time
> >
> > try:
> > import numpy.core._dotblas
> > print 'Using ATLAS:'
> > except ImportError:
> > print 'No ATLAS:'
> >
> > t = time.time()
> > x = numpy.random.random((1000,1000))
> > y = numpy.random.random((1000,1000))
> > z = numpy.dot(x, y)
> >
> > print time.time()-t
> >
> > My laptop is a Dell D620 Core Duo T2300 1.66 Ghz, running Archlinux with
> > GCC
> > 4.3.2, atlas 3.8.2, python 2.5.2 and numpy 1.2.1. Output of the script
> > above
> > is:
> >
> > Using ATLAS:
> > 7.99549412727
> >
> > A department desktop PC, Pentium D 3.00 Ghz, running Scientific Linux,
> > with GCC 4.1.2, atlas 3.7.30, python 2.5.1 and numpy 1.1.0, runs this
> > test 24 times faster:
> >
> > Using ATLAS:
> > 0.337520122528
>
> About .40 here with numpy from svn.
>
> > So even though _dotblas.so exists, matrix multiplication appears to run
> > at pretty much the same speed as if atlas were not available. Running
> > ldd on _dotblas.so suggests that numpy is indeed linking to the atlas
> > libs:
> >
> > ldd /usr/lib/python2.5/site-packages/numpy/core/_dotblas.so
> > linux-gate.so.1 => (0xb7fcf000)
> > libatlas.so => /usr/lib/libatlas.so (0xb7cb5000)
> > liblapack.so => /usr/lib/liblapack.so (0xb77ab000)
> > libcblas.so => /usr/lib/libcblas.so (0xb778b000)
> > libf77blas.so => /usr/lib/libf77blas.so (0xb776f000)
> > libpython2.5.so.1.0 => /usr/lib/libpython2.5.so.1.0 (0xb7630000)
> > libpthread.so.0 => /lib/libpthread.so.0 (0xb7618000)
> > libc.so.6 => /lib/libc.so.6 (0xb74d6000)
> > libm.so.6 => /lib/libm.so.6 (0xb74b0000)
> > libgfortran.so.3 => /usr/lib/libgfortran.so.3 (0xb73ff000)
> > libdl.so.2 => /lib/libdl.so.2 (0xb73fb000)
> > libutil.so.1 => /lib/libutil.so.1 (0xb73f6000)
> > /lib/ld-linux.so.2 (0xb7fd0000)
>
> What's in /usr/local/lib? Do you have a 64 bit system? What does locate
> libatlas return?
>
> Chuck
Thanks for the response. I'm on 32 bit and all ATLAS files are installed
in /usr/lib (headers are in /usr/include/atlas)
/usr/lib/libatlas.a
/usr/lib/libatlas.so
/usr/lib/libblas.so
/usr/lib/libblas.so.3
/usr/lib/libblas.so.3.0.3
/usr/lib/libcblas.a
/usr/lib/libcblas.so
/usr/lib/libf77blas.a
/usr/lib/libf77blas.so
/usr/lib/liblapack.a
/usr/lib/liblapack.so
/usr/lib/liblapack.so.3
/usr/lib/libptcblas.a
/usr/lib/libptf77blas.a
I posted a full build log earlier today, but I think it is still awaiting
approval of moderators because of file size limitations.
JW
More information about the NumPy-Discussion
mailing list