# Linking to ATLAS/BLAS in Cython

I've been using GSL's CBLAS for performing "fast" matrix-vector arithmetic in a Cython script but I've been told that ATLAS' CBLAS is faster by a couple of factors. However, I'm having trouble locating the ATLAS libraries and headers in $SAGE_ROOT/local. Could someone provide tips on how to link to CBLAS in my Cython code? Thanks. Edit: I found in module_list.py how different implementations of BLAS are detected. However, I haven't found any example codes that cdef extern that functionality directly! Anyone have any examples of using Sage's detected version of ATLAS? edit retag close merge delete ## 1 answer Sort by » oldest newest most voted Are you using OS X or Linux? The answer is slightly different on each platform. Linux: Link in cblas instead of gslcblas. Observe: wstein@sage:/tmp/wstein/sage-4.6.2-sage.math.washington.edu-x86_64-Linux$ ls -lh local/lib/*cblas*
-rw-r--r-- 1 wstein wstein 456K 2011-03-21 12:48 local/lib/libcblas.a
-rw-r--r-- 1 wstein wstein 147K 2011-02-25 08:33 local/lib/libcblas.so  # <---- see!


OS X: Link in cblas as well: it's the file /usr/lib/libcblas.dylib which comes with OS X. Note that OS X comes with its own excellent system-wide copy of ATLAS, which works well and has good parallel support.

more

But how would this work if I wanted to submit this code to Sage? I wouldn't want the user to have to specify which BLAS to use based on their operating system. Is there a way to get this information "dynamically"? If would I have to write a conditional similar to that near the top of module_list.py for using "cdef extern..." in my code?

( 2011-03-21 19:50:33 -0500 )edit

D'oh! I was a bit tired when I last commented and I understand now. Thanks!

( 2011-03-24 13:49:06 -0500 )edit