PME algorithm heterogeneous calculation method and device applied to FPGA accelerator

By implementing the heterogeneous calculation of the PME algorithm in the FPGA accelerator, and using technologies such as B-spline interpolation and fast Fourier transform, the problem of low computational efficiency of the PME algorithm under the CPU+FPGA architecture is solved, and faster electrostatic force calculations are achieved. and more efficient resource utilization.

CN118711680APending Publication Date: 2024-09-27XIDIAN UNIV
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410779206.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-17
Publication Date
2024-09-27

AI Technical Summary

Technical Problem

In the existing technology, the use of HBM as memory results in long data access delays during PME calculations, and the separate processing of transposition and convolution during multi-dimensional FFT calculations leads to problems such as large storage resource usage and long calculation time, especially in CPU+ It has not been effectively solved under FPGA architecture.

Method used

By implementing the heterogeneous calculation of the PME algorithm in the FPGA accelerator, B-spline interpolation is used to interpolate the charge to the fast Fourier transform grid, and three-dimensional fast Fourier transform, convolution calculation and inverse transformation are performed, and the interpolation calculation is performed in conjunction with the CPU. , using a two-level storage architecture of global memory and local memory to optimize data access and calculation processes.

Benefits of technology

It significantly shortens the calculation time of the PME algorithm, improves the calculation efficiency, reduces the storage resource occupation, and improves the performance of the PME algorithm under the CPU+FPGA architecture.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118711680A
    Figure CN118711680A
Patent Text Reader

Abstract

The invention discloses a PME algorithm heterogeneous calculation method and device applied to an FPGA accelerator, relates to the technical field of molecular dynamics simulation, and solves the problems that in the prior art, data access delay is long in the PME calculation process due to the fact that an HBM is used as a memory; in order to solve the problems of large storage resource occupation and long calculation time caused by independent processing of transposing and convolution in a multi-dimensional FFT calculation process, the method comprises the following steps of: interpolating charges to a fast Fourier transform grid by using B-spline interpolation to obtain an electrostatic potential energy matrix and a coefficient matrix; calculating the electrostatic potential energy matrix and the coefficient matrix to obtain an electrostatic force matrix; carrying out B spline interpolation on the electrostatic force matrix to obtain a stress condition analysis result of each atom; the PME algorithm is unloaded into the FPGA, so that the calculation speed of the PME algorithm is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of molecular dynamics simulation, and in particular to a PME (Particle Mesh Ewald) algorithm heterogeneous computing method and device applied to an FPGA accelerator. Background Art

[0002] Molecular dynamics (MD) simulation is a common method used to simulate molecular motion in order to obtain various chemical and physical properties of molecular systems. In molecular systems, there are various types of forces within and between molecules, among which electrostatic forces are an important component of non-bonded interaction forces. As the molecular scale of the simulation system increases, the computational resources consumed by calculating electrostatic forces are also increasing rapidly. In order to reduce the amount of calculation of electrostatic forces, a series of methods have been gradually developed, among which the PME method is the mainstream method for calculating electrostatic forces.

[0003] Under the PME method, the electrostatic potential energy of the simulation system is divided into three parts, namely the electrostatic potential energy in real space, the electrostatic potential energy in Fourier space, and the energy correction term. By selecting the appropriate Ewald coefficient, the electrostatic potential energy in real space can converge quickly, and then the electrostatic potential energy in real space can be processed by truncation. The energy correction term itself does not require much calculation, so the most time-consuming part of the entire PME algorithm is the calculation of the electrostatic force in Fourier space.

[0004] A heterogeneous computing system is a system composed of computing units with different types of instruction sets and architectures, such as CPU and FPGA, CPU and GPU. The CPU completes the task allocation and scheduling, and the FPGA or GPU completes the specific computing tasks, thereby improving the efficiency of the calculation. In order to improve the computational efficiency of the PME algorithm, the electrostatic force calculation in Fourier space can be offloaded to the FPGA or GPU, and the CPU only performs management and scheduling, thereby improving the calculation speed of the PME algorithm.

[0005] Currently, the PME algorithm based on heterogeneous systems is mainly based on the CPU+GPU architecture. In comparison, the PME algorithm based on the CPU+FPGA architecture is not mature enough. OpenMM is an open source toolkit for molecular dynamics simulation. It has high scalability, flexibility and high performance. It is mainly used to calculate the electronic structure, dynamics and thermodynamic properties of proteins, drugs and other biological molecules. OpenMM supports pure CPU computing and CPU+GPU heterogeneous computing, but does not yet support CPU+FPGA heterogeneous computing.

