An Optimization Method and System for Heterogeneous Parallel Cholesky Decomposition Based on ShenWei Architecture

Through the secondary parallel Cholesky decomposition algorithm based on the Shenwei architecture, the problem of failure to fully utilize the kernel parallel computing in the existing technology is solved, efficient parallel computing and memory optimization in the beam adjustment process is realized, and computing speed and memory utilization efficiency are improved.

CN120179412BActive Publication Date: 2025-08-05QILU UNIVERSITY OF TECHNOLOGY (SHANDONG ACADEMY OF SCIENCES) +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510631260.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-05-16
Publication Date
2025-08-05
Estimated Expiration
2045-05-16

AI Technical Summary

Technical Problem

The existing Cholesky decomposition algorithm fails to fully utilize the kernel parallel computing power on Shenwei supercomputers, resulting in slow speed and insufficient memory when dealing with large-scale problems, which cannot meet the computing needs of beam adjustment optimization.

Method used

The secondary parallel Cholesky decomposition algorithm based on the Shenwei architecture is adopted to divide the symmetric positive definite matrix into sub-blocks through a distributed parallel allocation scheme, and the master-slave kernel acceleration characteristics are used to optimize the secondary parallel acceleration of POTRF, TRSM, SYRK and GEMM operations in Cholesky decomposition, combining the MPI programming model and asynchronous communication to reduce data dependence and memory bandwidth bottlenecks.

Benefits of technology

Efficient parallel computing in the beam adjustment process is realized, computing speed and memory utilization efficiency are improved, and data access conflicts and memory bandwidth bottlenecks are minimized through master-slave core acceleration and asynchronous communication technology, and efficient task-level parallel acceleration is achieved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120179412B_ABST
    Figure CN120179412B_ABST
Patent Text Reader

Abstract

The present invention proposes a Cholesky decomposition heterogeneous parallel optimization method and system based on the Shenwei architecture, which relates to the field of high-performance computing technology. The method comprises: dividing a symmetric positive definite matrix into sub-blocks based on a distributed parallel allocation scheme and iteratively completing the matrix decomposition; allocating each sub-block to a different process through the MPI programming model, exchanging data between processes through asynchronous communication, and performing coarse-grained task-level parallel acceleration; utilizing the master-slave core acceleration parallel characteristics of the Shenwei architecture to perform two-level parallel acceleration on the four operations in the Cholesky decomposition; wherein, for GEMM and SYRK operations, the column vectors of the matrix are mapped to the slave core array, and the columns are divided according to the number of slave cores; the calculation process is optimized through a double buffering mechanism, vectorized operations and loop unrolling technology to improve parallel efficiency; for the TRSM operation, it is decomposed into multiple TRSV operations, which are allocated to the slave cores for parallel execution, and the data dependency is reduced by loop reading and data broadcasting to achieve efficient parallel computing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of high-performance computing technology, and in particular relates to a Cholesky decomposition heterogeneous parallel optimization method and system based on Shenwei architecture. 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] The Cholesky decomposition, also known as the square root method, is most commonly used in engineering applications to solve linear systems of symmetric positive definite matrices. It is widely used in finite element analysis, power systems, signal processing, computer vision, financial engineering, medical imaging, robotics, and other fields. Its high efficiency and numerical stability make it an ideal choice for solving large-scale computational problems.

[0004] A symmetric positive definite matrix is a A real symmetric matrix A is positive definite if and only if for all nonzero real coefficient vectors x, Cholesky decomposition is an efficient matrix decomposition method in linear algebra, applicable to symmetric positive definite matrices, and is used to decompose a symmetric positive definite matrix A into a lower triangular matrix and its lower triangular matrix transpose, that is, .

[0005] In the fields of computer vision and 3D reconstruction, bundle adjustment is a core optimization problem aimed at optimizing camera parameters and 3D point coordinates by minimizing reprojection error. Based on the corresponding image points formed by multiple 3D points on multiple cameras, the camera orientation and the position of the 3D points can be estimated. Bundle adjustment optimizes the estimated orientations of all cameras and minimizes the errors in the positions of the 3D points. This ultimately translates into solving a symmetric positive definite system. Cholesky decomposition plays a crucial role in this process. Solving this symmetric positive definite system is a key step in bundle adjustment and also represents a computational bottleneck.

