Change the future

Saturday 3:15 p.m.–4 p.m.

Numba: A Dynamic Python compiler for Science

Travis Oliphant, Siu Kwan Lam, Mark Florisson

Audience level:
Experienced
Category:
High Performance Computing

Description

Numba is a compiler for Python syntax that uses the LLVM library and llvmpy to convert specifically decorated Python functions to machine code at run-time. It allows Python syntax to be used to do scientific and numerical computing that is blazing fast yet tightly integrated with the CPython run-time.

Abstract

Numba is a NumPy-aware compiler for Python code that uses the LLVM library and it's Python wrapper, llvmpy, to convert specifically decorated Python functions to machine code at run-time. It allows Python syntax to be used to do scientific and numerical computing that is as fast as compiled code yet integrated tightly with the standard CPython run-time. Numba understands both NumPy arrays as well as arbitrary ctypes functions and can therefore be used to perform a wide variety of computations that were thought to be only in the realm of C/C++ and Fortran. Numba also comes with a static compiler that creates shared objects (and C-headers) from Python syntax. This talk will first describe LLVM, discuss the llvmpy wrapper, detail the architecture of Numba, and show the latest results.

The outline of the talk will be as follows:

Motivation (10 minutes)

  • Why Numba?
  • How is it different from PyPy, Cython, and Unladen Swallow
  • Motivating use-cases - extending NumPy and SciPy
  • Array-oriented computing
  • Image Processing
  • Vectorization
  • Time-series Analysis
  • Using multiple cores and GPUs for technical computing
  • Target is to match or beat Fortran for technical computing with Python

Examples of what Numba can do (7 minutes)

  • Image Processing in Python
  • Time-Series analysis in Python
  • Special Functions in SciPy

Overview of Architecture (15 minutes):

  • Explanation of LLVM
  • Overview of llvmpy and how it exposes LLVM to Python
  • Bytecode translation path
  • AST translation path
  • Discussion of design decisions and trade-offs

Future Directions and Demo (8 minutes):

  • Full support for Python language
  • Supporting the creation of Python extension types
  • Compiling array expressions
  • GPU support and multi-core

Numba Project Page llvmpy Project Page