Numba recompile() for nested functions

Hi,
I have a a set of functions and I have changing a global parameter (I am running MD simulations and am changing some interaction parameter)
and wish to recompile the jitted functions for the new value. All functions get called via a single function as they are nested, for example

@jit()
def f1:
f2()

@jit()
def f2:
f3()

@jit()
def f3:
…do something…

in this case is it sufficient to recompile f1? Will this recompile all my functions (which all depend on some global parameter that I have changed)? Or do I have to individually recompile all the functions?

Thanks

hi there,

recompilation happens automatically the first time the function is executed for each “session”, ie execution of the main script. Recompilation will also happen even if nothing has changed, because results are not saved to disk.

I suggest that you set up a simple example and experiment yourself to make sure that you understand the behaviour. Something like:

from numba import njit

global_param = 1

@njit
def foo():
    return global_param

print(foo()) 

You can then change the value of param and see that the result is correct.

Luk