
Auto-tuning Dynamically Rebuilding Containers for Particle Simulations
Please login to view abstract download link
Particle simulation methods are widely used across science and engineering, from Molecular Dynamics (MD) simulations in thermodynamics and protein folding [1] to Smoothed Particle Hydrodynamics (SPH) in astrophysics and flow simulations in complex geometries [2], and in Discrete Element Method (DEM) simulations of granular materials [3]. Their increasing application is driven by advances in high-performance computing. Developing a particle simulator involves many algorithmic choices. Existing simulators, such as GROMACS, LAMMPS, and DualSPH, employ highly optimized single-algorithm combinations. In contrast, AutoPas implements multiple configurations and dynamically selects the optimal one at runtime. A configuration consists of a combination of containers (e.g., Linked Cells, Verlet Lists, Verlet Cluster Lists), shared-memory parallelism, data layouts, and cell size factors. The tuning strategy selects promising configurations, which AutoPas tests to determine the best option [4][5]. In particle simulations, containers frequently rebuild to update neighbor information, with rebuild iterations being significantly more computationally expensive than standard iterations. To minimize rebuilds without losing accuracy, a fixed rebuild frequency is often estimated based on maximum velocity. However, this estimate is typically conservative, leading to unnecessary rebuilds. We propose dynamically rebuilding containers that track particle movement per timestep and trigger a rebuild only when particles leave each other's neighborhood. Our results show up to a ~40% runtime reduction for VL-based containers, though LC containers experience a ~5% increase due to their already low rebuild costs. AutoPas evaluates configurations based on a weighted average of rebuild and non-rebuild iterations, where the weight depends on rebuild frequency. With dynamic containers, this frequency is unknown in advance. We explore methods for estimating it from simulation data and validate these predictions during the non-tuning phase. Our improvements are demonstrated in molecular dynamics simulations, and we discuss further optimizations to enhance AutoPas's dynamic container performance and autotuning capabilities.