Skip to main content
QUICK REVIEW

[Paper Review] Rapid Exploration of Optimization Strategies on Advanced Architectures using TestSNAP and LAMMPS

Rahulkumar Gayatri, Stan Moore|arXiv (Cornell University)|Nov 25, 2020
Machine Learning in Materials ScienceMaterials Science12 references4 citations
TL;DR

This paper presents a 22x performance improvement in the Spectral Neighbor Analysis Potential (SNAP) within LAMMPS by rearchitecting the algorithm using Kokkos and GPU-specific optimizations, including hierarchical parallelism, AoSoA data layout, and kernel fission, enabling high compute saturation and performance portability across exascale architectures.

ABSTRACT

The exascale race is at an end with the announcement of the Aurora and Frontier machines. This next generation of supercomputers utilize diverse hardware architectures to achieve their compute performance, providing an added onus on the performance portability of applications. An expanding fragmentation of programming models would provide a compounding optimization challenge were it not for the evolution of performance-portable frameworks, providing unified models for mapping abstract hierarchies of parallelism to diverse architectures. A solution to this challenge is the evolution of performance-portable frameworks, providing unified models for mapping abstract hierarchies of parallelism to diverse architectures. Kokkos is one such performance portable programming model for C++ applications, providing back-end implementations for each major HPC platform. Even with a performance portable framework, restructuring algorithms to expose higher degrees of parallelism is non-trivial. The Spectral Neighbor Analysis Potential (SNAP) is a machine-learned inter-atomic potential utilized in cutting-edge molecular dynamics simulations. Previous implementations of the SNAP calculation showed a downward trend in their performance relative to peak on newer-generation CPUs and low performance on GPUs. In this paper we describe the restructuring and optimization of SNAP as implemented in the Kokkos CUDA backend of the LAMMPS molecular dynamics package, benchmarked on NVIDIA GPUs. We identify novel patterns of hierarchical parallelism, facilitating a minimization of memory access overheads and pushing the implementation into a compute-saturated regime. Our implementation via Kokkos enables recompile-and-run efficiency on upcoming architectures. We find a $\sim$22x time-to-solution improvement relative to an existing implementation as measured on an NVIDIA Tesla V100-16GB for an important benchmark.

Motivation & Objective

  • Address the challenge of performance portability and scalability of molecular dynamics applications on heterogeneous exascale architectures with diverse CPU and GPU components.
  • Overcome performance bottlenecks in existing GPU implementations of the SNAP interatomic potential, which suffered from memory access inefficiencies and load imbalance.
  • Develop a high-performance, portable implementation of SNAP in LAMMPS using the Kokkos programming model to support future hardware evolution.
  • Explore and validate algorithmic and low-level optimizations that maximize arithmetic intensity and minimize memory latency on modern GPUs.
  • Establish a rapid prototyping pipeline using the TestSNAP proxy application to accelerate optimization cycles before integration into production code.

Proposed method

  • Employed the TestSNAP proxy application to rapidly prototype and test optimization strategies before integration into LAMMPS.
  • Reimplemented the SNAP potential using Kokkos with a CUDA backend to ensure performance portability across CPU and GPU architectures.
  • Applied hierarchical parallelism via a 3D MDRangePolicy mapping to an array-of-structures-of-arrays (AoSoA) data layout, with the innermost dimension fixed at 32 (CUDA warp size) for coalesced memory access.
  • Optimized memory access by restructuring data layouts to eliminate load imbalance and improve L1 cache reuse, particularly for compute_Y and compute_U kernels.
  • Used kernel fission instead of fusion to improve occupancy and reduce divergence, especially in compute_Y where atomic operations were involved.
  • Introduced shared memory caching of intermediate results and split complex data structures (e.g., Ylist) into real and imaginary components to enhance coalescing and reduce atomic conflicts.

Experimental results

Research questions

  • RQ1How can algorithmic restructuring and low-level optimizations improve the performance of the SNAP potential on modern GPU architectures?
  • RQ2What role does data layout (e.g., AoSoA) play in achieving coalesced memory access and load balancing on GPUs?
  • RQ3Can kernel fission outperform kernel fusion in GPU kernels with high-occupancy and atomic operations?
  • RQ4To what extent can performance-portable frameworks like Kokkos enable portable optimization strategies across heterogeneous architectures?
  • RQ5How do architecture-specific optimizations (e.g., shared memory, warp-level coalescing) contribute to achieving compute saturation on GPUs?

Key findings

  • The final optimized implementation achieved a 19.6× speedup on the 2J8 benchmark and a 21.7× speedup on the 2J14 benchmark over the baseline GPU implementation on an NVIDIA V100-16GB.
  • The AoSoA data layout eliminated load imbalance within warps, yielding a 1.4× speedup for both 2J8 and 2J14 problem sizes due to perfect coalescing and balanced work distribution.
  • Memory usage was significantly reduced: the 2J8 benchmark used only 0.1 GB of GPU memory, and the 2J14 benchmark used 0.9 GB, despite larger problem sizes.
  • The performance gain came at the cost of CPU performance, necessitating divergent code paths in the Kokkos implementation, with CPU path using only optimizations up to section V.
  • The fundamental adjoint refactorization was essential for enabling all subsequent optimizations and improving numerical stability and code clarity.
  • All optimizations were successfully backported into the public LAMMPS release, with future work planned for CPU SIMD extensions using similar AoSoA principles.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.