Hi,
I am checking whether it is possible to make my jit function customizable by passing in a user-defined function. I found the useful documentation here. It suggests to use the factory function. I wonder how does cache work on the returned function?
For example, when calling the factory twice, does the returned function share the cache? (Does f1 and f2 share the cache or they must be recompiled every time?)
def make_f(g):
@jit(nopython=True, cache=True)
def f(x):
return g(x) + g(-x)
return f
@njit
def g(x):
return x + 1
f1 = make_f(g)
print(f1(1))
f2 = make_f(g)
print(f2(1))