Numba, a JIT compiler for fast numerical code

1

Speaker presentation

2

What is Numba?

3

Why a just-in-time compiler?

4

Why a just-in-time compiler?

Mandelbrot (20 iterations):

CPython 1x
Numpy array-wide operations 13x
Numba (CPU) 120x
Numba (NVidia Tesla K20c) 2100x
_images/mandel20.png
5

LLVM

6

LLVM optimizations

7

LLVM crazy optimizations

Constant time arithmetic series

_images/llvm-arith1.png
8

LLVM crazy optimizations

Assembler output

_images/llvm-arith2.png
9

Runs on CPython

10

Opt-in

11

Specialized

12

Multiple targets

13

Numba architecture

14

Compilation pipeline

_images/how-numba-works.png
15

Numba types

16

Numba specializations

17

Supported Python syntax

18

Unsupported Python syntax

19

Supported Python features

20

Supported Python modules

21

Supported Numpy features

22

Limitations

23

Semantic changes

24

Using Numba: @jit

25

GIL removal with @jit(nogil=True)

Tip

Use concurrent.futures.ThreadPoolExecutor on Python 3

26

Using Numba: @vectorize

27

Using Numba: @guvectorize

28

@jit example: Ising models

_images/ising.gif
29

Ising model: code

_images/ising.png
30

Ising model: performance

CPython 1x
Numba (CPU) 130x
Fortran 275x
31

CUDA support

32

CUDA support

33

CUDA example

_images/cuda-cos.png
34

Installing Numba

35

Contact

36