On 17/11/14 19:31, Wouter van Heijst wrote:
On Sat, Nov 15, 2014 at 20:04:37 +0200, Matti Picus wrote:
which may improve (but will never be as fast as cffi) in a future
release of pypy as we are working on a ufuncapi branch.
Contributions to speed this work along are welcome.
What can be done to help?  What I know about ufuncs comes from reading
numpy's internals.code-explanations.rst and ufuncs.rst yesterday.

On irc you've mentioned that the next step is to set up iterators to
deal with ufunc signatures, like (m,n)->(m,m),(m),(m,n) .

What are the correct references to make more sense of that?

Wouter
Sorry for the non-telegraphic reply, kind of needed to formulate my thoughts anyway.

The work-in-progress, for what it is worth, is in ufunc.py on the ufuncapi branch, in the over-long call() method of W_UfuncGeneric I am using test_frompyfunc_2d_sig() in test_ufunc which should pass once it all works.

My plan is to complete pypy's extensions of frompyfunc() [0] so that it looks more like the capi cpython numpy function PyUFunc_FromFuncAndDataAndSignature(). Then modules like linalg or aubio can be written in python, where they need to call external ufunc functions that iterate over numpy ndarrays, they can easily call them via cffi. It should also support some of numpy's ufunc capi via cpyext, which will always be slow and poorly maintained.

The basic machinery to handle signatures parsing and iterating has been "implemented", but I'm not very happy with it. I simply translated _parse_signature() from c to python, without really trying to pythonize the resulting structures. Then when I came to use the parsed results, I discovered that the mechanism I wanted to use, W_NDIter, is not really useful in rpython's interpreter space (as opposed to python application space), so I just left the whole mess to ferment. Now I think it has sat long enough that I can plow it into the ground and use it as compost (my way of saying throw it out and redo)

Help in the form of suggestions, criticism, or code are all welcomed, as well as continual encouragement to just finish it.
Matti

[0] adding cpython-numpy incompatible keywords dtypes, signature, identity, and stack_inputs as documented in the docstring of the frompyfunc function on the ufuncapi branch
_______________________________________________
pypy-dev mailing list
pypy-dev@python.org
https://mail.python.org/mailman/listinfo/pypy-dev

Reply via email to