4.0 Slowdown

4 views
Skip to first unread message

Timothy Cyders

unread,
Nov 7, 2009, 4:45:12 PM11/7/09
to fre...@googlegroups.com
I've been doing some really simple benchmarking, and I see that most matrix operations are slower in 4.0 than previous versions (even with JIT turned off). Gaussian elimination, for example, is slowed down by ~40% on my machine (same across Linux and Windows), while matrix multiplication is slowed down by ~70%.

Example:

--> A = rand(1000);B = rand(1000); tic;A*B;toc
                                                             
ans =      
                                                               
     1.0150                 <--- Version 3.6

ans =

      3.4530                 <--- Version 4.0

Was the architecture for basic operations like this changed, or is there a way to speed things up?

TJ

Eugene

unread,
Nov 8, 2009, 1:48:43 AM11/8/09
to fre...@googlegroups.com
TJ,

Timing of matrix multiply for large matrices should mostly depend on the
BLAS library speed.

We added dynamic blas loading and also have an un-optimized fall-back
blas library. So, it is possible that you are using the fall-back blas
in 4.0. Another thing, the first time you do matrix multiplication (or
any other operation that involves blas) it's going to take longer -
FreeMat uses lazy function resolution on the first call.

You can control which blas library is used by using blaslib command. The
available blas libraries are listed in blas.ini file. Under windows we
ship generic blas and ATLAS blas optimized for Pentium III. Under Linux
we only have reference blas. Library that is marked with "*" is the one
that is used.

You can try building ATLAS blas for your CPU, adding it to blas.ini and
loading it for the test.

Hope this helps. Please post your results - good or bad.

Eugene

Timothy Cyders

unread,
Nov 8, 2009, 8:34:28 AM11/8/09
to fre...@googlegroups.com
Eugene,


Using ATLAS sped things up very quickly. So far I've only tested Linux64, but all I needed to do was add the asterisk after the [Linux64] in /usr/bin/blas.ini, restart FreeMat and it was good to go (I already had libblas installed through my package manager).

Old results vs. new results:


--> A = rand(1000);B = rand(1000); tic;A*B;toc
                              
                               
ans =      
                                                               
     1.0150                 <--- Version 3.6

ans =

      3.4530                 <--- Version 4.0 %%%---OLD RESULTS---%%%

ans =

      0.3220                 <--- Version 4.0 %%%---NEW RESULTS---%%%

Result is about a 10x speed increase over the unoptimized blas library, and a 3x speedup from 3.6.

TJ
Reply all
Reply to author
Forward
0 new messages