[Numpy-discussion] speed of numpy vs matlab on dot product

JJ josh8912 at yahoo.com
Sat Jun 10 18:15:07 EDT 2006


Hello.  I am a new user to scipy, thinking about
crossing over from Matlab.  I have a new AMD 64
machine and just installed fedora 5 and scipy.  It is
a dual boot machine with windows XP.  I did a small
test to compare the speed of matlab (in 32 bit
windows, Matlab student v14) to the speed of scipy (in
fedora, 64 bit).  I generated two random matrices of
10,000 by 2,000 elements and then took their dot
product.  The scipy code was:

python
import numpy
import scipy
a = scipy.random.normal(0,1,[10000,2000])
b = scipy.random.normal(0,1,[10000,2000])
c = scipy.dot(a,scipy.transpose(b))
 
I timed the last line of the code and compared it to
the equivalent code in Matlab.  The results were that
Matlab took 3.3 minutes and scipy took 11.5 minutes. 
Thats a factor of three.  I am surprised with the
difference and am wondering if there is anything I can
do to speed up scipy.  
 
I installed scipy, blas, atlas, numpy and lapack from
source, just as the instructions on the scipy web site
suggested (or as close to the instructions as I
could).  The only thing odd was that when installing
numpy, I received messages that the atlas libraries
could not be found.  However, it did locate the lapack
libraries.  I dont know why it could not find the
atlas libraries, as I told it exactly where to find
them.  It did not give the message that it was using
the slower default libraries.  I also tried compiling
after an export ATLAS =  statement, but that did not
make a difference.  Wherever I could, I complied it
specifically for the 64 bit machine.  I used the
current gcc compiler.  The ATLAS notes suggested that
the speed problems with the 2.9+ compilers had been
fixed.

Any ideas on where to look for a speedup?  If the
problem is that it could not locate the atlas
ibraries, how might I assure that numpy finds the
atlas libraries.  I can recompile and send along the
results if it would help.  
Thanks.  John

PS.  I first sent this to the scipy mailing list, but
it didnt seem to make it there.


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 




More information about the NumPy-Discussion mailing list