[Numpy-discussion] The value of a native Blas

Chris Barker Chris.Barker at noaa.gov
Thu Jul 29 12:01:05 CDT 2004

Hi all,

I think this is a nifty bit of trivia.

After getting my nifty Apple Dual G5, I finally got around to doing a 
test I had wanted to do for a while. The Numeric package uses LAPACK for 
the Linear Algebra stuff. For OS-X there are two binary versions 
available for easy install:

One linked against the default, non-optimized version of BLAS (from Jack 
  Jansen's PackMan database)

One linked against the Apple Supplied vec-lib as the BLAS. (From Bob 
Ippolito's PackMan database (http://undefined.org/python/pimp/)

To compare performance, I wrote a little script that generates a random 
matrix and vector: A, b, and solves the equation: Ax = b for x

N = 1000

a = RandomArray.uniform(-1000, 1000, (N,N) )
b = RandomArray.uniform(-1000, 1000, (N,) )
start = time.clock()
x = solve_linear_equations(a,b)
print "It took %f seconds to solve a %iX%isystem"%(
time.clock()-start, N, N)

And here are the results:

With the non-optimized version:

It took 3.410000 seconds to solve a 1000X1000 system
It took 28.260000 seconds to solve a 2000X2000 system

With vec-Lib:

It took 0.360000 seconds to solve a 1000X1000 system
It took 2.580000 seconds to solve a 2000X2000 system

for a speed increase of over 10 times! Wow!

Thanks Bob, for providing that package.

I'd be interested to see similar tests on other platforms, I haven't 
gotten around to figuring out how to use a native BLAS on my Linux box.


Christopher Barker, Ph.D.
NOAA/OR&R/HAZMAT         (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker at noaa.gov

More information about the Numpy-discussion mailing list