Source-linked AI summary
Efficient molecular dynamics simulations with many-body potentials on graphics processing units
Zheyong Fan, Wei Chen, Ville Vierimaa, Ari Harju
TL;DR
GPU acceleration has progressed less for many-body potentials than for pairwise potentials, partly because conventional force, virial-stress, and heat-current accumulation can create CUDA write conflicts. The paper introduces an explicit pairwise-force algorithm that accumulates these quantities per atom in one thread and implements it in GPUMD. For Tersoff and Stillinger-Weber potentials, GPUMD achieves performance comparable to LAMMPS using tens to hundreds of CPU cores.
Problem
GPU acceleration of force evaluations for many-body potentials remains less developed than for pairwise potentials, with conventional accumulation vulnerable to CUDA write conflicts.
Method
The paper derives a general GPU force-evaluation algorithm from an explicit pairwise force expression and implements it in GPUMD.
Results
GPUMD on one Tesla K40 GPU can be as fast as LAMMPS running with tens to hundreds of CPU cores for the Tersoff and Stillinger-Weber potentials.
Takeaways & Limitations
The conflict-free per-atom formulation supports simple, flexible, and efficient GPU implementation of many-body potentials.
Takeaways & Limitations
The implementation’s treatment of virial stress is not necessarily equivalent to the conventional expression, and GPU atomic operations are unlikely to improve performance substantially.
Abstract
from arXiv · showhide
Graphics processing units have been extensively used to accelerate classical molecular dynamics simulations. However, there is much less progress on the acceleration of force evaluations for many-body potentials compared to pairwise ones. In the conventional force evaluation algorithm for many-body potentials, the force, virial stress, and heat current for a given atom are accumulated within different loops, which could result in write conflict between different threads in a CUDA kernel. In this work, we provide a new force evaluation algorithm, which is based on an explicit pairwise force expression for many-body potentials derived recently [Phys. Rev. B 92 (2015) 094301]. In our algorithm, the force, virial stress, and heat current for a given atom can be accumulated within a single thread and is free of write conflicts. We discuss the formulations and algorithms and evaluate their performance. A new open-source code, GPUMD, is developed based on the proposed formulations. For the Tersoff many-body potential, the double precision performance of GPUMD using a Tesla K40 card is equivalent to that of the LAMMPS (Large-scale Atomic/Molecular Massively Parallel Simulator) molecular dynamics code running with about 100 CPU cores (Intel Xeon CPU X5670 @ 2.93 GHz).
1. Introduction
GPU acceleration has advanced molecular dynamics, but force evaluation for many-body potentials remains more challenging than for pairwise potentials. The paper proposes a general, conflict-free GPU algorithm and evaluates it in GPUMD.
- Motivation: Many-body potentials such as Tersoff, Stillinger-Weber, and Brenner are important for modelling materials but are harder to accelerate on GPUs than pairwise potentials.
- Motivation: Naive many-body force evaluation can make multiple GPU threads write to the same atom’s force data, creating write conflicts.
- Prior work: Prior approaches addressed write conflicts with specialized neighbour lists, flexible potential-specific implementations, or vectorization schemes.
- Proposed approach: The proposed method uses an explicit pairwise force expression so each atom’s force, virial stress, and heat current can be accumulated within one thread.
- Evaluation: The implementation is developed in GPUMD, with Tersoff and Stillinger-Weber potentials evaluated against LAMMPS using silicon-crystal test systems.
2. Formulations and algorithms
This section develops a GPU-oriented formulation for many-body force evaluation, using explicit pairwise forces so per-atom quantities can be accumulated without write conflicts. It applies the approach to Tersoff potentials, establishes equivalence with conventional forces, and describes implementation choices and comparisons with prior methods.
- 2.1. The Terso: Tersoff interactions are many-body because each bond-order term depends on neighboring atoms beyond the bonded pair.The formulation is presented for single-element systems, while the implementation also supports multiple atom types and modified Tersoff forms.
- 2.1. The Terso: The cutoff function enables Verlet neighbor lists and cell-list methods to accelerate force evaluation.Standard cell lists are efficient for uniform cutoffs; systems with large size disparities may benefit from more sophisticated methods.
- 2.2. The conventional method of implementing the Tersoff potential: The conventional algorithm accumulates energy, forces, virial stress, and heat current through separate loops over atoms and neighbors.Its force and stress expressions include pairwise and many-body contributions, while heat current is computed from per-atom virial stress and velocity.
- 2.2. The conventional method of implementing the Tersoff potential: GPU execution makes the conventional algorithm unsuitable because threads associated with neighboring atoms concurrently update the same force and stress locations.CUDA write conflicts can produce incorrect accumulation, while atomic operations would provide little performance gain.
- 2.3. A new method of implementing the Tersoff potential: The new method uses an explicit pairwise force expression that is equivalent to the conventional Tersoff force calculation.The equivalence follows by rewriting absolute positions in relative coordinates and regrouping the conventional force terms.
- 2.3. A new method of implementing the Tersoff potential: The pairwise formulation gives simple per-atom expressions for energy, force, virial stress, and heat current, each accumulated solely by its associated thread.This removes write conflicts by construction and yields a simpler CUDA or OpenCL force-evaluation kernel.
- 2.3. A new method of implementing the Tersoff potential: For Tersoff potentials, a two-kernel implementation precomputes bond-order functions and derivatives before force evaluation.The preprocessing kernel takes about 20% of total force-evaluation time and reduces redundant bond-order calculations by about M, the maximum neighbor count.
- 2.5. Comparison with previous works: The algorithm is presented as general and supports efficient per-atom stress and heat-current calculations, while usually requiring only one force-evaluation kernel.The authors distinguish it from related approaches by its formal basis, included per-atom quantities, and limited kernel count.
3. Performance evaluation
GPUMD’s performance is evaluated for Tersoff and Stillinger-Weber potentials on a Tesla K40 GPU across system sizes, precisions, and CPU baselines. Performance scales with system size, and GPUMD compares favorably with serial and MPI-parallel LAMMPS.
- Experimental setup: GPUMD performance is measured for Tersoff and Stillinger-Weber potentials using silicon systems from 1,000 to 2,744,000 atoms on a Tesla K40 GPU.Simulations use 300 K and zero pressure; computational speed is reported from 1,000-step runs.
- GPUMD scaling: Performance increases rapidly with system size and nearly saturates above 10^5 atoms for both potentials and precisions.The comparison includes double- and single-precision GPUMD runs.
- Precision dependence: Single-precision GPUMD is about 3-4 times as fast as double-precision, with measured GPU occupancy of about 50% versus 25%.The paper attributes the difference partly to faster single-precision arithmetic and partly to register use and occupancy.
- Precision dependence: 25 ns per day is achieved by single-precision Stillinger-Weber GPUMD for a system with 10^6 atoms and a 2 fs time step.
- LAMMPS comparisons: For large systems, GPUMD’s speedup over single-core LAMMPS ranges from a few tens to a few hundred, depending on potential and precision.The baseline is Intel Xeon CPU X5670 @ 2.93 GHz; using a similarly timed CPU would roughly halve the reported speedup factors.
- LAMMPS comparisons: For 512,000 atoms, Tersoff GPUMD matches LAMMPS using about 100 CPU cores in double precision and about 500 CPU cores in single precision.LAMMPS MPI scaling is reported to be good up to about 100 cores before becoming less ideal.
- LAMMPS comparisons: GPUMD is more than one order of magnitude faster than original GPU LAMMPS for Tersoff in both double- and single-precision.An optimized LAMMPS version is a few times faster than the original but remains a few times slower than GPUMD.
4. Conclusions
The paper presents an efficient, write-conflict-free GPU algorithm for many-body potentials and implements it in GPUMD, achieving strong performance against CPU-based LAMMPS.
- The algorithm accumulates force, virial stress, and heat current for each atom in one thread, avoiding write conflicts by construction.This design supports simple, flexible, and efficient GPU implementation of many-body potentials.
- GPUMD implements the algorithm for Tersoff and Stillinger-Weber potentials with excellent performance.
- GPUMD on one Tesla K40 GPU can be as fast as LAMMPS running with tens to hundreds of CPU cores.