[0006] At present, the PME algorithm based on heterogeneous systems is mainly based on the CPU+GPU architecture. OpenMM is an open source toolkit for molecular dynamics simulation, which is mainly used to calculate the electronic structure, dynamics and thermodynamic properties of proteins, drugs and other biological molecules. The PME algorithm is an important algorithm in the OpenMM toolkit, which is used to calculate long-range electrostatic forces, and FFT calculation is an important part of the PME algorithm. Currently, OpenMM supports pure CPU calculation and CPU+GPU heterogeneous calculation, but does not support CPU+FPGA heterogeneous calculation. There is also a method in the prior art to transplant the PME algorithm to FPGA for calculation, but there are problems such as long data access delay during PME calculation caused by using HBM as memory, and large storage resource usage and long calculation time caused by separate processing of transposition and convolution during multi-dimensional FFT calculation. Summary of the invention

[0007] The present invention provides a PME algorithm heterogeneous computing method applied to an FPGA accelerator, thereby solving the problems in the prior art of long data access delay in the PME computing process caused by using HBM as a memory, and large storage resource occupation and long computing time caused by separate processing of transposition and convolution in the multi-dimensional FFT computing process, and realizes the offloading of the PME algorithm to the FPGA, thereby improving the computing speed of the PME algorithm.

[0008] In a first aspect, the present invention provides a PME algorithm heterogeneous computing method applied to an FPGA accelerator, the method comprising:

[0009] The charges are interpolated to the fast Fourier transform grid using B-spline interpolation to obtain the electrostatic potential energy matrix and coefficient matrix;

[0010] Calculating the electrostatic potential energy matrix and the coefficient matrix to obtain an electrostatic force matrix;

[0011] The electrostatic force matrix is ​​interpolated by B-spline to obtain the analysis result of the force condition of each atom.

[0012] In combination with the first aspect, in a possible implementation, the operation of interpolating the charge to a fast Fourier transform grid using B-spline interpolation to obtain an electrostatic potential energy matrix and a coefficient matrix occurs in a CPU.

[0013] In combination with the first aspect, in a possible implementation manner, calculating the electrostatic potential energy matrix and the coefficient matrix to obtain an electrostatic force matrix includes:

[0014] Accessing the host memory through a direct memory access engine to obtain the electrostatic potential energy matrix and the coefficient matrix;

[0015] The FPGA accelerator is used to perform three-dimensional fast Fourier transform calculation, convolution calculation and three-dimensional inverse fast Fourier transform on the electrostatic potential energy matrix and the coefficient matrix to obtain an electrostatic force matrix.

[0016] In combination with the first aspect, in a possible implementation, the use of an FPGA accelerator to perform three-dimensional fast Fourier transform calculation, convolution calculation, and three-dimensional fast Fourier inverse transform on the electrostatic potential energy matrix and the coefficient matrix to obtain an electrostatic force matrix includes:

[0017] Firstly, the electrostatic potential energy matrix is ​​subjected to an X-dimensional Fourier transform to obtain an X-dimensional Fourier transform result;

[0018] Performing data processing on the X-dimensional Fourier transform result, and performing Y-dimensional Fourier transform on the processed result to obtain a Y-dimensional Fourier transform result;

[0019] Performing a Z-dimensional Fourier transform on the X-dimensional Fourier transform result to obtain a Z-dimensional Fourier transform result; wherein the X-dimensional Fourier transform result, the Y-dimensional Fourier transform result and the Z-dimensional Fourier transform result are all complex numbers;

[0020] Multiplying the Z-dimensional Fourier transform result by the coefficient matrix to obtain a Fourier transform result;

[0021] Performing a Z-dimensional inverse Fourier transform on the Fourier transform result to obtain a Z-dimensional inverse Fourier transform result;

[0022] Performing a Y-dimensional inverse Fourier transform on the Z-dimensional inverse Fourier transform result to obtain a Y-dimensional inverse Fourier transform result;

[0023] The Y-dimensional inverse Fourier transform result is subjected to data processing, and the processed result is subjected to an X-dimensional inverse Fourier transform to obtain an electrostatic force matrix.

[0024] In combination with the first aspect, in a possible implementation manner, the data processing includes:

[0025] The input data is first transposed, and then the transposed data is concatenated to obtain the data processing result.

