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.
Note
It is likely that the organization of the code base will change in the future to improve organization. Follow issue #3807 for more details.
make
@lower*
for reference
documentation. Currently misses implementations from the higher
level extension API.Numba ships with both the source code and tests in one package.
These define aspects of the public Numba interface.
overload
, intrinsic
, etc)@cfunc
decorator for compiling
functions to a fixed C signature. Used to make callbacks.@jit
. A dispatcher has different implementations
for different type signatures.**
) with constant arguments so faster code can be
generatednumba.rewrites.macros
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.
_helperlib.c
and _npymath_exports.c
six
package for Python 2 +
3 compatibilitysix
)@intrinsic
helper functions that can be used
to implement direct memory/pointer manipulation from nopython mode
functionsctypes
to
workaround portability issue with Python 2.7Code transformation passes that extract parallelizable code from a function and convert it into multithreaded gufunc calls.
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.
cmath
)
modulemath
modulerandom
modulesarray
moduleImplementations 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.
None
math
moduleheapq
modulerandom
modulesnumpy.roots
functionparallel
targetCPU unit tests (GPU target unit tests listed in later sections
test_dispatcher.py
numba_entry.py
numba
command line
toolpycc
command line
toolcompiler.py
cc.py
instead.Note that the CUDA target does reuse some parts of the CPU target.
numba.cuda
numba.cuda.*
Note that the ROCm target does reuse some parts of the CPU target, and duplicates some code from CUDA target. A future refactoring could pull out the common subset of CUDA and ROCm. An older version of this target was based on the HSA API, so “hsa” appears in many places.
@jit
decorator for kernels and
device functions