JuliaCon 2026

Performance-Portable Random Sampling in Julia: Event Generation and Particle Transport on GPUs
2026-08-12 , Room 5

In this talk, we present techniques for implementing efficient GPU-based random sampling
algorithms, including rejection sampling and multi-stage sampling pipelines using
KernelAbstractions.jl. We discuss strategies to avoid costly synchronizations between host
and device, manage divergent execution flows, and schedule heterogeneous
workloads entirely on device. Particular attention is given to structuring rejection
sampling and sequential transport algorithms in ways that preserve GPU occupancy while
maintaining statistical correctness.

To demonstrate the applicability of these techniques, we present results from two Julia
packages developed for plasma and high-energy physics applications. The first,
QEDevents.jl, focuses on Monte-Carlo event generation for high-multiplicity
scattering processes in quantum electrodynamics, building on the generic sampling
framework RejectionSamplers.jl and the QuantumElectrodynamics.jl ecosystem. The second,
PhotonTransport.jl implements a Monte-Carlo photon transport code for warm-dense matter.
Together, these case studies illustrate how Julia enables both the expressive
implementation of parallel sampling algorithms and near-peak accelerator performance,
while maintaining portability across hardware backends.


Monte-Carlo techniques are central for many applications in physics simulations, such as
event generation in high-energy physics or particle transport in matter. A common
theme in these applications is the random sampling of complex probability
distributions, often using techniques such as rejection sampling or multi-stage sampling
schemes. While these algorithms are simple and robust, the inherent randomness
poses challenges to modern accelerators.

In applications such as Monte-Carlo event generation, the target distributions are usually
high-dimensional and expensive to evaluate. Similarly, in Monte-Carlo particle transport,
the involved sequence of stochastic events that determine the particle's
propagation, interaction channels, and momentum updates within a spatially resolved geometry.
Although both classes of algorithms are often described as embarrassingly parallel, since
the events and particle histories are independent, the random nature of the execution path
leads to highly heterogeneous workloads. This irregularity complicates the efficient scheduling on GPUs and significantly limits the achievable throughput.

In the presented work. we highlight how Julia's GPU tooling can support stochastic simulation workflows and provides practical patterns for implementing scalable Monte-Carlo algorithms on
heterogeneous systems.

I am a particle physicist by training, currently working on the theoretical side of strong laser interactions and matter under extreme conditions at the Helmholtz-Zentrum Dresden-Rossendorf. For the past five years, I have conducted all my research in Julia, and I am the primary author of several Julia packages, including the QuantumElectrodynamics.jl framework, JuliaXRTS, and a maintainer at the JuliaHEP GitHub organization. In addition, for the past three years, I have served as one of the conveners of the JuliaHEP working group within the HEP Software Foundation, making me an active member of the Julia community in high-energy physics.