[0026] In combination with the first aspect, in a possible implementation manner, the X-dimensional Fourier transform result, the Y-dimensional Fourier transform result, the Z-dimensional Fourier transform result, the Fourier transform result, the Z-dimensional Fourier inverse transform result, the Y-dimensional Fourier inverse transform result and the electrostatic force matrix are all saved in the FPGA.

[0027] In combination with the first aspect, in a possible implementation manner, the operation of calculating the electrostatic potential energy matrix and the coefficient matrix to obtain the electrostatic force matrix occurs in an FPGA.

[0028] In a second aspect, the present invention provides a PME algorithm heterogeneous computing device applied to an FPGA accelerator, the device comprising: a CPU and an FPGA; the CPU and the FPGA are connected using a high-speed serial computer expansion bus;

[0029] The CPU is used to interpolate the charge to a fast Fourier transform grid using B-spline interpolation to obtain an electrostatic potential energy matrix and a coefficient matrix;

[0030] The FPGA is used to calculate the electrostatic potential energy matrix and the coefficient matrix to obtain an electrostatic force matrix;

[0031] The CPU is also used to perform B-spline interpolation on the electrostatic force matrix to obtain analysis results of the force conditions of each atom.

[0032] In conjunction with the second aspect, in a possible implementation, the FPGA accelerator includes: a computing unit, a global memory unit;

[0033] The calculation unit uses the transformation calculation module, the convolution calculation module, and the data processing module to perform transformation and convolution calculation of the data, and uses the data loading module to complete the data interaction between the global memory in the global memory unit and the local memory in the transformation calculation module and the convolution calculation module;

[0034] The global memory unit stores the electrostatic potential energy matrix, the coefficient matrix and the electrostatic force matrix sent by the CPU.

[0035] One or more technical solutions provided in the present invention have at least the following technical effects or advantages:

[0036] (1) The present invention implements the time-consuming Fourier transform, convolution calculation and inverse Fourier transform in the PME algorithm by placing them into the FPGA accelerator, and retains the interpolation calculation in the host. The data transmitted between the host and the accelerator are the electrostatic potential energy matrix, the coefficient matrix, and the electrostatic force matrix;

[0037] (2) The present invention first sends the electrostatic potential energy matrix and coefficient matrix to the global memory of the FPGA accelerator through the host, and tells the accelerator to start the calculation task through instructions. The calculation unit in the accelerator takes out data from the global memory and stores it in the local memory. Each transformation calculation core and convolution calculation core in the calculation unit takes out data from their respective local memories to complete the three-dimensional Fourier transform, convolution calculation and three-dimensional Fourier inverse transform, and finally obtains the electrostatic force matrix and stores it back to the global memory. The accelerator tells the host that the calculation task is completed through an interrupt signal, and the host retrieves the data from the global memory of the accelerator;

[0038] (3) The storage consists of global memory and local memory. The local memory is divided into electrostatic potential energy local memory and coefficient matrix local memory. The electrostatic potential energy local memory is a true dual-port RAM, and the coefficient matrix local memory is a simple dual-port RAM. During multiple three-dimensional fast Fourier transform and inverse fast Fourier transform processes, data is accessed in the local memory, and the data access speed is fast. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] Figure 1 A flowchart of the steps of the PME algorithm heterogeneous computing method applied to the FPGA accelerator provided by the embodiment of the present invention;

[0040] Figure 2 A schematic diagram of a heterogeneous computing architecture of a PME algorithm provided in an embodiment of the present invention;

[0041] Figure 3 A schematic diagram of a heterogeneous computing and storage architecture of a PME algorithm provided in an embodiment of the present invention;

[0042] Figure 4 A schematic diagram of the charge interpolation process in the PME algorithm provided in an embodiment of the present invention;

[0043] Figure 5 A schematic diagram of a 32×32×32 electrostatic potential energy matrix or coefficient matrix provided in an embodiment of the present invention;

[0044] Figure 6 A schematic diagram of an X-dimensional Fourier transform / inverse Fourier transform calculation space provided by an embodiment of the present invention;

[0045] Figure 7 A schematic diagram of a Y-dimensional Fourier transform / inverse Fourier transform calculation space provided by an embodiment of the present invention;

[0046] Figure 8 A schematic diagram of a Z-dimensional Fourier transform / inverse Fourier transform calculation space provided by an embodiment of the present invention;

[0047] Fig. 9 A schematic diagram of a data reading and storage method in the entire computing process provided by an embodiment of the present invention;

[0048] Fig.10 The timing diagram of the PME algorithm in a heterogeneous system provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0049] The technical solutions in the embodiments of the present invention will be described clearly and completely below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0050] In a first aspect, the present invention provides a PME algorithm heterogeneous computing method applied to an FPGA accelerator, such as Figure 1 As shown, the method includes the following steps S101 to S103.

[0051] S101, interpolating the charge to the fast Fourier transform grid by using B-spline interpolation to obtain an electrostatic potential energy matrix and a coefficient matrix. Specifically, step S101 occurs in the CPU.

[0052] S102, calculating the electrostatic potential energy matrix and the coefficient matrix to obtain the electrostatic force matrix. Specifically, step S102 occurs in the FPGA.

[0053] Specifically, in step S102, the electrostatic potential energy matrix and the coefficient matrix are calculated to obtain the electrostatic force matrix, including the following steps S1021 to S1022.

[0054] S1021, access the host memory through the direct memory access engine to obtain the electrostatic potential energy matrix and the coefficient matrix.

[0055] Here, the FPGA is connected to the CPU through a high-speed serial computer expansion bus, and the direct memory access engine completes the data transmission between the CPU and FPGA.

[0056] S1022, using the FPGA accelerator to perform three-dimensional fast Fourier transform calculation, convolution calculation and three-dimensional inverse fast Fourier transform on the electrostatic potential energy matrix and the coefficient matrix to obtain an electrostatic force matrix.

[0057] Specifically, in step S1022, the FPGA accelerator is used to perform three-dimensional fast Fourier transform calculation, convolution calculation and three-dimensional fast Fourier inverse transform on the electrostatic potential energy matrix and the coefficient matrix to obtain an electrostatic force matrix, including:

[0058] (1) Perform an X-dimensional Fourier transform on the electrostatic potential energy matrix to obtain an X-dimensional Fourier transform result.

[0059] (2) Performing data processing on the X-dimensional Fourier transform result, and performing Y-dimensional Fourier transform on the processed result to obtain a Y-dimensional Fourier transform result.

[0060] (3) Performing a Z-dimensional Fourier transform on the X-dimensional Fourier transform result to obtain a Z-dimensional Fourier transform result; wherein the X-dimensional Fourier transform result, the Y-dimensional Fourier transform result and the Z-dimensional Fourier transform result are all complex numbers.

[0061] (4) The Fourier transform result is obtained by multiplying the Z-dimensional Fourier transform result and the coefficient matrix.

[0062] (5) Perform a Z-dimensional inverse Fourier transform on the Fourier transform result to obtain a Z-dimensional inverse Fourier transform result.

[0063] (6) Using the Z-dimensional inverse Fourier transform result, a Y-dimensional inverse Fourier transform is performed to obtain a Y-dimensional inverse Fourier transform result.

[0064] (7) Data processing is performed on the Y-dimensional inverse Fourier transform result, and the processed result is subjected to an X-dimensional inverse Fourier transform to obtain an X-dimensional inverse Fourier transform result, that is, an electrostatic force matrix.

[0065] Here, the X-dimensional Fourier transform result, the Y-dimensional Fourier transform result, the Z-dimensional Fourier transform result, the Fourier transform result, the Z-dimensional Fourier inverse transform result, the Y-dimensional inverse Fourier transform result and the electrostatic force matrix in step S1022 are all stored in the FPGA.

[0066] The data processing includes: firstly transposing the data of each Fourier channel in the input transformation result, and then splicing the transposed data to obtain the data processing result.

[0067] Specifically, the FPGA accelerator includes: a computing unit and a global memory unit. The computing unit uses a transformation computing module, a convolution computing module, and a data processing module to perform transformation and convolution computing of data, and uses a data loading module to complete data interaction between the global memory in the global memory unit and the local memory in the transformation computing module and the convolution computing module.

[0068] The global memory unit stores the electrostatic potential energy matrix, coefficient matrix and electrostatic force matrix sent by the CPU.

[0069] Exemplarily, during the entire three-dimensional fast Fourier transform process, the data processing module obtains the results of one-dimensional three-dimensional fast Fourier transform on all transform calculation kernels, processes the results of one-dimensional three-dimensional fast Fourier transform to obtain the initial data of the next-dimensional three-dimensional fast Fourier transform, and stores it in the corresponding local memory.

[0070] The convolution kernel performs convolution processing on the calculation results only after the Z-dimensional Fourier transform is completed, and does not perform any processing on the Fourier transform results at other times.

[0071] S103, performing B-spline interpolation on the electrostatic force matrix to obtain analysis results of the force conditions of each atom.