[0006] However, during the bundle adjustment optimization process, the Cholesky decomposition algorithm still requires a lot of computing resources and time. In addition, on modern high-performance computing platforms, the existing Cholesky decomposition implementation does not fully utilize the parallel computing capabilities of the hardware. Currently, the implementation of the Cholesky decomposition algorithm on the Shenwei supercomputer relies on multiple libraries. In the LAPACK library, it can only be executed serially through the master core, and the slave core parallelism cannot be used. In the xMath library, single-core group parallelism can be performed, but for large-scale problems, it faces problems such as slow processing speed and insufficient core group memory. Although the ScaLAPACK library can process large-scale problems through distributed memory on the Shenwei supercomputer, it cannot use slave core parallelism. Summary of the Invention

[0007] In order to overcome the deficiencies of the above-mentioned prior art, the present invention provides a Cholesky decomposition heterogeneous parallel optimization method and system based on the Shenwei architecture, and constructs a two-level parallel Cholesky decomposition algorithm based on the Shenwei supercomputer to achieve efficient optimization of bundle adjustment.

[0008] To achieve the above objectives, one or more embodiments of the present invention provide the following technical solutions:

[0009] The first aspect of the present invention provides a Cholesky decomposition heterogeneous parallel optimization method based on the Shenwei architecture;

[0010] A Cholesky decomposition heterogeneous parallel optimization method based on the Shenwei architecture, comprising:

[0011] Construct a symmetric positive definite matrix for bundle adjustment;

[0012] The symmetric positive definite matrix of bundle adjustment is divided into sub-blocks based on a distributed parallel allocation scheme, and the matrix decomposition is completed by iteratively performing the sub-block decomposition.

[0013] The divided sub-blocks are assigned to different processes, and data is exchanged between the processes through asynchronous communication to achieve coarse-grained task-level parallel acceleration;

[0014] Leveraging the master-slave core acceleration parallelism of the Shenwei architecture, we perform two-level parallel acceleration optimization on the POTRF, TRSM, SYRK, and GEMM operations in the Cholesky decomposition.

[0015] For SYRK and GEMM operations in master-slave core parallel acceleration, the column vectors of the matrix are mapped to the slave core array, and the columns are divided according to the number of slave cores. The calculation process is optimized through a double buffering mechanism, vectorized operations, and loop unrolling to improve parallel efficiency.

[0016] For the TRSM operation in the master-slave core acceleration parallelism, it is decomposed into multiple TRSV triangular matrix vector solution operations, which are assigned to the slave cores for parallel execution. The loop reading and data broadcasting methods are used to reduce data dependencies and achieve efficient parallel computing.

[0017] As a further technical solution, the process of constructing the symmetric positive definite matrix of the bundle adjustment is:

[0018] The bundle adjustment method optimizes the 3D structure and camera parameters by indirectly minimizing the projection error, where is the vector synthesized from the coordinates of all real projection points, For all estimated projection point coordinates synthesized vector, all parameters are synthesized into parameter vector p, then there exists a nonlinear function such that ;

[0019] Iterate to minimize the sum of squares of the reprojection errors between all true projection point coordinates and the estimated projection point coordinates; in each iteration, the minimized error amount is:

[0020] ;

[0021] Where J is the Jacobian matrix, is the parameter error of the current iteration, which is calculated by the Gauss-Newton direction in each iteration. The parameters are gradually optimized; Calculated by the following equation:

[0022] ;

[0023] Where E is the identity matrix, let , A is a symmetric positive definite matrix; is the damping factor that makes A a symmetric positive definite matrix.

[0024] As a further technical solution, the process of sub-dividing the symmetric positive definite matrix of the bundle adjustment based on the distributed parallel allocation scheme is as follows:

[0025] According to the number of processes involved in the calculation, the symmetric positive definite matrix is divided into p×p sub-blocks, each sub-block The sizes are as follows:

[0026] in, , ;

[0027] when hour ;

[0028] when hour,

[0029]

[0030] Where, represents whether the matrix can be equally divided into p*p submatrices; , Remaining operation; is the number of rows or columns of the matrix; is the number of processes; is the size of each submatrix, .

[0031] As a further technical solution, the process of allocating the divided sub-blocks to different processes and exchanging data between the processes through asynchronous communication to perform coarse-grained task-level parallel acceleration is as follows:

