Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it merely a coincidence that certain modules' numba operations respect PISA_NUM_THREADS? #785

Open
thehrh opened this issue Jul 27, 2024 · 0 comments

Comments

@thehrh
Copy link
Contributor

thehrh commented Jul 27, 2024

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 😅

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)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant