Sparse matrix parallel numerical decomposition calculation method and device based on DAG scheduling

Through the parallel numerical decomposition method of sparse matrices based on DAG scheduling, the elimination tree of sparse matrices is divided into blocks and represents task dependencies, which solves the problem of low parallel computing performance on 'big and small core' processors and achieves efficient sparse matrix decomposition. and load balancing to adapt to parallelism in elimination trees of different shapes.

CN118395809BActive Publication Date: 2024-08-23HUNAN MAIXI SOFTWARE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410822231.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-25
Publication Date
2024-08-23
Estimated Expiration
2044-06-25

AI Technical Summary

Technical Problem

Existing multi-threaded parallel computing methods have low parallel computing performance on ‘big and small core’ processors, making it difficult to meet the rapid solution needs of large-scale finite element analysis, especially in scenarios where the computing capabilities of CPU cores are inconsistent.

Method used

Using a sparse matrix parallel numerical decomposition method based on DAG scheduling, by dividing the super nodes in the elimination tree of the sparse matrix into blocks, and using a directed acyclic graph to represent task dependencies, the number of dependent tasks in each block is counted in advance to realize the pipeline Compute and dynamic load balancing, avoiding explicit synchronization.

Benefits of technology

It can realize efficient sparse matrix Cholesky decomposition calculation on any number of cores, improve the scalability and parallel computing efficiency of the program, and can work efficiently on multi-core processors with inconsistent computing capabilities of each core.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118395809B
    Figure CN118395809B
Patent Text Reader

Abstract

The present invention discloses a sparse matrix parallel numerical decomposition calculation method and device based on DAG scheduling, the method comprising: obtaining a sparse matrix in finite element simulation calculation; dividing the super nodes in the elimination tree of the sparse matrix into a plurality of blocks; using a directed acyclic graph to represent the task dependency relationship in the block-based numerical decomposition; pre-counting the number of dependent tasks of each block, and reducing the dependency number of the block by one whenever a dependent task is completed, and once the dependency number of the block is zero, adding the computing tasks contained in the block to the computing queue and generating new tasks after the computing is completed. The present invention can cope with the scenario of inconsistent CPU core computing power, and realize efficient sparse matrix Cholesky decomposition calculation on any number of cores.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of structural simulation in numerical computational mechanics, and in particular to a sparse matrix parallel numerical decomposition calculation method and device based on DAG scheduling. Background Art

[0002] Finite element simulation analysis is widely used in aerospace, aviation, automobile, heavy industry, shipbuilding, electronic appliances and other fields, and has become an indispensable means and method for the positive innovation and development of industrial products. With the rapid development of industry and the continuous improvement of product complexity, the corresponding finite element simulation calculation scale is also increasing. As a result, the simulation calculation time has shown an explosive growth, which has become a key factor restricting the rapid iteration of products. At the same time, due to the failure of Moore's Law, modern processor hardware is developing in the direction of multi-core and multi-core, and "big and small core" processors with inconsistent computing power have emerged. How to make full use of modern processor architecture to achieve efficient finite element simulation calculations to shorten simulation time, thereby shortening the product development cycle and accelerating the product iteration process has become a vital issue.

[0003] The MKL PARDISO solver, which is currently closer to the present invention, includes a variety of sparse matrix direct solution algorithms and implements a shared memory multi-threaded parallel computing method. However, the parallel computing performance of this solver on "big and small core" processors is relatively low, which makes it difficult to meet the current fast solution requirements of large-scale finite element analysis. Summary of the invention

[0004] The purpose of the present invention is to provide a sparse matrix parallel numerical decomposition calculation method and device based on DAG scheduling, which can cope with the scenario of inconsistent CPU core computing power and realize efficient sparse matrix Cholesky decomposition calculation on any number of cores.

[0005] In a first aspect, the present invention provides a sparse matrix parallel numerical decomposition calculation method based on DAG scheduling, comprising:

[0006] Get sparse matrix in finite element simulation calculation;

[0007] Divide the super nodes in the elimination tree of the sparse matrix into several blocks;

[0008] Use directed acyclic graphs to represent task dependencies in block-based numerical decomposition;

[0009] The number of dependent tasks of each block is counted in advance. Every time a dependent task is completed, the dependency number of the block is reduced by one. Once the dependency number of a block is zero, the computing tasks contained in the block are added to the computing queue and new tasks are generated after the computing is completed.

[0010] Furthermore, the super nodes in the elimination tree of the sparse matrix are divided into several blocks, including:

[0011] A supernode containing Ncol columns is divided into multiple regular blocks. Bsize represents the default global block size. Except for the blocks at the bottom and rightmost of the supernode, the sizes of the remaining blocks are Bsize times Bsize.

[0012] Change the block size Local_size inside the supernode according to the following method. When Ncol is smaller than Bsize, in order to ensure the amount of calculation for each block, adjust the internal size to

[0013] ;

[0014] These blocks are merged with adjacent blocks to avoid the performance loss caused by too small blocks.

[0015] Furthermore, a directed acyclic graph is used to represent the task dependencies in the block-based numerical decomposition, including:

[0016] For diagonal blocks, they can only be decomposed after all descendant blocks have been updated; for non-diagonal blocks, in addition to being updated by all descendant blocks, they also need to wait for the diagonal blocks in the same column to be decomposed before they can be solved. After the solution is completed, the corresponding ancestor block is updated.

[0017] Furthermore, the method further comprises:

[0018] All tasks in the computing queue are processed in parallel without any explicit synchronization, and the calculation and generation of all tasks implement pipeline computing.

[0019] In a second aspect, the present invention provides a sparse matrix parallel numerical decomposition computing device based on DAG scheduling, comprising:

[0020] An acquisition unit, used to acquire a sparse matrix in a finite element simulation calculation;

[0021] A partitioning unit, used for partitioning a super node in an elimination tree of a sparse matrix into a plurality of blocks;

[0022] A representation unit for representing task dependencies in block-based numerical decomposition using a directed acyclic graph;

[0023] The statistical unit is used to pre-count the number of dependent tasks of each block. Every time a dependent task is completed, the dependency number of the block will be reduced by one. Once the dependency number of the block is zero, the computing tasks contained in the block are added to the computing queue and new tasks are generated after the calculation is completed.

[0024] Furthermore, the division unit is used to:

[0025] A supernode containing Ncol columns is divided into multiple regular blocks. Bsize represents the default global block size. Except for the blocks at the bottom and rightmost of the supernode, the sizes of the remaining blocks are Bsize times Bsize.

[0026] Change the block size Local_size inside the supernode according to the following method. When Ncol is smaller than Bsize, in order to ensure the amount of calculation for each block, adjust the internal size to

[0027] ;

[0028] These blocks are merged with adjacent blocks to avoid the performance loss caused by too small blocks.

[0029] Furthermore, the representation unit is used to:

[0030] For diagonal blocks, they can only be decomposed after all descendant blocks have been updated; for non-diagonal blocks, in addition to being updated by all descendant blocks, they also need to wait for the diagonal blocks in the same column to be decomposed before they can be solved. After the solution is completed, the corresponding ancestor block is updated.

[0031] Furthermore, all tasks in the computation queue are processed in parallel without any explicit synchronization, and the computation and generation of all tasks implement pipeline computation.

[0032] Beneficial effects of the present invention: The present invention provides a sparse matrix parallel numerical decomposition calculation method and device based on DAG scheduling, and designs a secondary block partitioning strategy based on super nodes, which solves the defect that traditional parallel computing methods are difficult to deal with elimination trees of different shapes. By managing the dependencies between different tasks and realizing the parallelization of tasks through directed acyclic graphs, the performance loss caused by explicit synchronization in parallel computing is avoided, and the scalability of the program is greatly improved. A fully pipelined Cholesky numerical decomposition parallel computing method is designed to achieve complete dynamic load balancing between threads during the calculation process, and can work efficiently on multi-core processors with inconsistent core computing capabilities. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] In order to further understand the features and technical contents of the present invention, please refer to the following detailed description and drawings of the present invention. However, the drawings are only provided for reference and illustration and are not intended to limit the present invention.

