I am trying to use numba to compile several functions within my codebase to speed up execution. I have several thousand standalone functions that I am trying to compile with the jit decorator. While compiling my functions I notice that all the code is compiled within a single python process and only makes use of a single core within my machine. This results in compilation times often exceeding an hour. I am wondering if I can enable parallelization during the compilation step similar to make -j <number of processors>.
My functions are completely independent of each other and subsequent calls that utilize them are in a separate sub-module. Here is an example of the sort of functions that I would like to be able to compile in parallel:
import numpy as np
from numba import jit, float64
@jit(float64[:](float64[:]),nopython=True,cache=True,fastmath=True,parallel=True,nogil=True)
def fun_0(x):
return np.power(x,0)
@jit(float64[:](float64[:]),nopython=True,cache=True,fastmath=True,parallel=True,nogil=True)
def fun_1(x):
return np.power(x,1)
@jit(float64[:](float64[:]),nopython=True,cache=True,fastmath=True,parallel=True,nogil=True)
def fun_2(x):
return np.power(x,2)
@jit(float64[:](float64[:]),nopython=True,cache=True,fastmath=True,parallel=True,nogil=True)
def fun_3(x):
return np.power(x,3)
The code is only illustrative of my use case. Alternate ways to structure my functions/modules may also be an acceptable solution for me.