[0072] Exemplarily, the host mainly performs B-spline interpolation calculations. This embodiment uses a grid number of 32×32×32 as an example to illustrate the interpolation process. In the simulation system, the charges are randomly distributed. In order to convert the calculation to Fourier space, the host first performs B-spline interpolation to interpolate each charge into the fast Fourier transform grid. Assuming that each charge is interpolated to the 4×4×4 grid points around it in the three-dimensional space, the charge amount of each grid point is the sum of the charge contributions in the surrounding space, such as Figure 4 After completing the B-spline interpolation, the host (CPU) can obtain a 32×32×32 electrostatic potential energy matrix and a 32×32×32 coefficient matrix, as shown in Figure 5 As shown, each grid point has a corresponding value. After the host completes the B-spline interpolation to obtain the electrostatic potential energy matrix and coefficient matrix, it transfers the data to the global memory of the accelerator and starts the calculation of the accelerator. After the accelerator completes the calculation and obtains the electrostatic force matrix, the host reads back the calculation results from the global memory of the accelerator and also performs B-spline interpolation on the electrostatic force matrix to obtain the force conditions of each atom in the original simulated molecular system.

[0073] The present invention proposes a heterogeneous calculation method for the PME algorithm applied to the FPGA accelerator, which unloads the time-consuming three-dimensional FFT and convolution calculations of the PME algorithm in OpenMM to the FPGA, while the preprocessing of the data is still retained in the CPU. Compared with the CPU processing completely in OpenMM, the CPU computing resources can be released and the computing speed can be improved. Compared with the heterogeneous architecture of CPU+GPU, FPGA has lower power consumption and higher programmability than GPU, and the number of FFT computing cores can be expanded according to demand, thereby improving the parallelism of FFT calculation and shortening the calculation time. Compared with the solution of implementing the PME algorithm by FPGA in the prior art, the present invention is integrated with the OpenMM toolkit to perform molecular dynamics simulation of complex structures. At the same time, the present invention proposes a two-level storage architecture of global memory+local memory, which can solve the problem of long data reading and writing delay caused by relying solely on global memory for data storage, and in the multi-dimensional FFT calculation process, transposition and convolution calculations are performed synchronously with FFT calculations, which can further shorten the calculation time of the PME algorithm.

[0074] By offloading the PME algorithm to the FPGA, multiple FFT computing cores are used to perform FFT calculations in parallel, and transposition and convolution calculations are performed in parallel with FFT calculations, thereby achieving the goal of shortening the PME algorithm duration.

[0075] In the method provided by the present invention, all calculation processes of the PME algorithm can be completed in the CPU. In order to speed up the PME calculation and release the CPU computing resources, the calculation process of step S103 is loaded into the FPGA accelerator in the present invention, and the CPU completes the interpolation calculation of step S101 and step S103 to form a heterogeneous computing system of CPU+FPGA. Figure 2 As shown. The accelerator is connected to the host through a high-speed serial computer expansion bus, and the direct memory access engine completes the data transmission between the host and the accelerator. The global memory is used to store the original data sent by the host and the final calculation results. The computing unit is the computing core of the accelerator, which consists of a data loading module, a data processing module, a transformation calculation module, and a convolution calculation module to complete the calculation process of step S102. The data loading module completes the data interaction between the global memory and the local memory, the data processing module completes the data processing between dimensions, the transformation calculation module completes the Fourier transform calculation in step S102, and the convolution calculation module completes the convolution calculation in step S102.

[0076] The transform calculation module is the core of the calculation unit, which consists of multiple transform calculation cores and a corresponding number of local memories. Each transform calculation core has multiple three-dimensional fast Fourier transform calculation channels, which can realize the parallel calculation of three-dimensional fast Fourier transform and shorten the calculation time of three-dimensional fast Fourier transform. The local memory of the transform calculation module is a true dual-port RAM, which can realize the read and write operations of RAM through two ports at the same time, and is used to store the initial data and calculation results in the multi-dimensional three-dimensional fast Fourier transform process. The number of convolution calculation cores in the convolution calculation module is the same as the number of transform calculation cores. Similarly, each convolution calculation core also has a local memory, which is a simple dual-port RAM, one port is used for read operations, and the other port is used for write operations, which stores the coefficients corresponding to the electrostatic potential energy.

[0077] The storage architecture of PME algorithm heterogeneous computing is as follows Figure 3 As shown, the data loading module is connected to the global memory through an advanced extensible interface to read the electrostatic potential energy data and coefficient data from the global memory. The data loading module is connected to multiple electrostatic potential energy local memories and coefficient matrix local memories through multiple local ports to distribute the electrostatic potential energy data and coefficient data to each local memory.

