[SciPy-Dev] Expose Lapack for Cython

Ian Henriksen insertinterestingnamehere at gmail.com
Tue Sep 9 15:05:24 EDT 2014


Hmm. It's not clear to me exactly how to make a custom Python module with
additional C level pointers like that that. I'm in the process of looking
through the C api to see how something like that might be done, but an
example would be helpful. That would certainly be a good way to take care
of references though. My end goal is to make these all available in a
single pxd file. It will be necessary to initialize the struct/module from
the wrappers in scipy, but other than that I'd like to make the interface
as simple as possible.

I don't think using the lapack test programs is feasible without a great
deal of trouble. My main concern is what sort of testing needs to be done
for its inclusion in scipy. I could write examples that call each of them,
but that would be a rather lengthy project in its own right. I really just
need a way to show that the signatures are correct.

Does anyone have any suggestions as to how/where this should be included?

Thanks!

-Ian

On Sun, Sep 7, 2014 at 10:21 AM, Sturla Molden <sturla.molden at gmail.com>
wrote:

> Ian Henriksen <insertinterestingnamehere at gmail.com> wrote:
> > Hi all, I have put together pxd files that allow direct access from
> Cython
> > to the the blas and lapack functions wrapped in scipy.linalg.blas and
> > scipy.linalg.lapack. The idea is to make these low level functions
> > available in Cython without the corresponding Python level function call
> > that is necessary when using the wrappers already in SciPy. They are
> > currently in my github repository
> > <a
> > href="https://github.com/insertinterestingnamehere/cylinalg.">
> https://github.com/insertinterestingnamehere/cylinalg.</a>
> > The approach is
> > based on the gist <a
> > href="https://gist.github.com/pv/5437087.">
> https://gist.github.com/pv/5437087.</a> I think
> > this would be
> > a good addition to SciPy since it is really only another interface to the
> > wrappers that are already there.
>
> I would recommend storing the pointers globally in a module (instead of
> populating a struct) together with references to the LAPACK and BLAS
> modules in SciPy. LAPACK and BLAS extension modules should not be unloaded
> as long as the pointers are available, or you risk creating dangling
> function pointers.
>
>
> > Where would be the best place to put this? Also, what sorts of tests
> should
> > be included? Any other input is welcome too.
>
> You can check that they create the same output as calls to the Python
> interface. Or you can use codes from the LAPACK test programs to check the
> sanity of the output.
>
> Sturla
>
> _______________________________________________
> SciPy-Dev mailing list
> SciPy-Dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scipy-dev/attachments/20140909/45c05c0b/attachment.html>


More information about the SciPy-Dev mailing list