The numba version of the Python loops kernel uses Numba JIT decorators to compile
the compute Python routines. This way, the code is not executed through Python’s interpreters,
but it is compiled and directly executed by the processor. For this purpose the decorator
@jit(nopython=True) is used. We set the parameter
nopython=True to let know Numba that
we don’t want Python interpreter to touch this function.
The following code snippet shows the change introduced to the code:
from numba import njit, jit @jit(nopython=True) def compute_step_1(sizes, weight_list, num_scen_found, load_orig, prob, vents, float_th, exposure_time): """ same code as original """ @jit(nopython=True) def compute_step_2(alpha, beta, prob, h, vents, n, n_sizes): """ same code as original """
Keep in mind that Numba does not support all Python operations and data structures. It might happen that the routine you
wish to compile uses Python features that Numba doesn’t implement, in which case you will have to set