Debugging is often the most time-consuming step of code development. Fortunately, there are tools available to users to speed up this task that are more robust than merely inserting and deleting print
statements. This session will introduce participants to general code debugging principles, practices, and tools for interpreted languages (Python, R). Participants will be introduced to popular Integrated Development Environments (IDE) for each of these languages and do hands-on exercises for finding bugs in code snippets. Time allowing, there will also be some discussion of debuggers for compiled languages (C/C++), including advanced debuggers available on all of Princeton’s research computing systems and that can be used to debug serial, parallel and GPU codes.
This workshop is geared toward computational researchers interested in learning debugging tools and best practices. Attendees will learn the best practices for debugging code and gain hands-on experience using debugging tools.
Basic Linux and some programming experience in Python and/or R
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.
Finally, the workshop format will be a short introduction using slides followed by instructor-led hands-on exercises. I strongly recommended trying to participate in the exercises, as attempting to read and debug code is the best way to learn debugging. If you’d like to participate in the Python and R hands-on activities, please follow the instructions at this link to setup your laptop or desktop environment for debugging (some overlap with the instructions at the links above, but some parts are additional, e.g. creating a conda environment for the session, or installing PyCharm.
Lecture, demo, and hands-on exercises
All presentation materials are here. Additional materials are in this Github repo.
A recording of the session is here (requires active Princeton NetID to view).