Numba is an open-source optimizer that compiles numerical Python and NumPy code to machine code via LLVM, often at runtime.
Overview
Numba is sponsored by Anaconda, Inc. and uses the LLVM project to generate machine code from Python syntax. It can compile much of numerically oriented Python, including many NumPy functions, without replacing the interpreter or requiring a separate compile step before run.
Decorators such as @njit turn functions into compiled versions. Numba supports automatic loop parallelization on CPUs, SIMD vectorization where the hardware allows, GPU code generation with NVIDIA CUDA, universal functions that broadcast like NumPy, and C callbacks.
It is built around NumPy arrays and array dtypes or layouts. It is documented to work with Jupyter notebooks and with distributed frameworks such as Dask and Spark. Prebuilt binaries are offered via conda and pip wheels for many platform combinations; supported CPUs include x86, POWER, and ARM, including Apple M1, with Windows, macOS, and Linux mentioned for deployments.
Key features
- LLVM-based JIT compilation
- NumPy function support
- CPU parallel loops via decorators
- NVIDIA CUDA GPU kernels
- SIMD vectorization of loops
- njit decorator workflow
- Jupyter notebook compatibility
- pip and conda packages
Use cases
- Accelerating NumPy-heavy Python
- Monte Carlo style simulations
- Parallel CPU numerical loops
- GPU kernels from Python
- Scientific computing in notebooks