[0032] After the main process performs the Cholesky decomposition operation on the matrix, it broadcasts the result to other processes in the same column through the broadcast operation;

[0033] When other processes execute TRSM operations, they use non-blocking communication to send the calculation results to the processes that need to receive the triangulation solution results of the current process, ensuring seamless connection between calculation and communication;

[0034] When executing SYRK and GEMM operations, processes transmit data through asynchronous communication to ensure a high degree of overlap between computing tasks and communication tasks.

[0035] As a further technical solution, the process of optimizing the calculation process by double buffering mechanism, vectorized operation and loop unrolling to improve parallel efficiency is as follows:

[0036] When calculating the matrix C_sub, first read a column of matrix A_sub data for calculation, and at the same time read the next column of data in the background to achieve parallelization of data access and calculation.

[0037] As a further technical solution, the vectorized operation and loop expansion are as follows: using the SIMD instruction set of the Shenwei architecture to perform vectorized operations on the matrix, and based on the SW multi-core processor to simultaneously calculate the loaded double data; through the loop expansion scheme, multiple columns of data of each slave core are calculated at the same time.

[0038] As a further technical solution, for the TRSM operation in the master-slave core acceleration parallelization, the process of decomposing it into multiple TRSV operations and assigning them to the slave cores for parallel execution is as follows:

[0039] For the m×n matrix C_sub, it is divided into 64 rows, and each slave core processes m / 64 rows; data dependencies are reduced through loop reading and data broadcasting.

[0040] A second aspect of the present invention provides a Cholesky decomposition heterogeneous parallel optimization system based on the Shenwei architecture.

[0041] A Cholesky decomposition heterogeneous parallel optimization system based on the Shenwei architecture, including:

[0042] A symmetric positive definite matrix construction module is configured to: construct a symmetric positive definite matrix for bundle adjustment;

[0043] A sub-block partitioning module is configured to: partition the symmetric positive definite matrix of the bundle adjustment into sub-blocks based on a distributed parallel allocation scheme, and iteratively complete matrix decomposition on the divided sub-blocks;

[0044] The MPI parallel module is configured to: assign the divided sub-blocks to different processes, exchange data between processes through asynchronous communication, and perform coarse-grained task-level parallel acceleration;

[0045] The master-slave core parallel module is configured to: utilize the master-slave core acceleration parallelism feature of the Shenwei architecture to perform two-level parallel acceleration optimization on the POTRF, TRSM, SYRK and GEMM operations in the Cholesky decomposition;

[0046] For GEMM and SYRK operations in master-slave core parallel acceleration, the column vectors of the matrix are mapped to the slave core array, and the columns are divided according to the number of slave cores. The calculation process is optimized through a double buffering mechanism, vectorized operations, and loop unrolling to improve parallel efficiency.

[0047] For the TRSM operation in the master-slave core acceleration parallelism, it is decomposed into multiple TRSV operations and assigned to the slave cores for parallel execution. The loop reading and data broadcasting methods are used to reduce data dependency and achieve efficient parallel computing.

[0048] The third aspect of the present invention provides a computer-readable storage medium having a program stored thereon, which, when executed by a processor, implements the steps of a Cholesky decomposition heterogeneous parallel optimization method based on the Shenwei architecture as described in the first aspect of the present invention.

[0049] The fourth aspect of the present invention provides an electronic device, comprising a memory, a processor, and a program stored in the memory and runnable on the processor. When the processor executes the program, the steps of the Cholesky decomposition heterogeneous parallel optimization method based on the Shenwei architecture as described in the first aspect of the present invention are implemented.

[0050] One or more of the above technical solutions have the following beneficial effects:

[0051] The present invention discloses a Cholesky decomposition heterogeneous parallel optimization method and system based on Shenwei architecture, which reduces memory bandwidth bottlenecks and data access conflicts to the greatest extent by combining task scheduling and data access mode, making data access in the calculation process more efficient, performs coarse-grained task-level parallel acceleration through the MPI programming model, and adopts asynchronous communication mode to overlap the computing task with the communication task. The core calculation of the Cholesky decomposition algorithm is accelerated in secondary parallel through master-slave acceleration parallelism. In the secondary parallel method, the data required for the secondary parallel calculation is obtained to the slave core LDM to the maximum extent according to the characteristics of GEMM, TRSM, and SYRK, and the DMA data transmission technology is utilized, and the data is obtained once and reused multiple times. At the same time, the slave core parallelization is completed for GEMM, TRSM, and SYRK through double buffer mode, SIMD vectorization, and loop expansion method.

