Bootcamp, Winter 2021     Agenda     Registration     About

Code Profiling in Python and R


Instructor bio

Description

Once their code works correctly, researchers often want to increase a program’s overall speed, or reduce its memory usage, or both. Rather than guess or assume which sections of a code are speed bottlenecks or memory-hungry, the program can be profiled dynamically as it runs in order to find its “hotspots”. Profilers are software tools that make this analysis systematic and less manual, sometimes reporting results with line-by-line granularity.

This session will introduce code profiling tools and techniques for Python and R. Hands-on examples will help participants get experience with different aspects of optimizing a short sample program. While the focus is on interpreted languages, many of the concepts carry over to compiled languages like C/C++ and Fortran.

Learning objectives

This workshop is geared toward computational researchers interested in improving the performance of their codes. Attendees will leave knowing tools and approaches that can help diagnose performance impediments in Python or R programs.

Knowledge prerequisites

Basic Linux and some programming experience in Python and/or R

Hardware/software prerequisites

Overarching requirements for all PICSciE virtual workshops are listed on the advance setup guide for PICSciE virtual workshops. In addition, for the hands-on portions of this session, participants will need some Python or R software on their laptops, depending on their preferred language.

Python users should install the Anaconda Python 3 distribution – which includes Jupyter notebooks, NumPy, and conda – on their laptops in advance. R users should have both R and RStudio installed on their laptops. Instructions for all this can be found on the PICSciE virtual workshops requirements page for both Python and R.

Alternately, participants who prefer to run Jupyter or RStudio remotely on one of Princeton’s systems can do so via the “myadroit” web interface to the Adroit cluster. To do so, you should first register for an account on Adroit, as described in the advance setup guide for PICSciE virtual workshops. Then, connect to “myadroit” and start a Jupyter or RStudio session, as described here.

Session format

Lecture, demo, and hands-on exercises

Session Materials

All presentation materials are here.

Session Recording

A recording of the session is here (requires active Princeton NetID to view).