fast_array_utils.numba¶
Numba utilities, mainly used to deal with The Threading Layers of numba.
numba.config.THREADING_LAYERenv variableNUMBA_THREADING_LAYERThis can be set to a
ThreadingLayerorTheadingCategory.numba.config.THREADING_LAYER_PRIORITYenv variableNUMBA_THREADING_LAYER_PRIORITYThis can be set to a list of
ThreadingLayers.
fast-array-utils provides the following utilities:
- type fast_array_utils.numba.TheadingCategory = Literal['default', 'safe', 'threadsafe', 'forksafe']¶
Identifier for a threading layer category.
- type fast_array_utils.numba.ThreadingLayer = Literal['tbb', 'omp', 'workqueue']¶
Identifier for a concrete threading layer.
- fast_array_utils.numba.njit(fn: Callable[P, R], /, *, nogil: bool = True) Callable[P, R]¶
- fast_array_utils.numba.njit(*, nogil: bool = True) Callable[[Callable[P, R]], Callable[P, R]]
Jit-compile a function using numba.
On call, this function dispatches to a parallel or serial numba function, depending on the current threading environment. In a process forked after numba launched a threading layer that isn’t fork-safe (GNU OpenMP on Linux), it runs the serial function. TBB is only fork-safe when forked from the thread that launched it, which isn’t detected.
- Parameters:
nogil – Release the GIL while the compiled function runs (see
numba.jit()).