A Map of the Numba Repository

The Numba repository is quite large, and due to age has functionality spread around many locations. To help orient developers, this document will try to summarize where different categories of functionality can be found.

Support Files

Build and Packaging

Continuous Integration

Documentation

Numba Source Code

Numba ships with both the source code and tests in one package.

  • numba/ - all of the source code and tests

Public API

These define aspects of the public Numba interface.

Dispatching

  • numba/core/dispatcher.py - Dispatcher objects are compiled functions produced by @jit. A dispatcher has different implementations for different type signatures.

  • numba/_dispatcher.cpp - C++ dispatcher implementation (for speed on common data types)

Compiler Pipeline

Type Management

Compiled Extensions

Numba uses a small amount of compiled C/C++ code for core functionality, like dispatching and type matching where performance matters, and it is more convenient to encapsulate direct interaction with CPython APIs.

Misc Support

Core Python Data Types

Math

  • numba/_random.c - Reimplementation of NumPy / CPython random number generator

  • numba/_lapack.c - Wrappers for calling BLAS and LAPACK functions (requires SciPy)

ParallelAccelerator

Code transformation passes that extract parallelizable code from a function and convert it into multithreaded gufunc calls.

Stencil

Implementation of @stencil:

Debugging Support

Type Signatures (CPU)

Some (usually older) Numba supported functionality separates the declaration of allowed type signatures from the definition of implementations. This package contains registries of type signatures that must be matched during type inference.

Target Implementations (CPU)

Implementations of Python / NumPy functions and some data models. These modules are responsible for generating LLVM IR during lowering. Note that some of these modules do not have counterparts in the typing package because newer Numba extension APIs (like overload) allow typing and implementation to be specified together.

Ufunc Compiler and Runtime

Unit Tests (CPU)

CPU unit tests (GPU target unit tests listed in later sections

Command Line Utilities

CUDA GPU Target

Note that the CUDA target does reuse some parts of the CPU target.