fast_array_utils.numba

Numba utilities, mainly used to deal with The Threading Layers of numba.

numba.config.THREADING_LAYERenv variable NUMBA_THREADING_LAYER

This can be set to a ThreadingLayer or TheadingCategory.

numba.config.THREADING_LAYER_PRIORITYenv variable NUMBA_THREADING_LAYER_PRIORITY

This 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], /) Callable[P, R]
fast_array_utils.numba.njit() 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 if it has been called from a thread pool.

fast_array_utils.numba.threading_layer(layer_or_category: ThreadingLayer | TheadingCategory | None = None, /, priority: Iterable[ThreadingLayer] | None = None) ThreadingLayer

Get numba’s configured threading layer as specified in The Threading Layers.

layer_or_category defaults numba.config.THREADING_LAYER and priority to numba.config.THREADING_LAYER_PRIORITY.