Implementing a neural network interatomic model with performance portability for emerging exascale architectures

Abstract The two main thrusts of computational science are increasingly accurate predictions and faster calculations; to this end, the zeitgeist in molecular dynamics (MD) simulations is pursuing machine learned and data driven interatomic models, e.g. neural network potentials, and novel hardware architectures, e.g. GPUs. Current implementations of neural network potentials are orders of magnitude slower than traditional interatomic models and while looming exascale computing offers the ability to run large, accurate simulations with these models, achieving portable performance for MD with new and varied exascale hardware requires rethinking traditional algorithms, using novel data structures, and library solutions. We re-implement a neural network interatomic model in CabanaMD, an MD proxy application , built on libraries developed for performance portability . Our implementation shows significantly improved thread scaling in this complex kernel as compared to a current LAMMPS implementation, across both strong and weak scaling. Our single-source solution enables simulations up to 20 million atoms on a single CPU node and 4 million atoms with improved performance on a single GPU. We also explore parallelism and data layout choices (using flexible data structures called AoSoAs) and their effect on performance, seeing up to ∼50% and ∼5% improvements in performance on a GPU by choosing the right level of parallelism and data layout respectively. Program summary Program title: CabanaMD-NNP CPC Library link to program files: https://doi.org/10.17632/x948kyy7jh.1 Developer's repository link: https://github.com/ECP-CoPA/CabanaMD , https://github.com/CompPhysVienna/n2p2 Licensing provisions: BSD3-Clause, GPL-3.0 Programming Language: C++ Nature of problem: Developing a performance portable implementation of a neural network potential for exascale architectures. Solution method: CabanaMD-NNP uses algorithms and data-structures from the Kokkos [1] and Cabana [2] libraries to re-implement the computations in Behler-Parrinello neural network potentials [3, 4] for performance portability across hardware. All molecular dynamics data is stored in performance portable data structures, with atomic properties in array-of-structs-of-arrays (Cabana::AoSoAs), and auxiliary values including potential parameters in arrays (Kokkos::Views ). All computation is also done in a performance portable way: neural network propagation uses Kokkos parallel kernels ( Kokkos::parallel_for), while calculations performed for each atom and neighbor, evaluation of descriptors (symmetry functions) and forces, use Cabana extensions of Kokkos constructs (Cabana::neighbor_parallel_for). These choices provide our implementation with significant speedups both on CPUs and GPUs for large systems, additionally allowing flexibility for parallelism and data layout for further optimizations. Additional comments including restrictions and unusual features: The previously developed n2p2 package [4] contains an interface to LAMMPS [5], which we compare to throughout the paper. We primarily extend the n2p2 library directly ( https://github.com/CompPhysVienna/n2p2 ) and also add an interface to that extension within CabanaMD ( https://github.com/ECP-CoPA/CabanaMD ), to obtain the main results with an identical LAMMPS input file. References [1] H.C. Edwards, C.R. Trott, D. Sunderland, Kokkos: Enabling manycore performance portability through polymorphic memory access patterns , Journal of Parallel and Distributed Computing . 74 (2014) 3202–3216. https://doi.org/10.1016/j.jpdc.2014.07.003 . [2] S. Slattery, C. Junghans, D. Lebrun-Grandie, R. Halver, G. Chen, S. Reeve, A. Scheinberg, C. Smith, R. Bird, ECP-CoPA/Cabana: Cabana Version 0.2.0, Zenodo, 2019. [3] J. Behler, M. Parrinello, Generalized Neural-Network Representation of High-Dimensional Potential-Energy Surfaces, Phys. Rev. Lett. 98 (2007) 146401. [4] A. Singraber, J. Behler, C. Dellago, Library-Based LAMMPS Implementation of High-Dimensional Neural Network Potentials, J. Chem. Theory Comput. 15 (2019) 1827–1840. https://doi.org/10.1021/acs.jctc.8b00770 . [5] S. Plimpton, Fast Parallel Algorithms for Short-Range Molecular Dynamics, Journal of Computational Physics. 117 (1995) 1–19. https://doi.org/10.1006/jcph.1995.1039 .