원시데이터 수집 시스템
선정목록으로

Extending the limit of molecular dynamics with ab initio accuracy to 10 billion atoms

간접 관련 화학·수지 · (21) 에폭시수지 (6) PEM(고분자전해질막)(7) MEA(막전극접합체)(16) CPI(투명 폴리이미드)

기본 정보

저자
  1. Guo, Zhuoqiang
  2. Lu, Denghui
  3. Yan Yu-jin
  4. Hu Siyu
  5. Liu Rong-Rong
  6. Tan Guangming
  7. Sun Ning-hui
  8. Jiang Wanrun
  9. Liu Li-jun
  10. Chen, Yixiao
  11. Zhang Linfeng
  12. Chen Mo-Han
  13. Wang Han
  14. Jia, Weile
DOI
10.48550/arxiv.2201.01446
저널
arXiv (Cornell University)
발행년도
2022
발행기관
Cornell University
피인용수
10
라이선스
0
논문 유형
–
언어
–
원문 페이지
https://doi.org/10.48550/arxiv.2201.01446
토픽
Electrocatalysts for Energy Conversion
OpenAlex ID
W6891969706

평가 내용

관련도
간접 관련
사업분야
화학·수지 · (21) 에폭시수지
부 분야
(6) PEM(고분자전해질막), (7) MEA(막전극접합체), (16) CPI(투명 폴리이미드)
R&D 측면
분석·모델링
확신도
0.70
근거 용어
molecular dynamics, ab initio accuracy, machine learning, potential energy surface, mechanical properties
판단 근거
본 논문은 머신러닝 기반의 분자 동역학(MD) 시뮬레이션 속도와 규모를 혁신적으로 개선하는 알고리즘을 다룹니다. 이는 코오롱인더스트리의 에폭시, PEMFC, 디스플레이 소재 등의 분자 구조 및 물성 예측을 위한 시뮬레이션 방법론에 간접적으로 활용될 수 있습니다.
R&D 활용 포인트
고분자 소재(에폭시, 폴리이미드 등) 및 수소연료전지용 이온전도성 막의 미세 구조와 열화 메커니즘을 원자 단위에서 고속으로 시뮬레이션하여 신소재 설계 및 물성 예측 효율을 높이는 데 활용 가능합니다.
평가 입력
본문 69,211자 중 30,032자 발췌

초록

High-performance computing, together with a neural network model trained from data generated with first-principles methods, has greatly boosted applications of \textit{ab initio} molecular dynamics in terms of spatial and temporal scales on modern supercomputers. Previous state-of-the-art can achieve $1-2$ nanoseconds molecular dynamics simulation per day for 100-million atoms on the entire Summit supercomputer. In this paper, we have significantly reduced the memory footprint and computational time by a comprehensive approach with both algorithmic and system innovations. The neural network model is compressed by model tabulation, kernel fusion, and redundancy removal. Then optimizations such as acceleration of customized kernel, tabulation of activation function, MPI+OpenMP parallelization are implemented on GPU and ARM architectures. Testing results of the copper system show that the optimized code can scale up to the entire machine of both Fugaku and Summit, and the corresponding system size can be extended by a factor of $134$ to an unprecedented $17$ billion atoms. The strong scaling of a $13.5$-million atom copper system shows that the time-to-solution can be 7 times faster, reaching $11.2$ nanoseconds per day. This work opens the door for unprecedentedly large-scale molecular dynamics simulations based on {\it ab initio} accuracy and can be potentially utilized in studying more realistic applications such as mechanical properties of metals, semiconductor devices, batteries, etc. The optimization techniques detailed in this paper also provide insight for relevant high-performance computing applications.

본문 69,211자

