22-26 July 2019
Princeton University
US/Eastern timezone

Accelerating Python

24 Jul 2019, 13:30
1h 30m
407 Jadwin Hall (Princeton University)

407 Jadwin Hall

Princeton University

Princeton Center For Theoretical Science (PCTS)

Speaker

Jim Pivarski (Princeton University)

Description

Python (or really its standard implementation, CPython) is notoriously slow, but it can be fast with the right techniques. Casting problems in Numpy is one way to do it, though algorithms that must "iterate until converged" don't fit Numpy's array-at-a-time model well.

Numba is an alternative that compiles Python to run as fast as C, but only if the code consists purely of numbers and arrays that don't change type. Quite a few call out to C++, such as pybind11, Cython, and PyROOT, which is another way of escaping Python for tight loops. There are also many tools to parallelize Python, though there are some pitfalls to consider.

In this session, we'll survey these methods and their strengths and weaknesses.

Presentation Materials