Home SPUR (internship) rust-game Classwork TV production Tech Skills Projects

Allen MacFarland's Website

Summer Program for Undergraduate Research (SPUR)
Just-in-time cross-language inlining on the GPU

Thank you to my mentors Jeremy Thompson and Professor Jed Brown at PhyPID!

A brief overview of how my summer of undergrad research went

Mission Statement

My lab develops a simulation library libCEED, which accepts user-defined code for a small but critical component. This code is compiled just-in-time and runs on both CPU and GPU targets, and was previously written in C. My task was to allow users to write this in Rust, which I did, allowing for better memory safety and modern language features, such as unit-checking and auto-differentiation.

High-level technical overview

Making this work on the GPU, where calling a function is not allowed, requires a complex pipeline, where both C and Rust sources are compiled manually into an Intermediate Representation (IR) - A low-level programming language that many programming languages individually compile to. After all source files are in the same language (LLVM), it is possible to link all the files into one big file, optimize the code, and compile it to a GPU with the individual LLVM tools.

For a more detailed explanation, please read my paper in webpage or PDF format. Please note that this paper is intended for more technical audiences than the rest of this website.

Skills this project taught me

Perseverance

This project was really hard, and full of issues that are very challenging to debug, especially with the LLVM tools. There were many points where I wanted to give up and do something more relaxing with my summer, but I decided to persevere and finish the project. This has made me into a more resilient person who is capable of accepting more difficult tasks in the future.

Collaborative software development

Before this project, I had never worked on such a large project; there were never more than 2-3 people, we all started around the same time, and the projects never got too large. This made onboarding onto libCEED much harder, as I had to get accustomed to the conventions of coordinating on such a large project. Now that I've successfully done this, I'm more prepared for the onboarding of my next big project.

Requesting assistance (Just the right amount)

There were many points in this project where I had to decide whether to ask my professor for help or keep struggling with a problem. It's important to find a balance between being over-reliant on others (wasting their time) and locking myself into a fruitless endeavor (wasting my time). My heuristic was to generally ask for help when I've exhausted my intuition, debugging tools, and relevant documentation, and then created a reproducible example that I could send to my professor