[0078] Each transformation calculation core and convolution calculation core retrieves data from the corresponding local memory to complete three-dimensional fast Fourier transform, convolution calculation and three-dimensional inverse fast Fourier transform.

[0079] Finally, the data loading module returns the calculated electrostatic force data to the global memory to complete the accelerator's calculation task.

[0080] In a specific embodiment provided by the present invention, Figure 2 In the heterogeneous system shown, the accelerator mainly completes three-dimensional fast Fourier transform, convolution calculation and three-dimensional fast Fourier inverse transform. This embodiment takes 4 three-dimensional fast Fourier transform calculation cores and 8 three-dimensional fast Fourier transform channels of each calculation core as an example to illustrate the three-dimensional fast Fourier transform, convolution calculation and three-dimensional fast Fourier inverse transform process. The electrostatic potential energy matrix is ​​a three-dimensional matrix of 32×32×32. The three-dimensional fast Fourier transform can be converted into three one-dimensional three-dimensional fast Fourier transforms, that is, three 32×32 32-point one-dimensional three-dimensional fast Fourier transforms are performed in the X, Y, and Z directions in sequence. The inverse Fourier transform is the same, and three 32×32 32-point one-dimensional inverse Fourier transforms are performed in the Z, Y, and X directions in sequence. The initial data of the next dimension transformation uses the result of the previous dimension transformation.

[0081] The transformation calculation module has 32 three-dimensional fast Fourier transform channels, which can simultaneously calculate 32 32-point one-dimensional and three-dimensional fast Fourier transforms. Therefore, it takes 32 times to complete the three-dimensional fast Fourier transform of X, Y, and Z dimensions. The calculation space is as follows: Figure 6 , Figure 7 and Figure 8 As shown in the figure, it can be seen that the initial data of each one-dimensional and three-dimensional fast Fourier transform of the three dimensions X, Y, and Z are different, and the data conversion between dimensions is required.

[0082] The way data is read and stored during the entire PME calculation process is as follows Fig. 9 As shown. The electrostatic potential energy data is sequentially stored in the electrostatic potential energy local memory. The transformation calculation core sequentially takes out the electrostatic potential energy data from the local memory to perform X-dimensional three-dimensional fast Fourier transform. The transformation results are transposed and stored back to the local memory. The transformation calculation core sequentially takes out the Y-dimensional transformation initial data from the local memory to perform Y-dimensional three-dimensional fast Fourier transform. The transformation results are directly stored back to the local memory in sequence. The transformation calculation core takes out the Z-dimensional transformation initial data from the local memory in a jump address manner to perform Z-dimensional three-dimensional fast Fourier transform. After the convolution calculation, the transformation results are still stored back to the local memory in a jump address manner. The transformation calculation core takes out the Z-dimensional inverse transformation initial data from the local memory in a jump address manner to perform Z-dimensional inverse fast Fourier transform. The transformation results are stored back to the local memory in a jump address manner. The transformation calculation core sequentially takes out the Y-dimensional inverse transformation initial data from the local memory to perform Y-dimensional inverse fast Fourier transform. The transformation results are transposed and stored back to the local memory. The transform calculation core sequentially takes out the X-dimensional inverse transform initial data from the local memory to perform an X-dimensional inverse fast Fourier transform, and the transform results are directly stored back to the local memory in sequence.

[0083] When applying the method provided by the present invention, the host first downloads the electrostatic potential energy matrix and the coefficient matrix to the global memory through the direct memory access engine, and informs the computing unit to start the computing task. Then the data loading module copies the electrostatic potential energy data of each transformation calculation core from the global memory to the local memory corresponding to the transformation calculation module; the data loading module copies the coefficient matrix of each transformation calculation core from the global memory to the local memory corresponding to the convolution calculation module.

[0084] Then the transformation calculation core takes out the data from the local memory and performs three 3D fast Fourier transforms, namely X-dimensional, Y-dimensional, and Z-dimensional 3D fast Fourier transforms. After completing the X-dimensional 3D fast Fourier transform, the data processing module transposes and splices the calculation results of the X-dimensional 3D fast Fourier transform to obtain the initial data of the Y-dimensional 3D fast Fourier transform, and stores the processed data back to the local memory of the transformation calculation module. For the Y-dimensional 3D fast Fourier transform result, the data processing module does not perform any processing and directly stores the calculation result back to the local memory of the transformation calculation module.