[0034] Figure 1 It is a flow chart of the sparse matrix parallel numerical decomposition calculation method based on DAG scheduling of the present invention;

[0035] Figure 2Schematic diagrams of the parallelism of elimination trees of different shapes; (a) is a schematic diagram of a tall and narrow elimination tree, and (b) is a schematic diagram of a flat and wide elimination tree;

[0036] Figure 3 Schematic diagram of block partitioning of supernodes; (a) is a schematic diagram of a supernode containing Ncol columns being divided into many regular blocks, and (b) is a schematic diagram when the supernode contains fewer columns and Ncol is less than Bsize;

[0037] Figure 4 The diagram is a schematic diagram of expressing the dependency relationships of different tasks based on a directed acyclic graph; (a) is a schematic diagram of two supernodes containing several blocks, and (b) is a schematic diagram of the computing tasks contained in the directed acyclic graph and their dependencies. DETAILED DESCRIPTION

[0038] To further illustrate the technical means and effects of the present invention, the following is a detailed description in conjunction with the preferred embodiments of the present invention and the accompanying drawings.

[0039] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of this application.

[0040] In the process of numerical decomposition of sparse matrices, the calculation order of each supernode needs to follow the dependency relationship based on the elimination tree, that is, the condition for a supernode to be decomposed is that all its descendant supernodes have been decomposed. Supernodes that have no dependencies on each other can be decomposed at the same time. This parallel computing strategy based on the elimination tree to parallelly process the tasks contained in different supernodes is usually called tree parallelism. When each supernode is decomposed, the computing tasks it contains can also be accelerated through parallel computing, such as using multi-threaded Basic Linear Algebra Subprograms (BLAS) and Linear Algebra PACKag (LAPACK). This strategy of processing the computing tasks of a single supernode through parallel computing is called supernode parallelism. Figure 2As shown, the entire numerical decomposition starts from the bottom of the tree and ends at the top. During this period, the number of supernodes that can be processed simultaneously becomes smaller and smaller, but the size of a single supernode will increase. In other words, the tree parallel gain will gradually decrease, while the supernode parallel gain will gradually increase. Therefore, only any one of the above parallel strategies cannot achieve efficient parallel numerical decomposition. Some studies have attempted to combine these two parallel strategies, changing the parallel mode at a certain dividing point or adjusting the combination of the number of threads of the two, but this method is difficult to achieve efficient calculation on any multi-core processor and cannot cope with the current "big and small core" architecture processor. The present invention proposes a fine-grained parallel strategy based on block partitioning, which obtains further parallelism by dividing supernodes into blocks. On this basis, the present invention designs a task flow management strategy to achieve parallel Cholesky factorization and solution, which can work efficiently on any multi-core processor, even if the computing power of each core is different.

[0041] See also Figure 1 The embodiment of the present invention provides a sparse matrix parallel numerical decomposition calculation method based on DAG scheduling, including:

[0042] S101, obtaining a sparse matrix in a finite element simulation calculation;

[0043] S102, dividing the super nodes in the elimination tree of the sparse matrix into a plurality of blocks.

[0044] Each supernode in the elimination tree is formed by merging adjacent columns with similar non-zero element distributions. The purpose is to use the multi-level cache of modern processing to improve the solving performance and allow the use of high-performance BLAS and LAPACK functions. In parallel computing, the calculation order of supernodes needs to satisfy the dependencies in the elimination tree, so the shape of the elimination tree has a great impact on the parallel efficiency, especially when the number of threads is large.

[0045] Figure 2 Shows two different elimination trees with the same number of supernodes. Figure 2 The elimination of (a) is that the tree is tall and narrow, Figure 2 The elimination tree of (b) is flat and wide. Each circle represents a supernode, and next to it is the processor number to which the supernode is mapped during parallel computing. It is obvious that Figure 2 The elimination tree of (b) has higher tree parallelism. One improvement method is to map multiple cores to a supernode and increase the processor utilization by increasing the supernode parallelism. However, this method is not universal. For example, when decomposing the sparse matrix brought by the car body in white, due to the presence of a large number of shell elements, the floating-point operations of the lower-level supernodes of the elimination tree are relatively small, making it difficult to obtain significant benefits from parallel computing.

[0046] In order to obtain a parallel method that can adapt to any type of elimination tree, a block partitioning strategy is proposed in the present invention. The present invention increases the number of tasks that can be calculated simultaneously by dividing the supernode into several blocks, thereby improving the parallel efficiency. Figure 3 (a) shows that a supernode containing Ncol columns is divided into many regular blocks. Bsize represents the default global block division size. Except for the blocks at the bottom and the rightmost side of the supernode, the sizes of the remaining blocks are Bsize times Bsize. Since it is a symmetric matrix, the present invention does not need to care about the upper triangular part.

[0047] In this way, the minimum unit for generating tasks is changed from supernode to block. Although these blocks also need to follow some dependencies, compared with supernode-based, a lot of parallelism is increased. For example, once block 1 is decomposed, other blocks in the same column can be solved and updated. The advantage of this is that the present invention does not need to pre-set the number of parallel threads of supernodes, but only needs to focus on the computing tasks of a single block, so it is adaptive to supernodes of different sizes.

[0048] In block-based computing, computing performance is very sensitive to block size. If the block size is too large, the parallel benefits brought by block partitioning will be insufficient. If the block size is too small, it will lead to low data reusability and increased parallel scheduling overhead. In both cases, efficient parallel computing cannot be achieved.

[0049] Therefore, the present invention needs to change the block size Local_size inside the supernode according to the actual situation, for example, Figure 3 In (b), when the supernode contains fewer columns and Ncol is less than Bsize, in order to ensure the computational complexity of each block, the present invention adjusts the internal size to:

[0050] ;

[0051] Among them, Local_size is the block size inside the supernode, Bsize is the default global block partition size, and Ncol is the number of columns of the supernode.

[0052] In addition, this block division method may also result in a relatively small size of edge blocks. Sometimes the present invention needs to merge these blocks with adjacent blocks to avoid performance loss caused by too small blocks.

[0053] S102, using a directed acyclic graph to represent task dependencies in block-based numerical decomposition.

[0054] After all supernodes are divided into blocks, it means that all calculations in numerical decomposition are based on the tasks generated by the blocks, and the elimination tree can only contain the dependencies between supernodes, so the present invention needs to reconstruct the dependencies between blocks to guide the block-based parallel numerical decomposition. For the blocks on the diagonal, they can only be decomposed after all the descendant blocks are updated; for the non-diagonal blocks, in addition to being updated by all the descendant blocks, they also need to wait for the diagonal blocks in the same column to be decomposed before they can be solved. Once the solution is completed, the corresponding ancestor block can be updated. Based on this rule, the present invention can use a directed acyclic graph (DAG) to represent the task dependencies in block-based numerical decomposition. Figure 4 The two supernodes in (a) contain several blocks. The present invention divides all tasks into four types, namely, decomposition of diagonal blocks, solution of non-diagonal blocks, block update within the same supernode, and block update between different supernodes. Figure 4 The directed acyclic graph in (b) lists the computing tasks they contain and their dependencies. Two connected tasks indicate that there is a dependency between them. The arrow indicates the direction of the dependency. If A points to B, it means that B depends on A. For the update task marked as [a,b,c], it means updating block c using block a and block b.

[0055] S103, pre-count the number of dependent tasks of each block, and each time a dependent task is completed, the dependency number of the block will be reduced by one. Once the dependency number of the block is zero, the computing tasks contained in the block are added to the computing queue and new tasks are generated after the computing is completed.

[0056] The update task is further divided into internal update and external update. This is because the size of blocks within the same supernode is aligned, but the blocks between different supernodes cannot guarantee this situation, and the row indexes between different supernodes are usually different, which requires additional data aggregation and dispersion operations, so the two update tasks are very different. In order to realize this parallel numerical decomposition based on blocks and directed acyclic graphs, the present invention needs to count the number of dependent tasks of each block in advance. Whenever a dependent task is completed, the dependency number of the block will be reduced by one. Once the dependency number of the block is zero, the computing tasks it contains can be added to the computing queue and generate new tasks after the calculation is completed. All tasks in the computing queue can be processed in parallel, and no explicit synchronization is required. The calculation and generation of all tasks can realize pipeline calculation.

[0057] As can be seen from the above embodiments, the present invention further divides the nodes of the sparse matrix into blocks, and each block data can be used to perform different types of computing tasks, and the dependencies between these tasks are represented by DAG, thereby guiding the parallel computing of all tasks. The advantage of this is that there is no need to perform any explicit synchronization to ensure the dependencies between computing tasks, which realizes the pipeline computing of tasks and improves the efficiency of parallel computing. In addition, there is no need to divide different tasks into different processors before the calculation starts to ensure load balancing during parallel computing. The processor can automatically execute tasks and add new tasks during calculation, and can also adapt well to the latest architecture of multi-core processors with inconsistent computing power of each core.

[0058] The embodiment of the present invention further provides a sparse matrix parallel numerical decomposition computing device based on DAG scheduling, comprising:

[0059] An acquisition unit, used to acquire a sparse matrix in a finite element simulation calculation;

[0060] A partitioning unit, used for partitioning a super node in an elimination tree of a sparse matrix into a plurality of blocks;

[0061] A representation unit for representing task dependencies in block-based numerical decomposition using a directed acyclic graph;

[0062] The statistical unit is used to pre-count the number of dependent tasks of each block. Every time a dependent task is completed, the dependency number of the block will be reduced by one. Once the dependency number of the block is zero, the computing tasks contained in the block are added to the computing queue and new tasks are generated after the calculation is completed.

[0063] In this embodiment, the division unit is used to:

[0064] A supernode containing Ncol columns is divided into multiple regular blocks. Bsize represents the default global block size. Except for the blocks at the bottom and rightmost of the supernode, the sizes of the remaining blocks are Bsize times Bsize.

[0065] Change the block size Local_size inside the supernode according to the following method. When Ncol is smaller than Bsize, in order to ensure the amount of calculation for each block, adjust the internal size to

[0066] ;

[0067] These blocks are merged with adjacent blocks to avoid the performance loss caused by too small blocks.

[0068] In this embodiment, the representation unit is used to:

[0069] For diagonal blocks, they can only be decomposed after all descendant blocks have been updated; for non-diagonal blocks, in addition to being updated by all descendant blocks, they also need to wait for the diagonal blocks in the same column to be decomposed before they can be solved. After the solution is completed, the corresponding ancestor block is updated.

[0070] In this embodiment, tasks in all computing queues are processed in parallel without any explicit synchronization, and the computation and generation of all tasks implement pipeline computation.

[0071] The embodiment of the present invention further provides a storage medium, in which a computer program is stored, and when the computer program is executed by a processor, some or all of the steps in each embodiment of the sparse matrix parallel numerical decomposition calculation method based on DAG scheduling provided by the present invention are implemented. The storage medium can be a disk, an optical disk, a read-only memory (English: Read-Only Memory, abbreviated: ROM) or a random access memory (English: Random Access Memory, abbreviated: RAM), etc.

