Error when compiling a Numba module with function using other functions inline
Become part of the top 3% of the developers by applying to Toptal https://topt.al/25cXVn
--
Music by Eric Matyas
https://www.soundimage.org
Track title: Over Ancient Waters Looping
--
Chapters
00:00 Question
01:56 Accepted answer (Score 5)
02:38 Thank you
--
Full question
https://stackoverflow.com/questions/4932...
Question links:
[Numba documentation specifies that other compiled functions can be inlined and called from other compiled functions.]: http://numba.pydata.org/numba-doc/dev/us...
[ahead of time]: http://numba.pydata.org/numba-doc/dev/us...
[ahead of time]: http://numba.pydata.org/numba-doc/dev/us...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #numpy #numba
#avk47
--
Music by Eric Matyas
https://www.soundimage.org
Track title: Over Ancient Waters Looping
--
Chapters
00:00 Question
01:56 Accepted answer (Score 5)
02:38 Thank you
--
Full question
https://stackoverflow.com/questions/4932...
Question links:
[Numba documentation specifies that other compiled functions can be inlined and called from other compiled functions.]: http://numba.pydata.org/numba-doc/dev/us...
[ahead of time]: http://numba.pydata.org/numba-doc/dev/us...
[ahead of time]: http://numba.pydata.org/numba-doc/dev/us...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #numpy #numba
#avk47
ACCEPTED ANSWER
Score 5
I reached out to the numba devs and they kindly answered that adding the @njit decorator after @cc.export will make the function call type resolution work and resolve.
So for example:
@cc.export('product','float64(float64[:], float64[:])')
@njit
def product(a, b):
prod = 0
for i in range(a.size):
prod += a[i] * b[i]
return prod
Will make the product function available to others. The caveat being that it is entirely possible in some cases that the inlined function ends up with a different type signature to that of the one declared AOT.