pisa
pisa copied to clipboard
Is it merely a coincidence that certain modules' numba operations respect `PISA_NUM_THREADS`?
Several services implement numpy generalised universal functions using from numba import guvectorize
.
Unless I'm misunderstanding, numba.set_num_threads(PISA_NUM_THREADS)
in https://github.com/icecube/pisa/blob/master/pisa/utils/numba_tools.py#L71 is always executed (for the parallel target) only after some involved chain of imports.
For example, take stages/xsec/dis_sys.py
, which does not explicitly import from pisa.utils.vectorizer
unlike other services (e.g., stages/pid/shift_scale_pid.py
).
I believe we reach the line above via from pisa.core.stage import Stage
-> from pisa.core.container import ContainerSet
-> from pisa.core.translation import histogram, lookup, resample
-> from pisa.utils import vectorizer
-> from pisa.utils.numba_tools import cuda_copy
:sweat_smile:
Since all services import the Stage
base class, it always seems to work out fine, but shouldn't we attempt to call numba.set_num_threads
already upon initialising the pisa package (in particular, given that numba is an install requirement now)?