[0052] Advantages of additional aspects of the present invention will be given in part in the following description and in part will be obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0053] The accompanying drawings, 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.

[0054] Figure 1 This is a flow chart of the method of the first embodiment.

[0055] Figure 2 FIG. 4 is a diagram of a distributed parallel allocation scheme of a four-process coefficient symmetric positive definite matrix A in the first embodiment.

[0056] Figure 3 This is a flow chart of the first-level parallel algorithm of the four-process main core in the first embodiment.

[0057] Figure 4 This is a flowchart of the secondary parallel algorithm of the slave core in the first embodiment.

[0058] Figure 5 This is a diagram of the data partitioning method in the GEMM operation in the first embodiment.

[0059] Figure 6 This is a graph showing the acceleration ratio of the method used in the first embodiment compared with the xMath math library.

[0060] Figure 7 This is a system structure diagram of the second embodiment. DETAILED DESCRIPTION

[0061] It should be noted that the following detailed descriptions are exemplary and intended to provide further explanation of the present invention. Unless otherwise specified, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art to which the present invention belongs.

[0062] It should be noted that the terms used herein are for describing particular embodiments only and are not intended to be limiting of exemplary embodiments according to the present invention.

[0063] In the absence of conflict, the embodiments of the present invention and the features thereof may be combined with each other.

[0064] Example 1

[0065] This embodiment discloses a Cholesky decomposition heterogeneous parallel optimization method based on the Shenwei architecture;

[0066] like Figure 1As shown in FIG, a Cholesky decomposition heterogeneous parallel optimization method based on the Shenwei architecture includes:

[0067] Step S1, constructing a symmetric positive definite matrix for bundle adjustment.

[0068] The bundle adjustment method indirectly minimizes the projection error To optimize the 3D structure and camera parameters, is the vector synthesized from the coordinates of all real projection points, For all estimated projection point coordinates synthesized vector, all parameters are synthesized into parameter vector p, then there exists a nonlinear function such that ;

[0069] Use the LM (Levenberg-Marquardt) method to iterate all the true projection point coordinates x and the estimated projection point coordinates The sum of squares of the reprojection errors between is minimized, that is, Minimize; in each iteration, the minimized error is:

[0070] ;

[0071] Where J is the Jacobian matrix, is the parameter error of the current iteration, which is calculated by the Gauss-Newton direction in each iteration. The parameters are gradually optimized; Calculated by the following equation:

[0072] ;

[0073] Where E is the identity matrix, let , A is a symmetric positive definite matrix; is the damping factor that makes A a symmetric positive definite matrix.

[0074] Step S2, dividing the symmetric positive definite matrix into sub-blocks based on a distributed parallel allocation scheme, and iterating the divided sub-blocks to complete matrix decomposition;

[0075] According to the number of processes p involved in the calculation, the symmetric positive definite matrix A is divided into p×p sub-blocks, each sub-block The sizes are as follows:

[0076] in, , ;

[0077] when hour ;

[0078] when hour,

[0079]

[0080] Where, represents whether the matrix can be equally divided into p*p submatrices; , Remaining operation; is the number of rows or columns of the matrix; is the number of processes; is the size of each submatrix, .

[0081] Since the matrix A is symmetric, only the sub-blocks of the lower or upper triangle of A need to be calculated. Taking 4 processes as an example, Figure 2 As shown, the process numbers in columns j and pj-1 constitute p processes, excluding the master process. 0 represents process 0 in the first iteration, 0' represents process 0 in the second iteration, and so on. The algorithm then completes the matrix decomposition through p iterations. In each iteration, all processes perform different computational tasks based on dependencies. Only after the master process completes its execution do processes in the same column depend on the master process's value. Once that column is complete, the remaining blocks are updated based on the column's value. The master process is responsible for the initial tasks at the start of each iteration and for coordinating scheduling. In iteration i, all related tasks in column i are processed first. Blocks after column i are updated based on the column's value and the value of iteration i-1. After iteration i completes, the processes in column i receive their final values. The decomposition process is complete until all tasks are completed by iteration p.

