Algebraic multi-grid storage and calculation integrated software and hardware acceleration system
By designing AGG, ASPR and AC modules based on storage and computing integrated devices in an algebraic multi-grid algorithm, the problem of large data movement overhead on the CPU and GPU platforms is solved, and the efficient acceleration and energy consumption reduction of the AMG algorithm are achieved.
Patent Information
- Application Number
- CN202411030406.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-30
- Publication Date
- 2024-12-31
AI Technical Summary
The architecture limitations of the CPU and GPU themselves result in high data movement overhead between the processor and memory, hindering the better acceleration of algebraic multiple grid algorithms (AMGs).
An algebraic multi-grid memory and computing integrated software and hardware acceleration system is designed, including AGG module, ASPR module and AC module. All of them are based on the memory and computing integrated device to realize data computing and access, saving the overhead of data movement between the processor and memory.
By reducing data movement overhead, the implementation speed of AMG algorithms is improved, and the performance and energy consumption are significantly improved on the CPU and GPU platforms.
Smart Images

Figure CN119225810A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of storage and computing integrated hardware implementation, and in particular to an algebraic multi-grid storage and computing integrated software and hardware acceleration system. Background Art
[0002] The Algebraic Multigrid (AMG) algorithm boasts optimal computational complexity and high scalability, enabling efficient solutions to linear systems of equations. It has been widely used in numerical simulations of practical problems in science, engineering, and industry. Over the past few decades, researchers have devoted significant effort to accelerating AMG on central processing unit (CPU) and graphics processing unit (GPU) platforms, achieving significant performance improvements. However, due to inherent limitations in the CPU and GPU architectures, the significant overhead of moving data between the processor and memory has become a major bottleneck in accelerating AMG, hindering further advancements. Summary of the Invention
[0003] In response to the problems existing in the prior art, the present invention provides an algebraic multi-grid storage and computing integrated software and hardware acceleration system.
[0004] In a first aspect, the present invention provides an algebraic multigrid storage and computation integrated hardware and software acceleration system, comprising: AGG module, ASPR module, AC module; The AGG module is used to implement the aggregation operation in the AMG algorithm; The ASPR module is used to implement multiplication, addition and subtraction operations between matrices and vectors in the AMG algorithm; The AC module is used to implement the matrix inverse multiplication operation in the AMG algorithm; The AGG module, ASPR module, and AC module all implement data calculation and access based on a storage and computing integrated device.
[0005] Optionally, the AGG module includes: Input buffer, multiple comparison units, a first register, a second register, a third register, and an output buffer; The input buffer is used to store the fine grid matrix; The comparison unit is used to perform a clustering operation on the fine grid matrix based on the storage and computing integrated device; The first register is used to store the index of the node gathered in each gathering; The second register is used to store the value of the nodes gathered in each gathering; The third register is used to update and mark the index of the aggregated node in the aggregation operation based on the index of the aggregated node in each aggregation; The output buffer is used to determine the aggregated nodes in the fine grid matrix based on the indexes of the aggregated nodes in each aggregation, and send the determined nodes to the ASPR module.
[0006] Optionally, the ASPR module is used to: Construct smoothing operators, interpolation operators, restriction operators, and coarse grid matrices; Smooth before proceeding; Perform residual calculations; constraining the residual to the coarse grid matrix; Interpolate and correct the fine grid matrix approximate solution; Smooth afterward.
[0007] Optionally, the ASPR module includes: A first interconnection module, a second interconnection module, a third interconnection module, and a fourth interconnection module; The first interconnection module is used to construct and store the smoothing operator and the coarse grid matrix based on the storage and computing integrated device to perform residual calculation; The second interconnection module is used to construct and store the interpolation operator and the restriction operator based on the storage and computing integrated device, and perform front smoothing and back smoothing; The third interconnection module is used to construct the coarse grid matrix based on the storage and computing integrated device, and interpolate and correct the fine grid matrix approximate solution; The fourth interconnection module is used to limit the residual to the coarse grid matrix based on the storage and computing integrated device.
[0008] Optionally, constructing and storing the smoothing operator and the coarse grid matrix and performing residual calculation includes: constructing the smoothing operator based on the fine grid matrix, the inverse matrix of the diagonal matrix corresponding to the fine grid matrix, and the identity matrix of the fine grid matrix; constructing the coarse grid matrix based on the fine grid matrix, the interpolation operator and the restriction operator; Residual calculation is performed based on the fine grid matrix, the pre-smoothed fine grid matrix approximate solution and the constant vector.
[0009] Optionally, the constructing and storing the interpolation operator and the restriction operator, and performing front smoothing and back smoothing, includes: constructing the interpolation operator based on the smoothing operator and the tentative interpolation; constructing the restriction operator based on the interpolation operator; Based on the smoothing operator, the inverse matrix of the diagonal matrix corresponding to the fine grid matrix, the initial approximate solution of the fine grid matrix, the approximate solution of the fine grid matrix after pre-smoothing and the constant vector, pre-smoothing and post-smoothing are performed.
[0010] Optionally, interpolating and correcting the fine grid matrix approximate solution includes: Based on the interpolation operator, the fine grid matrix approximate solution is interpolated and corrected.
[0011] Optionally, limiting the residual to the coarse grid matrix comprises: Based on the constraint operator, the residual is constrained to the coarse grid matrix.
[0012] Optionally, the AC module is used to: Store the coarse grid matrix and calculate the error based on the storage and computing device.
[0013] Optionally, the system further comprises: Global cache module, control module; The global cache module is used to send a fine grid matrix, an inverse matrix of a diagonal matrix corresponding to the fine grid matrix, and a constant vector to the AGG module, and receive a result output by the ASPR module; The control module is used to control the data flow between the AGG module, the ASPR module, the AC module and the global cache module.
[0014] The algebraic multigrid storage and computing integrated hardware and software acceleration system provided by the present invention, the AGG module, ASPR module, and AC module all implement data calculation and access in the AMG algorithm based on the storage and computing integrated device, saving the overhead of data movement between the processor and memory and improving the implementation speed of the AMG algorithm. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] In order to more clearly illustrate the technical solutions in the present invention or the prior art, a brief introduction is given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0016] Figure 1 This is one of the structural diagrams of the algebraic multigrid storage and computing integrated hardware and software acceleration system provided by the present invention.
[0017] Figure 2 This is the second structural diagram of the algebraic multigrid storage and computing integrated hardware and software acceleration system provided by the present invention.
[0018] Figure 3This is a schematic diagram of the data handling process of the algebraic multigrid storage and computing integrated hardware and software acceleration system provided by the present invention.
[0019] Figure 4 This is a performance comparison chart of the algebraic multigrid storage and computing integrated hardware and software acceleration system provided by the present invention and the GPU solver (AmgX) and CPU solver (HYPRE).
[0020] Figure 5 This is a comparison chart of energy consumption between the algebraic multigrid storage and computing integrated hardware and software acceleration system provided by the present invention and the GPU solver (AmgX).
[0021] Figure 6 This is a comparison chart of energy consumption between the algebraic multigrid storage and computing integrated hardware and software acceleration system provided by the present invention and the CPU solver (HYPRE). DETAILED DESCRIPTION
[0022] To make the objectives, technical solutions, and advantages of the present invention more clear, the technical solutions of the present invention will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the embodiments described are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making any creative efforts shall fall within the scope of protection of the present invention.
[0023] Solving systems of linear equations is a core component of many practical applications and one of the most common problems in science and engineering, such as quantum mechanics, statistical analysis, network theory, and machine learning. Therefore, efficiently solving linear equations is crucial, and improving the time and energy efficiency of solving linear equations has become a key issue for researchers. However, the efficiency of solving linear equations is limited by computational complexity.
[0024] To address this problem, researchers discovered that the AMG algorithm possesses optimal computational complexity and high scalability, enabling it to efficiently solve systems of linear equations. The AMG algorithm has been widely used in numerical simulations of practical problems in science, engineering, and industry. Over the past few decades, researchers have made significant efforts to accelerate AMG on CPU and GPU platforms, achieving certain performance improvements. However, due to the inherent limitations of the CPU and GPU architectures, the overhead of moving data between the processor and memory is considerable, presenting a major bottleneck in accelerating AMG.
[0025] Currently, all work on AMG acceleration is based on the traditional von Neumann architecture with separated storage and computing, which results in a large overhead in data movement between the processor and memory. In order to break through the limitations of the traditional von Neumann architecture, quickly read and access data, and better accelerate AMG, the present invention proposes a storage-computing integrated architecture AmgR based on storage-computing integrated devices for AMG acceleration to implement the AMG algorithm.
[0026] Figure 1 This is one of the structural diagrams of the algebraic multigrid storage and computing integrated hardware and software acceleration system provided by the present invention, such as Figure 1 As shown, the system includes: AGG module 100, ASPR module 110, AC module 120; The AGG module is used to implement the aggregation operation in the AMG algorithm; The ASPR module is used to implement multiplication, addition, and subtraction operations between matrices and vectors in the AMG algorithm; The AC module is used to implement the matrix inverse multiplication operation in the AMG algorithm; The AGG module, ASPR module, and AC module all implement data calculation and access based on integrated storage and computing devices.
[0027] Specifically, the aggregation operation in the AMG algorithm can also be understood as the operation of converting nodes in the fine grid into coarse points in the AMG algorithm.
[0028] In one implementation, a fine grid matrix to be clustered can be obtained first, and the adjacency graph corresponding to the fine grid matrix can be determined. Then, multiple clustering operations are performed on the adjacency graph. Each clustering operation selects the top k-1 nodes in terms of edge weight connected to the current node, and clusters these k nodes together (k is an integer greater than or equal to 1). The rows and columns where the indexes of these k nodes are located are removed, and the clustering operation is repeated for the remaining nodes until the clustering of the entire adjacency graph is completed.
[0029] Optionally, the ASPR module 110 may be used to: Construct smoothing operators, interpolation operators, restriction operators, and coarse grid matrices; Smooth before proceeding; Perform residual calculations; constraining the residuals to a coarse grid matrix; Interpolate and correct the fine grid matrix approximate solution; Smooth afterward.
[0030] In one embodiment, the multiplication, addition and subtraction operations between matrices and vectors in the AMG algorithm may include constructing a smoothing operator, an interpolation operator, a restriction operator, and a coarse grid matrix in the AMG algorithm; performing pre-smoothing; performing residual calculations; restricting the residuals to the coarse grid matrix; interpolating and correcting the fine grid matrix approximate solution; performing post-smoothing and other operations.
[0031] The matrix inverse multiplication operation in the AMG algorithm may include an operation of calculating an error based on a coarse grid matrix and a residual corresponding to the coarse grid matrix in the AMG algorithm.
[0032] The integrated storage and computing device can function as both a processor and memory during computation, thus achieving integrated storage and computing. The algebraic multigrid storage and computing hardware and software acceleration system provided by this invention is applicable to any integrated storage and computing device, for example, not only resistive random access memory (ReRAM), but also ferroelectric random access memory (FeRAM), magnetic random access memory (MRAM), and so on.
[0033] The algebraic multigrid storage and computing integrated hardware and software acceleration system provided by the present invention, the AGG module, ASPR module, and AC module all implement data calculation and access in the AMG algorithm based on the storage and computing integrated device, saving the overhead of data movement between the processor and memory and improving the implementation speed of the AMG algorithm.
[0034] Optionally, the AGG module 100 includes: Input buffer, multiple comparison units, a first register, a second register, a third register, and an output buffer; The input buffer is used to store the fine grid matrix; The comparison unit is used to perform aggregation operations on the fine grid matrix based on the storage and computing integrated device; The first register is used to store the index of the node gathered in each gathering; The second register is used to store the value of the node gathered in each gathering; The third register is used to update and mark the index of the gathered node in the gathering operation based on the index of the gathered node in each gathering; The output buffer is used to determine the clustered nodes in the fine grid matrix based on the index of the clustered nodes in each clustering and send them to the ASPR module.
[0035] Specifically, the input buffer can be used to receive and store the fine grid matrix that needs to be aggregated sent from the outside, and then send it to the comparison unit.
[0036] The comparison unit can perform multiple comparisons of the weights of the adjacency graph edges corresponding to the received fine grid matrix (i.e., perform multiple clustering of the fine grid matrix). In each clustering, the comparison unit selects the nodes connected to the first k-1 edges with the largest weights connected to the current node (k is an integer greater than or equal to 1), and clusters these k nodes. The index of the clustered node in each clustering is sent to the first register, and the value of the clustered node in each clustering is sent to the second register.
[0037] The first register may be used to store the index of the node gathered in each gathering and send it to the third register.
[0038] The second register can be used to store the values of the nodes gathered in each gathering and send them to the output buffer.
[0039] The third register may be used to update and mark the indexes of the nodes that have been aggregated during the aggregation process based on the received indexes of the nodes aggregated in each aggregation, so as to prevent repeated aggregation.
[0040] The output buffer can be used to determine the coarse points aggregated in the adjacency graph corresponding to the fine grid matrix (i.e., the final result of the aggregation) based on the index of the aggregated nodes in each aggregation, and send the result to the ASPR module.
[0041] Optionally, the ASPR module 110 includes: The first interconnection module is used to construct and store a smoothing operator and a coarse grid matrix based on the storage and computing integrated device to perform residual calculation; The second interconnection module is used to construct and store interpolation operators and restriction operators based on the storage and calculation integrated device, and perform forward smoothing and backward smoothing; The third interconnection module is used to construct a coarse grid matrix based on the storage and computing integrated device, and interpolate and correct the fine grid matrix approximate solution; The fourth interconnection module is used to limit the residual to a coarse grid matrix based on the storage and computing integrated device.
[0042] Specifically, the smoothing operator can be used to construct the interpolation operator and eliminate the high-frequency errors in the approximate solution of the fine grid matrix; the interpolation operator can be used to transfer the error calculated based on the coarse grid matrix to the approximate solution of the fine grid matrix, and to construct the coarse grid matrix; the restriction operator can be used to transfer the residual of the approximate solution of the fine grid matrix to the coarse grid matrix, and to construct the coarse grid matrix; the coarse grid matrix can be used to eliminate the low-frequency errors in the approximate solution of the fine grid matrix.
[0043] Optionally, the first interconnect module is further configured to store the inverse matrix and constant vector corresponding to the diagonal matrix of the fine grid matrix, and the second interconnect module is further configured to store the inverse matrix corresponding to the diagonal matrix of the fine grid matrix. By storing more frequently used operands in the interconnect module, the overhead of moving data between the processor and memory is reduced.
[0044] Optionally, constructing and storing the smoothing operator and the coarse grid matrix and performing residual calculation may include: Construct a smoothing operator based on the fine grid matrix, the inverse matrix of the diagonal matrix corresponding to the fine grid matrix, and the identity matrix of the fine grid matrix; Based on the fine grid matrix, interpolation operator and restriction operator, a coarse grid matrix is constructed; The residual is calculated based on the fine grid matrix, the pre-smoothed fine grid matrix approximate solution, and the constant vector.
[0045] In one implementation, a smoothing operator may be constructed based on a result obtained by performing matrix multiplication of the fine grid matrix with the identity matrix of the fine grid matrix, the inverse matrix of the diagonal matrix corresponding to the fine grid matrix, and the fine grid matrix.
[0046] For example, the smoothing operator can be constructed by the following formula:
[0047] in, S represents the smoothing operator, I represents the identity matrix of the fine grid matrix, represents the inverse matrix of the diagonal matrix corresponding to the fine grid matrix, A represents the fine grid matrix.
[0048] In one implementation, a coarse grid matrix may be constructed based on a result obtained by performing matrix multiplication on a fine grid matrix, an interpolation operator, and a restriction operator.
[0049] For example, the coarse grid matrix can be constructed by the following formula:
[0050] in, represents the coarse grid matrix, R represents the restriction operator, A represents the fine grid matrix, P Represents an interpolation operator.
[0051] In one implementation, the residual calculation may be performed based on a result obtained by matrix multiplication of a constant vector, a fine grid matrix, and a pre-smoothed fine grid matrix approximate solution.
[0052] For example, the residual can be calculated using the following formula:
[0053] in, r represents the residual error of the fine grid matrix approximate solution, b represents a constant vector, A represents the fine grid matrix, represents the fine grid matrix approximate solution after pre-smoothing.
[0054] Optionally, constructing and storing interpolation operators and restriction operators to perform front smoothing and back smoothing may include: constructing the interpolation operator based on the smoothing operator and the tentative interpolation; constructing the restriction operator based on the interpolation operator; Based on the smoothing operator, the inverse matrix of the diagonal matrix corresponding to the fine grid matrix, the initial approximate solution of the fine grid matrix, the approximate solution of the fine grid matrix after pre-smoothing and the constant vector, pre-smoothing and post-smoothing are performed.
[0055] In one implementation, an interpolation operator may be constructed based on a result obtained by matrix multiplication of a smoothing operator and a provisional interpolation, wherein the provisional interpolation is a result obtained by aggregating a fine grid matrix.
[0056] For example, the interpolation operator can be constructed by the following formula:
[0057] in, P represents the interpolation operator, S represents the smoothing operator, T Indicates a tentative interpolation.
[0058] In one implementation, the interpolation operator may be transposed to construct a restriction operator.
[0059] For example, the restriction operator can be constructed by the following formula:
[0060] in, R represents the restriction operator, Represents the transpose of the interpolation operator.
[0061] In one embodiment, the initial approximate solution of the fine grid matrix can be pre-smoothed based on the result obtained by matrix multiplication of the smoothing operator and the initial approximate solution of the fine grid matrix, and the result obtained by matrix multiplication of the inverse matrix of the diagonal matrix corresponding to the fine grid matrix and the constant vector.
[0062] For example, forward smoothing can be performed using the following formula:
[0063] in, represents the approximate solution of the fine grid matrix after pre-smoothing, S represents the smoothing operator, represents the initial approximate solution of the fine grid matrix, represents the inverse matrix of the diagonal matrix corresponding to the fine grid matrix,b represents a constant vector.
[0064] In one embodiment, the approximate solution after correction of the fine grid matrix can be post-smoothed based on the result obtained by matrix multiplication of the smoothing operator and the approximate solution after correction of the fine grid matrix, and the result obtained by matrix multiplication of the inverse matrix of the diagonal matrix corresponding to the fine grid matrix and the constant vector.
[0065] For example, post-smoothing can be performed using the following formula:
[0066] in, represents the fine grid matrix approximate solution after post-smoothing, S represents the smoothing operator, represents the approximate solution after fine grid matrix correction, represents the inverse matrix of the diagonal matrix corresponding to the fine grid matrix, b represents a constant vector.
[0067] Optionally, interpolating and correcting the fine grid matrix approximate solution may include: Based on the interpolation operator and the error of the coarse grid matrix approximate solution, the fine grid matrix approximate solution is interpolated and corrected.
[0068] In one embodiment, the fine grid matrix approximate solution may be interpolated and corrected based on a result obtained by matrix multiplication of a pre-smoothed fine grid matrix approximate solution, an interpolation operator, and an error between the coarse grid matrix approximate solution.
[0069] For example, the fine grid matrix approximate solution can be interpolated and corrected by the following formula:
[0070] in, represents the approximate solution after fine grid matrix correction, represents the approximate solution of the fine grid matrix after pre-smoothing, P represents the interpolation operator, represents the error in the approximate solution of the coarse grid matrix.
[0071] Optionally, constraining the residuals to a coarse grid matrix can include: Based on the constraint operator, the residual is constrained to the coarse grid matrix.
[0072] In one embodiment, the residual can be constrained to the coarse grid matrix based on the result of matrix multiplication of the constraint operator and the residual of the fine grid matrix approximate solution.
[0073] For example, the residuals can be constrained to the coarse grid matrix by the following formula:
[0074] in, represents the residual error of the coarse grid matrix approximate solution, R represents the restriction operator, r represents the residual error of the fine grid matrix approximate solution.
[0075] Optionally, the AC module 120 is used to: Store the coarse grid matrix and calculate the error based on the storage and computing device.
[0076] Specifically, the AC module may receive the coarse grid matrix and the residual of the coarse grid matrix approximate solution sent by the ASPR module, and calculate the error of the coarse grid matrix approximate solution based on the inverse matrix corresponding to the coarse grid matrix and the residual of the coarse grid matrix approximate solution.
[0077] In one embodiment, the error of the coarse grid matrix approximate solution can be calculated using the following formula:
[0078] in, represents the error of the coarse grid matrix approximate solution, represents the inverse matrix corresponding to the coarse grid matrix, represents the residual error of the approximate solution to the coarse grid matrix.
[0079] Optionally, the system further comprises: Global cache module, control module; The global cache module is used to send the fine grid matrix, the inverse matrix of the diagonal matrix corresponding to the fine grid matrix and the constant vector to the AGG module, and receive the results output by the ASPR module; The control module is used to control the data flow between the AGG module, ASPR module, AC module and global cache module.
[0080] Specifically, the global cache module can be used to send the fine grid matrix, the inverse matrix of the diagonal matrix corresponding to the fine grid matrix and the constant vector to the AGG module, and can receive the smoothed fine grid matrix approximate solution calculated by the ASPR module in each iteration.
[0081] The control module can be used to control the data flow between the AGG module, ASPR module, AC module and global cache module.
[0082] The algebraic multi-grid storage and computing integrated hardware and software acceleration system provided by the present invention is illustrated below through specific application scenarios.
[0083] The AMG algorithm process is as follows. It is divided into the Setup phase (based on matrix information, constructing multigrid algorithm components) and the Solve phase (based on the algorithm components in the Setup phase, repeatedly iterating between grid layers and performing multigrid loops). Various computational operations are involved in the entire algorithm.
[0084]
[0085] in, Indicates the The fine grid matrix of the input of the operation, Indicates the The coarse grid matrix output by this operation is Indicates the The interpolation operator constructed by the second operation, Indicates the The restriction operator constructed by the sub-operation, Indicates the The smooth operator constructed by the sub-operation, Indicates the The tentative interpolation constructed by the operation, b represents a constant vector, Indicates the The fine grid matrix approximate solution of the input is calculated by the operation, Indicates the The fine grid matrix approximate solution obtained by the pre-smoothing operation is Indicates the The residual error of the fine grid matrix approximate solution obtained by this operation is Indicates the The residual error of the coarse grid matrix approximate solution obtained by this operation is Indicates the The error of the coarse grid matrix approximate solution obtained by this operation is Indicates the The smoothed fine grid matrix approximate solution is obtained by this operation.
[0086] AMG calls various computing operations on large amounts of unpredictable data, making it difficult to improve hardware utilization and reduce data handling and storage costs. In addition, in the construction of multi-grid algorithm components, there are irregular computing patterns, especially aggregation operations, which are difficult to directly convert into matrix-vector operations that are particularly suitable for the storage-computing device architecture. Finally, the storage-computing device itself has poor write endurance, and AMG involves a large amount of data movement and needs to be written to the storage-computing device multiple times, which results in high write costs.
[0087] In order to solve the above problems, the present invention proposes a reusable architecture AmgR to accelerate the implementation of AMG on a storage-computing integrated device. It can reuse various computing operations in AMG and improve hardware utilization. There are 10 different irregular computing operations in AMG. If you want to implement all computing operations in AMG on a storage-computing integrated device, one solution is to design a hardware module specifically for each operation and connect the intermediate buffer in the form of a pipeline. However, when the matrix scale is slightly larger, the hardware overhead is very huge. However, many operation computing modes in the entire AMG process are very similar, which can be divided into three categories of calculations: (1) finding and recording the indices of the top k maximum values; (2) matrix inverse multiplication by vector; (3) multiplication, addition and subtraction between vectors and matrices. Therefore, the present invention makes full use of the similarity of computing modes and designs a flexible architecture.
[0088] Figure 2 The second structural diagram of the algebraic multigrid storage and computing integrated hardware and software acceleration system provided by the present invention is as follows: Figure 2 As shown in Figure 1, it contains five components: AGG module, ASPR module, AC module, Controller and Global Buffer, which can be reused by all operations in AMG. Among them, Global Buffer is used to provide the matrix fine grid matrix A and the inverse matrix of the diagonal matrix corresponding to the fine grid matrix , constant vector b and receives the approximate solution x calculated each time. The Controller is used to control the data flow between the four parts of AGG, AC, ASPR and Global Buffer. The AGG module is used to implement the aggregation process in AMG. The ASPR module is used to implement the functions of constructing the smoothing operator S, interpolation operator P, restriction operator R, coarse grid matrix Ac in AMG, as well as pre-smoothing, calculating the residual and restricting it to the coarse grid, interpolating and correcting the fine grid approximate solution, and post-smoothing. The AC module implements the operation of solving the coarse grid equation, which can be used to eliminate low-frequency errors and solve the limitations of solving at the fine grid layer.
[0089] Most operations in AMG involve various matrix operations, but the mesh coarsening part through aggregation does not involve any matrix operations. In order to implement such irregular operations, the present invention designs a special module based on the characteristics of storage (Content-addressable memory, CAM) search, such as Figure 2This module is shown in the AGG module in [1]. This module is used to implement the aggregation process in AMG, obtain the edge weights of the adjacency graph corresponding to the fine grid matrix, aggregate the points connected by the first k edges with larger weights into a coarse point, and finally aggregate all points in the adjacency graph corresponding to the fine grid matrix into a coarse point. This module consists of four comparison units (CUs), an input buffer, an output buffer, and three registers: Index, Value, and Flag. The lengths of these three registers are k, k, and n, respectively (k is the size of each aggregation, and the matrix size is n×n). The Index and Value registers are used to store the index and value of the aggregated nodes, and the Flag register is used to mark the index of the nodes that have been aggregated throughout the process to prevent repeated aggregation.
[0090] In order to reduce the number of data moves and writes to the storage and computing integrated device, thereby reducing the impact of the poor write endurance of the storage and computing integrated device on the acceleration of AMG, the present invention proposes a new mapping strategy. This mapping strategy effectively utilizes the characteristics of different frequencies of operands used in the entire operation process, and fixes the matrices A, S, P, and R on the four MACcrossbars of the ASPR module (the structure of AMC, SMC, PMC and RMC is the same). In order to further reduce the overhead, the present invention also Compressed storage, and b and Also fixed on the MAC crossbar. In the grid hierarchy construction stage, the matrix A is used to construct the tentative interpolation T and S, and A, S, b and Fixed, only T needs to be moved to construct P and R. Then, P and R are fixed, and R and the intermediate result R×A are moved again to obtain Ac. In the grid level execution stage, the initial approximate solution x of the fine grid matrix is moved to obtain the pre-smoothed fine grid matrix approximate solution x1. Then x1 is moved to obtain the residual r1 of the fine grid matrix approximate solution. Then r1 is moved to obtain the residual r2 of the coarse grid matrix approximate solution. r2 is moved to obtain the error e2 of the coarse grid matrix approximate solution. Then e2 is moved to obtain the approximate solution x2 after the fine grid matrix correction. Finally, only x2 is moved to obtain the post-smoothed fine grid matrix approximate solution x.
[0091] Figure 3 The data handling process diagram of the algebraic multigrid storage and computing integrated hardware and software acceleration system provided by the present invention is as follows: Figure 3 As shown in the figure, it can be seen that after adopting the new mapping strategy, the amount of data transported is greatly reduced, and the number of writes is also reduced.
[0092] The algebraic multigrid storage and computing integrated hardware and software acceleration system provided by the present invention has the following advantages: (1) It breaks through the limitations of the traditional von Neumann architecture and achieves fast read access to data, thereby accelerating AMG.
[0093] (2) A reusable architecture is proposed, which can be reused by all computing operations in AMG, thus solving the problems of high hardware overhead and low utilization.
[0094] (3) Utilize the search characteristics of CAM to select the first k larger values, and then aggregate the points connected by the first k edges with larger weights into a coarse point, thereby realizing the process of aggregating fine points into coarse points in AMG.
[0095] (4) Based on the different frequencies of operands in the operation process, the operands with higher frequencies are fixed on the MAC Crossbar. In order to further reduce the overhead, the operands are also fixed on the MAC Crossbar. Compressed storage is performed.
[0096] The proposed algebraic multigrid memory-computation integrated hardware and software acceleration system, AmgR, overcomes the limitations of the traditional von Neumann architecture, enabling fast data read access and thus significantly accelerating AMG. To evaluate the practical effectiveness of the proposed architecture, NeuroSim was used as a simulator for most hardware components (including the ADC, MAC crossbar, and DAC), and NVSim was used to model the write energy consumption and write latency of the memory-computation integrated device. Comparative tests were conducted on CPU and GPU platforms using a CPU solver (HYPRE) and a GPU solver (AmgX), the most widely used AMG software packages on their respective platforms. HYPRE 2.22.1 was run on an AMD 2nd EPYC 7702 server (64 cores, 200W power consumption), while AmgX 2.0.0 was run on an NVIDIA Tesla A100 (40GB of video memory, 250W power consumption). To validate the generalizability of the proposed method, tests were conducted on over 800 Suitesparse matrices from various fields, including circuit simulation and reservoir simulation.
[0097] Figure 4 The performance comparison chart of the algebraic multigrid storage and computing integrated hardware and software acceleration system provided by the present invention and the GPU solver (AmgX) and CPU solver (HYPRE) is as follows: Figure 4 As shown in the figure, the performance of over 800 matrices from SuiteSparse was compared on different platforms, using AmgX as a benchmark. It was found that AmgR achieved an average performance improvement of one order of magnitude over HYPRE, and an average improvement of two orders of magnitude over AmgX.
[0098] Figure 5The energy consumption comparison chart of the algebraic multigrid storage and computing integrated hardware and software acceleration system and the GPU solver (AmgX) provided by the present invention is as follows: Figure 5 As shown in Figure 2, AmgR reduces energy consumption by an average of 3 orders of magnitude compared to the GPU solver (AmgX).
[0099] Figure 6 The energy consumption comparison chart of the algebraic multigrid storage and computing integrated hardware and software acceleration system provided by the present invention and the CPU solver (HYPRE) is as follows: Figure 6 As shown in Figure 3, AmgR reduces energy consumption by 2 orders of magnitude on average compared to the CPU solver (HYPRE).
[0100] Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented using software plus a necessary general-purpose hardware platform, or of course, hardware. Based on this understanding, the essence of the above technical solution, or the portion that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a magnetic disk, or an optical disk, and includes a number of instructions for causing a computer device (such as a personal computer, server, or network device) to execute the methods described in each embodiment or certain portions of the embodiments.
[0101] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention.
Claims
1. An algebraic multigrid storage and computing integrated hardware and software acceleration system, characterized in that: include: AGG module, ASPR module, AC module; The AGG module is used to implement the aggregation operation in the AMG algorithm; The ASPR module is used to implement multiplication, addition and subtraction operations between matrices and vectors in the AMG algorithm; The AC module is used to implement the matrix inverse multiplication operation in the AMG algorithm; The AGG module, ASPR module and AC module all implement data calculation and access based on storage and computing integrated devices.
2. The algebraic multigrid storage and computing integrated hardware and software acceleration system according to claim 1, characterized in that: The AGG module includes: An input buffer, a plurality of comparison units, a first register, a second register, a third register, and an output buffer; The input buffer is used to store the fine grid matrix; The comparison unit is used to perform a clustering operation on the fine grid matrix based on a storage and computing integrated device; The first register is used to store the index of the node gathered in each gathering; The second register is used to store the values of the nodes gathered in each gathering; The third register is used to update and mark the indexes of the nodes that have been gathered in the gathering operation based on the indexes of the nodes gathered in each gathering operation; The output buffer is used to determine the clustered nodes in the fine grid matrix based on the indexes of the nodes clustered in each clustering, and send the clustered nodes to the ASPR module.
3. The algebraic multigrid storage and computing integrated hardware and software acceleration system according to claim 1, characterized in that: The ASPR module is used to: Construct smoothing operators, interpolation operators, restriction operators, and coarse grid matrices; Smooth before proceeding; Perform residual calculations; constraining the residual to the coarse grid matrix; Interpolate and correct fine grid matrix approximate solutions; Smooth after proceeding.
4. The algebraic multigrid storage and computing integrated hardware and software acceleration system according to claim 3, characterized in that: The ASPR module includes: A first interconnection module, a second interconnection module, a third interconnection module, and a fourth interconnection module; The first interconnection module is used to construct and store the smoothing operator and the coarse grid matrix based on the storage and computing integrated device to perform residual calculation; The second interconnection module is used to construct and store the interpolation operator and the restriction operator based on the storage and computing integrated device, and perform front smoothing and back smoothing; The third interconnection module is used to construct the coarse grid matrix based on the storage and computing integrated device, and interpolate and correct the fine grid matrix approximate solution; The fourth interconnection module is used to limit the residual to the coarse grid matrix based on the storage and computing integrated device.
5. The algebraic multigrid storage and computing integrated hardware and software acceleration system according to claim 4, characterized in that: The constructing and storing the smoothing operator and the coarse grid matrix and performing residual calculation includes: constructing the smoothing operator based on the fine grid matrix, the inverse matrix of the diagonal matrix corresponding to the fine grid matrix, and the identity matrix of the fine grid matrix; constructing the coarse grid matrix based on the fine grid matrix, the interpolation operator and the restriction operator; Residual calculation is performed based on the fine grid matrix, the pre-smoothed fine grid matrix approximate solution and the constant vector.
6. The algebraic multigrid storage and computing integrated hardware and software acceleration system according to claim 4, characterized in that: The constructing and storing the interpolation operator and the restriction operator, and performing front smoothing and back smoothing, comprises: Based on the smoothing operator and the tentative interpolation, construct the interpolation operator; Based on the interpolation operator, construct the restriction operator; Pre-smoothing and post-smoothing are performed based on the smoothing operator, the inverse matrix of the diagonal matrix corresponding to the fine grid matrix, the initial approximate solution of the fine grid matrix, the approximate solution of the fine grid matrix after pre-smoothing and the constant vector.
7. The algebraic multigrid storage and computing integrated hardware and software acceleration system according to claim 4, characterized in that: The interpolation and correction of the fine grid matrix approximate solution includes: Based on the interpolation operator and the error between the coarse grid matrix approximate solution, the fine grid matrix approximate solution is interpolated and corrected.
8. The algebraic multigrid storage and computing integrated hardware and software acceleration system according to claim 4, characterized in that: The step of limiting the residual to the coarse grid matrix comprises: Based on the constraint operator, the residual is constrained to the coarse grid matrix.
9. The algebraic multigrid storage and computing integrated hardware and software acceleration system according to claim 1, characterized in that: The AC module is used to: Store the coarse grid matrix and calculate the error based on the storage and computing integrated device.
10. The algebraic multigrid storage and computing integrated hardware and software acceleration system according to any one of claims 1 to 9, characterized in that: The system further comprises: Global cache module, control module; The global cache module is used to send a fine grid matrix, an inverse matrix of a diagonal matrix corresponding to the fine grid matrix and a constant vector to the AGG module, and receive a result output by the ASPR module; The control module is used to control the data flow between the AGG module, the ASPR module, the AC module and the global cache module.