[0072] Those skilled in the art can clearly understand that the technology in the embodiments of the present invention can be implemented by means of software plus a necessary general hardware platform. Based on this understanding, the technical solution in the embodiments of the present invention can be essentially or partly contributed to the prior art in the form of a software product, which can be stored in a storage medium such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in the various embodiments of the present invention or certain parts of the embodiments.

[0073] The same or similar parts between the various embodiments in this specification can be referred to each other. In particular, for the embodiment of the sparse matrix parallel numerical decomposition computing device based on DAG scheduling, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the description in the method embodiment.

[0074] The above-described embodiments of the present invention do not limit the protection scope of the present invention.

Claims

1. A sparse matrix parallel numerical decomposition calculation method based on DAG scheduling, It is characterized in that include: Get sparse matrix in finite element simulation calculation; Divide the super nodes in the elimination tree of the sparse matrix into several blocks; Use directed acyclic graphs to represent task dependencies in block-based numerical decomposition; The number of dependent tasks of each block is counted in advance. Every time a dependent task is completed, the dependency number of the block is reduced by one. Once the dependency number of a block is zero, the computing tasks contained in the block are added to the computing queue and new tasks are generated after the computing is completed. Divide the supernodes in the elimination tree of the sparse matrix into several blocks, including: A supernode containing Ncol columns is divided into multiple regular blocks. Bsize represents the default global block size. Except for the blocks at the bottom and rightmost of the supernode, the sizes of the remaining blocks are Bsize times Bsize. Change the block size Local_size inside the supernode according to the following method. When Ncol is smaller than Bsize, in order to ensure the amount of calculation for each block, adjust the internal size to ; Merge these blocks with adjacent blocks to avoid performance loss caused by too small blocks; A directed acyclic graph is used to represent the task dependencies in block-based numerical decomposition, including: For diagonal blocks, they can only be decomposed after all descendant blocks have been updated; for non-diagonal blocks, in addition to being updated by all descendant blocks, they also need to wait for the diagonal blocks in the same column to be decomposed before they can be solved. After the solution is completed, the corresponding ancestor block is updated.

2. The sparse matrix parallel numerical decomposition calculation method based on DAG scheduling as claimed in claim 1, It is characterized in that The method further comprises: All tasks in the computing queue are processed in parallel without any explicit synchronization, and the calculation and generation of all tasks implement pipeline computing.

3. A sparse matrix parallel numerical decomposition computing device based on DAG scheduling, It is characterized in that include: An acquisition unit, used to acquire a sparse matrix in a finite element simulation calculation; A partitioning unit, used for partitioning a super node in an elimination tree of a sparse matrix into a plurality of blocks; A representation unit for representing task dependencies in block-based numerical decomposition using a directed acyclic graph; The counting unit is used to count the number of dependent tasks of each block in advance. Every time a dependent task is completed, the dependency number of the block will be reduced by one. Once the dependency number of a block is zero, the computing tasks contained in the block are added to the computing queue and new tasks are generated after the computing is completed. The division unit is used for: A supernode containing Ncol columns is divided into multiple regular blocks. Bsize represents the default global block size. Except for the blocks at the bottom and rightmost of the supernode, the sizes of the remaining blocks are Bsize times Bsize. Change the block size Local_size inside the supernode according to the following method. When Ncol is smaller than Bsize, in order to ensure the amount of calculation for each block, adjust the internal size to ; Merge these blocks with adjacent blocks to avoid performance loss caused by too small blocks; The representation unit is used for: For diagonal blocks, they can only be decomposed after all descendant blocks have been updated; for non-diagonal blocks, in addition to being updated by all descendant blocks, they also need to wait for the diagonal blocks in the same column to be decomposed before they can be solved. After the solution is completed, the corresponding ancestor block is updated.

4. The sparse matrix parallel numerical decomposition computing device based on DAG scheduling as claimed in claim 3, It is characterized in that All tasks in the computing queue are processed in parallel without any explicit synchronization, and the calculation and generation of all tasks implement pipeline computing.