[Numpy-discussion] Accessing LAPACK and BLAS from the numpy C API

David Cournapeau cournape at gmail.com
Mon Nov 9 18:24:39 EST 2009


On Tue, Nov 10, 2009 at 4:08 AM, Jake VanderPlas <jakevdp at gmail.com> wrote:
>>The safe way to access them, since they are not exposed, is to call the
>>function at the python level in your C code, but I don't think that's
>>what you want,
>
> I want to avoid calling functions at the python level, because of the
> overhead for multiple calls within nested loops.

Yes, there is no question this would be useful, but we don't have the
mechanism (yet) to make that possible. We have added some
infrastructure at the build level to make C libraries available to 3rd
parties, but more is needed for blas/lapack.

> ...and directly call the BLAS fortran library.  This pattern works on
> my system (linux, using the system BLAS/LAPACK libraries).  Is this a
> form that will work across different OSs and different installs?

Not at all. What you have done here is simply link against whatever
blas/lapack is found on your system. It will not work on platforms
without development package of blas/lapack, with different fortran
name mangling, etc...

That's certainly a valid option until we support this better in
numpy/scipy, though.

David



More information about the NumPy-Discussion mailing list