[0085] After completing the Z-dimensional 3D fast Fourier transform calculation, the transform result is a complex number, each data consists of a real part and an imaginary part. The convolution calculation kernel of the convolution calculation module takes out the coefficient matrix from the local memory, multiplies it with the real and imaginary parts of the corresponding Z-dimensional 3D fast Fourier transform result, and then stores the product result back to the local memory of the transform calculation module.

[0086] Then the transformation calculation core takes out the data from the local memory and performs three inverse fast Fourier transforms, namely, the Z-dimensional, Y-dimensional, and X-dimensional inverse fast Fourier transforms. After completing the Y-dimensional inverse fast Fourier transform, the data processing module transposes and splices the calculation results of the Y-dimensional inverse fast Fourier transform to obtain the initial data of the X-dimensional inverse fast Fourier transform, and stores the processed data back to the local memory of the transformation calculation module. For the inverse fast Fourier transform results of other dimensions, the data processing module does not perform any processing and directly stores the calculation results back to the local memory of the transformation calculation module.

[0087] After completing three 3D fast Fourier transform calculations, convolution processing, and three inverse fast Fourier transforms, the data loading module takes the calculation results from the local memory of the transform calculation module, stores them in the global memory, and informs the host of the completion of the calculation task through an interrupt signal. Finally, the host retrieves the calculation results through the direct memory access engine to complete the calculation task. The timing diagram of the entire calculation process is shown in Fig.10 shown.

[0088] The method provided by the present invention realizes heterogeneous computing of the PME algorithm based on OpenMM software, puts the time-consuming Fourier transform, convolution calculation and inverse Fourier transform in the PME algorithm into the accelerator, and retains the interpolation calculation in the host. The data transmitted between the host and the accelerator are the electrostatic potential energy matrix, the coefficient matrix, and the electrostatic force matrix.

[0089] In the method provided by the present invention, the host first sends the electrostatic potential energy matrix and the coefficient matrix to the global memory of the accelerator, and tells the accelerator to start the calculation task through instructions. The calculation unit in the accelerator takes out data from the global memory and stores it in the local memory. Each transformation calculation core and convolution calculation core in the calculation unit takes out data from their respective local memories to complete three-dimensional Fourier transform, convolution calculation and three-dimensional Fourier inverse transform, and finally obtains the electrostatic force matrix and stores it back in the global memory. The accelerator tells the host that the calculation task is completed through an interrupt signal, and the host retrieves the data from the global memory of the accelerator.

[0090] The method provided by the present invention comprises a global memory and a local memory for storage, wherein the local memory is further divided into an electrostatic potential energy local memory and a coefficient matrix local memory, wherein the electrostatic potential energy local memory is a true dual-port RAM, and the coefficient matrix local memory is a simple dual-port RAM. In the process of multiple three-dimensional fast Fourier transform and inverse fast Fourier transform, data is accessed in the local memory, and the data access speed is fast.

[0091] In a second aspect, the present invention provides a PME algorithm heterogeneous computing device applied to an FPGA accelerator, such as Figure 2 As shown, the device includes: a CPU and an FPGA; the CPU and the FPGA are connected using a high-speed serial computer expansion bus.

[0092] The CPU is used to interpolate the charge to the fast Fourier transform grid using B-spline interpolation to obtain the electrostatic potential energy matrix and coefficient matrix. The CPU is also used to perform B-spline interpolation on the electrostatic force matrix to obtain the force analysis results of each atom.

[0093] FPGA is used to calculate the electrostatic potential energy matrix and the coefficient matrix to obtain the electrostatic force matrix.

[0094] Some modules in the apparatus of the present invention may be described in the general context of computer executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, classes, etc. that perform specific tasks or implement specific abstract data types. The present invention may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.

[0095] The various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. All or part of the present invention can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld devices or portable devices, tablet devices, mobile communication terminals, multi-processor systems, microprocessor-based systems, programmable electronic devices, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc.

[0096] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the present invention. Although the present invention has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some or all of the technical features thereof may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the scope of the technical solutions of the present invention.

Claims

1. A PME algorithm heterogeneous computing method applied to FPGA accelerator, characterized in that: include: The charges are interpolated to the fast Fourier transform grid using B-spline interpolation to obtain the electrostatic potential energy matrix and coefficient matrix; Calculating the electrostatic potential energy matrix and the coefficient matrix to obtain an electrostatic force matrix; The electrostatic force matrix is ​​interpolated by B-spline to obtain the analysis result of the force condition of each atom.