본문 펼치기
# Extending the limit of molecular dynamics with ab initio accuracy to 10 billion atoms Zhuoqiang Guo <sup>1</sup> <sup>_,_</sup> <sup>2</sup>, Denghui Lu <sup>4</sup>, Yujin Yan <sup>1</sup> <sup>_,_</sup> <sup>2</sup>, Siyu Hu <sup>1</sup> <sup>_,_</sup> <sup>2</sup>, Rongrong Liu <sup>1</sup> <sup>_,_</sup> <sup>2</sup>, Guangming Tan <sup>1</sup> <sup>_,_</sup> <sup>2</sup> <sup>_,_</sup> <sup>3</sup>, Ninghui Sun <sup>1</sup> <sup>_,_</sup> <sup>2</sup> <sup>_,_</sup> <sup>3</sup>, Wanrun Jiang <sup>5</sup>, Lijun Liu <sup>6</sup>, Yixiao Chen <sup>7</sup>, Linfeng Zhang <sup>5</sup> <sup>_,_</sup> <sup>8</sup>, Mohan Chen <sup>4</sup>, Han Wang <sup>9</sup>, Weile Jia <sup>1</sup> <sup>_,_</sup> <sup>2</sup> <sup>_,_</sup> <sup>3</sup> <sup>_,_</sup> <sup>∗</sup> 1Institute of Computing Technology, Chinese Academy of Sciences, Beijing, China 2 University of Chinese Academy of Sciences, Beijing, China 3 State Key Laboratory of Computer Architecture, ICT, Chinese Academy of Sciences, Beijing, China Email: {guozhuoqiang20z, yanyujin17z, husiyu20b, liurongrong21s, tgm, snh, jiaweile}@ict.ac.cn, 4HEDPS, CAPT, College of Engineering, Peking University, Beijing, China Email: {denghuilu,mohanchen}@pku.edu.cn 5AI for Science Institute, Beijing, China Email: wanrunj@live.com 6Osaka University, Osaka, Japan Email: liu@mech.osaka-u.ac.jp 7Princeton University, Princeton, USA Email: yixiaoc@princeton.edu 8DP Technology, Beijing, China Email: zhanglf@dp.tech 9Laboratory of Computational Physics, Institute of Applied Physics and Computational Mathematics, Beijing, China Email: wang_han@iapcm.ac.cn Abstract High-performance computing, together with a neural network model trained from data generated with first-principles methods, has greatly boosted applications of _ab initio_ molecular dynamics in terms of spatial and temporal scales on modern supercomputers. Previous state-of-the-art can achieve 1 − 2 nanoseconds molecular dynamics simulation per day for 100-million atoms on the entire Summit supercomputer. In this paper, we have significantly reduced the memory footprint and computational time by a comprehensive approach with both algorithmic and system innovations. The neural network model is compressed by model tabulation, kernel fusion, and redundancy removal. Then optimizations such as acceleration of customized kernel, tabulation of activation function, MPI+OpenMP parallelization are implemented on GPU and ARM architectures. Testing results of the copper system show that the optimized code can scale up to the entire machine of both Fugaku and Summit, and the corresponding system size can be extended by a factor of 134 to an Permission to make digital or hard copies of part or all of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for thirdparty components of this work must be honored. For all other uses, contact the owner/author(s). _PPoPP ’22, February 12–16, 2022, Seoul, Republic of Korea_ © 2022 Copyright held by the owner/author(s). ACM ISBN 978-1-4503-9204-4/22/02. [https://doi.org/10.1145/3503221.3508425](https://doi.org/10.1145/3503221.3508425) unprecedented 17 billion atoms. The strong scaling of a 13 _._ 5million atom copper system shows that the time-to-solution can be 7 times faster, reaching 11 _._ 2 nanoseconds per day. This work opens the door for unprecedentedly large-scale molecular dynamics simulations based on _ab initio_ accuracy and can be potentially utilized in studying more realistic applications such as mechanical properties of metals, semiconductor devices, batteries, etc. The optimization techniques detailed in this paper also provide insight for relevant high-performance computing applications. _Keywords:_ Deep potential, molecular dynamics, GPU, heterogeneous architecture, DeePMD-kit 1 Introduction Machine learning (ML) applications are playing an increasingly important role in modern high-performance computing (HPC) systems. Besides the optimization of gigantic neural network model training [3, 8, 17, 25, 29], HPC plus artificial intelligence (AI) in solving scientific problems are gaining momentum [5, 20, 22, 23]. One example is the machinelearning molecular dynamics (MLMD), which aims to bridge the gap between first-principles accuracy and Newtonian MD efficiency [9, 37]. In MLMD, the atomic potential energy surface (PES) is fitted to obtain _ab initio_ accuracy via MLbased models trained from first-principles data, which can be generated from density functional theory (DFT) calculation software packages such as VASP, Quantum Espresso, PWmat, *Corresponding author PPoPP ’22, February 12–16, 2022, Seoul, Republic of Korea Zhuoqiang Guo,Denghui Lu, et al. etc [13, 16, 18, 19, 30]. Many machine-learning models, such as the Gaussian regression [1, 32], linear regression [7, 21, 28, 33], and neural network methods [2, 38], can be applied in the MLMD. The resulting MLMD packages, such as the representative works listed in Table 1, can significantly increase the spatial and temporal limit of AIMD. One state-of-the-art MLMD code is the open-source package DeePMD-kit [35], which adopts Deep Potential [37, 38], a neural network approach by combing the symmetry-preserving features and highly efficient implementations. Compared with the best reported AIMD results, the spatial and temporal scales of the accommodated physical systems can speed up by a factor of 100 and 1000, respectively [20]. Recently, the size of the system that the DeePMD method can handle reaches 100-million atoms on the entire Summit supercomputer (2020 Gordon Bell prize), achieving 91/171/285 PFLOPS for double/mixedsingle/mixed-half precision arithmetic operation. This opens the door for tackling important scientific problems with unprecedented system size and time scales. For example, recent works that used DeePMD-kit focused on the interactions of molecules in water [10], nucleation of liquid silicon [4], phase transition of water [11], and phase diagram of water [39], etc. Despite the success, MLMD software packages still face challenges on modern HPC platforms. First, the diversity of many-core architecture supercomputers has raised the issue of performance portability. For example, the efficient MPI+CUDA implementation of DeePMD-kit cannot be adopted to fully exploit the computing power of Fugaku, which uses many-core ARM CPU and currently ranks No. 1 on the top 500 list [34]. It remains unknown whether the optimal granularity and data parallelism on GPU works on many-core CPU architecture for HPC+AI applications. Second, it is unclear whether the current DeePMD-kit implementation is the optimal choice. For example, model compression techniques, such as pruning and low-rank factorization [6, 12, 14, 15], are introduced in the fields of natural language processing and computer vision. The compressed model, as discussed in Ref. [6], may suffer from accuracy loss by throwing away some parameters. For scientific computing applications such as the MLMD, the difficulty lies in compressing the neural network model without loss of accuracy. Third, for problems in complex chemical reactions, electrochemical cells, nanocrystalline material, radiation damage, dynamic fracture and crack propagation, etc., the required spatial and temporal scales can even go beyond 100 million atoms and several nanoseconds. Thus, extending the limit of MD with _ab initio_ accuracy is important for many scientific applications. In this paper, we attempt to solve the above problems by algorithmic and system innovations. It is noted that a flat MPI version of DeePMD-kit [20] (current state-of-the-art) is set as the baseline throughout this paper. The main contributions of this paper are: - We introduce a novel algorithm of tabulating the neural network model with fifth-order polynomials, and save 82% of floating-point operations (FLOPs) compared with the previous state-of-the-art. - We optimize the memory usage and computational time of the embedding matrix, which take more than 95% of total memory footprint, by applying system optimizations such as kernel fusion, redundancy removal, etc. - We implement an optimized GPU version of DeePMDkit on Summit. Testing results show that our optimized code can be 3.7 to 9.7 times faster, and the physical system size can be 26 _._ 7 times bigger (3.4 billion atoms) compared to the current state-of-the-art. - We implement an optimized version of DeePMD-it on Fugaku, and obtained 21.2 and 46.7 times of speedup for water and copper system, respectively. Normalized testing results with respect to peak performance and power consumption show that our Fugaku implementation can be 1 _._ 2 and 1 _._ 3 times faster than V100 GPU, respectively. - Weak scaling shows that the optimized DeePMD-kit can scale up to the entire Summit and Fugaku, reaching an unprecedented 25 and 17 billion atoms of water and copper, respectively. The strong scaling on Summit shows that DeePMD-kit can reach 11.24 nanoseconds MD simulation per day for a 13.5-million atom copper system. Such spatial and temporal scales further extend the capability of MD with _ab intitio_ accuracy. The rest of this paper is organized as follows: The Deep Potential algorithm is introduced in Sec. 2, with algorithmic and system innovations provided in Sec. 3. The physical system and testing platform are presented in Sec. 4 and 5, respectively. Results are discussed and analyzed in Sec. 6. Conclusions are drawn in Sec. 7. 2 DEEP POTENTIAL MODEL The Deep Potential (DP) model is constructed with deep neural networks for representing the potential energy surface in a symmetry preserving manner. It achieves comparable accuracy as the _ab initio_ calculations and reduces the computational complexity to linearly depending on the degrees of freedom in the system. In this section, we introduce the construction of the DP model and analyzing the most expensive part in terms of floating-point operation and memory usage. 2.1 Model definition A schematic illustration of the DP model is shown in Fig. 1. In a physical system of _?_ atoms, each atom is described by using its atomic position _?_ _?_ = ( _??,??,??_ ) ∈ R <sup>3</sup>, _?_ = 1 _,_ 2 _, . . ., ?_ . Each MPI task holds a sub-region of the physical system. Note that the DP model assumes the potential energy _??_ of atom _?_ only depends on its neighbors R _?_ = { _?_ _??_ | _?_ ∈ _???_ ( _?_ )}, Extending the limit of molecular dynamics with _ab initio_ accuracy to 10 billion atoms PPoPP ’22, February 12–16, 2022, Seoul, Republic of Korea Table 1. Performance of MLMD applications with _ab initio_ accuracy. The abbreviations TtS, BP, and DP stand for time-tosolution, Behler-Parrinello scheme, and Deep Potential, respectively. *The parallel efficiency does not significantly decay at the largest machine scale tested in the work, so it is highly likely that they can scale to larger machines. †Vienna Scientific Cluster (VSC), an HPC system with Intel Xeon Gold 6138 CPUs. ‡An unknown cluster with Intel Xeon E5-2650v2 CPUs at the KISTI supercomputing center. **The baseline is the current state-of-the-art DeePMD-kit. Work Year Pot. System # atoms # CPU cores # GPUs Machine Peak[FLOPS] TtS [s/step/atom] Simple-NN [24]* 2019 BP SiO2 14K 80 - Unknown‡ ? 3 _._ 6 × 10 <sup>−5</sup> Singraber el.al. [31]* 2019 BP H2O 9K 512 - VSC† ? 1 _._ 3 × 10 <sup>−6</sup> Baseline [20]**(double) 2020 DP Cu 127M 27.3K 27.3K Summit 91P 8 _._ 1 × 10 <sup>−10</sup> Baseline [20]**(mixed-half) 2020 DP Cu 127M 27.3K 27.3K Summit 275P 2 _._ 7 × 10 <sup>−10</sup> This work (double) 2021 DP Cu 3.4B 27.3K 27.3K Summit 43.7P 1 _._ 1 × 10 <sup>−10</sup> This work (double) 2021 DP Cu 17B 7,630K - Fugaku 119P 4 _._ 1 × 10 <sup>−11</sup> where _?_ _??_ = _??_ - _?_ _?_ and _???_ ( _?_ ) denotes the index set of the neighboring atoms within the cut-off radius _??_ as shown in Fig. 1 (a). In the execution of the DP model, first, the _envi-_ _ronment matrix_ R <sup>˜</sup> _?_ is generated from the neighboring list of a particular atom _?_ . Then _?_ ( _?_ _??_ ), the first column of the environment matrix, is passed to a three hidden layer _embedding_ _net_ to obtain the _embedding matrix_ G _?_ . Next, the symmetrypreserving descriptor D(R <sup>˜</sup> _?_ ) is constructed, followed by a three-hidden-layer _fitting_ _net_ to produce _??_, the potential energy of atom _?_ . In the end, the total energy of the system _?_ is calculated by summing each individual potential energy, i.e., _?_ = <sup>�</sup> _?_ <sup>_?_</sup> _?_ <sup>. Note that the</sup> <sup>_?_</sup> _?_ <sup>is evaluated in forward propa-</sup> gation, while the atomic force _??_, which is the gradient of the potential energy, is calculated in the backward propagation. A detailed mathematical view of the model is the following: The input of the DP model is the environment matrix of each atom _?_, which is denoted as R <sup>˜</sup> _?_ ∈ R <sup>_??_</sup> <sup>×4</sup>, where _??_ is the maximum of all neighbor list. R <sup>˜</sup> _?_ is constructed from the local environment, i.e. all relative postitions of neighboring atoms _?_ _??_ = _??_ - _?_ _?_ = { _???,???,???_ }, with the following equations: R˜ _?_ = _?_ ( _???_ ) × (1 _,???_ /| _?_ _??_ | _,???_ /| _?_ _??_ | _,???_ /| _?_ _??_ |) _,_ (1) where _?_ ( _???_ ) = _?_ (| _?_ _??_ |)/| _?_ _??_ | and _?_ (| _?_ _??_ |) is a gating function that decays smoothly from 1 to 0 when | _?_ _??_ | ≤ _??_ . The DP model is unique in automatically generated descriptors D(R <sup>˜</sup> _?_ ), which preserved physical symmetries such as translational, rotational, and permutational invariance: D(R <sup>˜</sup> _?_ ) = (G _?_ <sup>_<_</sup> <sup>)</sup> <sup>_?_</sup> <sup>R˜</sup> <sup>_?_</sup> <sup>(R˜</sup> <sup>_?_</sup> <sup>)</sup> <sup>_?_</sup> <sup>G</sup> <sup>_?,_</sup> (2) where G _?_ ∈ R <sup>_??_</sup> <sup>×</sup> <sup>_?_</sup> is the embedding matrix as illustrated in Fig. 1(b). The matrix G _?_ obtained by forwarding vector _?_ ( _???_ ) through the _?_ -layer fully connected embedding net (see Fig. 1 (c)): The input size is expanded by _?_ 1 times after the first layer. The rest layers are fully-connected layers with shortcut connection and tanh activation function: _?_ <sup>_?_</sup> <sup>(</sup> <sup>_?_</sup> <sup>)</sup> <sup>=</sup> <sup>(</sup> <sup>_?,?_</sup> <sup>) + tanh(</sup> <sup>_?_</sup> <sup>·</sup> <sup>_?_</sup> _?_ <sup>_?_</sup> _?_ <sup>_?_</sup> <sup>)</sup> <sup>_._</sup> (5) L _?_ <sup>_?_</sup> _?_ <sup>_?_</sup> <sup>+</sup> <sup>_?_</sup> _?_ <sup>_?_</sup> G _?_ = L _?_ <sup>_?_</sup> _?_ <sup>_?_</sup> <sup>◦· · · ◦L</sup> 1 <sup>_?_</sup> 1 <sup>_?_</sup> <sup>◦L</sup> 0 <sup>_?_</sup> <sup>(</sup> <sup>_?_</sup> <sup>(</sup> <sup>_???_</sup> <sup>))</sup> <sup>_._</sup> (3) The first layer is a standard fully-connected layer with activation function tanh: 0 <sup>_?_</sup> <sup>(</sup> <sup>_?_</sup> <sup>)</sup> <sup>= tanh(</sup> <sup>_?_</sup> <sup>·</sup> <sup>_?_</sup> 0 <sup>_?_</sup> <sup>+</sup> <sup>_??_</sup> 0 <sup>)</sup> <sup>_,_</sup> _?_ 0 <sup>_?_</sup> The output size of each layer is doubled and final output size is _?_ (see Fig. 1 (e), note _?_ = 4 _?_ 1). The matrix G _?_ <sup>_<_</sup> <sup>∈</sup> <sup>R</sup> <sup>_??_</sup> <sup>×</sup> <sup>_?_</sup> <sup>_<_</sup> with _?_ <sup>_<_</sup> _<_ _?_ is a sub-matrix of G _?_ formed by taking the first _?_ <sup>_<_</sup> columns of G _?_ . The symmetry-preserving descriptor D is mapped to atomic energy _??_ via a fitting network N : _??_ = N (D(R <sup>˜</sup> _?_ )) (see Fig. 1 (d)). The fitting network N is a standard fullyconnected network with hidden layers being of the same size. A shortcut connection is established between the input and output of each hidden layer of the fitting network. The force on atom _?_ is derived from the negative gradient of the total energy: _??_ = −∇ _??_ _?_ = − <sup>�</sup> _?_ <sup>∇</sup> _??_ <sup>_?_</sup> _?_ <sup>.</sup> 2.2 Computationally intensive parts and memory footprint Both the training and inference of the DP model are implemented in an open-source package DeePMD-kit[37]. DeePMD-kit is further interfaced with the LAMMPS package [27] to perform large-scale MD simulations. The model training generally takes a few hours to one week on a single GPU, depending on the complexity of the physical system [38]. The model inference, on the other hand, can take hours, even days on supercomputers for simulating a large system with long time scales. Thus, in this work, we focus on the computationally intensive part, i.e., the inference of the DP model. TensorFlow is selected as the framework for building the DP model. All procedures listed in Fig. 1 are implemented either with standard TensorFlow operators or with customized TensorFlow operators. For example, both embedding net and fitting net are constructed with standard TensorFlow operators, and the environment matrix R <sup>˜</sup> _?_ is built via hand-crafted TensorFlow operators. L0 <sup>_?_</sup> 0 <sup>_?_</sup> <sup>∈</sup> <sup>R</sup> <sup>_?_</sup> <sup>1</sup> <sup>_,??_</sup> 0 <sup>∈</sup> <sup>R</sup> <sup>_?_</sup> <sup>1</sup> <sup>_._</sup> (4) PPoPP ’22, February 12–16, 2022, Seoul, Republic of Korea Zhuoqiang Guo,Denghui Lu, et al. Figure 1. A schematic illustration of the DP model. (a). One sub-region on a single MPI task (Green: local region, light cyan: ghost region). (b). The mapping from local environment R <sup>˜</sup> _?_ to the energy _??_ for a single atom. (c). Embedding net with three hidden layers. (d). Fitting net with three hidden layers. (e). Execution of the embedding net of the previous DP model via matrix-matrix multiplications, the first layer expands vector _?_ ( _???_ ) by a factor of _?_ 1, the next two layers expand the input matrix by a factor of two. (f). Physical symmetry preserving descriptors. The most computationally intensive part of the DP model lies in attaining the embedding matrix from _?_ ( _???_ ) via the embedding net, as illustrated in Fig. 1 (e). Profiling of the previous DeePMD-kit shows that more than 90 percent of the total time are spent on execution of the embedding net. The input vector _?_ ( _???_ ), which is a smooth function of | _?_ <u>1</u> _??_ | <sup>(see Sec. 2.1),</sup> is expanded from size _??_ to _??_ × 4 _?_ 1 by matrix-matrix multiplication operations, where _??_ is the max length of all atomic neighbor lists and _?_ 1 is the width of the first fully connected layer. Theoretically, the total FLOPs of the embedding net is _??_ × ( _??_ × _?_ 1 + 10 × _??_ × _?_ 1 <sup>2), where</sup> <sup>_??_</sup> <sup>stands</sup> for the number of atoms residing on single MPI task. For example, _??_ can be up to 4 _,_ 600 and _??_ is 512 for the copper system in the previous work[20], and the corresponding width of the three fully connected layers in the embedding net are 32, 64, and 128, respectively. The computational cost of the embedding net approximately accounts for 95% of the total FLOPs. It is noted that the embedding matrix G _?_ (dimension: _??_ × _??_ ×128) is the most memory-demanding variable in the DeePMD-kit. For example, G _?_ can take 2 _._ 4GB GPU global memory for a system of 4 _,_ 600 copper atoms mentioned above. Since several copies of G _?_ are required during the model inference, such as in forward and backward propagation, trading time with space, etc., the G _?_ related memory consumption accounts for more than 95% of the total. 3 INNOVATION 3.1 Summary of contributions The main contribution of this paper is a performance portable DeePMD-kit code, which further extends the system size and time scale of molecular dynamics with _ab initio_ accuracy on modern HPC platforms. The optimization strategy and implementation details are summarized on both Fugaku and Summit, providing insights to the optimization of other HPC applications. 3.2 Algorithmic innovation As discussed in Sec. 2.2, the propagation of the embedding net accounts for 95% of the FLOPs in the baseline implementation, and takes more than 90% of the total time. The reason, as shown in Fig. 1 (e), lies in the computational expense of matrix-matrix multiplications, which rapidly increases through each layer of the embedding net. The embedding matrix G _?_ is expanded from one vector _?_ ( _???_ ) ∈ R <sup>_??_</sup> by _?_ times in this process, and reaches _??_ × _?_ after the propagation of the embedding net. Essentially, embedding net can be viewed as a mapping function _?_ : R → R <sup>_?_</sup>, from each component of the vector _?_ ( _???_ ) to one row of the embedding matrix G _?_ . By employing Equations 4 and 5 in Sec. 2.1 as activation functions, the embedding net is a high-dimensional and extraordinarily complex continuous function[26]. Weierstrass Approximation Theorem 1. _Suppose ?_ _is a_ _continuous real-valued function defined on the real interval_ [ _?,?_ ] _. For every ?_ _>_ 0 _, there exists a polynomial_ _?_ _such that_ _for all ?_ _in_ [ _?,?_ ] _, we have_ | _?_ ( _?_ ) − _?_ ( _?_ )| _< ?, or equivalently,_ _the supremum norm_ ∥ _?_ ( _?_ ) − _?_ ( _?_ )∥ _< ?._ Based on the Theorem 1, polynomials can be introduced to approximate the embedding network. The domain of the input is equally divided into _?_ intervals with nodes denoted by _?_ 0 _<_ _?_ 1 _<_ - · · _<_ _??_ . In the _?_ -th interval ( _??_ −1 _,??_ ] _,?_ = 1 _,_ 2 _, . . .,?_, we approximate the embedding net with _?_ fifthorder polynomials _??_ <sup>_?_</sup> <sup>(</sup> <sup>_?_</sup> <sup>)</sup> <sup>=</sup> <sup>_??_</sup> _?_ <sup>_?_</sup> _?_ 4 <sup>_?_</sup> <sup>4 +</sup> <sup>_??_</sup> _?_ <sup>_?_</sup> _?_ 5 <sup>_?_</sup> <sup>5</sup> <sup>_._</sup> _??_ <sup>_?_</sup> <sup>_?_</sup> _?_ 0 <sup>+</sup> <sup>_?_</sup> _?_ <sup>_?_</sup> _?_ <sup>_?_</sup> 1 <sup>_?_</sup> <sup>+</sup> <sup>_??_</sup> _?_ <sup>_?_</sup> _?_ 2 <sup>_?_</sup> <sup>2 +</sup> <sup>_??_</sup> _?_ <sup>_?_</sup> _?_ 3 <sup>_?_</sup> <sup>3 +</sup> <sup>_??_</sup> _?_ Extending the limit of molecular dynamics with _ab initio_ accuracy to 10 billion atoms PPoPP ’22, February 12–16, 2022, Seoul, Republic of Korea Figure 2. Accuracy of the tabulated model compared to the baseline DP model. Root mean squared error (RMSE) of per-atom energy and per-component force are shown, with respect to 3 interval sizes (0.1, 0.01, and 0.001). 100 data are tested for each system. In order to determine the coefficients _?_ <sup>_?_</sup> _??_ <sup>,</sup> <sup>_?_</sup> <sup>=</sup> <sup>0</sup> <sup>_,_</sup> <sup>1</sup> <sup>_,_</sup> <sup>2</sup> <sup>_,_</sup> <sup>3</sup> <sup>_,_</sup> <sup>4</sup> <sup>_,_</sup> <sup>5,</sup> _?_ = 1 _,_ 2 _, . . ., ?_, we acquire the values, first and second order derivatives of _??_ and _?_ matched at the nodes _??_ −1 and _??_ . The obtained coefficients _?_ <sup>_?_</sup> _??_ <sup>are gathered and stored as a table,</sup> so that the evaluation of the original embedding net now can be approximated by the polynomials. This procedure is also referred as _tabulation_ in this work. The accuracy of the tabulation relies on the size of the interval ( _??_ −1 _,??_ ]. With a decreasing interval size, the error introduced by the approximation would vanish. Two physical systems, water and copper, are tested to show the accuracy of the tabulated DP model against the baseline in Fig. 2. The accuracy is measured by the root mean square error (RMSE) in predicted per-atom energy ( _?????_ ) and per-component force ( _?????_ ), i.e., <u>1</u> _?_ <u>∑</u> _?_ ︁ _?????_ = <sup><u>1</u></sup> _?_ √︂ ︁ _?_ _?_ =1 <sup>(</sup> <sup>_????_</sup> _?_ - _??_ <sup>_????_</sup> <sup>_???_</sup> _?_ <sup>_????_</sup> ) <sup>2</sup> _,_ and _?????_ = √︂ <u>1</u> 3 _??_ <u>∑</u> _?_ ︁ _?_ =1 <u>∑︁</u> _?_ _?_ =1 _?,?,?_ <sup>_???_</sup> <sup>−</sup> <sup>_?_</sup> _?,?,?_ <sup>_????_</sup> <u>∑︁3</u> ︁ _?_ =1 <sup>(</sup> <sup>_?_</sup> _?,?,?_ <sup>_???_</sup> _?,?,?_ <sup>_????_</sup> <sup>)2</sup> <sup>_,_</sup> where _?_ is the number of data to be tested (the number of atomic configurations), _?_ is the number of atoms in each configuration and _?_ represents three directions of Cartesian coordinates. Quantities with superscripts _???_ and _????_ denote the predictions of the tabulated DP model and the original DP model, respectively. As shown in Fig. 2, the RMSE of the per-atom energy drop from 2 _._ 0 × 10 <sup>−5</sup> eV/atom to 5 _._ 0 × 10 <sup>−15</sup> eV/atom and the corresponding per-component force drop from 6 _._ 0 × 10 <sup>−5</sup> eV/Å to 4 _._ 0 × 10 <sup>−13</sup> eV/Å when the interval varies from 0 _._ 1 to 0 _._ 001. Note that the double-precision limit is reached when the interval is set to 0 _._ 001. This means our tabulated model can be equally accurate as the original model. We remark that the size of the tabulated model grows as the interval decreases. For example, the size of the model can be 257 MB for water system when interval equals 0 _._ 001, but only 33 MB when the interval is 0 _._ 01. Thus in practice, an Figure 3. An illustration of the data movement when evaluating the descriptor D _?_ of the optimized (tabulated and kernel fused) DP model. Dashed line: memory allocation/access saved by the kernel fusion. optimal interval is balanced between accuracy and model size, and we choose 0 _._ 01 as default in our optimized code. A theoretical analysis of the FLOPs on embedding matrix for both the original and tabulated model is as follows. We denote the number of atoms by _??_, the maximal neighbor list size by _??_ and the size of the first layer of the embedding net by _?_ 1. For the purpose of simplicity, the FLOPs of activation function are counted. The total number of FLOPs for computing the three-layer embedding net by the original model is _??_ ×( _??_ × _?_ 1 +10× _??_ × _?_ 1 <sup>2), as discussed in Sec. 2.2,</sup> while that for the tabulated model is _??_ × 56 × _??_ × _?_ 1. Thus, the theoretical speedup in terms of FLOPs is: <sup>(1+10×</sup> <sup>_?_</sup> <sup>1)</sup> /56. In the previous work[20], _?_ 1 is set to be 32 for both water and copper systems, thus the tabulated model saves 82 percent of the embedding matrix FLOPs compared to the original model. 3.3 Optimization strategy In this section, we will discuss the general strategies used in optimizing DeePMD-kit on modern many-core architectures. The goal is to reduce the memory footprint after the total FLOPs are brought down by 82 percent by the tabulation of embedding net as discussed in Sec. 3.2. The first strategy is to reduce the memory footprint by contracting variables and merging calculations. We find that the embedding matrix G _?_, as discussed in Sec. 2.2, is the most memory-demanding variable and takes more than 95 percent of the total memory usage in the baseline implementation. After the tabulation of the embedding net (See Sec. 3.2), G _?_ is no longer built through the three-layer embedding net (Fig. 1 (e)), rather, it is approximated by fifth-order interpolations. The data movement of evaluating the descriptor D _?_ on typical modern many-core architecture is illustrated in PPoPP ’22, February 12–16, 2022, Seoul, Republic of Korea Zhuoqiang Guo,Denghui Lu, et al. conditions, while the water model is trained only for ambient conditions. The _??_ reserved for the copper model is larger because the neighbor lists are longer in the high-pressure conditions (higher density and thus more neighbors in the cutoff radius). When the models are used under ambient conditions, the copper model has a higher degree of redundancy, and the redundancy can not be avoided nor reduced due to the data layout and matrix operations in the baseline implementation. Figure 4. Removing the redundant zeros from the DP model. (a) Redundant zeros in the environment matrix R _?_, _?_ ( _???_ ). (b) Evaluation of R <sup>˜</sup> <sup>_?_</sup> _?_ <sup>G</sup> <sup>_?_</sup> <sup>. Note that redundant-zero ratio of the</sup> embedding matrix G _?_ are related to the _?_ ( _???_ ). (c) Bypassing redundant zeros in the execution of outer product in one thread block. Fig. 3. For simplicity, we only demonstrate the data movement among the basic components such as arithmetic logic unit (ALU), register (REG), and high-bandwidth memory (MEM). CACHE and shared memory are not discussed. The tabulation of embedding net ( _??_ ( _?_ ) = _??_ 0 + _??_ 1 _?...??_ 5 _?_ <sup>5</sup> ) loads the vector _?_ ( _???_ ) and the parameter table, and stores the embedding matrix G _?_ . Then R <sup>˜</sup> _?_ the embedding matrix G _?_ . Then R <sup>˜</sup> _??_ G _?_ is carried out by call ing the matrix-matrix multiplication (GEMM) subroutine. We optimize the allocation and access of G _?_ by contracting the tabulation and matrix-matrix multiplication, and the resulting equation is R <sup>˜</sup> _??_ _??_ ( _?_ ( _???_ )). Although the contracted sulting equation is R <sup>˜</sup> _??_ _??_ ( _?_ ( _???_ )). Although the contracted equation saves the load and store of the embedding matrix G _?_, implementation detail still vary depending on the architecture, as will be discussed in Sec. 3.4 and Sec. 3.5. Removing redundancy is the second strategy used in our optimization. Related work demonstrated that up to 52 percent of performance boost can be gained in removing calculations related to redundant zeros [36]. In the previous DP model, the data redundancy stems from the padding of the number of rows of the environment matrix R <sup>˜</sup> _?_ to _??_, where _??_ is the maximally possible length of atomic neighboring list as discussed in Sec. 2. Then the padded matrix can take advantage of the high-performance matrix-matrix multiplication by calling the GEMM subroutine. However, since the tabulation of the embedding matrix and the consecutive GEMM operations are merged as discussed above, the redundancy related operations can also be bypassed. Note that data redundancy exists not only in R _?_, but also in _?_ ( _???_ ) and the corresponding embedding matrix G _?_ (Fig. 4 (a)). The size of _??_ can be as large as several hundred, depending on the cutoff radius _??_ . For example, _??_ is set to be 128 and 512 for the water and copper systems, respectively [20]. The copper model is trained for both ambient and high-pressure The third optimization strategy is to improve the parallel efficiency by increasing the computational granularity of each individual MPI process. We notice that given a fixed physical problem, the ratio between computation over communication decreases as we use more MPI tasks. This is mainly because the communication volume of the ghost region increases when using more MPI tasks. For example, in a one-dimensional problem, suppose the size of the ghost region of an individual MPI is _?_ and the total number of MPI process is _?_, then the communication volume of the ghost region is _?_ × _?_ . This means theoretically, it is optimal to launch only one MPI per node and distribute the workload into finer granularity by using OpenMP, CUDA, etc... In practice, MPI+X is the most frequently used parallelization schemes, and X can be OpenMP, CUDA, HIP, etc. 3.4 Implementation I: GPU In the following subsections, we will focus on optimizing the DeePMD-kit on the GPU heterogeneous architecture based on the strategies outlined in Sec. 3.3 . 3.4.1 Kernel fusion. We optimize the GPU memory footprint by merging the tabulation of the embedding net and consecutive matrix-matrix multiplication into a single CUDA customized kernel. In the optimized DeePMD-kit, each row of G _?_ is evaluated in one thread block and stored in the register (without storing back to global memory), then one column of the environment matrix R <sup>˜</sup> _??_ is loaded into the of R <sup>˜</sup> _??_, together with one row of G _?_, are held by one thread block to perform an outer product. The dimension of the resulting matrix D <sup>˜</sup> _?_ = R <sup>˜</sup> _??_ G _?_ is 4 × _?_, where _?_ is typically _?_ G _?_ is 4 × _?_, where _?_ is typically column of the environment matrix R <sup>˜</sup> _??_ is loaded into the registers to perform an outer product. An illustration of the outer product is shown in Fig. 4. The result from all thread blocks is added up to from R <sup>˜</sup> _??_ G _?_ . Note that the dimension of blocks is added up to from R <sup>˜</sup> _??_ G _?_ . Note that the dimension of the outer product matrix is 4 × _?_, and can be accommodated in the shared memory on V100 GPUs for an efficient summation. We remark that G _?_ is neither allocated nor moved between global memory and registers in the optimized code, and both the memory footprint and computational time are significantly reduced after the kernel fusion, as will be discussed in Sec. 6. 3.4.2 Redundancy removal. The fused CUDA kernel introduced in Sec. 3.4.1 makes it possible to bypass the redundant zeros in the DP model. As shown in Fig. 4, one column of R <sup>˜</sup> _??_, together with one row of G _?_, are held by one thread Extending the limit of molecular dynamics with _ab initio_ accuracy to 10 billion atoms PPoPP ’22, February 12–16, 2022, Seoul, Republic of Korea 128. Note that if element _?_ in _?_ ( _???_ ) is padded, the correspond ing column _?_ of R <sup>˜</sup> _??_ and row _?_ of G _?_ are also padded with constant numbers. Thus, the corresponding final results can be directly derived without any floating-point operations. 3.4.3 Other optimizations. The customized TensorFlow operators are also accelerated. For example, ProdEnvMatA, which evaluates the environment matrix from the neighbor list of atom _?_, is further optimized on GPU by carefully using shared memory and removing redundancy. Testing results show that the optimized version can be 3 times faster compared to the original one. A random global memory writing policy is applied to ProdForceSeA and ProdVironSeA, which are operators for computing the forces and virial tensors, and improves the performance of atomic addition. 3.5 Implementation II: ARM CPU Starting from a flat MPI version of the DeePMD-kit [20], we apply the optimization strategies listed in Sec. 3.3 on the Fugaku supercomputer in the following subsections. 3.5.1 Tabulation of embedding net. In our previous implementation, the fifth-order tabulated model introduced in Sec. 3.2 are stored as an array of structures (AoS). The 6 coefficients of the polynomials are stored continuously as a row. However, AoS can not fully exploit the 1024 GB/s bandwidth provided by the A64FX CPU due to the discontinuous memory access. We optimize the data layout of the tabulated model by transposing every 16 structures so that the 512-bit scalable vector extension (SVE) instructions are invoked in accessing the table. Note that 16 is chosen because the loop is unrolled two times to take advantage of the two floating-point operation pipeline on A64FX(16 × 64 = 1024 bits). We remark that the data layout of the tabulated model is not transposed during the MD simulation, but during the tabulation as part of the post-processing. 3.5.2 Kernel fusion and redundancy removal. The tabulation of the embedding net and consecutive matrix-matrix multiplication are merged into a single function, and then the FLOPs with respect to redundant elements are avoided on A64FX. The outer product of the environment matrix R <sup>˜</sup> _??_ and the embedding matrix G _?_ is implemented on the ARM CPU to enhance the 64 KB L1 CACHE hit rate. We remark that the implementation of the kernel fusion and redundancy removal follows the same pattern on both A64FX and V100 GPU. 3.5.3 Other optimizations. We further optimize the customized TensorFlow operators by exploiting vectorization. One key data structure is descrpt_a_deriv which is used in multiple customized TensorFlow operators such as ProdEnvMatA, ProdViralSeA and ProdForceSeA. The variable descrpt_a_deriv is stored as an AoS, and is required to be converted between SoA and AoS for vectorization purposes. Figure 5. An illustration of converting between AoS and SoA by utilizing SVE instructions. Conversion of 6x4 arrays is plotted for simplicity. Each row is a vector register or is stored continuously in memory. For AoS of the size of 2×8, 3×8, and 4×8, the conversion can be performed with single ld2, ld3, or ld4 SVE instructions, respectively. However, in the DeePMD-kit, the size of descrpt_a_deriv is 12×8 and can not be trivially converted with single SVE instruction. We implement a fast converting subroutine to switch between SoA and AoS by utilizing 512-bit SVE instructions, as illustrated in Fig. 5. Then the corresponding customized TensorFlow operators are unrolled and vectorized to exploit the computing power of A64FX. The tanh function is selected as the activation function for both embedding and fitting net due to accuracy considerations [37], and it is optimized with a second-order polynomial approximation. Only the positive part of the function is tabulated because it is an odd function (tanh(− _?_ ) = − tanh( _?_ )). The upper bound of _?_ is chosen to be 8, and for any _?_ greater than 8, tanh( _?_ ) is set to 1 _._ 0. Our tabulation of the tanh function can be 60 times faster compared with the original one on A64FX, and the corresponding error is about 1 _._ 0 × 10 <sup>−7</sup> . It is noted that our tabulation of the tanh does not affect the overall accuracy of the code. 3.5.4 MPI+OpenMP. Previously, the DeePMD-kit is parallelized on Fugaku in a flat MPI scheme to exploit the performance of many-core architecture, as shown in Fig. 6(a). However, due to the limited size of high bandwidth memory on A64FX (32GB), each MPI task can only allocate a maximum of 0.67GB memory (32GB/48=0.67GB). Thus the size of the sub-region resides on a single MPI task is highly restricted by the memory available. Furthermore, the TensorFlow graph, along with MPI buffers, are allocated and kept 48 copies on a single Fugaku node and deteriorate the situation. A hybrid parallelization scheme using MPI+OpenMP can effectively reduce the number of MPI used, increasing parallel granularity and reducing inter-MPI communication, as discussed in Sec. 3.3. We find that intra-operators MPI+OpenMP parallelization (See Fig. 6(b)) is not efficient due to frequently forking and joining between different operators. And some customized TensorFlow operators, such as ProdVirialSeA, PPoPP ’22, February 12–16, 2022, Seoul, Republic of Korea Zhuoqiang Guo,Denghui Lu, et al. Figure 6. Hybrid paralllelization scheme including (a) Flat MPI parallelization, (b) each TensorFlow operator is parallelized among multiple threads in single MPI, and (c) each OpenMP thread holds a fraction of the sub-region and executed in parallel. ProdForceSeA, having writing conflicts and can not be easily parallelized with OpenMP. Then we implement an inter-operator parallelization scheme, as shown in Fig. 6(c). In this scheme, each OpenMP thread mimics the behavior of an MPI task by holding a fraction of the sub-region. Note that the sub-region is carefully divided to avoid load-balance problems, and thread forking and joining only occur once per MD step. In each MPI task, only one copy of the TensorFlow graph is kept and shared among OpenMP threads, and the inter-MPI communication is significantly reduced due to the increase of granularity. The optimized code can accommodate systems 1.5 time bigger compared to the flat MPI implementation. We remark that the performance of the hybrid parallelization scheme is highly related to the memory affinity of the non-uniform memory access (NUMA) node. 4 The physical systems The performance of the optimized DeePMD-kit is measured on two typical systems: water and copper, which have been extensively trained and studied in Refs. [37, 38], and [40], respectively. The cutoff radius of water and copper systems are chosen to be 6 and 8 Å, and the corresponding maximal number of neighbors are 138 and 500, respectively. In the previous DP model, the sizes of the embedding net and fitting net are set to be 32 × 64 × 128 and 240 × 240 × 240, respectively. In the optimized DeePMD-kit code, these models are compressed and tested on both Summit and Fugaku supercomputers. The strong scaling of the optimized DeePMD-kit is tested using the water system composed of 41 _,_ 472 _,_ 000 and 8 _,_ 294 _,_ 400 atoms on 4,560 computing nodes of Summit and Fugaku, respectively, and the weak scaling is performed using a copper system with 122,779 and 6,804 atoms per MPI task. We remark that our tests do not reach the entire Fugaku supercomputer due to the computing resource accessible to us. The configuration of the water system is made by replicating a well equilibrated liquid water system of 192 atoms, and that of the copper system are generated as perfect face-centeredcubic (FCC) lattice with the lattice constant of 3.634 Å. A total of 99 MD steps evaluated by the Velocity-Verlet algorithm is performed (the energy and forces are evaluated 100 times), and time steps for water and copper systems are chosen to be 0.5 and 1.0 fs, respectively. Temperature is set to 330 K by utilizing random numbers as the initial velocities of atoms. The neighbor list with a 2 Å buffer region is updated every 50 MD steps. The thermodynamic data including the kinetic energy, potential energy, temperature, pressure are collected and recorded in every 50 MD steps. 5 Machine configuration All numerical tests are performed on two supercomputers: Fugaku and Summit. The Fugaku supercomputer has 157,986 computing nodes and currently ranks No.1 in the top 500 list [34] with a theoretical peak performance of 537 PFLOPS. Each computing node is equipped with one A64FX, which has 4 internal groups named core memory groups (CMGs). Each CMG consists of 13 processor cores (one for OS activities), an L2 cache, and a memory controller. Each CMG has 8GB second-generation high-bandwidth memory (HBM2), so one A64FX has 32 GB HBM2 in total and the bandwidth is 1024GB/s. The A64FX supports the Scalable Vector Extension (SVE) and the vector length of SVE can be 128, 256, and 512 bits. Theoretical peak performance of A64FX is 3.07/3.38 TFLOPS double-precision operation at 2.0 GHz and 2.2 GHz (auto boost), respectively. The tests on Fugaku are performed with an MPI+OpenMP hybrid parallelization scheme, all threads within an MPI task are bound to an individual NUMA node to take advantage of the CPU-memory affinity. All GPU-related tests are performed on the Summit supercomputer, which ranks No. 2 in the top 500 list [34] with a theoretical peak performance of 200 PFLOPS. Summit has 4,560 computing nodes, and each node has 2 identical groups consisting of one IBM POWER 9 socket and 3 NVIDIA V100 GPUs. The two groups of hardware are interconnected via XBus with a bandwidth of 64 GB/s. Each IBM POWER 9 socket has 22 CPU cores and is equipped with 256 GB main memory with a bandwidth of 135 GB/s. Each V100 GPU has 16 GB of HBM with a bandwidth of 900 GB/s, and its double-precision theoretical peak performance is 7 TFLOPS. The GPUs within a single group are connected through NVLink with a bandwidth of 50 GB/s. A non-blocking fat-tree topology using dual-rail Mellanox EDR InfiniBand with a bandwidth of 25 GB/s is formed among computing nodes, with one network adapter connected to one group of hardware. We use 6 MPI tasks per computing node in all tests on Summit by binding 3 MPI tasks to each group of hardware (each MPI binds to an individual GPU) to fully exploit the CPU-GPU affinity and network adapter. Extending the limit of molecular dynamics with _ab initio_ accuracy to 10 billion atoms PPoPP ’22, February 12–16, 2022, Seoul, Republic of Korea Figure 7. Step-by-step performance improvement on a single V100 GPU machine using algorithmic and system innovations. Baseline is the results from Ref. [20]. 6 PERFORMANCE RESULTS In this section, we test the performance of the DeePMD-kit first on a single GPU and A64FX, and then the scaling behavior on Summit and Fugaku. Note that in all comparisons, the baseline code is the current state-of-the-art [20] version of DeePMD-kit. 6.1 Single V100 GPU The performance results on 12 _,_ 880-atom water and 6 _,_ 912atom copper systems are tested to measure the performance improvement of critical algorithmic and system innovations on a single V100 GPU. The speedup of the time-to-solution for 99 steps of MD based on a step-by-step optimization is shown in Fig. 7. 6.1.1 Tabulation of embedding net. Compared to the baseline, we find that the optimized DeePMD-kit can be 2 _._ 3 and 3 _._ 7 times faster for water and copper system after introducing the tabulation of embedding net. Note that 82 percent of FLOPS (see Sec. 3.2) are saved by the tabulation, implying a 5.6 times speedup. The actual speedup is less than ideal because DeePMD-kit is memory-bound rather than compute-bound [20], the speedup factor is determined by the memory-access reduction in the inference. 6.1.2 Kernel fusion. As detailed in Sec. 3.4.1, both memory footprint and computational time are reduced by merging the tabulation and consecutive matrix-matrix multiplication into a single customized CUDA kernel. Testing results show that the maximum number of atoms accommodated on a single V100 GPU increase by a factor of 6 and 26 for water and copper systems, respectively. The total speedup is 3 _._ 1 and 5 _._ 9 compared to the baseline for water and copper, respectively. 6.1.3 Redundancy removal. As discussed in Sec. 3.4.2, the evaluation of redundant elements is skipped to reduce the floating-point operations. Compared with the baseline, Figure 8. Step-by-step performance improvement on a single A64FX node for the 18 _,_ 432-atom water and 2 _,_ 592-atom copper systems. the speedup factor increase to 3 _._ 4 and 8 _._ 4 for water and copper systems, respectively. Profiling results show that our optimized kernel achieves 94% of the 900 GB/s bandwidth provided by the V100 GPU. We remark that copper gains a higher speedup in this step due to a higher degree of redundancy, as discussed in Sec. 3.4.2. 6.1.4 Other optimizations. The customized TensorFlow operators in DeePMD-kit are also optimized, and the corresponding speedup compared to the baseline is shown in Fig. 7. Overall, the time-to-solution of the optimized DeePMD-kit is 3.7 and 9.7 times faster, and system size increase by a factor of 6 and 26 on a single V100 GPU for water and copper, respectively. 6.2 Single A64FX Two systems, 18 _,_ 432-atom water and 2 _,_ 592-atom copper, are tested to measure the performance of the optimized DeePMDkit on a single Fugaku node (A64FX). Note that the baseline is a flat MPI version of DeePMD-kit on A64FX. We remark that the GPU baseline is highly optimized [20], but the A64FX baseline is not optimal and requires further optimization. A step-by-step optimization is detailed at Sec. 3.5, and the corresponding speedup is shown in Fig. 8. 6.2.1 Tabulation of embedding net. The data layout of the tabulated polynomial coefficients is rearranged to take advantage of the 512-bit SVE instructions. As shown in Fig. 8, after rearranging the data layout of the tabulated polynomial coefficients discussed in Sec. 3.5.1, the optimized model can be 7 _._ 2 and 10 _._ 3 times faster compared to the baseline for water and copper, respectively. 6.2.2 Kernel fusion and redundancy removal. We find that the kernel fusion and redundancy removal not only brings significant performance improvement on GPU but also work efficiently on CPU architecture. As shown in Fig. 8, PPoPP ’22, February 12–16, 2022, Seoul, Republic of Korea Zhuoqiang Guo,Denghui Lu, et al. Table 2. Comparison between A64FX and V100: the timeto-solution (TtS) (in us/step/atom), the normalized time-tosolution with respect to FLOPS (TtS×Peak), and the normalized TtS with respect to power consumption (TtS×Power) are listed. Numbers in brackets are speedup factors as compared to the V100 results. TtS TtS × Peak TtS × Power water 2.58 18.1(1.0) 952.0(1.0) Summit copper 2.87 20.1(1.0) 1059.0(1.0) water 4.47 15.1(1.2) 737.6(1.3) Fugaku copper 5.78 19.5(1.03) 953.7(1.1) the optimized model can be 14 and 31 _._ 5 times faster compared to the baseline for water and copper, respectively. 6.2.3 Other Optimizations. The customized TensorFlow operators, such as ProdEnvMatA op, ProdVirialSeA op and ProdForceSeA, are vectorized in the optimized DeePMD-kit, as detailed in Sec. 3.5.3. We achieve an average speedup factor of 1 _._ 2, 8 _._ 3 and 7 for ProdEnvMatA op, ProdVirialSeA op and ProdForceSeA, respectively. The corresponding proportion of the customized operators decreases from 15% and 25% to 10% and 17% for water and copper, respectively. Tanh is the activation function used in the DP model, and it takes 32% and 20% of total computational time for water and copper, respectively, on A64FX. In the optimized DeePMD-kit, Tanh is accelerated by tabulation as detailed in Sec. 3.5.3. We achieve a speedup of 66 _._ 4 and 44 _._ 5 times for water and copper systems without any loss of accuracy. As shown in Fig. 8, the overall speedup factor reaches 20 _._ 5 and 42 _._ 5 for water and copper systems, respectively. 6.2.4 MPI+OpenMP. MPI+OpenMP parallelization is introduced into the optimized DeePMD-kit to save memory usage and inter-MPI communication on the many-core architecture, as discussed in Sec. 3.5.4. The extra copies of the TensorFlow graph and system buffers are no longer needed. The system size accommodated on single A64FX node increase from 110 _,_ 592 to 165 _,_ 888 when using a 16×3 configuration for water. Note that because the TensorFlow graph for the copper system is small (13 MB), the system size of copper using MPI+OpenMP almost remains the same as the flat-MPI version. Testing results show that MPI+OpenMP implementation can also be slightly faster than the flat MPI except when using 4×12 (Each MPI task consists of 12 threads, and resides on an individual CMG), as shown in Fig. 8. Since the 16×3 configuration is the optimal choice both in system size and computational speed, we use 16×3 as the configuration in the scaling tests. 6.3 Comparison between A64FX and V100 For the water system, we achieve 4.47 us/step/atom with one A64FX and 2.58 us/step/atom with one V100 GPU. The timeto-solution is normalized for a fair comparison, as shown in Table 2. First, we normalize the time-to-solution with respect to peak performance by multiplying time-to-solution with the theoretical peak of V100 and A64FX. We find that the normalized results on A64FX can be 1 _._ 2 and 1 _._ 03 times faster than V100 for water and copper systems, respectively. The average power consumption of a single V100 and A64FX is 369 and 165 watts [34], respectively. Then the time-tosolution is normalized with respect of power consumption, as shown in Table 2. By setting V100 as the baseline, the speedup factor of A64FX is 1.3 and 1.1 for water and copper, respectively. 6.4 Scaling The scalability of our optimized DeepMD-kit is evaluated on Summit and Fugaku. Note that a fraction of the Fugaku supercomputer is used due to the computational resource accessible to us. The system size can reach an unprecedented 17 billion atoms, 134 times bigger compared to the current state-of-the-art. And the corresponding time-to-solution can be 3 _._ 7 to 9 _._ 7 times faster compared to Ref. [20]. Note that in all scaling tests, we use an MPI+OpenMP parallelization configuration of 16 × 3. Figure 9. Strong scaling of MD simulations (99 steps, atomic forces and the total energy are computed 100 times) for the water system: a total of 8 _,_ 294 _,_ 400 atoms on Fugaku and 41 _,_ 472 _,_ 000 atoms on Summit are used. 6.4.1 Strong Scaling. We measure the scalability of the optimized DeePMD-kit using the parallel efficiency of water (8 _,_ 294 _,_ 400 atoms for Fugaku, 41 _,_ 472 _,_ 000 atoms for Summit) and copper (2 _,_ 177 _,_ 280 atoms for Fugaku, 13 _,_ 500 _,_ 000 for Summit) systems. The scaling behavior ranging from 20 to 4 _,_ 560 computing nodes of Summit and Fugaku are nearly the same, as shown in Fig. 9 and Fig. 10. Both water and copper show nearly perfect scaling on up to 570 and 285 Extending the limit of molecular dynamics with _ab initio_ accuracy to 10 billion atoms PPoPP ’22, February 12–16, 2022, Seoul, Republic of Korea computing nodes, and can further scale to 4 _,_ 560 computing nodes. For the water system, the parallel efficiency is 46 _._ 99% on 4 _,_ 560 computing nodes on Summit, and that of the Fugaku is 41 _._ 20%. The corresponding time-to-solution is 6 _._ 0 and 2 _._ 1 nanoseconds per day on Summit and Fugaku, respectively. For the copper system, the parallel efficiency on 4 _,_ 560 Summit nodes is 35 _._ 96%, and the corresponding parallel efficiency is 32 _._ 76% for Fugaku. The corresponding time-to-solution can reach 11 _._ 2 and 4 _._ 7 nanoseconds per day. We notice that the parallel efficiency on Summit is slightly better compared to that on Fugaku due to its higher ratio in computation over communication. Since the computational complexity of DP method is linear ( _?_ ( _?_ )), the ratio of computation over communication can be approximated with the size of the sub-region over the size of the ghost region. Note that we launch 16 MPI tasks on single A64FX node, but only 6 MPI process on one Summit node. When scaling to 4 _,_ 560 computing nodes, 72 _,_ 960 MPI tasks and 27 _,_ 360 MPI tasks are launched on Fugaku and Summit, respectively. In the strong scaling of the copper system, each MPI task on Fugaku holds a sub-region of 113 atoms, and its ghost region is 1 _,_ 735. Meanwhile the corresponding number on Summit is 1 _,_ 515 and 7 _,_ 520, respectively. The ratio of the computation over communication is <sup>1</sup> /15 and <sup>1</sup> /5 on Fugaku and Summit, respectively. 6.4.2 Weak Scaling. The weak scaling of the optimized DeePMD-kit is measured in terms of the system size and FLOPS of 99 MD steps for both water and copper systems (Fig. 11). As shown in Fig. 11, both systems show perfect scaling with respect to the number of nodes used on Fugaku and Summit. On Fugaku, the maximal number of atoms for water and copper can reach 1 _._ 56 and 1 _._ 08 billion atoms, respectively, on 9 _,_ 936 nodes, and a projected estimation shows that Figure 10. Strong scaling of MD simulations (99 MD steps, atomic forces and the total energy are evaluated 100 times) for the copper system: a total of 2 _,_ 177 _,_ 280 atoms on Fugaku and 13 _,_ 500 _,_ 000 atoms on Summit are adopted in these MD simulations. Figure 11. Weak scaling of water and copper systems ranging from <sup>1</sup> /256 to the entire machine (Summit and Fugaku). Note that the dotted line for Fugaku is a projected result due to the limited computing resources. the DeePMD-kit can reach 24 _._ 9 and 17 _._ 3 billion atoms for water and copper, respectively. We remark that our estimation of the weak scaling is reasonable based on the communication pattern of the DeePMD-kit. For the copper system, the time-to-solution can reach 4 _._ 1 × 10 <sup>−11</sup> seconds/step/atom, and the corresponding peak performance achieved is 119 PFLOPS (22 _._ 17% of the theoretical peak). Compared to the current state-of-the-art, the projected system size is 134 times bigger and the corresponding time-to-solution can be 20 times faster. On Summit, the maximum number of atoms can reach 3 _._ 9 and 3 _._ 4 billion atoms for water and copper, respectively. For the copper system, the time-to-solution can reach 1 _._ 1 × 10 <sup>−10</sup> seconds/step/atom, and the corresponding peak performance achieved is 43 _._ 7 PFLOPS (22 _._ 8% of the theoretical peak). Compared to the current state-of-the-art, the projected system size is 27 times bigger and the corresponding time-to-solution can be 7 times faster. Due to the perfect linear scaling, we foresee that our optimized DeePMD-kit code can compute larger physical systems on near-term and future exascale supercomputers without essential difficulties. 7 Conclusion and Future work In this paper, we presented an optimized version of DeePMDkit by adapting a novel tabulated DP model and system optimizations on the top two supercomputers: Summit and Fugaku. The tabulated model reduces the floating-point operations in the MLMD, and the consecutive optimizations improve the data locality/movement and memory usage on both CPU and GPU. Compared to the current state-of-theart, our optimized code extends the capacity of MLMD to 10 billion atoms, with a time-to-solution of 1 _._ 1 × 10 <sup>−10</sup> seconds/step/atom (7 times faster). This work opens the door for unprecedentedly large-scale molecular dynamics simulations based on _ab initio_ accuracy, and can be potentially utilized PPoPP ’22, February 12–16, 2022, Seoul, Republic of Korea Zhuoqiang Guo,Denghui Lu, et al. in studying more realistic applications such as mechanical properties of metals, semiconductor devices, batteries, etc. The performance of the optimized version of DeePMD-kit is demonstrated on both Summit and Fugaku, and our optimization strategies can also be beneficial for other architectures, such as Intel CPUs and the AMD GPU supercomputer Frontier targeting at exascale computing. The combination of the compressed neural network model and cross-kernel dataflow optimizations provide insight in exploiting the computing power provided by the modern supercomputer, especially for HPC+AI applications. The mixed-precision versions of code still has accuracy problems and will be our future work. Acknowledgments The numerical experiments are performed on Fugaku and Summit supercomputers. The computational resources of supercomputer Fugaku are provided by the RIKEN Center through the HPCI System Research project (Project ID: hp200307). The computational resources of supercomputer Summit are provided by the U.S. Department of Energy through its Innovative and Novel Computational Impact on Theory and Experiment (INCITE) program (Project ID: CHP115). This work is supported by the following funding: National Science Foundation of China under Grant No. (61802369, 61972377, 62032023, 12074007, 12122401), CAS Project for Young Scientists in Basic Research(YSBR-005), GHFund A(No. 20210701), Director’s Funding of Key State Laboratory of Computer Architecture(E04118), Network Information Project of Chinese Academy of Sciences(CASWX2021SF-0103), and Huawei Technologies Co., Ltd.. References [1] Albert P Bartók, Mike C Payne, Risi Kondor, and Gábor Csányi. 2010. Gaussian approximation potentials: The accuracy of quantum mechanics, without the electrons. _Physical Review Letters_ 104, 13 (2010), 136403. [2] Jörg Behler and Michele Parrinello. 2007. Generalized neural-network representation of high-dimensional potential-energy surfaces. _Physical_ _review letters_ 98, 14 (2007), 146401. [3] Zhengda Bian, Shenggui Li, Wei Wang, and Yang You. 2021. Online Evolutionary Batch Size Orchestration for Scheduling Deep Learning Workloads in GPU Clusters. [arXiv:2108.03645 [cs.DC]](https://arxiv.org/abs/2108.03645) [4] Luigi Bonati and Michele Parrinello. 2018. Silicon liquid structure and crystal nucleation from ab initio deep metadynamics. _Physical review_ _letters_ 121, 26 (2018), 265701. [5] Lorenzo Casalino, Abigail C Dommer, Zied Gaieb, Emilia P Barros, Terra Sztain, Surl-Hee Ahn, Anda Trifan, Alexander Brace, Anthony T Bogetti, Austin Clyde, Heng Ma, Hyungro Lee, Matteo Turilli, Syma Khalid, Lillian T Chong, Carlos Simmerling, David J Hardy, Julio DC Maia, James C Phillips, Thorsten Kurth, Abraham C Stern, Lei Huang, John D McCalpin, Mahidhar Tatineni, Tom Gibbs, John E Stone, Shantenu Jha, Arvind Ramanathan, and Rommie E Amaro. 0. AIdriven multiscale simulations illuminate mechanisms of SARS-CoV-2 spike dynamics. _The International Journal of High Performance Comput-_ _ing Applications_ 0, 0 (0), 10943420211006452. [https://doi.org/10.1177/](https://doi.org/10.1177/10943420211006452) [10943420211006452 arXiv:https://doi.org/10.1177/10943420211006452](https://doi.org/10.1177/10943420211006452) [6] Tejalal Choudhary, Vipul Mishra, Anurag Goswami, and Jagannathan Sarangapani. 2020. A comprehensive survey on model compression and acceleration. _Artificial Intelligence Review_ 53, 7 (2020), 5113–5155. [7] Ralf Drautz. 2019. Atomic cluster expansion for accurate and transfer able interatomic potentials. _Phys. Rev. B_ 99 (Jan 2019), 014104. Issue 1. [https://doi.org/10.1103/PhysRevB.99.014104](https://doi.org/10.1103/PhysRevB.99.014104) [8] Luciano Floridi and Massimo Chiriatti. 2020. GPT-3: Its nature, scope, limits, and consequences. _Minds and Machines_ 30, 4 (2020), 681–694. [9] Pascal Friederich, Florian Häse, Jonny Proppe, and Alán Aspuru-Guzik. 2021. Machine-learned potentials for next-generation matter simulations. _Nature Materials_ 20, 6 (2021), 750–761. [10] Mirza Galib and David T Limmer. 2021. Reactive uptake of N2O5 by atmospheric aerosol is dominated by interfacial processes. _Science_ 371, 6532 (2021), 921–925. [11] Thomas E Gartner, Linfeng Zhang, Pablo M Piaggi, Roberto Car, Athanassios Z Panagiotopoulos, and Pablo G Debenedetti. 2020. Signatures of a liquid–liquid transition in an ab initio deep neural network model for water. _Proceedings of the National Academy of Sciences_ 117, 42 (2020), 26040–26046. [12] Cong Guo, Bo Yang Hsueh, Jingwen Leng, Yuxian Qiu, Yue Guan, Ze huan Wang, Xiaoying Jia, Xipeng Li, Minyi Guo, and Yuhao Zhu. 2020. Accelerating sparse dnn models without hardware-support via tilewise sparsity. In _SC20: International Conference for High Performance_ _Computing, Networking, Storage and Analysis_ . IEEE, 1–15. [13] Mohamed Hacene, Ani Anciaux-Sedrakian, Xavier Rozanska, Diego Klahr, Thomas Guignon, and Paul Fleurat-Lessard. 2012. Accelerating VASP electronic structure calculations using graphic processing units. _Journal of computational chemistry_ 33, 32 (2012), 2581–2589. [14] Song Han, Huizi Mao, and William J Dally. 2015. Deep compression: Compressing deep neural networks with pruning, trained quantization and huffman coding. _arXiv preprint arXiv:1510.00149_ (2015). [15] Itay Hubara, Matthieu Courbariaux, Daniel Soudry, Ran El-Yaniv, and Yoshua Bengio. 2017. Quantized neural networks: Training neural networks with low precision weights and activations. _The Journal of_ _Machine Learning Research_ 18, 1 (2017), 6869–6898. [16] Maxwell Hutchinson and Michael Widom. 2012. VASP on a GPU: Application to exact-exchange calculations of the stability of elemental boron. _Computer Physics Communications_ 183, 7 (2012), 1422–1426. [17] Arpan Jain, Ammar Ahmad Awan, Asmaa M Aljuhani, Jahanzeb Maq bool Hashmi, Quentin G Anthony, Hari Subramoni, Dhableswar K Panda, Raghu Machiraju, and Anil Parwani. 2020. GEMS: GPU-Enabled Memory-Aware Model-Parallelism System for Distributed DNN Training. In _SC20: International Conference for High Performance Computing,_ _Networking, Storage and Analysis_ . IEEE, 1–15. [18] Weile Jia, Zongyan Cao, Long Wang, Jiyun Fu, Xuebin Chi, Weiguo Gao, and Lin-Wang Wang. 2013. The analysis of a plane wave pseudopotential density functional theory code on a GPU machine. _Computer_ _Physics Communications_ 184, 1 (2013), 9 – 18. [https://doi.org/10.1016/](https://doi.org/10.1016/j.cpc.2012.08.002) [j.cpc.2012.08.002](https://doi.org/10.1016/j.cpc.2012.08.002) [19] Weile Jia, Jiyun Fu, Zongyan Cao, Long Wang, Xuebin Chi, Weiguo Gao, and Lin-Wang Wang. 2013. Fast plane wave density functional theory molecular dynamics calculations on multi-GPU machines. _J. Comput._ _Phys._ 251 (2013), 102 – 115. [https://doi.org/10.1016/j.jcp.2013.05.005](https://doi.org/10.1016/j.jcp.2013.05.005) [20] W. Jia, H. Wang, M. Chen, D. Lu, J. Liu, L. Lin, R. Car, . Weinan, E., and L. Zhang. 2020. Pushing the limit of molecular dynamics with ab initio accuracy to 100 million atoms with machine learning. (2020). [21] Ryosuke Jinnouchi, Ferenc Karsai, and Georg Kresse. 2019. On-the-fly machine learning force field generation: Application to melting points. _Physical Review B_ 100, 1 (2019), 014105. [22] John Jumper, Richard Evans, Alexander Pritzel, Tim Green, Michael Figurnov, Olaf Ronneberger, Kathryn Tunyasuvunakool, Russ Bates, Augustin Žídek, Anna Potapenko, et al. 2021. Highly accurate protein structure prediction with AlphaFold. _Nature_ (2021), 1–11. [23] Sadegh Karimpouli and Pejman Tahmasebi. 2020. Physics informed machine learning: Seismic wave equation. _Geoscience Frontiers_ 11, 6 (2020), 1993–2001. Extending the limit of molecular dynamics with _ab initio_ accuracy to 10 billion atoms PPoPP ’22, February 12–16, 2022, Seoul, Republic of Korea [24] Kyuhyun Lee, Dongsun Yoo, Wonseok Jeong, and Seungwu Han. 2019. SIMPLE-NN: An efficient package for training and executing neuralnetwork interatomic potentials. _Computer Physics Communications_ 242 (2019), 95–103. [25] Shigang Li and Torsten Hoefler. 2021. Chimera: Efficiently Train ing Large-Scale Neural Networks with Bidirectional Pipelines. _arXiv_ _preprint arXiv:2107.06925_ (2021). [26] Yiping Lu, Chao Ma, Yulong Lu, Jianfeng Lu, and Lexing Ying. 2020. A Mean Field Analysis Of Deep ResNet And Beyond: Towards Provably Optimization Via Overparameterization From Depth. In _International_ _Conference on Machine Learning_ . PMLR, 6426–6436. [27] S. Plimpton. 1995. Fast parallel algorithms for short-range molecular dynamics. _J. Comput. Phys._ 117, 1 (1995), 1–19. [28] Evgeny V Podryabinkin and Alexander V Shapeev. 2017. Active learn ing of linearly parametrized interatomic potentials. _Computational_ _Materials Science_ 140 (2017), 171–180. [29] Samyam Rajbhandari, Jeff Rasley, Olatunji Ruwase, and Yuxiong He. 2020. Zero: Memory optimizations toward training trillion parameter models. In _SC20: International Conference for High Performance_ _Computing, Networking, Storage and Analysis_ . IEEE, 1–16. [30] Joshua Romero, Everett Phillips, Gregory Ruetsch, Massimiliano Fat ica, Filippo Spiga, and Paolo Giannozzi. 2018. A Performance Study of Quantum ESPRESSO’s PWscf Code on Multi-core and GPU Systems. In _High Performance Computing Systems. Performance Modeling, Bench-_ _marking, and Simulation_, Stephen Jarvis, Steven Wright, and Simon Hammond (Eds.). Springer International Publishing, Cham, 67–87. [31] Andreas Singraber, Jörg Behler, and Christoph Dellago. 2019. Library Based LAMMPS Implementation of High-Dimensional Neural Network Potentials. _Journal of chemical theory and computation_ 15, 3 (2019), 1827–1840. [32] Wojciech J Szlachta, Albert P Bartók, and Gábor Csányi. 2014. Accuracy and transferability of Gaussian approximation potential models for tungsten. _Physical Review B_ 90, 10 (2014), 104108. [33] A.P. Thompson, L.P. Swiler, C.R. Trott, S.M. Foiles, and G.J. Tucker. 2015. Spectral neighbor analysis method for automated generation of quantum-accurate interatomic potentials. _J. Comput. Phys._ 285 (2015), 316–330. [https://doi.org/10.1016/j.jcp.2014.12.018](https://doi.org/10.1016/j.jcp.2014.12.018) [34] Top 500 list June 2020 (accessed 2020-08-01). [https://www.top500.org.](https://www.top500.org) [35] Han Wang, Linfeng Zhang, Jiequn Han, and Weinan E. 2018. DeePMD kit: A deep learning package for many-body potential energy representation and molecular dynamics. _Computer Physics Communications_ 228 (2018), 178–184. [36] Xin You, Hailong Yang, Zhongzhi Luan, Depei Qian, and Xu Liu. 2020. ZeroSpy: Exploring Software Inefficiency with Redundant Zeros. In _SC20: International Conference for High Performance Computing, Net-_ _working, Storage and Analysis_ . 1–14. [https://doi.org/10.1109/SC41405.](https://doi.org/10.1109/SC41405.2020.00033) [2020.00033](https://doi.org/10.1109/SC41405.2020.00033) [37] Linfeng Zhang, Jiequn Han, Han Wang, Roberto Car, and Weinan E. 2018. Deep Potential Molecular Dynamics: A Scalable Model with the Accuracy of Quantum Mechanics. _Physical Review Letters_ 120 (Apr 2018), 143001. Issue 14. [38] Linfeng Zhang, Jiequn Han, Han Wang, Wissam Saidi, Roberto Car, and Weinan E. 2018. End-to-end Symmetry Preserving Inter-atomic Potential Energy Model for Finite and Extended Systems. In _Advances_ _in_ _Neural_ _Information_ _Processing_ _Systems_ _31_, S. Bengio, H. Wallach, H. Larochelle, K. Grauman, N. Cesa-Bianchi, and R. Garnett (Eds.). Curran Associates, Inc., 4441–4451. [39] Linfeng Zhang, Han Wang, Roberto Car, and E Weinan. 2021. Phase Diagram of a Deep Potential Water Model. _Physical Review Letters_ 126, 23 (2021), 236001. [40] Yuzhi Zhang, Haidi Wang, Weijie Chen, Jinzhe Zeng, Linfeng Zhang, Han Wang, and Weinan E. 2020. DP-GEN: A concurrent learning platform for the generation of reliable deep learning based potential energy models. _Computer Physics Communications_ (2020), 107206.

섹션 본문

섹션 본문이 없습니다.

참고문헌

참고문헌 정보가 없습니다.