[0082] Furthermore, the divided sub-blocks are assigned to different processes through the MPI programming model, and data is exchanged between processes through asynchronous communication, achieving coarse-grained task-level parallel acceleration;

[0083] Use Cholesky decomposition to transform the matrix Decomposed into a lower triangular matrix and a lower triangular matrix transpose form, that is ,in ,Right now:

[0084] ;

[0085] The Cholesky decomposition completes the task in four iterations. The first iteration consists of:

[0086] (1) First ,get

[0087] (2) Get After the value of Blocks in the same column are based on , , get , the above operation is called TRSM operation.

[0088] (3) Get After the value of The diagonal blocks in the same row are based on = , = , = get , the above value is not the final value and needs to continue to the next iteration, which is called SYRK operation.

[0089] (4) The remaining blocks, = , = , = get , which is not the final value, needs to be iterated further, which is called GEMM operation.

[0090] When this iteration is complete, the first column gets the final value, and the next iteration starts with the second column.

[0091] Furthermore, the main process Perform POTRF operation to obtain , where i represents the number of iterations, and then the broadcast operation MPI_Bcast is used to Send to other processes in the same column for execution = , namely TRSM operation. After these processes have completed the TRSM operation, they use non-blocking communication to send the calculation results to other processes to ensure seamless connection between calculation and communication, and then continue to execute = - , that is, SYRK operation, and while performing the SYRK operation The value of SYRK is sent to other processes to prepare for GEMM, and the GEMM operation is executed directly after the SYRK operation is completed. Data is transmitted through asynchronous communication to ensure a high degree of overlap between computing tasks and communication tasks without waiting for transmission. While executing GEMM, the value of SYRK is continued to be transmitted to the previous process, so that the computing tasks and communication tasks are highly overlapped, achieving a time balance between computing tasks and communication tasks, eliminating waiting and idle time to the maximum extent, and ensuring their seamless connection in the parallel process, thereby improving overall efficiency.

[0092] Furthermore, the master-slave core acceleration parallel feature utilizing the Shenwei architecture also includes transferring matrix data from the main memory to the LDM of the slave core to reduce the main memory access overhead; and realizing batch transmission of data through DMA technology to improve data access efficiency.

[0093] Step S3, using the master-slave core acceleration parallel feature of the Shenwei architecture, perform two-level parallel acceleration optimization on the POTRF, TRSM, SYRK and GEMM operations in the Cholesky decomposition respectively;

[0094] Combine Figure 3 and Figure 4 , master-slave accelerated parallelism is a two-level parallel method supported by the Shenwei supercomputer system. The master core mainly completes the calculation and communication of the non-multi-core parallel parts. When the slave core performs task calculations, the master core waits. The core calculation problem in this invention is the four operations of POTRF, TRSM, SYRK and GEMM in Cholesky decomposition, where POTRF represents the Cholesky decomposition of the matrix, TRSM represents the matrix triangle solution, SYRK represents the matrix rank-k update, and GEMM represents the matrix multiplication. Each slave core of the Shenwei multi-core processor has a high-speed local local data storage space (Local Data Memory, LDM). DMA provides the function of batch data transmission between the main memory and LDM, converting direct data access to the memory into access to the local LDM. The efficiency of this method is much faster than direct access to the main memory, so the subsequent operations are to read the data into the LDM first and then perform the calculation task.

[0095] Step S4, for the GEMM and SYRK operations in the master-slave core acceleration parallelism, mapping the column vectors of the matrix to the slave core array, dividing the columns according to the number of slave cores; optimizing the calculation process through a double buffering mechanism, vectorized operations and loop unrolling technology to improve parallel efficiency;

[0096] Combine Figure 5 , the calculation process of GEMM is to calculate the product of matrices A_sub and B_sub, get an intermediate matrix, and then calculate the weight coefficients and , sum the matrix C_sub with the intermediate matrix and add the result to the corresponding position of the C_sub matrix, , but the GEMM in Cholesky decomposition is to calculate The GEMM operation is a three-layer loop structure. To calculate each element of the matrix C_sub, it is necessary to read a row of the matrix A_sub and a column of the matrix B_sub. The entire process requires repeatedly reading the matrices A_sub and B_sub. Its implementation efficiency is very low, but it has strong parallelism because each column is independent.

