Calling "typed python" wrapper from nopython

0 views
Skip to first unread message

Carlos Pita

unread,
May 26, 2016, 12:23:52 AM5/26/16
to Numba Public Discussion - Public
(I've posted a similar question while being unsubscribed to the group; I think it's still waiting for approval, but there were some misconceptions of mine about @overload there, so prefer this one)

Hi all,

suppose I've written a @jit'ed function implementing a loop that every once in a while has to call a non @jit'able python function f. This function f takes two integers and returns a new integer, so it might be possible to wrap it into, say, typed_f: i8(i8,i8). But I don't see any way of achieving something like the following:  

@typed(i8(i8,i8))
def f(x, y):
     ....  # this code is not jittable
     return z

This would be very handy for mixing python and nopython when loop-lifting is not helpful. The only way I can figure out to get something like that is by means of a ctypes callback.

Is there any easier or more idiomatic way? In case there isn't, is it because of a fundamental limitation or just because nobody else would find it useful? The separation between python and nopython is often but not always as clear-cut as loop-lifting requires.

Cheers
--
Carlos
Reply all
Reply to author
Forward
0 new messages