An acceleration system for molecular dynamics simulation, a simulation method
By combining data flow rearrangement and preloading techniques with weighted pulsation lines, matrix multiplication calculations in molecular dynamics simulations are optimized, eliminating matrix transpose operations and achieving more efficient molecular dynamics simulations.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- INST OF COMPUTING TECH CHINESE ACAD OF SCI
- Filing Date
- 2025-03-20
- Publication Date
- 2026-04-21
AI Technical Summary
Deep learning-based molecular dynamics simulation methods involve numerous matrix transpose operations during matrix multiplication, leading to increased computation time and resource consumption. Furthermore, data flow management has limitations, failing to effectively reduce performance bottlenecks caused by data movement.
By employing data flow rearrangement and data flow preloading techniques, combined with pulsation lines with fixed weights and fixed outputs, the matrix multiplication calculation process is optimized, matrix transpose operations are eliminated, and a fine-grained pipeline architecture is designed to accelerate streaming computation.
It significantly improves computational efficiency without sacrificing computational accuracy, reduces hardware resource consumption, and increases computational speed and resource utilization.
Smart Images

Figure CN120412763B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to molecular dynamics simulation, more specifically to molecular dynamics simulation acceleration technology, and more specifically, to an acceleration system and simulation method for molecular dynamics simulation. Background Technology
[0002] Molecular dynamics (MD) simulations, as an important computational method, are widely used to study the dynamic behavior of molecular systems. Classical molecular dynamics (CMD) simulations calculate the interactions between atoms or molecules using classical force fields, relying on potential energy functions to describe these interactions without considering quantum mechanical effects. Although traditional molecular dynamics simulation methods are simple and computationally efficient, their simulation accuracy is limited and cannot meet the needs of some complex scenarios.
[0003] To improve simulation accuracy, first-principles molecular dynamics (AIMD) simulations have emerged. This method directly determines the interatomic forces through quantum mechanical calculations and is typically based on density functional theory, thus taking into account electronic structure and quantum mechanical effects, significantly improving simulation accuracy. However, the computational cost of first-principles molecular dynamics simulations is enormous, limiting their application in large-scale atomic and long-timescale simulations.
[0004] In recent years, deep learning-based molecular dynamics simulation methods have attracted widespread attention. These methods train neural networks to predict the potential energy functions between atoms, thus avoiding traditional empirical potential fields or computationally expensive quantum mechanical calculations. This approach can achieve AIMD-level accuracy while maintaining high computational speed. The core of deep learning-based molecular dynamics simulation methods lies in using machine learning models to replace traditional potential functions, thereby improving the computational efficiency and accuracy of molecular dynamics simulations.
[0005] While deep learning-based molecular dynamics simulations have improved computational efficiency and accuracy, they involve numerous matrix multiplications and transpose operations, which incur significant overhead, increasing computation time and consuming substantial storage resources. Furthermore, deep learning-based simulations suffer from limitations in data flow management; they cannot effectively rearrange data flows to reduce performance bottlenecks caused by data movement, further increasing computation time.
[0006] It should be noted that the background information provided is only for illustrating relevant information about the present invention to aid in understanding the technical solutions of the present invention, and does not imply that the relevant information is necessarily prior art. In the absence of evidence indicating that the relevant information was disclosed before the filing date of this invention, the relevant information should not be considered prior art. Summary of the Invention
[0007] Therefore, the purpose of this invention is to overcome the shortcomings of the prior art and provide an acceleration system and a molecular dynamics simulation method for molecular dynamics simulation.
[0008] The objective of this invention is achieved through the following technical solutions.
[0009] According to a first aspect of the present invention, an acceleration system for molecular dynamics simulation is provided. The molecular dynamics simulation is used to simulate the dynamic behavior of a molecular system, which includes multiple molecules composed of atoms. The acceleration system includes a data processing module, a feature extraction module, and a target model. The acceleration system is configured to perform the following simulation calculations for each motion process of the molecular system: the data processing module is used to obtain a position matrix based on the position information of atoms in the molecular system updated by the previous simulation calculation, and to process the position matrix using a preset model to obtain an embedding matrix; and to calculate the forces acting on the molecular system based on the derivative matrix of the fusion matrix obtained by the feature extraction module according to existing calculation methods to update the position information of atoms in the molecular system; the feature extraction module includes a forward calculation submodule and a backward calculation submodule, wherein: the forward submodule includes a first pulsation line with fixed output and a second pulsation line with fixed weight; wherein the first pulsation line is used to calculate the product of the position matrix and the embedding matrix to obtain the fusion matrix; the second pulsation line... The line is used to calculate the product of the fusion matrix and the fusion cut matrix to obtain the symmetric description matrix; wherein, the fusion cut matrix is composed of the first preset number of columns of the fusion matrix; the reverse calculation submodule includes a cache unit, a third pulse line with fixed weights, a fourth pulse line with fixed output, and a summation unit; wherein, the cache unit is used to store the fusion matrix; the third pulse line is used to calculate the product of the fusion cut matrix and the derivative matrix of the symmetric description matrix to obtain the first matrix; the fourth pulse line is used to calculate the product of the derivative matrix of the symmetric description matrix and the fusion matrix to obtain the second matrix; the summation unit is used to add the elements of the corresponding column vectors of the first matrix and the second matrix to obtain the derivative matrix of the fusion matrix; wherein, fixed output means that the pulse line splits the calculated matrix into column vectors of fixed size for output, and fixed weight means that the pulse line fixes the column vector or row vector of a matrix involved in the calculation as its own weight during the calculation; the target model is used to process the symmetric description matrix to obtain the molecular potential energy of the molecular system and the derivative matrix of the symmetric description matrix.
[0010] In some embodiments of the present invention, the first pulsation line includes a first splitter, a first computing unit array, and a first multiplexer, and the first pulsation line is configured to calculate the product of the position matrix and the embedding matrix in the following manner: the first splitter is used to receive a row vector of the embedding matrix transmitted by the data processing module, and to allocate the elements in the row vectors to the first computing unit array in sequence; the first computing unit array includes a plurality of sequentially arranged computing units, each computing unit is assigned one element, and each computing unit is used to perform a product operation based on the allocated element and the row vector corresponding to the position matrix transmitted by the data processing module; wherein, after each computing unit performs a product operation of the row vector of the position matrix and the corresponding element of the row vector of the embedding matrix once, a column vector of fixed size is obtained, and each computing unit adds the elements at the same position in all the column vectors it has calculated to obtain a column vector of the fusion matrix; the first multiplexer is used to output the column vectors obtained by all computing units in the array in sequence after the first computing unit array completes the calculation, so as to transmit the fusion matrix to the second pulsation line and the reverse calculation submodule.
[0011] In some embodiments of the present invention, the second pulsation line includes a first decomposer, a second computational unit array, and a first merger, and the second pulsation line is configured to calculate the product of the fusion matrix and the fusion cut matrix in the following manner: the first decomposer is used to decompose and fix the column vectors of the fusion cut matrix passed by the first pulsation line to the corresponding second computational unit array in sequence; the second computational unit array includes a plurality of computational units arranged in sequence, each computational unit is assigned a column vector of the fusion cut matrix, and each computational unit is used to perform a product operation with all column vectors of the fusion matrix passed by the first pulsation line in sequence based on the assigned column vector to obtain all elements of the symmetric description matrix; the first merger is used to combine all elements calculated by the second computational unit array in sequence into a symmetric description matrix, and output the column vectors of the symmetric description matrix to the target model in sequence.
[0012] In some embodiments of the present invention, the third systolic line includes a second multi-way decomposer, a third computational unit array, and a second merger, and the third systolic line is configured to calculate the product of the fused truncated matrix and the derivative matrix of the symmetric description matrix in the following manner: the second multi-way decomposer is used to decompose the fused truncated matrix prefetched from the cache unit to fix the row vectors of the fused truncated matrix to the third computational unit array; the third computational unit array includes a plurality of sequentially arranged computational units, each computational unit is assigned a row of row vectors, and each computational unit is used to perform a product operation on all column vectors of the derivative matrix of the symmetric description matrix passed by the target model in sequence based on the assigned row vectors to obtain all elements of the first matrix; the second merger is used to combine all elements calculated by the third computational unit array in sequence into the first matrix, and sequentially output the column vectors of the first matrix to the summing unit.
[0013] In some embodiments of the present invention, the fourth pulsation line includes a second splitter, a fourth computational unit array, and a second multiplexer. The fourth pulsation line is configured to calculate the product of the derivative matrix of the symmetric description matrix and the fusion matrix in the following manner: the second splitter is used to receive a column vector of the derivative matrix of the symmetric description matrix transmitted by the target model, and to allocate the elements in the column vector to the fourth computational unit array in sequence; the fourth computational unit array includes a plurality of computational units arranged in sequence, each computational unit is assigned one element, and each computational unit is used to perform a product operation based on the allocated element and the column vector corresponding to the fusion matrix obtained from the cache unit; wherein, after each computational unit performs a product operation of the corresponding elements of the column vector of the fusion matrix and the column vector of the derivative matrix of the symmetric description matrix once, a column vector of fixed size is obtained, and each computational unit adds the elements at the same position in all the column vectors it has calculated to obtain a column vector of the second matrix; the second multiplexer is used to output the column vectors obtained by all computational units in the array in sequence after the fourth computational unit array has completed the calculation, so as to pass the second matrix to the summing unit.
[0014] In some embodiments of the present invention, the target model is composed of a three-layer fully connected neural network.
[0015] In some embodiments of the present invention, the first computing unit array, the second computing unit array, the third computing unit array and the fourth computing unit array each contain a row of multiple columns of computing units.
[0016] According to a second aspect of the present invention, a molecular dynamics simulation method is provided, the method comprising: step S1, obtaining a molecular system to be simulated; and step S2, processing the molecular system to be simulated using the acceleration system described in the first aspect of the present invention.
[0017] Compared with the prior art, the advantages of the present invention are: (1) By using data flow rearrangement and data flow preloading technology, combined with pulsation lines with fixed weights and fixed outputs, the computational overhead of transpose operation is eliminated, avoiding the time and resource consumption caused by matrix transpose in traditional hardware implementation, and improving computational efficiency; (2) A fine-grained pipeline architecture is designed to meet the matrix multiplication computation requirements, which can accelerate the streaming computation of pulsation lines with high resource utilization. Attached Figure Description
[0018] The embodiments of the present invention will be further described below with reference to the accompanying drawings, wherein:
[0019] Figure 1 This is a schematic diagram of the acceleration system according to an embodiment of the present invention;
[0020] Figure 2 This is a schematic diagram of the forward computation submodule structure according to an embodiment of the present invention;
[0021] Figure 3 This is a schematic diagram of the reverse computation submodule structure according to an embodiment of the present invention. Detailed Implementation
[0022] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are merely illustrative and are not intended to limit the invention.
[0023] As mentioned in the background section, although deep learning-based molecular dynamics simulation methods have improved the computational efficiency and accuracy of molecular dynamics simulations, the simulation process involves numerous matrix multiplications, including a large number of matrix transpose operations. These transpose operations incur significant overhead, increasing computation time and consuming substantial storage resources. Furthermore, deep learning-based molecular dynamics simulation methods also have limitations in data flow management; they cannot effectively rearrange data flows to reduce performance bottlenecks caused by data movement, further increasing computation time.
[0024] To address the aforementioned issues, the inventors analyzed the matrix multiplication calculation process involving matrix transposition operations in existing technologies and proposed using data flow rearrangement and data flow preloading techniques, combined with fixed-weight pulsation lines and fixed-output pulsation lines, to optimize the matrix multiplication calculation process. This eliminates a large number of matrix transposition operations involved in the matrix multiplication calculation, significantly improving computational efficiency without sacrificing computational accuracy. Based on this analysis, the inventors proposed an acceleration system to accelerate the molecular dynamics simulation process. This acceleration system incorporates a novel feature extraction module, which includes a forward calculation submodule and a backward calculation submodule. The forward calculation submodule includes a first pulsation line with fixed output and a second pulsation line with fixed weights. The first and second pulsation lines, based on their computational characteristics, utilize data flow rearrangement operations to eliminate matrix transposition operations involved in the calculation process. The backward calculation submodule includes a cache unit, a third pulsation line with fixed weights, and a fourth pulsation line with fixed outputs. The third and fourth pulsation lines, based on their computational characteristics, utilize data flow preloading techniques to preload data stored in the cache unit to eliminate matrix transposition operations involved in the calculation process.
[0025] In summary, such as Figure 1As shown, this invention provides an acceleration system for molecular dynamics simulation. Molecular dynamics simulation is used to simulate the dynamic behavior of a molecular system, which includes multiple molecules composed of atoms. The acceleration system includes a data processing module, a feature extraction module, and a target model. The acceleration system is configured to perform the following simulation calculations for each motion process of the molecular system: The data processing module obtains a position matrix based on the position information of atoms in the molecular system updated by the previous simulation calculation, and processes the position matrix using a preset model to obtain an embedding matrix; and calculates the forces acting on the molecular system based on the derivative matrix of the fusion matrix obtained by the feature extraction module according to existing calculation methods to update the position information of atoms in the molecular system. The feature extraction module includes a forward calculation submodule and a backward calculation submodule, wherein: the forward submodule includes a first pulsation line with fixed output and a second pulsation line with fixed weight; wherein the first pulsation line is used to calculate the product of the position matrix and the embedding matrix to obtain the fusion matrix; the second ... The product of the fusion matrix and the fusion cut matrix is calculated to obtain the symmetric description matrix; wherein, the fusion cut matrix is composed of the first preset number of columns of the fusion matrix; the reverse calculation submodule includes a cache unit, a third pulsation line with fixed weights, a fourth pulsation line with fixed output, and a summation unit; wherein, the cache unit is used to store the fusion matrix; the third pulsation line is used to calculate the product of the fusion cut matrix and the derivative matrix of the symmetric description matrix to obtain the first matrix; the fourth pulsation line is used to calculate the product of the derivative matrix of the symmetric description matrix and the fusion matrix to obtain the second matrix; the summation unit is used to add the elements of the corresponding column vectors of the first matrix and the second matrix to obtain the derivative matrix of the fusion matrix; wherein, fixed output means that the pulsation line splits the calculated matrix into column vectors of fixed size for output, and fixed weights means that the pulsation line fixes the column vector or row vector of a matrix involved in the calculation as its own weight during calculation; the target model is used to process the symmetric description matrix to obtain the molecular potential energy of the molecular system and the derivative matrix of the symmetric description matrix.
[0026] To better understand the present invention, each component of the acceleration system will be described in detail below with reference to specific embodiments.
[0027] I. Data Processing Module
[0028] The data processing module is used to obtain a position matrix based on the position information of atoms in the molecular system updated by the previous simulation calculation, and to process the position matrix using a preset model to obtain an embedding matrix; and to calculate the forces on the molecular system based on the derivative matrix of the fusion matrix obtained by the feature extraction module according to existing calculation methods to update the position information of atoms in the molecular system. The preset model is based on a three-layer fully connected neural network architecture and is fine-tuned according to actual needs.
[0029] II. Feature Extraction Module
[0030] The feature extraction module is used to calculate the derivative matrix of the symmetric description matrix and the fusion matrix. The feature extraction module includes a forward calculation submodule and a backward calculation submodule. These two calculation submodules are described below.
[0031] 2.1 Forward Calculation Submodule
[0032] Before introducing the forward computation submodule, let's first explain the matrix multiplication process involved. The forward computation submodule is responsible for performing two matrix multiplications based on the position matrix and embedding matrix passed from the data processing module to obtain a symmetric description matrix. This symmetric description matrix describes the triple symmetry invariance of the molecular system: translation invariance, rotation invariance, and arrangement invariance, reflecting the local structure and interactions of atomic clusters within the molecular system. Specifically, the first matrix multiplication calculation obtains a fusion matrix (denoted as matrix A) by combining the position matrix (represented as matrix R) and the embedding matrix (represented as matrix G). The second matrix multiplication is performed using the fusion matrix and the fusion cutoff matrix (represented as matrix B). “ "" indicates that the first few column vectors of the fusion matrix of a predetermined number of columns are extracted to obtain a symmetric description matrix (represented as matrix D). ).
[0033] In the forward computation submodule, both the first and second matrix multiplication operations involve matrix transpose. Therefore, in order to eliminate the transpose operation in the forward computation submodule, this invention proposes... Figure 2 The forward calculation submodule shown is composed of Figure 2 It can be seen that the forward calculation submodule includes a first pulsation line with fixed output and a second pulsation line with fixed weight.
[0034] According to one embodiment of the present invention, the first pulsation line includes a first splitter, a first computing unit array, and a first multiplexer, and the first pulsation line is configured to calculate the product of the position matrix and the embedding matrix in the following manner: the first splitter is used to receive a row vector of the embedding matrix transmitted by the data processing module, and to allocate the elements in the row vector to the first computing unit array in sequence; the first computing unit array includes a plurality of sequentially arranged computing units, each computing unit is assigned one element, and each computing unit is used to perform a product operation based on the allocated element and the row vector corresponding to the position matrix transmitted by the data processing module; wherein, after each computing unit performs a product operation of the row vector of the position matrix and the corresponding element of the row vector of the embedding matrix once, it obtains a column vector of fixed size, and each computing unit adds the elements at the same position in all the column vectors it has calculated to obtain a column vector of the fusion matrix; the first multiplexer is used to output the column vectors obtained by all computing units in the array in sequence after the first computing unit array completes the calculation, so as to transmit the fusion matrix to the second pulsation line and the reverse calculation submodule. The first computing unit array contains a row of multiple columns of computing units.
[0035] As can be seen, the first computational unit array in the first pulsating line of this invention only has one row and multiple columns of computational units, while traditional computational unit arrays require multiple rows and multiple columns of computational units depending on the size of the output matrix. Therefore, the computational unit array in the first pulsating line achieves matrix multiplication with less hardware resource overhead, avoiding resource waste. Furthermore, when calculating the fusion matrix, the first pulsating line uses fine-grained pipeline design to transform the position matrix into a row data stream (row vector) and transmit it to the first computational unit array to achieve matrix multiplication. This logical vector transposition does not introduce wiring overhead in physical implementation, thus eliminating the transposition operation of the position matrix.
[0036] According to one embodiment of the present invention, the second pulsation line includes a first decomposer, a second computational unit array, and a first merger. The second pulsation line is configured to calculate the product of a fusion matrix and a fusion cutoff matrix as follows: the first decomposer is used to sequentially decompose and fix the column vectors of the fusion cutoff matrix transmitted by the first pulsation line to the corresponding second computational unit array; the second computational unit array includes a plurality of sequentially arranged computational units, each computational unit being assigned a column vector of the fusion cutoff matrix, and each computational unit is used to perform a product operation based on the assigned column vector with all column vectors of the fusion matrix sequentially transmitted by the first pulsation line to obtain all elements of the symmetric description matrix; the first merger is used to sequentially combine all elements calculated by the second computational unit array into a symmetric description matrix, and sequentially output the column vectors of the symmetric description matrix to the target model. The second computational unit array contains computational units with one row and multiple columns.
[0037] As can be seen, similar to the first pulsating line, the second computational unit array in the second pulsating line also only has one row and multiple columns of computational units. Traditional computational unit arrays, however, require multiple rows and columns of computational units depending on the size of the output matrix. Therefore, the computational unit array in the second pulsating line achieves matrix multiplication with less hardware resource overhead, avoiding resource waste. Simultaneously, the second pulsating line eliminates matrix transpose overhead through data flow rearrangement when calculating the symmetric description matrix. Based on the foregoing analysis, it can be seen that the symmetric description matrix... In other words, calculating the symmetric description matrix requires fusing the transpose row data stream of the truncated matrix and the column data stream of the fused matrix. During the calculation process, the column vector of the fused truncated matrix, which is fixed in the second computing unit array, corresponds exactly to the transpose row data stream of the fused truncated matrix. The column vector of the fused matrix received by the second computing unit array corresponds exactly to the column data stream of the fused matrix. Therefore, the matrix transpose overhead is eliminated by rearranging the same data stream (fused matrix).
[0038] To better understand the forward computation submodule, the following will combine... Figure 2 This section details the workflow of the forward computation submodule. Here, matrix R represents the position matrix, matrix G represents the embedding matrix, matrix A represents the fusion matrix, matrix B represents the fusion truncation matrix, and matrix D represents the symmetric description matrix.
[0039] In the forward calculation submodule, the first pulsation line is used to calculate matrix A (fusion matrix) based on matrix R (position matrix) and matrix G (embedding matrix).
[0040] The first splitter receives a row vector of matrix G from the data processing module and assigns each element in the row vector to a computing unit in the first computing unit array in sequence. At this time, each computing unit is assigned one element of a row vector of matrix G.
[0041] The first computing unit array receives row vectors of matrix R transmitted by the data processing module, and performs a product operation between the elements allocated to each computing unit and row vectors of matrix R. At this time, each computing unit obtains a column vector (an m×1 matrix, where m equals the number of elements contained in a row vector of matrix R), and the column vectors of all computing units are combined to obtain a matrix with a fixed number of rows and columns (an m×n matrix, where n equals the number of computing units).
[0042] The first splitter, in conjunction with the first computing unit array, sequentially processes the products between all row vectors of matrix R and all row vectors of matrix G. Each computing unit performs a product operation once between the corresponding elements of the row vectors of the position matrix and the row vectors of the embedded matrix to obtain a column vector of fixed size. Furthermore, each computing unit adds the elements at the same position in all its calculated column vectors to obtain a column vector of the fused matrix. Specifically, during the calculation process, the first row vector of matrix R is multiplied by the first row vector of matrix G, the second row vector of matrix R is multiplied by the second row vector of matrix G, and so on, achieving the product operation between each row vector of matrix R and the corresponding row vector of matrix G.
[0043] The first multiplexer is used to output the column vectors obtained by all computing units in the first computing unit array in sequence, so as to pass matrix A to the second pulsating line and the reverse computing submodule.
[0044] In the forward calculation submodule, the second pulsation line is used to calculate matrix D (symmetric description matrix) based on matrix B (fusion cutoff matrix) and matrix A (fusion matrix).
[0045] The first demultiplexer receives matrix B obtained by rearranging the data stream and decomposes the column vectors in matrix B into corresponding second computing unit arrays in sequence. At this time, a column vector of matrix B is allocated to the computing unit.
[0046] The second computing unit array receives all column vectors of matrix A sequentially, and performs a product operation between the column vectors assigned to each computing unit and all column vectors of matrix A that were sequentially passed to it by the first pulsation line, to obtain all elements of matrix D. During computation, since the column vectors of matrix A are passed sequentially, when a computing unit completes a product operation between its assigned column vector and a column vector of the passed matrix A, it passes the calculated column vector of matrix A to the next computing unit. Specifically, during the calculation, the first computing unit in the second computing unit array first receives the first column vector of matrix A and performs a product calculation (at this time, other computing units have not yet received the column vectors of matrix A). After completing the current calculation, the first computing unit passes the first column vector of matrix A to the second computing unit and receives the second column vector of matrix A. Then, the first computing unit in the second computing unit array performs a product calculation with the second column vector of matrix A, and the second computing unit performs a product calculation with the first column vector of matrix A (at this time, other computing units have not yet received the column vectors of matrix A). After completing the current calculation, the first computing unit passes the second column vector of matrix A to the second computing unit and receives the third column vector of matrix A. The second computing unit passes the first column vector of matrix A to the third computing unit and receives the second column vector of matrix A. And so on, the second computing unit array completes the matrix multiplication operation between matrix A and matrix B.
[0047] The first merger combines all the elements calculated by the second computing unit array into matrix D in sequence, and outputs the column vectors of matrix D in order.
[0048] 2.2 Reverse Calculation Submodule
[0049] Before introducing the backpropagation submodule, let's first explain the matrix multiplication process involved. The backpropagation submodule is responsible for performing backpropagation calculations based on the derivative matrix of the symmetric description matrix. This backpropagation process involves two matrix multiplications. The first matrix multiplication is performed by combining the derivative matrix of the symmetric description matrix (denoted as d(D) matrix) with the fused truncation matrix (B matrix) to obtain the first matrix (denoted as d(At) matrix). The second matrix multiplication is performed by combining the derivative matrix (d(D) matrix) of the symmetric description matrix with the fusion matrix (A matrix) to obtain the second matrix (denoted as d(Bt) matrix). After performing two matrix multiplications, the elements of the corresponding column vectors of the first and second matrices are added together to obtain the derivative matrix of the fusion matrix (denoted as d(A) matrix). .
[0050] In the reverse computation submodule, the second matrix multiplication involves a matrix transpose operation. Therefore, in order to eliminate the transpose operation in the reverse computation submodule, this invention proposes as follows: Figure 3 The reverse computation submodule shown is composed of Figure 3 It can be seen that the reverse calculation submodule includes a cache unit, a third pulsation line with fixed weights, a fourth pulsation line with fixed outputs, and a summation unit.
[0051] According to an embodiment of the present invention, the third systolic line includes a second decomposer, a third computational unit array, and a second merger. The third systolic line is configured to calculate the product of the fused truncated matrix and the derivative matrix of the symmetric description matrix in the following manner: the second decomposer decomposes the fused truncated matrix prefetched from the cache unit to fix the row vectors of the fused truncated matrix to the third computational unit array; the third computational unit array includes multiple sequentially arranged computational units, each computational unit being assigned a row vector, and each computational unit being used to perform a product operation based on the assigned row vector with all column vectors of the derivative matrix of the symmetric description matrix passed by the target model in sequence to obtain all elements of the first matrix; the second merger is used to sequentially combine all elements calculated by the third computational unit array into the first matrix, and sequentially output the column vectors of the first matrix to the summing unit. The third computational unit array contains computational units with one row and multiple columns. It can be seen that the third computational unit array in the third systolic line is similar to the computational unit arrays in the first and second systolic lines, and will not be described in detail further.
[0052] It should be noted that the reverse calculation submodule receives the column data stream of the fusion matrix from the forward calculation submodule and the column data stream of the derivative matrix of the symmetric description matrix from the target model. At this point, the calculation data streams of the second matrix naturally match, while those of the first matrix do not, requiring transposition of the calculation data streams. Compared to transposing the derivative matrix data stream of the symmetric description matrix, transposing the fusion truncation matrix data stream has lower time and resource overhead; therefore, transposing the fusion truncation matrix data stream is chosen. Furthermore, considering that the fusion matrix will be pre-stored in the cache unit before the derivative matrix of the symmetric description matrix, a data stream preloading technique can be used to pre-load the fusion truncation matrix from the cache unit. The transposition processing of the fusion truncation matrix data stream can be hidden by adjusting the data fixing method of the third pulsation line; that is, the transposition overhead is hidden by fixing the row vectors of the fusion truncation matrix.
[0053] According to one embodiment of the present invention, the fourth systolic line includes a second splitter, a fourth computational unit array, and a second multiplexer. The fourth systolic line is configured to calculate the product of the derivative matrix of the symmetric description matrix and the fusion matrix in the following manner: the second splitter receives a column vector of the derivative matrix of the symmetric description matrix transmitted by the target model and sequentially assigns the elements in the column vector to the fourth computational unit array; the fourth computational unit array includes multiple sequentially arranged computational units, each computational unit is assigned one element, and each computational unit is used to perform a product operation based on the assigned element and the column vector corresponding to the fusion matrix obtained from the cache unit; wherein, after each computational unit performs a product operation of the corresponding elements of the column vector of the fusion matrix and the column vector of the derivative matrix of the symmetric description matrix once, a column vector of fixed size is obtained, and each computational unit adds the elements at the same position in all the column vectors it has calculated to obtain a column vector of the second matrix; the second multiplexer is used to sequentially output the column vectors obtained by all computational units in the array after the fourth computational unit array has completed its calculation, so as to pass the second matrix to the summation unit. The fourth computational unit array contains computational units with one row and multiple columns. As can be seen, the fourth computing unit array in the fourth pulsation line is similar to the computing unit array in the first and second pulsation lines, so we will not go into further detail here.
[0054] To better understand the reverse computation submodule, the following will combine... Figure 3 This section details the workflow of the reverse computation submodule. Here, matrix A represents the fusion matrix, matrix B represents the fusion truncation matrix, matrix d(D) represents the derivative matrix of the symmetric description matrix, matrix d(At) represents the first matrix, matrix d(Bt) represents the second matrix, and matrix d(A) represents the derivative matrix of the fusion matrix.
[0055] In the reverse calculation submodule, the third pulsation line is used to calculate the d(At) matrix based on matrix B and d(D) matrix.
[0056] The second multi-way decomposer decomposes the matrix B prefetched from the cache unit to fix the row vectors of matrix B to the third computing unit array. At this time, each computing unit is assigned a row vector of matrix B.
[0057] Each computing unit in the third computing unit array is used to perform a product operation on all column vectors of the d(D) matrix passed sequentially from the target model based on the assigned row vectors, in order to obtain all elements of the d(At) matrix. The computing principle of the third computing unit array is the same as that of the second computing unit array mentioned above, and will not be repeated here.
[0058] The second combiner is used to combine all the elements calculated by the third computing unit array in sequence into a d(At) matrix, and output the column vectors of the d(At) matrix in sequence.
[0059] In the reverse calculation submodule, the fourth pulsation line is used to calculate the d(Bt) matrix based on matrix A and d(D) matrix.
[0060] The second splitter receives a column vector of the d(D) matrix passed from the target model and assigns the elements in the column vectors to the fourth computational unit array in sequence. At this time, each computational unit is assigned one element from the column vector.
[0061] Each computing unit in the fourth computing unit array is used to perform a product operation based on the allocated elements and the column vectors corresponding to matrix A obtained from the cache unit to obtain a matrix with a fixed number of rows and columns. The computing principle of the fourth computing unit array is the same as that of the first computing unit, and will not be repeated here.
[0062] The second multiplexer is used to output the column vectors obtained by all computing units in the array in sequence after the fourth computing unit array has completed its calculation, so as to pass the d(Bt) matrix to the summing unit.
[0063] For the summation unit, the elements of the column vectors of the d(At) matrix output sequentially by the third pulsation line are added to the column vectors of the d(Bt) matrix output sequentially by the fourth pulsation line to obtain the derivative matrix d(A) of the fusion matrix.
[0064] To better understand the feature processing module, the following example uses a 514×4 position matrix R and a 512×128 embedding matrix G to illustrate how the feature extraction module calculates the derivative matrices of the symmetric description matrix and the fusion matrix.
[0065] First, a forward computation submodule performs matrix multiplication on the position matrix R and the embedding matrix G to obtain a symmetric description matrix. Specifically, the first pulsation line assigns elements from the row vectors of the embedding matrix G to the computation unit and then multiplies them with the row vectors of the position matrix R to obtain a fusion matrix A of size 4×128, and outputs the column vectors of fusion matrix A in sequence. The second pulsation line uses the column vectors of a 4×16 matrix B (preset to have 16 columns) obtained after data stream rearrangement as fixed weights for the computation unit and then multiplies them with fusion matrix A to obtain a symmetric description matrix D of size 16×128.
[0066] Then, the derivative of the symmetric description matrix D is calculated using the target model to obtain the d(D) matrix with a size of 16×128.
[0067] Finally, the reverse calculation submodule performs matrix multiplication on the fusion matrix A and the d(D) matrix to obtain the derivative matrix d(A) of the fusion matrix. Specifically, the third pulsation line uses the row vectors of matrix B as fixed weights of the calculation unit to perform matrix multiplication with the d(D) matrix, resulting in a 4×128 d(At) matrix. The fourth pulsation line assigns the elements of the column vectors of the d(D) matrix to the calculation unit and then multiplies them with the fusion matrix A to obtain a 4×16 d(Bt) matrix. The summation unit adds the elements of the 16 column vectors of the d(Bt) matrix to the corresponding elements of the first 16 column vectors of the d(At) matrix, resulting in the final d(A) matrix (4×128).
[0068] III. Target Model
[0069] The target model is used to process the symmetric description matrix to obtain the molecular potential energy of the molecular system and the derivative matrix of the symmetric description matrix. According to one embodiment of the present invention, the target model consists of a three-layer fully connected neural network.
[0070] The acceleration system proposed in the foregoing embodiments can be used to accelerate the process of molecular dynamics simulation. Based on this, the present invention proposes a molecular dynamics simulation method, which includes: step S1, obtaining the molecular system to be simulated; step S2, processing the molecular system to be simulated using the acceleration system as described in the foregoing embodiments.
[0071] As can be seen from the foregoing embodiments, compared with existing molecular dynamics simulation methods, this invention sets up a first and fourth pulsation line with fixed outputs, and a second and third pulsation line with fixed weights. These pulsation lines, combined with data stream rearrangement and data stream preloading techniques, optimize the matrix multiplication calculation process, eliminating a large number of matrix multiplication transpose operations involved in the matrix multiplication calculation, thereby significantly improving computational efficiency without sacrificing computational accuracy. Simultaneously, the first, second, third, and fourth pulsation lines implement matrix multiplication calculations (multi-column calculation units per row) with lower hardware resource overhead, avoiding resource waste.
[0072] The beneficial effects of the present invention are as follows: (1) By using data flow rearrangement and data flow preloading technology, combined with pulsation lines with fixed weights and fixed outputs, the computational overhead of transpose operation is eliminated, avoiding the time and resource consumption caused by matrix transpose in traditional hardware implementation, and improving computational efficiency; (2) A fine-grained pipeline architecture is designed to meet the matrix multiplication computation requirements, which can accelerate the streaming computation of pulsation lines with high resource utilization.
[0073] It should be noted that although the steps are described in a specific order above, it does not mean that the steps must be executed in the above specific order. In fact, some of these steps can be executed concurrently or even in a different order, as long as the required function can be achieved.
[0074] This invention can be a system, method, and / or computer program product. A computer program product may include a computer-readable storage medium having computer-readable program instructions loaded thereon for causing a processor to implement various aspects of the invention.
[0075] Computer-readable storage media can be tangible devices that hold and store instructions for use by an instruction execution device. Computer-readable storage media can include, for example, but not limited to, electrical storage devices, magnetic storage devices, optical storage devices, electromagnetic storage devices, semiconductor storage devices, or any suitable combination thereof. More specific examples (a non-exhaustive list) of computer-readable storage media include: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), static random access memory (SRAM), portable compact disc read-only memory (CD-ROM), digital multifunction disc (DVD), memory sticks, floppy disks, mechanical encoding devices, such as punch cards or recessed protrusions storing instructions thereon, and any suitable combination thereof.
[0076] The various embodiments of the present invention have been described above. These descriptions are exemplary and not exhaustive, nor are they limited to the disclosed embodiments. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is chosen to best explain the principles, practical application, or technical improvements to the embodiments in the market, or to enable others skilled in the art to understand the embodiments disclosed herein.
Claims
1. An acceleration system for molecular dynamics simulations, wherein the molecular dynamics simulations are used to simulate the dynamic behavior of a molecular system comprising a plurality of molecules composed of atoms, characterized in that, The acceleration system includes a data processing module, a feature extraction module, and a target model. The acceleration system is configured to perform the following simulation calculations for each motion process of the molecular system: The data processing module is used to obtain the position matrix based on the position information of atoms in the molecular system updated by the previous simulation calculation, and to process the position matrix using a preset model to obtain the embedding matrix. And the derivative matrix of the fusion matrix obtained by the feature extraction module is used to calculate the forces on the molecular system according to the existing calculation method to update the position information of atoms in the molecular system; The feature extraction module includes a forward computation submodule and a backward computation submodule, wherein: The forward submodule includes a first pulsation line with fixed output and a second pulsation line with fixed weights. The first pulsation line is used to calculate the product of the position matrix and the embedding matrix to obtain a fusion matrix, and includes a first splitter, a first computational unit array, and a first multiplexer. The second pulsation line is used to calculate the product of the fusion matrix and the fusion truncation matrix to obtain a symmetric description matrix, and includes a first multiplexer, a second computational unit array, and a first merger. The fusion truncation matrix is composed of the first preset number of columns of the fusion matrix. The reverse computation submodule includes a cache unit, a third systolic line with fixed weights, a fourth systolic line with fixed outputs, and a summation unit. The cache unit stores the fusion matrix. The third systolic line calculates the product of the fusion truncation matrix and the derivative matrix of the symmetric description matrix to obtain the first matrix; the third systolic line includes a second decomposer, a third computational unit array, and a second merger. The fourth systolic line calculates the product of the derivative matrix of the symmetric description matrix and the fusion matrix to obtain the second matrix; the fourth systolic line includes a second splitter, a fourth computational unit array, and a second multiplexer. The summation unit adds the elements of the corresponding column vectors of the first and second matrices to obtain the derivative matrix of the fusion matrix. Among them, fixed output means that the pulsating line splits the calculated matrix into column vectors of fixed size for output, and fixed weight means that the pulsating line fixes the column vector or row vector of a matrix involved in the calculation as its own weight during the calculation. The target model is used to process the symmetric description matrix to obtain the molecular potential energy of the molecular system and the derivative matrix of the symmetric description matrix.
2. The system according to claim 1, characterized in that, The first pulsation line includes a first splitter, a first computational unit array, and a first multiplexer, and the first pulsation line is configured to calculate the product of the position matrix and the embedding matrix in the following manner: The first splitter is used to receive a row vector of the embedded matrix passed by the data processing module, and to distribute the elements in the row vector sequentially to the first computing unit array; The first computing unit array includes multiple sequentially arranged computing units, each of which is assigned one element. Each computing unit is used to perform a product operation based on the assigned element and the row vector corresponding to the position matrix transmitted by the data processing module. Each computing unit performs a product operation once on the corresponding elements of the row vector of the position matrix and the row vector of the embedding matrix to obtain a column vector of fixed size. Each computing unit adds the elements at the same position in all the column vectors it has calculated to obtain a column vector of the fusion matrix. The first multiplexer is used to output the column vectors obtained by all computing units in the array in sequence after the first computing unit array has completed the calculation, so as to pass the fusion matrix to the second pulsation line and the reverse calculation submodule.
3. The system according to claim 2, characterized in that, The second pulsation line includes a first multi-path decomposer, a second computational unit array, and a first merger, and the second pulsation line is configured to calculate the product of the fusion matrix and the fusion truncation matrix in the following manner: The first multi-path decomposer is used to decompose and fix the column vectors of the fusion truncation matrix passed by the first pulsation line to the corresponding second computing unit array in sequence; The second computing unit array includes multiple sequentially arranged computing units. Each computing unit is assigned a column vector of the fusion truncation matrix. Each computing unit is used to perform a product operation on all column vectors of the fusion matrix that are sequentially passed by the first pulsation line based on the assigned column vector, so as to obtain all elements of the symmetric description matrix. The first merger is used to combine all the elements calculated by the second computing unit array in sequence into a symmetric description matrix, and output the column vectors of the symmetric description matrix to the target model in sequence.
4. The system according to claim 3, characterized in that, The third pulsation line includes a second multi-path decomposer, a third computational unit array, and a second merger, and the third pulsation line is configured to calculate the product of the derivative matrix of the fusion truncation matrix and the symmetric description matrix in the following manner: The second multi-way decomposer is used to decompose the fused truncated matrix prefetched from the cache unit, so as to fix the row vector decomposition of the fused truncated matrix to the third computing unit array. The third computational unit array includes multiple computational units arranged in order. Each computational unit is assigned a row vector, and each computational unit is used to perform a product operation on all column vectors of the derivative matrix of the symmetric description matrix passed by the target model in sequence based on the assigned row vector to obtain all elements of the first matrix. The second merger is used to combine all the elements calculated by the third computing unit array in sequence into the first matrix, and output the column vectors of the first matrix to the summation unit in sequence.
5. The system according to claim 4, characterized in that, The fourth pulsation line includes a second splitter, a fourth computational unit array, and a second multiplexer. The fourth pulsation line is configured to compute the product of the derivative matrix of the symmetric description matrix and the fusion matrix in the following manner: The second splitter is used to receive a column vector of the derivative matrix of the symmetric description matrix passed by the target model, and to assign the elements in the column vector to the fourth computational unit array in sequence. The fourth computing unit array includes multiple computing units arranged in order. Each computing unit is assigned one element, and each computing unit is used to perform a product operation based on the assigned element and the column vector corresponding to the fusion matrix obtained from the cache unit. Specifically, each computing unit performs a product operation once on the corresponding elements of the column vector of the fusion matrix and the column vector of the derivative matrix of the symmetric description matrix to obtain a column vector of fixed size. Each computing unit adds the elements at the same position in all the column vectors it has calculated to obtain a column vector of the second matrix. The second multiplexer is used to output the column vectors obtained by all computing units in the array in sequence after the fourth computing unit array has completed its calculation, so as to pass the second matrix to the summing unit.
6. The system according to claim 5, characterized in that, The target model consists of a three-layer fully connected neural network.
7. The system according to claim 6, characterized in that, The first, second, third, and fourth computing unit arrays each contain a row of multiple columns of computing units.
8. A molecular dynamics simulation method, characterized in that, The method includes: Step S1: Obtain the molecular system to be simulated; Step S2: Process the simulated molecular system using the acceleration system as described in any one of claims 1-7.
9. A computer-readable storage medium, characterized in that, It stores a computer program that can be executed by a processor to implement the steps of the method of claim 8.
10. An electronic device, characterized in that, include: One or more processors, and memory, wherein the memory is used to store executable instructions; The one or more processors are configured to implement the steps of the method of claim 8 by executing the executable instructions.