[0097] Based on the above characteristics, in this embodiment, for a C_sub matrix, first map the column vector of matrix C_sub to the CPE array. To ensure load balancing, each slave core reads n / 64 column elements of C_sub to LDM, and it is continuous n / 64 columns, that is, the matrix C_sub is divided into 64 columns (64 represents the number of slave cores used), and then each slave core corresponds to one of the columns. If the data is too much to be loaded into the LDM at one time, it will be read in a loop, and the maximum number of columns that the slave core can put into the LDM each time. In this way, the CPE array performs GEMM operations in parallel to achieve high performance. For matrix A_sub, in the i-th loop, only one slave core reads the i-th column of A_sub and then the slave core broadcasts this column to all slave cores, instead of each slave core reading the same column of A_sub data. For matrix B_sub, B_sub is read in the i-th loop. The task is completed when n / 64 data starting from the position are cycled until all columns of A_sub are completed.

[0098] In terms of optimization, through the double buffering mechanism, first, a column of A_sub needs to be read in to calculate C_sub, and then, while calculating C_sub, the next column of A_sub continues to be read; secondly, through vectorized operations, the main core of the SW multi-core processor supports 256-bit SIMD extension instructions, and the slave core supports 512-bit SIMD extension instructions. For the double type, 8 double data can be loaded at a time, and then these 8 data are calculated at the same time. When using, it is necessary to ensure 64-byte alignment; finally, through the loop unrolling scheme, multiple columns of data of each slave core are calculated at the same time. For example, if each slave core processes x columns of data, then x vector registers are used to increase the parallelism of the program. Since each slave core has 32 vector registers, the number of vector registers used cannot exceed 32. When the final data cannot be aligned, it is processed separately.

[0099] Step S5, for the TRSM operation in the master-slave core acceleration parallelism, decompose it into multiple TRSV operations, assign them to the slave cores for parallel execution, use cyclic reading and data broadcasting to reduce data dependency and achieve efficient parallel computing.

[0100] The TRSM operation is explained using the TRSV operation. That is, when B is a vector, it is a TRSV operation. For the TRSV operation, B[0,j] is first calculated using the value of the matrix A, and then the subsequent element B[0,k] (k>j) is updated based on the value of B[0,j]. TRSM can be seen as the implementation of multiple TRSV operations. Therefore, multiple TRSVs are distributed to 64 slave cores for processing, thereby realizing parallel TRSM operations. For a The C_sub matrix is directly divided into 64 rows, and each slave core processes m / 64 rows, and then a similar scheme as GEMM is adopted.

[0101] Furthermore, the present invention further verifies the effectiveness of the method adopted by the present invention through test experiments. The test environment is the prototype of the new generation supercomputer of Sunway. The Gaussian kernel matrix based on image pixel values in the field of image processing is used as the test case. The matrix size is set to 20480*20480. The test results are as follows: Figure 6 shown. Figure 6 The speedup ratio is shown to be the highest when the core group is 32, compared with the high-performance math library xMath designed specifically for the Sunway multi-core processor. Figure 6 It can be seen that the highest acceleration ratio reaches 4.43 times.

[0102] Example 2

[0103] This embodiment discloses a Cholesky decomposition heterogeneous parallel optimization system based on the Shenwei architecture;

[0104] like Figure 7 As shown in FIG, a Cholesky decomposition heterogeneous parallel optimization system based on the Shenwei architecture includes:

[0105] A symmetric positive definite matrix construction module is configured to: construct a symmetric positive definite matrix for bundle adjustment;

[0106] A sub-block partitioning module is configured to: partition the symmetric positive definite matrix of the bundle adjustment into sub-blocks based on a distributed parallel allocation scheme, and iteratively complete matrix decomposition on the divided sub-blocks;

[0107] The MPI parallel module is configured to: assign the divided sub-blocks to different processes, exchange data between processes through asynchronous communication, and perform coarse-grained task-level parallel acceleration;

[0108] The master-slave core parallel module is configured to: utilize the master-slave core acceleration parallelism feature of the Shenwei architecture to perform two-level parallel acceleration optimization on the POTRF, TRSM, SYRK and GEMM operations in the Cholesky decomposition;

[0109] For the GEMM and SYRK operations in the master-slave core parallel acceleration, the column vectors of the matrix are mapped to the slave core array, and the columns are divided according to the number of slave cores; the calculation process is optimized through a double buffering mechanism, vectorized operations and loop unrolling to improve parallel efficiency;

