JuliaCon 2023

Pinning Julia Threads to CPU-Cores with ThreadPinning.jl
07-26, 11:40–11:50 (US/Eastern), 32-141

Have you ever wondered how to bind a thread to a specific CPU-core in Julia? And why that might be useful in the first place? Then this talk is for you! I demonstrate how to easily query and control the affinity of your Julia threads using ThreadPinning.jl and present instructive examples that highlight the importance of thread pinning, especially on HPC clusters.

In this talk, I will introduce ThreadPinning.jl, a Julia package that makes controlling the affinity of your Julia threads simple (and fun!). First, you'll learn how to get an overview of the system topology and find out where your Julia threads are currently running. I'll then explain how to readily pin your Julia threads to specific cores, sockets, or memory domains (NUMA) either interactively from inside the Julia REPL or via environment variables or Julia preferences. Applying these techniques, we will study a few instructive examples, such as a (memory bound) streaming kernel, to understand the impact of thread pinning. In particular, we'll consider different pinning schemes on a typical HPC cluster node (dual-socket system). Finally, I'll give an outlook on future features (e.g. interactively pinning BLAS threads) and discuss potential Windows support.

Disclaimer: Linux only (for now)

Carsten is a postdoctoral theoretical physicist from Cologne, Germany, and a senior HPC consultant within the German National High-Performance Computing Alliance (NHR) at the Paderborn Center for Parallel Computing (PC2).

This speaker also appears in: