Sparse triangular matrix heterogeneous parallel solution method and system for power flow calculation
By adopting the heterogeneous parallel solution method of sparse triangular matrix in power flow calculation, the problem of inefficient calculation in traditional algorithms in large-scale power systems is solved, more efficient calculation and better resource utilization are achieved, and trend calculation is improved Accuracy and real-time.
Patent Information
- Application Number
- CN202411487280.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-24
- Publication Date
- 2025-02-14
- Estimated Expiration
- 2044-10-24
AI Technical Summary
The traditional SpTRSV algorithm has inefficient computing and insufficient memory usage in large-scale power system trend computing, and has failed to make full use of the parallel computing capabilities of modern high-performance computing platforms.
The heterogeneous parallel solution method of sparse triangle matrix is adopted, and the parallel processing and allocation of matrix blocks are realized by constructing directed acyclic graphs, hierarchical processing, block processing and flexible local scheduling strategies, and the computing resources of the distributed system are fully utilized.
It improves the accuracy and real-time performance of trend computing in large-scale power systems, significantly reduces the overall computing time, and optimizes the scalability of data access mode and parallel computing.
Smart Images

Figure CN119006221B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field related to distributed computing, and in particular to a sparse triangular matrix heterogeneous parallel solution method and system for power flow calculation. Background Art
[0002] The statements in this section merely provide background information related to the present invention and do not necessarily constitute prior art.
[0003] As a key link in power system analysis, power flow calculation is of great significance for evaluating the steady-state behavior of power systems and guiding system planning and operation. Power flow calculation aims to determine the steady-state operating characteristics of power systems, such as node voltage, branch current, and power flow, under given network structure, load, and generation conditions. Traditional power flow calculation methods, such as the Newton-Raphson method and the Gauss-Seidel method, face the challenges of low computational efficiency and insufficient memory usage when solving large-scale power systems. In particular, in the Newton-Raphson method, each step requires solving a large set of linear equations represented by a Jacobian matrix.
[0004] The Jacobian matrix is usually a sparse matrix. Through LU decomposition, the original problem is transformed into solving two smaller triangular linear equations. Solving these triangular linear equations is a key step in power flow calculation and also the bottleneck of calculation. In order to effectively solve these problems, an efficient sparse matrix solving algorithm is needed.
[0005] The SpTRSV (Sparse Triangular Solve) algorithm is an efficient algorithm specifically used to solve sparse triangular matrix equations. The algorithm uses the sparsity of the matrix and only calculates the necessary non-zero elements, greatly reducing the amount of calculation and memory usage. In solving large-scale sparse linear equations, the SpTRSV algorithm demonstrates its unique advantages, especially in high-performance computing that requires efficient use of computing resources and memory space, and has broad application prospects.
[0006] However, with the continuous growth of the scale of power systems, the traditional serial SpTRSV algorithm can no longer meet the requirements of real-time performance and computational efficiency. In addition, on modern high-performance computing platforms, especially for the architecture of the new generation of domestic supercomputers, the existing SpTRSV algorithm does not fully utilize the parallel computing capabilities of the hardware. This makes it difficult for the SpTRSV algorithm to play its advantages such as high scalability and low storage requirements on the Shenwei architecture.
[0007] Distributed systems, taking the new generation of Sunway supercomputer system as an example, the new generation of Sunway supercomputer system is built with the new generation of Sunway multi-core processor SW26010pro. Each Sunway multi-core chip integrates 6 core groups, each of which contains a master core and 64 slave cores, forming an efficient computing network. Each slave core has an independent local data memory (LDM) and realizes fast data exchange through advanced communication mechanisms, providing hardware support for large-scale parallel computing.
[0008] Although there are some basic parallel algorithms and software libraries on the new generation of Sunway supercomputers, there is still a lack of parallel algorithms that can efficiently and fully utilize computing resources to solve sparse triangular matrices. Summary of the invention
[0009] In order to overcome the deficiencies of the above-mentioned prior art, the present invention provides a sparse triangular matrix heterogeneous parallel solution method and system for power flow calculation. The scheme of the present invention makes full use of distributed system computing resources, improves the accuracy and real-time performance of large-scale power system power flow calculation, and provides strong technical support for the planning and operation of the power system.
[0010] In order to achieve the above object, the present invention adopts the following technical solution:
[0011] In a first aspect, the present invention provides a sparse triangular matrix heterogeneous parallel solution method for power flow calculation, comprising:
[0012] Constructing a directed acyclic graph according to the dependencies between equations in the sparse triangular matrix of the power flow calculation; wherein each equation serves as a task node in the directed acyclic graph;
[0013] The task nodes having dependency relationships in the directed acyclic graph are processed in layers to obtain layers for parallel processing;
[0014] Divide the layers into blocks according to the number of non-zero elements in each layer to obtain matrix blocks;
[0015] Based on the flexible locality scheduling strategy, according to the computing power of the slave core cluster where the parent node is located, it is determined whether the current scheduling matrix block is scheduled to the slave core adjacent to its parent node, and the matrix block is allocated in combination with the polling scheduling strategy;
[0016] Based on the parallel processing results of each slave matrix block, a sparse triangular solution result is obtained.
[0017] In a second aspect, the present invention provides a sparse triangular matrix heterogeneous parallel solution system for power flow calculation, comprising:
[0018] A construction module is configured to: construct a directed acyclic graph according to the dependencies between equations in a sparse triangular matrix for power flow calculation; wherein each equation serves as a task node in the directed acyclic graph;
[0019] A layering module is configured to: perform layered processing on the task nodes having dependency relationships in the directed acyclic graph to obtain layers for parallel processing;
[0020] A block module is configured to: perform block processing according to the number of non-zero elements in each layer to obtain matrix blocks;
[0021] The scheduling module is configured to: determine whether the current scheduling matrix block is scheduled to the slave core adjacent to its parent node based on the flexible locality scheduling strategy and the computing power of the slave core cluster where the parent node is located, and allocate the matrix block in combination with the polling scheduling strategy;
[0022] The solution module is configured to obtain a sparse triangular solution result based on the parallel processing result of each slave core matrix block.
[0023] One or more of the above technical solutions have the following beneficial effects:
[0024] In the present invention, the sparse triangular solution matrix is constructed in layers and processed in blocks, which optimizes the data access mode and improves the scalability of parallel computing. The round-robin scheduling strategy and the flexible locality scheduling strategy are used to minimize the communication delay across the slave core cluster, which significantly reduces the overall calculation time. The scheme of the present invention improves the accuracy and real-time performance of large-scale power system flow calculations, and provides strong technical support for the planning and operation of power systems.
[0025] Advantages of additional aspects of the present invention will be given in part in the following description, and in part will become obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] The accompanying drawings in the specification, which constitute a part of the present invention, are used to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute improper limitations on the present invention.
[0027] Figure 1 The parallel mode in the first embodiment of the present invention adopts the master-slave collaborative parallel mode;
[0028] Figure 2 The figure is a schematic diagram of operation steps performed by the master core and the slave core in the first embodiment of the present invention. DETAILED DESCRIPTION
[0029] It should be noted that the following detailed descriptions are exemplary and are intended to provide further explanation of the present invention. Unless otherwise specified, all technical and scientific terms used herein have the same meanings as those commonly understood by those skilled in the art to which the present invention belongs.
[0030] It should be noted that the terms used herein are for describing specific embodiments only and are not intended to be limiting of exemplary embodiments according to the present invention.
[0031] In the absence of conflict, the embodiments of the present invention and the features of the embodiments may be combined with each other.
[0032] Embodiment 1
[0033] This embodiment discloses a sparse triangular matrix heterogeneous parallel solution method for power flow calculation, including:
[0034] According to the dependency relationship between equations in the sparse triangular matrix of the power flow calculation, a task graph, i.e., a directed acyclic graph, is constructed; wherein each equation serves as a task node in the directed acyclic graph;
[0035] The directed acyclic graph is topologically sorted to obtain a new task processing sequence; tasks are hierarchically processed according to the topological sorting result. Tasks within a layer have no dependencies, while tasks between layers have dependencies, thus forming a task hierarchy structure for parallel processing.
[0036] Block processing is performed according to the number of non-zero elements in each task layer to obtain matrix blocks;
[0037] Based on the flexible locality scheduling strategy, according to the computing power of the slave core cluster where the parent node is located, it is determined whether the current scheduling matrix block is scheduled to the slave core adjacent to its parent node, and the matrix block is allocated in combination with the polling scheduling strategy;
[0038] Based on the parallel processing results of the matrix blocks by each slave core cluster, a sparse triangular solution result is obtained.
[0039] This embodiment takes the implementation of sparse triangular solution for power flow calculation on the new generation supercomputer system of Sunway as an example for detailed description.
[0040] Step 1: Linearization of the power system and construction of the Jacobian matrix.
[0041] Step 11: Establish the nonlinear equations for power system flow calculation:
[0042]
[0043] in, P i and Q iThe nodes are i The injected active power and reactive power, V i and V j Is a node i and j The voltage amplitude, d i and d j are their corresponding voltage phase angles, G ij and B ij The nodes are i and j The conductance and susceptance between them.
[0044] Step 12: Use Taylor series to expand each equation and convert the nonlinear system of equations into a linear system of equations:
[0045]
[0046] in, ΔP i and ΔQ i are the deviations of active power and reactive power, respectively, and ΔV i and Dd i is the change in voltage amplitude and phase angle.
[0047] Calculate the coefficient matrix of the linearized equations above, namely the Jacobian matrix J, which is a matrix of the first-order partial derivatives of the equations. The form of the Jacobian matrix is as follows:
[0048]
[0049] Step 13: Establish a linear system of equations based on the Jacobian matrix and the deviation vector JΔX=-ΔF ;in, ΔX Contains the changes in voltage amplitude and phase angle, ΔF Includes deviations in active power and reactive power.
[0050] Step 2: Jacobian matrix LU break down.
[0051] use LU Decomposition Decompose the matrix J into a lower triangular matrix L and an upper triangular matrix U The product of J=LU ; Then, the original system of equations becomes LUΔx=-f .
[0052] Step 3: Parallel solution of sparse matrix
[0053] Specifically, it is carried out in 4 steps, as Figure 1 shown. The sparse triangular linear equations can be represented in two common forms: the lower triangular system and the upper triangular system.
[0054] They can be expressed as follows:
[0055] (1) Upper triangular system ( Ux = b ) In the upper triangular matrix U , all superdiagonal elements (i.e., elements below the diagonal) are 0.
[0056] Specifically, if U is an × upper triangular matrix, then its element satisfies the following conditions:
[0057] If i ≤ j, then may be a non-zero value;
[0058] If i > j, then = 0;
[0059] This structure means that each unknown (except the last one) is only related to all the unknowns after it, which enables efficient solution by back substitution.
[0060]
[0061] (2) Lower triangular system ( Lx=b ) In the lower triangular matrix L , all superdiagonal elements, i.e., elements above the diagonal, are 0. Specifically, if L is an 𝑛×𝑛 lower triangular matrix, then its element satisfies the following conditions:
[0062] If i ≥ j, then may be a non-zero value;
[0063] If i < j, then = 0;
[0064] This structure means that each unknown (except the first one) is only related to all the unknowns before it, which enables efficient solution by forward substitution.
[0065]
[0066] The specific implementation steps are as follows:
[0067] Step 31: Sparse triangular matrix preprocessing and task graph construction.
[0068] Represent the sparse triangular matrix in the form of a graph, where each node represents an equation or a row in the matrix, and the edges represent the dependencies between equations. If the calculation of row i depends on the result of row j, then in the task graph, node i will be connected to node j. Traverse each row in the sparse triangular matrix, build a task node for each equation, and connect these nodes according to the dependencies; the resulting task graph should be a directed acyclic graph (DAG).
[0069] The task graph allows us to identify which nodes or equations are independent, that is, they have no direct dependencies. The graph is divided into multiple layers, each layer representing a set of nodes or equations that can be executed in parallel. Once the task graph is constructed, the next step is to topologically sort it.
[0070] Topological sorting sorts the nodes in the task graph, using in-degree-based topological sorting so that the predecessor dependent tasks of each node can be completed before its own calculation.
[0071] Kahn Algorithm:
[0072] Initialize the queue Q and the sorted node set T:
[0073] while :
[0074] Take a node v from the queue Q i , and add it to the sorted set T
[0075] for each v j Satisfy A ij ≠ 0:
[0076] indegree(v j ) ← indegree(v j ) — 1
[0077] if indegree(v j ) = 0 then Q ← Q ∪ {v j}
[0078] Reorder the rows and columns of the matrix according to T.
[0079] In the task graph, each node represents a computational task, such as a row or column of a matrix, and the edges represent the dependencies between tasks, such as v iMust be on task v j This dependency can be represented by non-zero elements in the matrix. ij ≠ 0 means the node v i Task v i Dependency node v j Task v j In order to solve the matrix in parallel, we need to ensure that all dependencies are satisfied, so we need to reorder the matrix rows and columns.
[0080] In this embodiment, 1. Construction of task dependency: In the corresponding sparse triangular matrix, rows and columns represent different tasks. A dependency graph can be constructed through the non-zero elements of the sparse triangular matrix. The nodes in the graph represent tasks, and the edges represent the dependency relationships of tasks. If A ij ≠ 0, then the task v i Dependent tasks v j, This means that when topologically sorting, the task v j Must be ranked v i Before.
[0081] 2. Initialization: Queue Q: stores all nodes with in-degree 0, that is, tasks that do not depend on other tasks. These nodes (rows) can start computing immediately because they do not depend on other tasks.
[0082] Set T: used to save the sorted task set, indicating the execution order of the tasks.
[0083] Algorithm execution process:
[0084] Take a node from Q v i : This node represents a task. All the predecessor tasks that the task depends on have been completed, so it can be added to the sorted set T and prepared for execution;
[0085] Update dependencies: Update all dependencies with v i Related tasks v j Check if A ji ≠ 0, meaning v j rely v i ,at this time, v j The in-degree of is reduced by 1, indicatingv j Prerequisites v i Already completed; if v j The in-degree becomes 0, indicating v j It can be executed in the subsequent steps, so it is added to the queue Q and the above process is repeated.
[0086] In the application, this step reflects the gradual resolution of task dependencies, that is, subsequent tasks can only be executed after all dependent tasks are completed in sequence.
[0087] 3. Reordering matrix: When the queue Q is empty, the set T stores the topological sorting results of all tasks, which provides a basis for reordering the rows and columns of the matrix.
[0088] By reordering the rows and columns of the matrix, ensuring that each task (row) precedes the dependent tasks, the matrix dependencies are explicitly handled and can be solved in parallel in topological order.
[0089] Step 32: The matrix is divided into blocks and merged row by row.
[0090] In a topological sorting manner, tasks without dependencies are grouped together to form a hierarchy. For tasks in each hierarchy, the complexity of the tasks is determined based on the number of non-zero elements, and the tasks are further grouped according to their complexity. The goal is to assign these tasks to the slave core cluster for parallel computing.
[0091] Since each slave core cluster of the new generation supercomputer of Sunway has 4 slave cores, N 簇 =4, so when performing hierarchical matrix partitioning, different grouping strategies are adopted for different situations. The specific grouping strategies are as follows:
[0092] 1) When the number of rows in the layer n ≤ N 簇 When , the rows in the layer are directly assigned to a slave core cluster. Because the number of rows in the layer is less than or equal to the number of slave cores in the slave core cluster, they can be directly executed in parallel.
[0093] 2) When the number of rows in the layer n>N 簇 When , the rows in the layer are divided into several matrix blocks according to the load balancing principle.
[0094] The L_balance strategy is adopted to further sort the rows within the layer according to the number of non-zero elements and allocate them in descending order.
[0095] Specifically, a function nonzero_elements(node) can be defined to calculate the number of nonzero elements in each row and sort the rows in the layer according to this number; then the rows are assigned to different matrix blocks in descending order to ensure that the computational load of each matrix block is as close as possible.
[0096] Use the L_balance strategy to sort the rows in the layer in descending order according to the number of non-zero elements. The purpose of this sorting is to balance the load according to the complexity of the tasks. The specific process is as follows:
[0097] For each row in the layer, count the number of its non-zero elements to form a sorted task list;
[0098] From the sorted task list, assign rows to different matrix blocks in descending order. At this time, first select the most complex row, that is, the row with the most non-zero elements, and assign it to a certain matrix block, then select the next row with higher complexity and assign them in turn. In this way, the computational load within each matrix block can be kept as balanced as possible;
[0099] When allocating, the allocation position of the next row can be determined based on the current computational load of each matrix block, that is, the cumulative complexity of the row, to ensure that the load in each matrix block is close.
[0100] Processing operations of matrix blocks after allocation: After the matrix blocks are divided, the next processing steps may include the following:
[0101] Matrix blocks are assigned to slave core clusters: Each matrix block will be assigned to one or more slave core clusters for parallel processing. There should be no dependencies between matrix blocks to ensure that these blocks can be independently executed in parallel on different core clusters.
[0102] Local solution: After each matrix block is assigned to a specific slave core cluster, it uses the parallel resources within the core cluster, such as 4 slave cores, to perform local solution.
[0103] Global communication and synchronization: After all matrix blocks have been solved, global synchronization and communication may be required to merge the final results or handle cross-layer dependencies.
[0104] In addition, when n mod N 簇 ≠0 means that the number of rows in a certain layer cannot be divided evenly by the number of slave cores in the slave core cluster. The remaining rows can be combined with the rows of the adjacent layer. When combining across layers, the remaining rows are combined with the rows of the adjacent layer into a new matrix block. During the combination process, ensure that there is no dependency within the combined row block, that is, ensure that the combined rows come from a lower level in the hierarchy, or ensure that the dependency has been processed in the previous allocation.
[0105] When the number of rows in a certain layer is too large, that is, greater than four rows, and in order to fully utilize the resources of the slave core cluster, every four rows in the layer are merged into a matrix block and split into multiple slave core clusters for execution.
[0106] Step 33: The hierarchical matrix block is transferred from the master core to the slave core cluster.
[0107] After completing the row block division, it is necessary to further distribute these matrix blocks to the slave core clusters reasonably to ensure that each slave core cluster can receive tasks fairly.
[0108] Initial task scheduling, the master core MPE is responsible for the initial task allocation. According to the task dependency graph and task grouping strategy, tasks are allocated to different slave core clusters in the core group. When allocating, data locality is given priority. For example, if the data that a task depends on already exists in a slave core cluster, the task is preferentially allocated to the same slave core cluster.
[0109] Dynamic task scheduling monitors the load of each slave core cluster in real time during the calculation process. If a slave core cluster encounters a computing bottleneck, the task allocation can be adjusted dynamically to allocate subsequent tasks to other slave core clusters with lighter loads. The scheduler runs on MPE and dynamically adjusts the task allocation through polling and load monitoring mechanisms to ensure global load balancing.
[0110] The round-robin scheduling strategy RLD allocates matrix blocks to different slave core clusters in a round-robin manner, thereby ensuring that each slave core cluster can receive tasks fairly. The general process of this strategy is as follows:
[0111] i :Initialize an index list C={C1,C2,…,C 16} and a pointer p pointing to the first element C1 of the list; C1 represents the first slave core cluster;
[0112] Initialize a load list L = {L1, L2, ..., L 16}The initial value of each element is 0, L1, L2, ..., L 16 : Represent the current load of the 1st to 16th slave core clusters respectively.
[0113] ii: Loop through the matrix row block set G={G1,G2,…,G M}, for each row block G j , get the node group G j The slave core cluster P where the parent node is located j ; Check P j Load condition L j and the load conditions of its adjacent slave core clusters.
[0114] iii: Apply the flexible locality scheduling strategy FLS:
[0115] If P j Available, select with P j Adjacent slave cluster C k , G j Assigned to C k ;
[0116] Update L k :L k =L k +workload(G j );L k is used to represent the k The load, L k The update means that the node group G j The workload is accumulated to the slave core cluster C k This allows the workload of each slave core cluster to be tracked dynamically, helping to make load balancing decisions.
[0117] If P j If there is no adjacent idle slave core cluster, a polling scheduling strategy is adopted.
[0118] It can be understood that availability and unavailability here mainly depend on whether the slave core cluster has sufficient computing resources to process the new node group and whether data locality can be maintained.
[0119] For each node i , whose parents are those nodes that precede i The node being processed, and i The computation depends on the results of these nodes. For example, if the row i Contains from j non-zero elements of , then the row j Just OK i One of the parent nodes.
[0120] ⅳ: Round Robin Scheduling Strategy RLD:
[0121] If the FLS strategy cannot be applied, the RLD strategy is used to select the slave core cluster C pointed to by the current pointer. p ;
[0122] G j Assigned to C p ;
[0123] Update L p :L p =L p +workload(G j );
[0124] Update pointer p: p=(p+1)mod |C|.
[0125] Repeat the above steps until all row blocks are allocated.
[0126] For example, assume that there are multiple node groups G1, G2, G3, and G4 that need to be assigned to 16 slave core clusters:
[0127] Allocate G1:
[0128] Assume that the parent node of G1 is located in the slave core cluster P1, and check the load L1 of P1.
[0129] If L1 is lower, select the slave core cluster C2 adjacent to P1, assign G1 to C2, and update L2: L2 = L2 + workload (G1);
[0130] If L1 is higher, select the slave core cluster C1 pointed to by the current pointer, assign G1 to C1, and update L1: L1=L1+workload(G1);
[0131] Update pointer p: p=(p+1)mod 16.
[0132] Allocate G2:
[0133] Assume that the parent node of G2 is located in the slave core cluster P2, and check the load L2 of P2;
[0134] If L2 is lower, select slave core cluster C3 adjacent to P2, assign G2 to C3, and update L3: L3= L3+workload(G2);
[0135] If L2 is higher, select the slave core cluster C2 pointed to by the current pointer, assign G2 to C2, and update L2: L2 = L2 + workload (G2);
[0136] Update pointer p: p=(p+1)mod 16.
[0137] Assign G3:
[0138] Assume that the parent node of G3 is located in the slave core cluster P3, and check the load L3 of P3;
[0139] If L3 is lower, select the slave core cluster C4 adjacent to P3, assign G3 to C4, and update L4: L4= L4+workload(G3); if L3 is higher, select the slave core cluster C3 pointed to by the current pointer, assign G3 to C3, and update L3: L3=L3+workload(G3);
[0140] Update pointer p: p=(p+1)mod 16.
[0141] Allocate G4:
[0142] Assume that the parent node of G4 is located in the slave core cluster P4, and check the load L4 of P4;
[0143] If L4 is lower, select slave core cluster C5 adjacent to P4, assign G4 to C5, and update L5: L5 = L5 + workload (G4);
[0144] If L4 is higher, select the slave core cluster C4 pointed to by the current pointer, assign G4 to C4, and update L4: L4=L4+workload(G4);
[0145] Update pointer p: p=(p+1)mod 16.
[0146] Step 34: Solve in parallel across core clusters.
[0147] After completing the matrix block scheduling to the slave core cluster, the parallel solution phase begins. This phase can be divided into the following six main steps: Figure 2 As shown:
[0148] Step 341: In the data preparation and DMA transfer stage:
[0149] For each slave cluster PE i (i=1,2,…,16), transfer data from the master core or external storage to the local storage of the slave core cluster through direct memory access DMA, and use the DMA controller to simultaneously transfer data of multiple matrix blocks to the corresponding slave core cluster, reducing the waiting time for data transmission. While transmitting data, the data that has been transferred to the local storage is calculated in advance, realizing the overlapping execution of data transmission and calculation, and reducing the total calculation time.
[0150] Step 342: In the shared memory strategy phase:
[0151] In each slave core cluster PE i Use shared memory SharedMem i To store the intermediate data and calculation results of the current task. Divide the data of the matrix block into blocks and store them in the shared memory of the slave core cluster, ensuring that each slave core PE ij All of them can efficiently access the required data, reduce data transmission across slave core clusters, and ensure that different slave core PEs are ij There will be no memory contention between them, thus preventing performance degradation caused by storage conflicts; where j is the slave core number in the slave core cluster.
[0152] Step 343: In the parallel forward / backward substitution solving phase:
[0153] For the forward substitution solution of sparse matrices, different matrix rows are assigned to different slave core clusters PE i To process, each slave core cluster processes one or more rows, ensuring that the dependencies between rows are handled correctly.
[0154] Through topological sorting, it is ensured that other rows that depend on the row can be solved only after the result of the previous row is solved. After each row is calculated, the result will be immediately passed to the next slave core cluster that depends on the row. In the backward substitution solution, for the inverse triangular structure of the matrix, the number of rows in each layer is assigned to different slave core clusters for parallel calculation. Each slave core cluster solves its assigned rows in parallel and uses the intermediate results obtained by the forward solution. The results calculated by each slave core cluster will be passed to other slave core clusters that need these results through local shared memory or RMA communication.
[0155] Step 344: In the computation and communication overlap phase:
[0156] The computation process is divided into multiple stages, each of which processes one or more matrix blocks. Based on topological sorting, the computational dependencies between matrix blocks are correctly processed. Based on the load balancing principle, the computational tasks are reasonably distributed to each slave core cluster to avoid computational bottlenecks caused by overload of some slave core clusters. While the computation is being performed, the data transmission tasks of other slave core clusters are started to further reduce the computational time by overlapping computation and communication.
[0157] Step 345: In the inter-slave core cluster communication phase:
[0158] When the calculation result of a matrix block needs to be transferred to another slave core cluster, RMA or shared memory is used for efficient communication; for data transfer between different slave core clusters, RMA communication protocol is used to achieve efficient data exchange. Within the same slave core cluster, data exchange within the matrix block is achieved through shared memory, and communication across slave core clusters is minimized to reduce latency.
[0159] Step 346: In the result merging and global synchronization phase:
[0160] After each slave core cluster completes the calculation task of its assigned matrix block, it transmits the intermediate results back to the master core or the designated slave core cluster for merging; after all slave core clusters complete their tasks, the correctness of all calculation results is ensured through a global synchronization mechanism, and the calculation results of all matrix blocks are merged into the final global solution and output to the master core or external storage.
[0161] This embodiment applies a series of core optimization technologies in the SpTRSV algorithm, including data partitioning optimization, DMA technology parallel initialization, etc. These technologies significantly improve the execution efficiency of the SpTRSV algorithm on the new generation supercomputer platform of Sunway; through intelligent scheduling and optimization strategies, the communication delay across slave core clusters is minimized, and the overall calculation time is significantly reduced; the load balancing strategy is adopted to ensure the calculation load balancing at the slave core level, slave core cluster level and between slave core clusters, and fully utilize the computing resources; through the matrix block scheduling strategy and the data distributed partitioning strategy, the data access mode is optimized, the data transmission across slave core clusters is reduced, and the delay is reduced; the scalability of parallel computing is improved, so that the SpTRSV algorithm can still maintain good scalability when processing larger-scale power systems; it is not only suitable for power system flow calculations, but also provides a parallel computing optimization idea that can be used as a reference for other scientific computing fields that require efficient sparse matrix solutions; by improving the accuracy and real-time performance of large-scale power system flow calculations, it provides strong technical support for the planning and operation of power systems.
[0162] This embodiment combines the characteristics of the SpTRSV algorithm and the Sunway architecture, greatly accelerating and improving the simulation and analysis efficiency of power system flow calculations, providing a new and efficient technical means for large-scale parallel computing platforms such as the Sunway supercomputer, and strongly supporting the solution of complex power system problems.
[0163] This embodiment proposes a multi-level grouping strategy based on a task graph, which ensures reasonable grouping and allocation of tasks by constructing a task dependency graph and performing topological sorting, thereby optimizing the efficiency of parallel computing.
[0164] This embodiment adopts the round-robin scheduling strategy RLD and the flexible locality scheduling strategy FLS, which minimizes the communication delay across the slave core clusters and significantly reduces the overall computing time.
[0165] This embodiment proposes a matrix block grouping and merging strategy to ensure balanced distribution of computing tasks among slave cores, including a polling strategy, a cross-layer combination strategy, and the like.
[0166] This embodiment adopts a load balancing strategy to ensure computing load balancing at the slave core level, slave core cluster level, and between slave core clusters, making full use of computing resources; through the matrix block scheduling strategy and data distributed partitioning strategy, the data access mode is optimized, the data transmission across slave core clusters is reduced, and the delay is reduced.
[0167] This embodiment uses DMA technology to reduce the waiting time of data transmission and realize overlapping execution of data transmission and calculation.
[0168] In the inter-slave core cluster communication stage, this embodiment adopts different communication modes within a slave core cluster and between slave core clusters. The slave core clusters use RMA for efficient communication, and the slave core cluster uses shared memory for efficient communication.
[0169] This embodiment adopts an asynchronous communication and computing overlap strategy, and overlaps computing and data transmission through an asynchronous communication mechanism to maximize the computing capability of the CPE.
[0170] The technology of this embodiment adopts a multi-level parallel strategy to solve the sparse triangular linear equations on the SW26010 pro processor, thereby comprehensively improving the parallel computing efficiency and system performance. The parallel mode adopts the master-slave collaborative parallel mode. Figure 1 shown.
[0171] When implementing parallel solution of sparse triangular matrices on the SW26010 pro processor, the master core and slave core need to work together. Specifically, the master core is responsible for overall control, scheduling, and global management of data, while the slave core is responsible for performing specific computing tasks. In the actual implementation process, the roles of the master core and slave core are clearly divided, and each is responsible for different tasks. The following are the detailed responsibilities and operation steps of the master core and slave core in this process, such as Figure 2 shown.
[0172] Embodiment 2
[0173] The purpose of this embodiment is to provide a sparse triangular matrix heterogeneous parallel solution system for power flow calculation, including:
[0174] A construction module is configured to: construct a directed acyclic graph according to the dependencies between equations in a sparse triangular matrix for power flow calculation; wherein each equation serves as a task node in the directed acyclic graph;
[0175] A layering module is configured to: perform layered processing on the task nodes having dependency relationships in the directed acyclic graph to obtain layers for parallel processing;
[0176] A block module is configured to: perform block processing according to the number of non-zero elements in each layer to obtain matrix blocks;
[0177] The scheduling module is configured to: determine whether the current scheduling matrix block is scheduled to the slave core adjacent to its parent node based on the flexible locality scheduling strategy and the computing power of the slave core cluster where the parent node is located, and allocate the matrix block in combination with the polling scheduling strategy;
[0178] The solution module is configured to obtain a sparse triangular solution result based on the parallel processing result of each slave core matrix block.
[0179] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with this embodiment can be implemented in electronic hardware or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0180] Although the above describes the specific implementation mode of the present invention in conjunction with the accompanying drawings, it is not intended to limit the scope of protection of the present invention. Those skilled in the art should understand that various modifications or variations that can be made by those skilled in the art on the basis of the technical solution of the present invention without creative work are still within the scope of protection of the present invention.
Claims
1. A sparse triangular matrix heterogeneous parallel solution method for power flow calculation, characterized in that: include: Constructing a directed acyclic graph according to the dependencies between equations in the sparse triangular matrix of the power flow calculation; wherein each equation serves as a task node in the directed acyclic graph; Perform topological sorting on the directed acyclic graph, perform task hierarchical processing based on the topological sorting result, and obtain the task hierarchy for parallel processing; Block processing is performed according to the number of non-zero elements in each task level to obtain matrix blocks; Based on the flexible locality scheduling strategy, according to the computing power of the slave core cluster where the parent node is located, it is determined whether the current scheduling matrix block is scheduled to the slave core adjacent to its parent node, and the matrix block is allocated in combination with the polling scheduling strategy, specifically: Initialize the index list of the slave cluster, a pointer to the first element in the list, and the load list of the slave cluster; Loop through the matrix row block set, and for each matrix row block, obtain the slave core cluster where the parent node of the matrix row block is located; Check the load of the slave core cluster where the parent node of the matrix row block is located and the load of its adjacent slave core clusters; If the slave core cluster where the parent node of the matrix row block is located is available, the corresponding matrix row block is allocated to the slave core cluster adjacent to the slave core cluster where the parent node is located; If the slave core cluster where the parent node of the matrix row block is located is unavailable, the round-robin scheduling strategy is used to allocate the matrix row block; Based on the parallel processing results of each slave matrix block, a sparse triangular solution result is obtained.
2. The sparse triangular matrix heterogeneous parallel solution method for power flow calculation according to claim 1 is characterized in that: The task nodes in the directed acyclic graph are sorted based on the in-degree Kahn algorithm, specifically: Initialize the queue Q and store the task nodes that do not depend on other tasks in the queue Q; Take the task node from the queue Q v i , the task node v i Join the sorted set T and perform a query on all nodes with the task v i Related task nodes v j Check if the task node v j Dependent task nodes v i , then the task node v j The in-degree of the task node is reduced by one. v j If the in-degree is zero, the task node v j Join queue Q and repeat the above steps.
3. The sparse triangular matrix heterogeneous parallel solution method for power flow calculation according to claim 1 is characterized in that: According to the number of non-zero elements in each layer, the matrix blocks are obtained by block processing, specifically: Determine the number of slave nuclei in the slave nucleus cluster; If the number of rows in the layer is not greater than the number of slave cores in the slave core cluster, the rows in the layer are assigned to a slave core cluster for calculation processing; If the number of rows in the layer is greater than the number of slave cores in the slave core cluster, calculate the number of non-zero elements in each row of the layer, sort the rows in the layer according to the calculated number of non-zero elements, assign the rows to different matrix blocks according to the sorting results, and assign different matrix blocks to multiple slave core clusters for parallel processing.
4. The sparse triangular matrix heterogeneous parallel solution method for power flow calculation according to claim 3 is characterized in that: If the number of rows in a layer cannot divide the number of slave cores in a slave core cluster, the remaining rows that cannot be divided evenly are combined with the rows in the connected layer to form a new matrix block; the formed new matrix block has no computational dependency.
5. The sparse triangular matrix heterogeneous parallel solution method for power flow calculation according to claim 1, characterized in that: The round-robin scheduling strategy is used to allocate matrix row blocks, specifically: Select the slave core cluster pointed to by the current pointer; Allocate the matrix block to the slave core cluster pointed to by the current pointer, and update the slave core cluster load status and pointer status.
6. The sparse triangular matrix heterogeneous parallel solution method for power flow calculation according to claim 1, characterized in that: Based on the parallel processing results of each slave matrix block, the sparse triangular solution results are obtained, specifically: For each slave core cluster, data is transferred from the master core or external storage to the local storage of the slave core cluster by memory access, and multiple data blocks are transferred to the corresponding slave core cluster; In each slave core cluster, shared memory is used to store the intermediate data and calculation results of the current task; For the forward substitution solution of sparse matrices, different matrix rows are assigned to different slave core clusters, and each slave core cluster processes one or more rows; After each slave core cluster completes the calculation task of its assigned matrix block, it transmits the intermediate results back to the master core or the designated slave core cluster for merging.
7. The sparse triangular matrix heterogeneous parallel solution method for power flow calculation according to claim 6, characterized in that: When the matrix block calculation result of a slave core cluster is transferred to another slave core cluster, the communication is carried out using the RMA communication protocol or shared memory.
8. The sparse triangular matrix heterogeneous parallel solution method for power flow calculation according to claim 6, characterized in that: In the same slave core cluster, data exchange within the matrix block is achieved through shared memory.
9. A sparse triangular matrix heterogeneous parallel solution system for power flow calculation, characterized by: include: A construction module is configured to: construct a directed acyclic graph according to the dependencies between equations in a sparse triangular matrix for power flow calculation; wherein each equation serves as a task node in the directed acyclic graph; A layering module is configured to: perform layered processing on the task nodes having dependency relationships in the directed acyclic graph to obtain layers for parallel processing; A block module is configured to: perform block processing according to the number of non-zero elements in each layer to obtain matrix blocks; The scheduling module is configured to: based on the flexible locality scheduling strategy, determine whether the current scheduling matrix block is scheduled to the slave core adjacent to its parent node according to the computing power of the slave core cluster where the parent node is located, and allocate the matrix block in combination with the polling scheduling strategy, specifically: Initialize the index list of the slave cluster, a pointer to the first element in the list, and the load list of the slave cluster; Loop through the matrix row block set, and for each matrix row block, obtain the slave core cluster where the parent node of the matrix row block is located; Check the load of the slave core cluster where the parent node of the matrix row block is located and the load of its adjacent slave core clusters; If the slave core cluster where the parent node of the matrix row block is located is available, the corresponding matrix row block is allocated to the slave core cluster adjacent to the slave core cluster where the parent node is located; If the slave core cluster where the parent node of the matrix row block is located is unavailable, the round-robin scheduling strategy is used to allocate the matrix row block; The solution module is configured to obtain a sparse triangular solution result based on the parallel processing result of each slave core matrix block.
Citation Information
Patent Citations
Method and system for solving lower trigonometric equations of power system based on lazy hierarchy
CN109062865A
Heterogeneous parallel computing method for row updating of sparse matrix LU factorization
CN109145255A