[0110] For the TRSM operation in the master-slave core acceleration parallelism, it is decomposed into multiple TRSV operations, which are assigned to the slave cores for parallel execution. The loop reading and data broadcasting methods are used to reduce data dependency and achieve efficient parallel computing.

[0111] Example 3

[0112] The purpose of this embodiment is to provide a computer-readable storage medium.

[0113] A computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of a Cholesky decomposition heterogeneous parallel optimization method based on the Shenwei architecture as described in Example 1.

[0114] Example 4

[0115] The purpose of this embodiment is to provide an electronic device.

[0116] An electronic device includes a memory, a processor, and a program stored in the memory and executable on the processor. When the processor executes the program, the steps of a Cholesky decomposition heterogeneous parallel optimization method based on the Shenwei architecture as described in Example 1 are implemented.

[0117] The steps involved in the apparatuses of Examples 2, 3, and 4 above correspond to those of Method Example 1. For detailed implementations, please refer to the relevant description of Example 1. The term "computer-readable storage medium" should be understood to mean a single medium or multiple media containing one or more instruction sets; it should also be understood to include any medium capable of storing, encoding, or carrying an instruction set for execution by a processor and causing the processor to perform any method of the present invention.

[0118] Those skilled in the art will appreciate that the modules or steps of the present invention described above can be implemented using a general-purpose computer device. Alternatively, they can be implemented using program code executable by a computing device, which can then be stored in a storage device and executed by the computing device. Alternatively, they can be fabricated into separate integrated circuit modules, or multiple modules or steps can be fabricated into a single integrated circuit module for implementation. The present invention is not limited to any specific combination of hardware and software.

[0119] Although the above describes the specific embodiments 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 any creative work are still within the scope of protection of the present invention.

Claims

1. A Cholesky decomposition heterogeneous parallel optimization method based on Shenwei architecture, characterized by: include: Construct a symmetric positive definite matrix for bundle adjustment; The symmetric positive definite matrix of bundle adjustment is divided into sub-blocks based on a distributed parallel allocation scheme, and the matrix decomposition is completed by iteratively performing the sub-block decomposition. The divided sub-blocks are assigned to different processes, and data is exchanged between the processes through asynchronous communication to achieve coarse-grained task-level parallel acceleration; Leveraging the master-slave core acceleration parallelism of the Shenwei architecture, we perform two-level parallel acceleration optimization on the POTRF, TRSM, SYRK, and GEMM operations in the Cholesky decomposition. For SYRK and GEMM operations in master-slave core parallel acceleration, the column vectors of the matrix are mapped to the slave core array, and the columns are divided according to the number of slave cores. The calculation process is optimized through a double buffering mechanism, vectorized operations, and loop unrolling to improve parallel efficiency. For the TRSM operation in the master-slave core acceleration parallelism, it is decomposed into multiple TRSV triangular matrix vector solution operations, which are assigned to the slave cores for parallel execution. The loop reading and data broadcasting methods are used to reduce data dependencies and achieve efficient parallel computing.

2. The Cholesky decomposition heterogeneous parallel optimization method based on the Shenwei architecture according to claim 1, characterized in that: The process of constructing the symmetric positive definite matrix of the bundle adjustment is: The bundle adjustment method optimizes the 3D structure and camera parameters by indirectly minimizing the projection error, where is the vector synthesized from the coordinates of all real projection points, For all estimated projection point coordinates synthesized vector, all parameters are synthesized into parameter vector p, then there exists a nonlinear function such that ; Iterate to minimize the sum of squares of the reprojection errors between all true projection point coordinates and the estimated projection point coordinates; in each iteration, the minimized error amount is: ; Where J is the Jacobian matrix, is the parameter error of the current iteration, which is calculated by the Gauss-Newton direction in each iteration. The parameters are gradually optimized; Calculated by the following equation: ; Where E is the identity matrix, let , A is a symmetric positive definite matrix; is the damping factor that makes A a symmetric positive definite matrix.

