[Cython] CEP1000: Native dispatch through callables
stefan_ml at behnel.de
Fri Apr 13 07:24:38 CEST 2012
Dag Sverre Seljebotn, 13.04.2012 00:34:
> On 04/13/2012 12:11 AM, Dag Sverre Seljebotn wrote:
>> Travis Oliphant recently raised the issue on the NumPy list of what
>> mechanisms to use to box native functions produced by his Numba so that
>> SciPy functions can call it, e.g. (I'm making the numba part up):
>> @numba # Compiles function using LLVM
>> def f(x):
>> return 3 * x
>> print scipy.integrate.quad(f, 1, 2) # do many callbacks natively!
>> Obviously, we want something standard, so that Cython functions can also
>> be called in a fast way.
>> This is very similar to CEP 523
>> (http://wiki.cython.org/enhancements/nativecall), but rather than
>> Cython-to-Cython, we want something that both SciPy, NumPy, numba,
>> Cython, f2py, fwrap can implement.
>> Here's my proposal; Travis seems happy to implement something like it
>> for numba and parts of SciPy:
> I'm sorry. HERE is the CEP:
Some general remarks:
I'm all for doing something in this direction and have been hinting at it
on the PyPy mailing list for a while, without reaction so far. I'll trigger
them again, with a pointer to this discussion and the CEP. PyPy should be
totally interested in a generic way to do fast calls into wrapped C code in
general and Cython implemented functions specifically. Their JIT would then
look at the function at runtime and unwrap it.
There's PEP 362 which proposes a Signature object. It seems to have
attracted some interest lately and Guido seems to like it also. I think we
should come up with a way to add a C level interface to that, instead of
designing something entirely separate.
More information about the cython-devel