[Cython] Cython <> pythran collaboration
serge Guelton
serge.guelton at enst-bretagne.fr
Mon Dec 8 20:52:46 CET 2014
Hi Cython dev,
I am one of the two core developers of the Pythran[0] compiler.
We are planning to start a project where Cython would delegate the
generation of optimized (i.e. parallel / vectorized / without temporary
arrays) numpy expression when it finds one, instead of calling the
native API. Something like the following meaningless example:
import numpy as np
cimport numpy as np
def play_with_arrays(np.ndarray arr):
cdef int N = arr.shape[0]
cdef np.ndarray other_arr = np.empty([N], dtype=np.int)
other_arr = arr ** 2 + 1 # pythran would handle this
for i in range(N):
other_arr[i] /= 2 # cython would handle this
return other_arr
Everything would live in a pyx file and it should be transparent to a
cython user. Cython would drive the compilation process, using pythran
as a numpy expression optimizer.
Does that look feasible / appealing to you?
[0] http://pythonhosted.org/pythran/
More information about the cython-devel
mailing list