3. The Cholesky decomposition heterogeneous parallel optimization method based on the Shenwei architecture according to claim 1, characterized in that: The process of sub-blocking the symmetric positive definite matrix of the bundle adjustment based on the distributed parallel allocation scheme is as follows: According to the number of processes involved in the calculation, the symmetric positive definite matrix is divided into p×p sub-blocks, each sub-block The sizes are as follows: in, , ; when hour ; when hour, Where, represents whether the matrix can be equally divided into p*p submatrices; , Remaining operation; is the number of rows or columns of the matrix; is the number of processes; is the size of each submatrix, .

4. The Cholesky decomposition heterogeneous parallel optimization method based on the Shenwei architecture according to claim 1, characterized in that: The process of allocating the divided sub-blocks to different processes and exchanging data between the processes through asynchronous communication to perform coarse-grained task-level parallel acceleration is as follows: After the main process performs the Cholesky decomposition operation on the matrix, it broadcasts the result to other processes in the same column through the broadcast operation; When other processes execute TRSM operations, they use non-blocking communication to send the calculation results to the processes that need to receive the triangulation solution results of the current process, ensuring seamless connection between calculation and communication; When executing SYRK and GEMM operations, processes transmit data through asynchronous communication to ensure a high degree of overlap between computing tasks and communication tasks.

5. The Cholesky decomposition heterogeneous parallel optimization method based on the Shenwei architecture according to claim 1, characterized in that: The process of optimizing the computing process by using the double buffer mechanism, vectorized operations, and loop unrolling to improve parallel efficiency is as follows: When calculating the matrix C_sub, first read a column of matrix A_sub data for calculation, and at the same time read the next column of data in the background to achieve parallelization of data access and calculation.

6. The Cholesky decomposition heterogeneous parallel optimization method based on the Shenwei architecture according to claim 1, characterized in that: The vectorized operation and loop expansion are as follows: using the SIMD instruction set of the Shenwei architecture to perform vectorized operations on the matrix, and based on the SW multi-core processor to simultaneously calculate the loaded double data; through the loop expansion scheme, multiple columns of data of each slave core are calculated at the same time.

7. The Cholesky decomposition heterogeneous parallel optimization method based on the Shenwei architecture according to claim 1, characterized in that: For the TRSM operation in the master-slave core acceleration parallelization, the process of decomposing it into multiple TRSV operations and assigning them to the slave cores for parallel execution is as follows: For the m×n matrix C_sub, it is divided into 64 rows, and each slave core processes m / 64 rows; data dependencies are reduced through loop reading and data broadcasting.

8. A Cholesky decomposition heterogeneous parallel optimization system based on the Shenwei architecture, characterized by: include: A symmetric positive definite matrix construction module is configured to: construct a symmetric positive definite matrix for bundle adjustment; A sub-block partitioning module is configured to: partition the symmetric positive definite matrix of the bundle adjustment into sub-blocks based on a distributed parallel allocation scheme, and iteratively complete matrix decomposition on the divided sub-blocks; The MPI parallel module is configured to: assign the divided sub-blocks to different processes, exchange data between processes through asynchronous communication, and perform coarse-grained task-level parallel acceleration; The master-slave core parallel module is configured to: utilize the master-slave core acceleration parallelism of the Shenwei architecture to perform two-level parallel acceleration optimization on the POTRF, TRSM, SYRK and GEMM operations in the Cholesky decomposition; For GEMM and SYRK operations in master-slave core parallel acceleration, the column vectors of the matrix are mapped to the slave core array, and the columns are divided according to the number of slave cores. The calculation process is optimized through a double buffering mechanism, vectorized operations, and loop unrolling to improve parallel efficiency. For the TRSM operation in the master-slave core acceleration parallelism, it is decomposed into multiple TRSV operations and assigned to the slave cores for parallel execution. The loop reading and data broadcasting methods are used to reduce data dependency and achieve efficient parallel computing.

9. A computer-readable storage medium having a program stored thereon, characterized in that: When the program is executed by a processor, the steps of the Cholesky decomposition heterogeneous parallel optimization method based on the Shenwei architecture are implemented.

10. An electronic device comprising a memory, a processor, and a program stored in the memory and executable on the processor, wherein: When the processor executes the program, the steps of the Cholesky decomposition heterogeneous parallel optimization method based on the Shenwei architecture are implemented as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • A GEMM (general matrix-matrix multiplication) high-performance realization method based on a domestic SW 26010 many-core CPU

    CN107168683A

  • High-performance parallel implementation method of K-means algorithm on domestic Sunway 26010 multi-core processor

    CN108509270A