Numba
NumPy-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 fits 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)
Demo
RoadMap
• Numba 0.2 available now
• Github trunk has many changes -- 0.3 will support
 - structures
 - Python code
 - objects with inheritance


                     Check out NumbaPro
                    for cutting-edge features
Software Stack Future?
         Plateaus of Code re-use + DSLs
   SQL                                R
            TDPL                                Matlab


                    Python


             OBJC                C
  FORTRAN                                 C++



                     LLVM
Join Us!


           http://numba.pydata.org

 https://store.continuum.io/cshop/numbapro

Numba lightning

  • 1.
    Numba NumPy-aware dynamic Pythoncompiler Lightning Talk Travis E. Oliphant PyData NYC October 27, 2012
  • 2.
    Motivation • Python isgreat 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.
  • 3.
    Motivation • NumPy usershave a lot of type information --- but only currently have one-size fits all pre-compiled, vectorized loops. • Many new features envisioned will need the ability for high-level expressions to be compiled to machine code.
  • 4.
    Goal: rapid iteration and development + fast code execution Numba should be the world’s best array-oriented compiler.
  • 5.
    NumPy + Mamba= Numba Python Function Machine Code LLVM-PY LLVM Library ISPC OpenCL OpenMP CUDA CLANG Intel AMD Nvidia Apple ARM
  • 6.
    Example Numba @jit(‘f8(f8)’) def sinc(x): if x==0.0: return 1.0 else: return sin(x*pi)/(pi*x)
  • 7.
    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)
  • 8.
  • 9.
    RoadMap • Numba 0.2available now • Github trunk has many changes -- 0.3 will support - structures - Python code - objects with inheritance Check out NumbaPro for cutting-edge features
  • 10.
    Software Stack Future? Plateaus of Code re-use + DSLs SQL R TDPL Matlab Python OBJC C FORTRAN C++ LLVM
  • 11.
    Join Us! http://numba.pydata.org https://store.continuum.io/cshop/numbapro

Editor's Notes