Mixing Python and Compiled Code

Nov 16, 2021, 4:30 pm6:30 pm
Lewis Library 120
Event Description

This workshop will introduce participants to compiled code bindings in Python. It will also explore how to use an existing or multipurpose compiled library from within Python code, either for better performance or for reuse of legacy calculations/software.

Workshop format: Lecture, demo, and hands-on

Target audience: This workshop is intended for relatively experienced Python users who would like to learn tools and best practices for leveraging code written in compiled languages like C or C++ from within Python (usually in order to improve performance). Reasonable facility both with Python and with its numerical packages like NumPy and SciPy is assumed -- this workshop is *NOT* appropriate for complete newcomers to Python.

Knowledge prerequisites: Basic Python knowledge, basic to intermediate knowledge of a compiled language, preferably C++.

Hardware/software prerequisites: For this workshop, users must have an account on the Adroit cluster, and they should confirm that they can SSH into Adroit *at least 48 hours beforehand*. Details on all of the above can be found in this guide. THERE WILL BE LITTLE TO NO TROUBLESHOOTING DURING THE WORKSHOP!

Optionally, users can also install the Anaconda Distribution of Python on their laptops in order to run and build the examples and exercises locally. Instructions for installing Anaconda, running Jupyter, downloading and viewing a notebook, and verifying that your setup is successful can be found on this advance setup guide.

Learning objectives: Attendees will learn how to call C from Python and how to create Python bindings for a C++ library using PyBind11. They will also leave with at least a general idea of other existing methods for mixing Python and compiled code.