Numba

Numba is an  that translates a subset of  and  into fast machine code using, via the llvmlite Python package. It offers a range of options for parallelising Python code for CPUs and GPUs, often with only minor code changes.

Numba was started by in 2012 and has since been under active development at https://github.com/numba/numba with frequent releases. The project is driven by developers at Anaconda, Inc., with support by DARPA, the Gordon and Betty Moore Foundation, Intel, nvidia and AMD, and a community of contributors on Github.

Example
Numba can be used by simply applying the  decorator to a Python function that does numerical computations:

The happens transparently when the function is called:

The Numba website at https://numba.pydata.org contains many more examples, as well as information how to get good performance from Numba.

GPU Support
Numba can compile Python functions to GPU code. Currently two backends are available:


 * , see https://numba.pydata.org/numba-doc/dev/cuda
 * ROCm, see https://numba.pydata.org/numba-doc/dev/roc

Alternative approaches
Numba is one approach to make Python fast, by compiling specific functions that contain Python and Numpy code. Many alternative approaches for fast numeric computing from Python exist, e.g., , , , Pythran, , ...