[SciPy-user] SciPy ATLAS vs. Matlab 7.2 linear algebra benchmarks
Bart Vandereycken
bart.vandereycken at cs.kuleuven.be
Thu Aug 30 10:54:53 EDT 2007
Jose Unpingco wrote:
> For this experiment, I create a square matrix with random entries of
> size 500, 1000, 1500, 2000 and then apply a variety of factorizations to
> those matrices. Naturally, each of these experiments is run on exactly
> the same workstation. The times are wall times in seconds.
>
> The bottom line is that Matlab is still substantially faster than either
> of the ATLAS library versions. However, the newer developer version
> (3.7.37) of the ATLAS library is about one third faster than the
> previous version (3.6). Note that Enthought SciPy distribution includes
> ATLAS 3.6.
I think you compared the wrong timings. If I compare the svd of scipy
(atlas 3.6) and matlab 7.2 on my machine I get:
n 500 1000 1500
scipy 0.4 3.9 13
matlab 0.4 3.9 13
There is no difference between scipy and matlab.
Matlab script:
tic; s = svd(A); toc
Scipy script:
import numpy as NY
import scipy.linalg as LA
import time
t = time.time()
T = LA.svd(A,compute_uv=0)
t = time.time() - t
print t
As you can see the compute_uv=0 is important. The matlab command "s =
svd(A)" only computes the singular values.
If you want the full output with singular vectors, I get this
n 500 1000 1500
scipy 1.3 10 31
matlab 3.0 32 107
Now scipy is significantly faster! This is probably because matlab's
output for S is a full matrix and the V is not transposed. Scipy just
gives you the raw output of lapack svd routines, which is good enough.
Matlab script:
tic; [U,S,V] = svd(A); toc
Scipy script:
import numpy as NY
import scipy.linalg as LA
import time
t = time.time()
T = LA.svd(A)
t = time.time() - t
print t
I suspect the same has happened to the lu and qr routines. It would help
if you include the benchmark code.
BTW I didn't know atlas 3.7 was that much faster :)
-- bart
More information about the SciPy-User
mailing list