Contribute Media
A thank you to everyone who makes this possible: Read More

Accelerating Scientific Code with Numba


Numba is a just-in-time Python compiler that can be used to speed up a wide range of scientific and other numerical applications. This tutorial is intended to provide an introduction to using Numba, and ways of understanding of the performance of Numba-compiled code.


This tutorial will provide an overview of Numba, a just-in-time Python compiler focused on numerical computing. Originally aimed at computations using Numpy arrays, it has been expanded to work with other Python types and can speed up computations that require more than just fast linear algebra operations. Numba targets both CPUs and CUDA GPUs by generating native code using the LLVM compiler infrastructure.

As there are different components of Numba that can be applied in different circumstances, this introduction aims to span the breadth of use cases rather than focusing on a single area in depth. This is in order to enable the selection of appropriate portions of code to use with Numba, and the correct selection of Numba's facilities in each case.

Areas that will be covered include:

  • An overview of the type system, with a view to understanding and overcoming typing issues,
  • Compilation of Python functions using the @jit decorator,
  • Creation of Numpy ufuncs in Python using the @vectorize decorator,
  • Understanding and measuring the performance of Numba-compiled code,
  • Debugging facilities in Numba.

This tutorial is intended for an audience of programmers and data scientists who have an interest in speeding up numerical routines, and people with a general interest in high-performance Python. In order to get started quickly, it is recommended that attendees install the Anaconda Python distribution or Miniconda, as this provides a robust mechanism for installing Numba on Linux, Mac OS X and Windows.


Improve this page