GPU acceleration LU algorithm of CSC format sparse matrix in power system
By reshaping the sparse matrix in the power system using the CSC format and combining it with the parallel LU decomposition algorithm, the bottleneck of GPU computing performance in traditional methods is solved, realizing real-time simulation and efficient computing of large-scale power grids.
Patent Information
- Application Number
- CN202610014553.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-01-07
- Publication Date
- 2026-04-24
AI Technical Summary
Traditional CPU-based sparse matrix computation methods in power systems are too time-consuming when processing large-scale power grids, making it difficult to meet the needs of real-time analysis and decision-making. Furthermore, traditional sparse formats exhibit memory access mismatch and low parallelism on GPUs, resulting in the GPU's computing power not being fully utilized.
The organization of sparse matrices in GPU memory is reshaped using the CSC format. Combined with the parallel LU decomposition algorithm, fine-grained parallel symbol analysis is used to predict the filling pattern and dynamic task scheduling to optimize the data structure to adapt to the GPU architecture, thereby achieving load balancing and efficient memory access.
It significantly improves computing performance, achieves peak memory bandwidth utilization, solves the thread divergence problem, increases computing speed by an order of magnitude, ensures the reliability and scalability of simulation results, and supports real-time simulation of large-scale power grids.
Smart Images

Figure CN121918876A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of fast solution technology for sparse matrices in power systems, and in particular to a GPU-accelerated LU algorithm for CSC-formatted sparse matrices in power systems. Background Technology
[0002] As new power systems transition towards a high proportion of renewable energy and power electronic devices, their dynamic behavior exhibits unprecedented complexity and strong nonlinearity, posing a severe challenge to transient stability simulation. Traditional CPU-based serial computing simulation methods are too time-consuming when handling ultra-large-scale power grids with tens of thousands of nodes or more, failing to meet the needs of real-time analysis and decision-making, and becoming a core bottleneck restricting the development of smart grids. In transient simulation, each Newton iteration requires solving a large-scale sparse linear equation system, whose computational cost can account for more than 80% of the total time consumption. LU decomposition in direct methods has become the preferred algorithm due to its numerical stability and adaptability to various computational scenarios. In recent years, general-purpose graphics processing units (GPUs), with their massively parallel architecture and ultra-high memory bandwidth, have provided a revolutionary solution to accelerate this computationally intensive task.
[0003] However, the Jacobian matrix of a power system exhibits a highly irregular distribution of non-zero elements, causing traditional LU decomposition based on Compressed Sparse Row (CSR) or Column (CSC) formats to encounter severe performance bottlenecks on GPUs. Irregular memory access patterns lead to thread branch divergence and low memory bandwidth utilization, while dynamic padding further increases the unpredictability of the data structure. The inherent serial dependency in the triangulation stage further limits the exploitation of parallelism. These factors prevent the direct porting of traditional algorithms from fully leveraging the powerful computing capabilities of GPUs. Summary of the Invention
[0004] Purpose of the invention: In order to overcome the shortcomings of the prior art, the present invention provides a GPU-accelerated LU algorithm for CSC format sparse matrices in power systems. By constructing a variant CSC format, the data organization in GPU memory is reshaped. This format is deeply coupled with a tailored parallel LU decomposition algorithm, adopts a fine-grained parallel symbolic analysis prediction filling mode, achieves load balancing of numerical decomposition based on dynamic task scheduling, and reconstructs the triangulation process to adapt to the parallel architecture of the GPU.
[0005] Technical solution: The GPU-accelerated LU algorithm for CSC-formatted sparse matrices in power systems provided by this invention includes the following steps: S1. Compress and store the input sparse matrix in column-major order as CSC format; S2. Based on the CSC format stored above, implement a numerical algorithm for LU decomposition suitable for sparse matrices; S3. Implement the parallelizable part of the LU decomposition numerical algorithm on the GPU and perform parallel design; S4. Timing for solving the problem.
[0006] Furthermore, S1 specifically refers to: Given a list of triplets (i, j, val) of non-zero elements of a sparse matrix, iterate through all triplets and increment col_count[j] for each element to count the number of non-zero elements in each column. Then, for j from 0 to n-1, increment col_ptr[j+1] = col_ptr[j] + col_count[j] to obtain col_ptr[j], which is the column pointer array that stores the position of the first non-zero element in each column in the array val. To populate the data, iterate through each element, obtain its insertion position `pos` in its column, and then populate the output array `row_ind[pos] = i`, `val[pos] = val`. Next, increment the column pointer to reserve space for the next element in the same column. Finally, you obtain the three arrays required for storing the matrix in CSC format. `val` records the value of a non-zero element; The column pointer array col_ptr stores the position of the first non-zero element in each column within the array val; The row index array row_ind stores the row numbers of non-zero elements.
[0007] Furthermore, S2 specifically refers to: An n*n matrix A is decomposed into the product of a lower triangular matrix L and a unit upper triangular matrix U using the LU decomposition method, i.e., A = LU. When performing LU decomposition in CSC format, the left-looking LU decomposition algorithm is used. When decomposing the k-th column, the left-looking LU only uses the information of the first k-1 columns that have been decomposed, which is suitable for a storage format that is mainly based on column access.
[0008] Furthermore, the LU decomposition numerical algorithm includes four steps: reordering, symbolic decomposition, numerical decomposition, and forward and backward iteration.
[0009] Furthermore, S3 specifically includes the following steps: Preprocessing, including sparse matrix reordering and symbolic decomposition: During reordering, a row and column permutation operation is performed on matrix A, denoted as: B = PAQ = LU. By sorting matrix A, the mapping from A to B is achieved, and the subsequent LU decomposition is performed on matrix B. After sorting, symbolic decomposition is performed to map matrix B to a new matrix C. Matrix C is a framework containing the original non-zero element positions and the filling element positions. By combining reordering and symbolic decomposition, the mapping from A to C is finally confirmed as mapAtoC. Parallelism of numerical decomposition: Based on the elimination tree generated by symbolic decomposition, the calculation of node j depends on all its child nodes. There is no mutual dependence between all nodes in the same level. Parallel processing is performed. The elimination tree is traversed in a level order to divide the numerical decomposition into multiple sequential stages. In each stage, all columns of the current stage are processed in parallel. Each column performs a left-looking operation to access its dependent predecessor column and perform corresponding numerical updates and corrections. Parallelism of the solution part: This includes solving the upper triangular sparse equation system Ly = b and the lower triangular sparse equation system Ux = y. In the CSC format, the forward solving of Ly = b and the back substitution solving of Ux = y are both executed in parallel according to the hierarchical processing order eorderL and eorderU generated by symbolic decomposition. For forward solving, each column first waits for its dependent columns to complete, then calculates the diagonal division to obtain the solution yk of the current column, and then updates the subsequent rows dependent on yk. The back substitution is performed similarly, and finally the solution of x is achieved.
[0010] Furthermore, timing codes are used to time the solution process.
[0011] Beneficial effects: Compared with the prior art, the significant advantage of this invention is that, through the innovative approach of hardware and software co-design, it completely solves the fundamental problem of mismatch between sparse matrix computation and GPU architecture, transforming the algorithm that traditionally relies on general sparse formats (such as CSC / CSR) into a dedicated computational paradigm that is highly compatible with the matrix characteristics of power systems, thereby unleashing the full potential of GPU hardware.
[0012] Specifically, this is reflected in three aspects: In terms of computing performance, the new hierarchical block CSC format greatly improves memory access efficiency through data reorganization, enabling GPU threads to load data efficiently in a merged access manner, increasing memory bandwidth utilization to the theoretical peak. At the same time, the intelligent task scheduling mechanism transforms irregular computing tasks into regular parallel operations, solving the thread divergence problem and ultimately achieving a computing speed improvement of more than an order of magnitude. In terms of user experience, the technology is completely transparent to users, and can achieve extreme computational acceleration without changing existing modeling habits. Its excellent numerical stability ensures the reliability of simulation results, and its strong scalability ensures that it can adapt to power grids of various scales, from tens of thousands to millions of nodes. In terms of industry impact, it has made real-time and even ultra-real-time accurate simulation of large-scale power grids possible for the first time, providing unprecedented computing tools for intelligent scheduling and online security analysis. At the same time, the pioneering "domain-customized sparse computing" paradigm has provided new ideas for the entire computer science community. Its technical framework is easy to transfer to other engineering fields and has broad application prospects. Attached Figure Description
[0013] Figure 1 This is a schematic diagram of the algorithm of the present invention; Figure 2 This is a comparison chart of errors in LU calculation example 1 of the present invention; Figure 3 This is a comparison chart of errors in LU calculation example 2 of the present invention; Figure 4 This is a comparison chart of errors in LU calculation example 3 of the present invention. Detailed Implementation
[0014] like Figure 1 The GPU-accelerated LU algorithm for CSC-formatted sparse matrices in the power system shown includes the following steps: S1. Compress and store the input sparse matrix in column-major order as CSC format; Specifically, the process is as follows: Input a list of triplets (i, j, val) containing non-zero elements of the sparse matrix. Iterate through all triplets, incrementing `col_count[j]` for each element to count the number of non-zero elements in each column. Then, for each j (from 0 to n-1), increment `col_ptr[j+1] = col_ptr[j] + col_count[j]`. The resulting `col_ptr[j]` is the column pointer array, storing the position of the first non-zero element in each column within the `val` array. Next, data is filled by iterating through each element, obtaining its insertion position `pos` in its column, and then filling the output array `row_ind[pos] = i, val[pos] = val`. The column pointers are then incremented to reserve positions for the next element in the same column. Finally, the three arrays required for storing the matrix in CSC format are obtained: `val` records the values of non-zero elements; the column pointer array `col_ptr` stores the position of the first non-zero element in each column within the `val` array; and the row index array `row_ind` stores the row numbers of the non-zero elements.
[0015] S2. Based on the CSC format stored above, implement a numerical algorithm for LU decomposition suitable for sparse matrices; Specifically, an n*n matrix A can be decomposed into the product of a lower triangular matrix L and a unit upper triangular matrix U using the LU decomposition method, i.e., A = LU. In CSC format, the left-looking LU decomposition algorithm is often used. When decomposing the k-th column, left-looking LU only uses the information from the first k-1 columns, making it suitable for storage formats where column access is primary.
[0016] For a sparse matrix A, its LU decomposition needs to consider the storage and computational efficiency of non-zero elements to avoid unnecessary zero-element storage. Sparse LU decomposition typically includes four steps: reordering, symbolic decomposition, numerical decomposition, and forward and backward substitution. The core steps are symbolic decomposition and numerical decomposition. The symbolic decomposition stage is used to determine the non-zero structure of L and U, while the numerical decomposition stage performs the actual numerical computation.
[0017] S3. Implement the parallelizable part of the LU decomposition numerical algorithm on the GPU and perform parallel design; Preprocessing: Before numerical decomposition, we first perform preprocessing, including sparse matrix reordering and symbolic decomposition. The purpose of reordering is to reduce the number of padding elements generated during the decomposition process. For sparse LU decomposition, a commonly used reordering method is the Approximate Minimum Decomposition (AMD) algorithm, which specifically involves performing row and column permutations on matrix A, denoted as: B = PAQ = LU By sorting matrix A, a mapping from A to B is achieved, and the subsequent LU decomposition is performed on matrix B. Symbolic decomposition is then performed after sorting to determine the non-zero structure of the decomposed sparse matrix and to mine the dependencies between data based on this new non-zero structure. This is used to estimate storage requirements and to guide the elimination process in subsequent parallel algorithms. In the specific implementation, we map matrix B to a new matrix C, where C is a framework containing the original non-zero element positions and the positions of the filled elements. Combining the reordering from A to B and the symbolic decomposition from B to C, we can finally confirm the mapping from A to C, mapAtoC. This mapping can quickly locate the non-zero element positions during the numerical decomposition stage, avoiding search overhead. More importantly, symbolic analysis generates the key for parallel execution: the hierarchical processing orders eorderL and eorderU. The core of these is to establish a data-dependent task hierarchy for the subsequent numerical decomposition process, transforming the serial triangulation process into a series of parallel task stages.
[0018] Parallelism of numerical decomposition: Based on the elimination tree generated by symbolic decomposition, the computation of node j depends on all its child nodes, and there is no mutual dependency between nodes at the same level, allowing for parallel processing. A level-order traversal of the elimination tree divides the numerical decomposition into multiple sequential stages. In each stage, all columns of the current stage are processed in parallel. For each column, a left-looking operation is performed to access its dependent predecessor columns, and corresponding numerical updates and corrections are made.
[0019] Parallelism of the solution process: The solution process of LU decomposition is divided into two parts: solving the upper triangular sparse equation system Ly = b, and solving the lower triangular sparse equation system Ux = y. In the CSC format, the forward pass to solve Ly = b and the back pass to solve Ux = y are executed in parallel according to the hierarchical processing order eorderL and eorderU generated by symbolic decomposition. For the forward pass, each column first waits for its dependent columns to complete, then calculates the diagonal division to obtain the solution yk for the current column, and then updates the subsequent rows dependent on yk. The back pass is performed similarly, ultimately solving for x.
[0020] S4. Use timing codes to time the solution.
[0021] This invention applies the LU decomposition parallel design algorithm to the power system simulation software Andes. To verify the algorithm's application in large-scale scenarios, three commonly used test cases covering scales from tens of thousands to hundreds of thousands were selected for testing. These are case13659pegase, case_ACTIVSg70k, and case_SyntheticUSA, hereinafter referred to as cases 1, 2, and 3. All three cases are selected from the MAT POWER test case library. Case 1 comes from the classic test system of the Western Electric Coordinating Committee (WECC) of the United States, while cases 2 and 3 are both selected from the MAT POWER test case library, based on the European high-voltage transmission network and the national power grid topology of the United States, respectively. Basic information for each case is shown in Table 1.
[0022] Table 1 Basic Information Table for Different Examples
[0023] The simulation times for each example are shown in Table 2.
[0024] Table 2 Simulation schedule for each example
[0025]
[0026] Where 1 represents the part of the forward and backward iterations solution that uses the GPU, and 0 represents the part of the forward and backward iterations solution that does not use the GPU.
[0027] like Figure 2-4 As shown: Figure 2 The examples are relatively small (794-order matrices), and the error curves of the four algorithm configurations (CSC_LU_GPU_1, CSC_LU_GPU_0, CSR_LU_GPU_1, and CSR_LU_GPU_0) largely overlap. This indicates that for small-scale problems, whether or not the CSC or CSR scheme is used, and whether or not GPU acceleration is enabled for the forward and backward subtraction parts, has no significant impact on numerical accuracy, reflecting the algorithm's good numerical stability on smaller matrices.
[0028] Figure 3 The example matrix is of medium size (31411th order matrix), and the error curves of the four algorithms remain largely consistent with no significant separation. This indicates that in medium-sized systems, different storage formats (CSC / CSR) and GPU acceleration strategies have little impact on the numerical error of LU decomposition. This further verifies the reliability and numerical robustness of the algorithm in medium-sized power grids.
[0029] Figure 4 The example matrix is the largest (177422-order matrix), and the error curves of the four algorithms still highly overlap. Even with large-scale sparse matrices, neither the CSC nor CSR formats, nor whether GPU acceleration is used for forward and backward iteration, introduce significant differences in numerical error. This demonstrates that the proposed algorithm can maintain high numerical accuracy in large-scale power grid simulations and possesses good scalability and stability.
Claims
1. A GPU-accelerated LU algorithm for CSC-formatted sparse matrices in power systems, characterized in that, Includes the following steps: S1. Compress and store the input sparse matrix in column-major order as CSC format; S2. Based on the CSC format stored above, implement a numerical algorithm for LU decomposition suitable for sparse matrices; S3. Implement the parallelizable part of the LU decomposition numerical algorithm on the GPU and perform parallel design; S4. Timing for solving the problem.
2. The GPU-accelerated LU algorithm for CSC-formatted sparse matrices in power systems according to claim 1, characterized in that, S1 specifically refers to: Given a list of triplets (i, j, val) of non-zero elements of a sparse matrix, iterate through all triplets and increment col_count[j] for each element to count the number of non-zero elements in each column. Then, for j from 0 to n-1, increment col_ptr[j+1] = col_ptr[j] + col_count[j] to obtain col_ptr[j], which is the column pointer array that stores the position of the first non-zero element in each column in the array val. To populate the data, iterate through each element, obtain its insertion position `pos` in its column, and then populate the output array `row_ind[pos] = i`, `val[pos] = val`. Next, increment the column pointer to reserve space for the next element in the same column. Finally, you obtain the three arrays required for storing the matrix in CSC format. `val` records the value of a non-zero element; The column pointer array col_ptr stores the position of the first non-zero element in each column within the array val; The row index array row_ind stores the row numbers of non-zero elements.
3. The GPU-accelerated LU algorithm for CSC-formatted sparse matrices in power systems according to claim 2, characterized in that, S2 specifically refers to: An n*n matrix A is decomposed into the product of a lower triangular matrix L and a unit upper triangular matrix U using the LU decomposition method, i.e., A = LU. When performing LU decomposition in CSC format, the left-looking LU decomposition algorithm is used. When decomposing the k-th column, the left-looking LU only uses the information of the first k-1 columns that have been decomposed, which is suitable for a storage format that is mainly based on column access.
4. The GPU-accelerated LU algorithm for CSC-formatted sparse matrices in power systems according to claim 1, characterized in that: The numerical algorithm for LU decomposition consists of four steps: reordering, symbolic decomposition, numerical decomposition, and forward and backward iteration.
5. The GPU-accelerated LU algorithm for CSC-formatted sparse matrices in power systems according to claim 3, characterized in that, S3 specific Includes the following steps: Preprocessing, including sparse matrix reordering and symbolic decomposition: During reordering, a row and column permutation operation is performed on matrix A, denoted as: B = PAQ = LU. By sorting matrix A, the mapping from A to B is achieved, and the subsequent LU decomposition is performed on matrix B. After sorting, symbolic decomposition is performed to map matrix B to a new matrix C. Matrix C is a framework containing the original non-zero element positions and the filling element positions. By combining reordering and symbolic decomposition, the mapping from A to C is finally confirmed as mapAtoC. Parallelism of numerical decomposition: Based on the elimination tree generated by symbolic decomposition, the calculation of node j depends on all its child nodes. There is no mutual dependence between all nodes in the same level. Parallel processing is performed. The elimination tree is traversed in a level order to divide the numerical decomposition into multiple sequential stages. In each stage, all columns of the current stage are processed in parallel. Each column performs a left-looking operation to access its dependent predecessor column and perform corresponding numerical updates and corrections. Parallelism of the solution part: This includes solving the upper triangular sparse equation system Ly = b and the lower triangular sparse equation system Ux = y. In the CSC format, the forward solving of Ly = b and the back substitution solving of Ux = y are both executed in parallel according to the hierarchical processing order eorderL and eorderU generated by symbolic decomposition. For forward solving, each column first waits for its dependent columns to complete, then calculates the diagonal division to obtain the solution yk of the current column, and then updates the subsequent rows dependent on yk. The back substitution is performed similarly, and finally the solution of x is achieved.
6. The GPU-accelerated LU algorithm for CSC-formatted sparse matrices in power systems according to claim 1, characterized in that: Use timing codes to time the solution.
