NumbaNumPy-aware dynamic Python compiler Lightning Talk Travis E. Oliphant PyData NYC October 27, 2012
Motivation• Python is great for rapid development and high-level thinking-in-code• It is slow for interior loops because lack of type information leads to a lot of indirection and “extra” code.
Motivation• NumPy users have a lot of type information --- but only currently have one-size ﬁts all pre-compiled, vectorized loops.• Many new features envisioned will need the ability for high-level expressions to be compiled to machine code.
Goal: rapid iteration and development + fast code execution Numba should be the world’s best array-oriented compiler.
NumPy + Mamba = Numba Python Function Machine Code LLVM-PY LLVM Library ISPC OpenCL OpenMP CUDA CLANG Intel AMD Nvidia Apple ARM
Example Numba@jit(‘f8(f8)’)def sinc(x): if x==0.0: return 1.0 else: return sin(x*pi)/(pi*x)
Status and Future• My early bytecode branch further developed by Jon Riehl (Resilient Science) sponsored by Continuum Analytics, Inc. --- interprets bytecode directly• Current trunk works with AST directly and making rapid progress - Mark Florrison (minivect) - Siu Kwan Lam (pymothoa)