2. The PME algorithm heterogeneous computing method applied to FPGA accelerator according to claim 1 is characterized in that: The operation of interpolating the charge to the fast Fourier transform grid using B-spline interpolation to obtain the electrostatic potential energy matrix and the coefficient matrix occurs in the CPU.

3. The PME algorithm heterogeneous computing method applied to FPGA accelerator according to claim 1 is characterized in that: The electrostatic potential energy matrix and the coefficient matrix are calculated to obtain an electrostatic force matrix, including: Accessing the host memory through a direct memory access engine to obtain the electrostatic potential energy matrix and the coefficient matrix; The FPGA accelerator is used to perform three-dimensional fast Fourier transform calculation, convolution calculation and three-dimensional inverse fast Fourier transform on the electrostatic potential energy matrix and the coefficient matrix to obtain an electrostatic force matrix.

4. The PME algorithm heterogeneous computing method applied to FPGA accelerator according to claim 3 is characterized in that: The method of using the FPGA accelerator to perform three-dimensional fast Fourier transform calculation, convolution calculation and three-dimensional inverse fast Fourier transform on the electrostatic potential energy matrix and the coefficient matrix to obtain an electrostatic force matrix includes: Performing an X-dimensional Fourier transform on the electrostatic potential energy matrix to obtain an X-dimensional Fourier transform result; Performing data processing on the X-dimensional Fourier transform result, and performing Y-dimensional Fourier transform on the processed result to obtain a Y-dimensional Fourier transform result; Performing a Z-dimensional Fourier transform on the Y-dimensional Fourier transform result to obtain a Z-dimensional Fourier transform result; wherein the X-dimensional Fourier transform result, the Y-dimensional Fourier transform result and the Z-dimensional Fourier transform result are all complex numbers; Performing a convolution operation on the Z-dimensional Fourier transform result and the coefficient matrix to obtain a Fourier transform result; Performing a Z-dimensional inverse Fourier transform on the Fourier transform result to obtain a Z-dimensional inverse Fourier transform result; Performing a Y-dimensional inverse Fourier transform on the Z-dimensional inverse Fourier transform result to obtain a Y-dimensional inverse Fourier transform result; The Y-dimensional inverse Fourier transform result is subjected to data processing, and the processed result is subjected to an X-dimensional inverse Fourier transform to obtain an electrostatic force matrix.

5. The PME algorithm heterogeneous computing method applied to FPGA accelerator according to claim 4 is characterized in that: The data processing includes: The input data is first transposed, and then the transposed data is concatenated to obtain the data processing result.

6. The PME algorithm heterogeneous computing method applied to FPGA accelerator according to claim 4, characterized in that: The X-dimensional Fourier transform result, the Y-dimensional Fourier transform result, the Z-dimensional Fourier transform result, the Fourier transform result, the Z-dimensional inverse Fourier transform result, the Y-dimensional inverse Fourier transform result and the electrostatic force matrix are all stored in the FPGA.

7. The PME algorithm heterogeneous computing method applied to FPGA accelerator according to claim 1, characterized in that: The operation of calculating the electrostatic potential energy matrix and the coefficient matrix to obtain the electrostatic force matrix occurs in the FPGA.

8. A PME algorithm heterogeneous computing device applied to an FPGA accelerator, characterized in that: include: CPU and FPGA; the CPU and the FPGA are connected using a high-speed serial computer expansion bus; The CPU is used to interpolate the charge to a fast Fourier transform grid using B-spline interpolation to obtain an electrostatic potential energy matrix and a coefficient matrix; The FPGA is used to calculate the electrostatic potential energy matrix and the coefficient matrix to obtain an electrostatic force matrix; The CPU is also used to perform B-spline interpolation on the electrostatic force matrix to obtain analysis results of the force conditions of each atom.

9. The PME algorithm heterogeneous computing device applied to FPGA accelerator according to claim 8, characterized in that: The FPGA accelerator includes: a computing unit, a global memory unit and a direct memory access engine; The computing unit uses a transformation computing module, a convolution computing module, and a data processing module to perform Fourier transform and convolution computing, and uses a data loading module to complete data interaction between the global memory in the global memory unit and the local memory in the transformation computing module and the convolution computing module; The global memory unit stores the electrostatic potential energy matrix, the coefficient matrix and the electrostatic force matrix sent by the CPU.

Citation Information

Cited By

  • High-robustness charge inversion method based on B-spline function and related device

    CN119598811A