[Numpy-discussion] debian benchmarks
Francesc Alted
faltet at pytables.org
Tue Jul 6 03:01:08 EDT 2010
A Monday 05 July 2010 15:32:51 Isaac Gouy escrigué:
> Sturla Molden <sturla <at> molden.no> writes:
> > It is also the kind of tasks where NumPy would help. It would be nice to
> > get NumPy into the shootout. At least for the sake of advertising
>
> http://shootout.alioth.debian.org/u32/program.php?test=spectralnorm&lang=py
> thon&id=2
Let's join the game :-) If I run the above version on my desktop computer
(Intel E8600 Duo @ 3 GHz, DDR2 @ 800 MHz memory) I get:
$ time python -OO spectralnorm-numpy.py 5500
1.274224153
real 0m9.724s
user 0m9.295s
sys 0m0.269s
which should correspond to the 12.86s in shootout (so my machine is around 30%
faster). But, if I use ATLAS (3.9.25) so as to accelerate linear algebra:
$ python -OO spectralnorm-numpy.py 5500
1.274224153
real 0m5.862s
user 0m5.566s
sys 0m0.225s
Then, my profile said that building M matrix took a lot of time. After using
numexpr to improve this (see attached script), I get:
$ python -OO spectralnorm-numpy-numexpr.py 5500
1.274224153
real 0m3.333s
user 0m3.071s
sys 0m0.163s
Interestingly, memory consumption also dropped from 480 MB to 255 MB.
Finally, if using Intel's MKL for taking advantage of my 2 cores:
$ python -OO spectralnorm-numpy-numexpr.py 5500
1.274224153
real 0m2.785s
user 0m4.117s
sys 0m0.139s
which is a 3.5x improvement over the initial version. Also, this seems faster
(around ~25%), and consumes similar memory than the fastest version written in
pure C in "interesting alternatives" section:
http://shootout.alioth.debian.org/u32/performance.php?test=spectralnorm#about
I suppose that, provided that Matlab also have a JIT and supports Intel's MKL,
it could beat this mark too. Any Matlab user would accept the challenge?
--
Francesc Alted
-------------- next part --------------
A non-text attachment was scrubbed...
Name: spectralnorm-numpy-numexpr.py
Type: text/x-python
Size: 778 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20100706/03aced9f/attachment.py>
More information about the NumPy-Discussion
mailing list