Large-scale matrix QR decomposition multi-core parallel computing method, device and equipment and storage medium
By dividing a large-scale matrix into matrix blocks and constructing a task execution dependency graph, the problem of low computational efficiency in traditional large-scale matrix QR decomposition is solved, and more efficient matrix QR decomposition computation is achieved.
Patent Information
- Application Number
- CN202511620960.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-06
- Publication Date
- 2026-02-10
AI Technical Summary
Traditional parallel computing systems for large-scale matrix QR decomposition suffer from low computational efficiency in ultra-large-scale matrices, mainly due to limitations in global broadcasting between column vectors and communication rates between computing nodes, which restricts the number of computation steps.
The target large-scale matrix is divided into multiple matrix blocks, which are arranged according to the fast memory capacity and core capacity of each core. The matrix blocks are allocated in a horizontal and vertical cyclic manner, and a task execution dependency graph is constructed to realize the QR decomposition and transmission tasks of the matrix blocks of each core.
By using a 2D cyclic distribution method, the problem of unbalanced storage and computation among computing nodes is alleviated, the computational efficiency and throughput of matrix QR decomposition are improved, and latency is reduced.
Smart Images

Figure CN121501446A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of digital signal processing technology, and more specifically, to a method, apparatus, device, and storage medium for large-scale matrix QR decomposition multi-core parallel computing. Background Technology
[0002] Traditional parallel QR decomposition has a direct dependency between column vectors in the computation process, which manifests as global broadcasting of column vectors in very large-scale matrices.
[0003] Existing large-scale matrix QR factorization parallel computing systems rely on interconnected networks of computing clusters to distribute matrix blocks. Communication between different computing nodes is far slower than the transmission rate between high-speed interconnected chips. Furthermore, this task distribution method heavily depends on the position of the matrix blocks within the original matrix. The tasks on each computing node need to maintain a relatively consistent computational order and steps. In computationally intensive and memory-constrained computational steps, the computation-to-transfer ratio is limited, requiring fine-tuning of the matrix block size to achieve higher computational efficiency. Summary of the Invention
[0004] This application provides a method, apparatus, device, and storage medium for large-scale matrix QR decomposition multi-core parallel computing.
[0005] The first aspect of this application provides a large-scale matrix QR factorization multi-core parallel computing method, including: The target large-scale matrix is divided into multiple matrix blocks based on the fast memory capacity of each core; Multiple cores are arranged according to their capacity to obtain a two-dimensional core arrangement; Multiple matrices are divided and distributed into a two-dimensional core arrangement in a cyclical manner in both the horizontal and vertical directions; Based on the QR decomposition principle, a task execution dependency graph is constructed between each matrix block in each core, so that each core executes the QR decomposition task and transmission task of the matrix block according to the task execution dependency graph.
[0006] In an optional embodiment of this application, dividing the target large-scale matrix into multiple matrix blocks based on the fast memory capacity of each core includes: Get the fast memory capacity for each core; Select the smallest fast memory capacity among all fast memory capacities; The corresponding block matrix is determined based on the minimum fast memory capacity; The target large-scale matrix is divided into multiple matrix blocks using square matrices as the unit.
[0007] In an optional embodiment of this application, arranging multiple cores according to their capacity to obtain a two-dimensional core arrangement includes: Get the capacity of each core; Sort the cores by capacity from largest to smallest, and then arrange the cores corresponding to the sorted capacities to obtain a two-dimensional core arrangement. In the two-dimensional core arrangement, the capacity of the left core is greater than or equal to the capacity of the right core among the left and right adjacent cores, and the capacity of the upper core is greater than or equal to the capacity of the lower core among the upper and lower adjacent cores.
[0008] In an optional embodiment of this application, the step of distributing multiple matrix blocks into a two-dimensional core arrangement in a cyclical manner along both the horizontal and vertical directions includes: In the two-dimensional core, K N ×K M In the case of the arrangement, the matrix in the Mth column is divided into blocks and distributed from top to bottom in a vertically cyclic manner to the mod(M, K)th column of the two-dimensional core arrangement. M In the core column, M is from 1 to the number of columns in the matrix block arrangement; Divide the Nth row matrix into blocks and distribute them horizontally in a cyclical manner from left to right to the mod(N, K)th row of the two-dimensional core arrangement. N In the core row, N is the number of rows in the matrix block arrangement from 1 to 2.
[0009] In an optional embodiment of this application, the step of dividing the M-th column matrix into blocks and distributing them vertically in a cyclic manner from top to bottom to the mod(M, K)-th column of the two-dimensional core arrangement is... M The core of the column includes: Determine the block partition of the M-th column matrix and the mod(M, K)-th column matrix. M The quotient between the number of cores in each column; Based on this quotient, the corresponding blocks of the Mth column matrix are grouped to obtain multiple groups of matrix blocks; For each group of matrix blocks, the m-th matrix block in the current group of matrix blocks is assigned to the mod(M, K)-th matrix block. M ) The m-th core in column (M, K), where m is from 1 to the modulo (M, K) core. M ) Column core quantity.
[0010] In an optional embodiment of this application, the step of dividing the Nth row matrix into blocks and distributing them horizontally in a cyclic manner from left to right to the mod(N, K)th row of the two-dimensional core arrangement is... N The core of the column includes: Determine the Nth row matrix block and the mod(N, K)th row block. N The quotient between the number of core rows; Based on this quotient, the corresponding blocks of the Nth row matrix are grouped to obtain multiple groups of matrix blocks; For each group of matrix blocks, the nth matrix block in the current group of matrix blocks is assigned to the mod(N, K)th matrix block. N The nth core in row ) where n is from 1 to the mod (N, K)th core. N ) number of core rows.
[0011] In an optional embodiment of this application, the step of constructing a task execution dependency graph between each matrix block in each core according to the QR decomposition principle, so that each core executes the QR decomposition task and transmission task of the matrix block according to the task execution dependency graph, includes: Perform QR decomposition on the first column matrix of each core in the first column, and update the remaining submatrices of each core except the first column according to the QR decomposition results. The QR decomposition results include orthogonal matrices and upper triangular matrices. Merge and QR decompose the upper triangular matrices corresponding to all the first column matrices of the first core to obtain the orthogonal matrix and upper triangular matrix in the binary tree structure. Based on the orthogonal matrix in the binary tree structure and the orthogonal matrix corresponding to all first column matrix blocks of the first column core, update the matrix blocks corresponding to the remaining cores other than the first column core.
[0012] A second aspect of this application provides a large-scale matrix QR factorization multi-core parallel computing device, comprising: The partitioning module is used to divide the target large-scale matrix into multiple matrix blocks based on the fast memory capacity of each core; The arrangement module is used to arrange multiple cores according to their capacity to obtain a two-dimensional core arrangement; The allocation module is used to distribute multiple matrices into a two-dimensional core arrangement in a cyclical manner along both the horizontal and vertical directions. The module is used to construct a task execution dependency graph between the matrix blocks in each core according to the QR decomposition principle, so that each core can execute the QR decomposition task and transmission task of the matrix block according to the task execution dependency graph.
[0013] A third aspect of this application provides a computer device, including: a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of any of the above-mentioned large-scale matrix QR decomposition multi-core parallel computing methods.
[0014] A fourth aspect of the embodiments of this application provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the large-scale matrix QR decomposition multi-core parallel computing method as described in any of the preceding claims.
[0015] Compared with the prior art, the technical solutions provided in this application have at least some or all of the following advantages: The large-scale matrix QR decomposition multi-core parallel computing method described in this application divides the target large-scale matrix into multiple matrix blocks based on the fast memory capacity of each core; arranges the multiple cores according to their capacity to obtain a two-dimensional core arrangement; distributes the multiple matrix blocks to the two-dimensional core arrangement in a cyclic manner in both horizontal and vertical directions; constructs a task execution dependency graph between the matrix blocks in each core according to the QR decomposition principle, so that each core executes the QR decomposition task and transmission task of the matrix block according to the task execution dependency graph. The 2D cyclic distribution method of matrix blocks transforms the dependency of column vectors into the dependency between matrix column blocks. This cyclic distribution method can alleviate the problem of uneven storage and computing among nodes to a certain extent. Attached Figure Description
[0016] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings: Figure 1 A flowchart illustrating a large-scale matrix QR decomposition multi-core parallel computing method provided in one embodiment of this application; Figure 2 A schematic diagram of a partitioned large-scale matrix provided in one embodiment of this application; Figure 3 A schematic diagram of a large-scale matrix allocated to multiple cores, provided as an embodiment of this application; Figure 4 A schematic diagram illustrating the interconnection of core components using a high-speed interconnect chip, provided as an embodiment of this application; Figure 5 A schematic diagram of a large-scale matrix QR decomposition multi-core parallel computing device provided in one embodiment of this application; Figure 6 This is a schematic diagram of a computer device structure provided in one embodiment of this application. Detailed Implementation
[0017] In the process of developing this application, the inventors discovered that current large-scale matrix QR decomposition is computationally inefficient.
[0018] To address the aforementioned issues, this application provides a method, apparatus, device, and storage medium for multi-core parallel computing of large-scale matrix QR decomposition, thereby improving the computational efficiency of large-scale matrix QR decomposition.
[0019] The solutions in this application embodiment can be implemented using various computer languages, such as the object-oriented programming language Java and the interpreted scripting language JavaScript.
[0020] To make the technical solutions and advantages of the embodiments of this application clearer, the exemplary embodiments of this application will be described in further detail below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not an exhaustive list of all embodiments. It should be noted that, unless otherwise specified, the embodiments and features in the embodiments of this application can be combined with each other.
[0021] Please see Figure 1 The large-scale matrix QR decomposition multi-core parallel computing method provided in this application includes the following steps S100~S400: S100 divides the target large-scale matrix into multiple matrix blocks based on the fast memory capacity of each core; S200 arranges multiple cores according to their capacity to obtain a two-dimensional core arrangement; S300 distributes multiple matrices into a two-dimensional core arrangement in a cyclical manner in both the horizontal and vertical directions; S400 constructs a task execution dependency graph between each matrix block in each core based on the QR decomposition principle, so that each core executes the QR decomposition task and transmission task of the matrix block according to the task execution dependency graph.
[0022] In an optional embodiment of this application, for a target large-scale matrix A∈R m×n (m, n > 1e5), assuming the computing nodes (cores) in the computing cluster are all of the same type of computing chip, the following uses 6 = 2 × 3 = P r ×P c Taking a single computing node as an example, when partitioning a large-scale target matrix, the size of each matrix block is determined by the maximum fast memory capacity of the node kernel (diagonal matrix blocks are required to be square matrices). Figure 2 The matrix is divided into block structures, where a square matrix represents a block whose size is just enough to be stored in the fast memory of a node. The matrix blocks are then distributed to a 2×3 computing cluster (P, denoted as P, with 6 computing nodes) using a 2D cyclic allocation method. i,j For i=0,1; j=0,1,2, the matrix block data received and stored by each node according to the above block division method is as follows: Figure 3 In this format, the various computing nodes are connected using high-speed interconnect chips, such as... Figure 4 As shown. According to the principle of QR decomposition, the diagonal blocks of the final upper triangular matrix R should be distributed and stored in A. i,i i=0,1,2,3,4,5,6 (corresponding to node P)0,0 , P 1,1 ,P 0,2 , P 1,0 , P 0,1 , P 1,2 , P 0,0 Therefore, when updating the matrix column by column from left to right, this application prioritizes calculating A. i,0 The decomposition of i=0,1,2,3,4,5,6 is performed, and then the remaining submatrix blocks are updated sequentially.
[0023] In an optional embodiment of this application, a matrix partitioning system is constructed in a multi-node processor cluster based on the storage capacity of the multi-core processor chip of each node. A task execution dependency graph is constructed between the matrix blocks in the partitioning system according to the computational principle of the QR algorithm. Each node in the cluster executes computation and transmission tasks according to the task execution dependency graph, enabling the QR decomposition of this application to achieve distributed parallelism, high throughput, and low latency through 2D cyclic parallel computation. Before the computation begins, the matrix to be QR decomposed is divided into multiple matrix blocks, and each matrix block is distributed to the storage space of the corresponding node in a 2D cyclic manner through high-speed interconnect chips (NVLink, NVSwitch) in the multi-core cluster. This application uses a task execution dependency graph to schedule subtasks in QR decomposition in the multi-core processor cluster to achieve QR parallel decomposition of ultra-large-scale matrices. Each node determines its computation and transmission tasks based on the matrix blocks within its current node.
[0024] In an optional embodiment of this application, the matrix A∈R is processed through the following steps. m×n In the Householder-based decomposition computation (m >> n), the distributed algorithm is tightly integrated with a fast in-memory data storage format, reducing the number of communication steps between multiple nodes and the computational latency between task-dependent nodes in the QR decomposition process. Specifically, for matrix A ∈ R... m×n The calculation steps for Householder-based decomposition (m >> n) are as follows: TSQR (Panel Fraction): This process is performed on the column nodes that store the column matrix blocks. It is called 1D-Householder-QR. The TSQR process uses a binary tree to schedule the matrix partitioning between column nodes, calculates the Householder elimination between the matrix partitions, and stores the calculated orthogonal transformation matrix in compact WY form on each node according to the above binary tree structure. Apply-TSQR-QT (Training Update): This process applies the transformation matrix stored in a binary tree to the remaining submatrix. This process is called 2D-Householder-Update. Because the Apply-TSQR-QT process uses a 2D cyclic allocation method for matrix partitioning, it can call all nodes to simultaneously compute the matrix partitioning computation tasks within each node.
[0025] In actual calculations, the size of the matrix blocks to be calculated on each node can be adjusted appropriately based on the number of nodes in the computing cluster and the memory capacity of each node to achieve computational masking communication.
[0026] The large-scale matrix QR decomposition multi-core parallel computing method of this application fully combines the matrix QR decomposition task within the computing node with the fast memory capacity within the core to divide the target large-scale matrix into multiple matrix blocks and perform 2D cyclic allocation of the matrix blocks, thereby reducing the time delay required for adjacent matrix blocks to wait for the calculation results of the preceding matrix blocks during the QR decomposition process, and making the task load among each computing node more balanced.
[0027] In an optional embodiment of this application, dividing the target large-scale matrix into multiple matrix blocks based on the fast memory capacity of each core includes: Get the fast memory capacity for each core; Select the smallest fast memory capacity among all fast memory capacities; The corresponding block matrix is determined based on the minimum fast memory capacity; The target large-scale matrix is divided into multiple matrix blocks using square matrices as the unit.
[0028] In an optional embodiment of this application, in pre-dividing the matrix block size according to the memory limitations of each computing node, the matrix block size can be kept consistent in a computing cluster composed of the same type of computing nodes (e.g., Figure 2 As shown in the figure, different matrix block sizes can be allocated in a cluster composed of multiple computing nodes to achieve more flexible matrix block partitioning and computing process control.
[0029] The large-scale matrix QR decomposition multi-core parallel computing method of this application divides the target large-scale matrix according to the smallest fast memory capacity among all fast memory capacities, so that the matrix blocks obtained after division are allocated in any core without exceeding the fast memory capacity of that core, thus ensuring the speed of data access.
[0030] In an optional embodiment of this application, arranging multiple cores according to their capacity to obtain a two-dimensional core arrangement includes: Get the capacity of each core; Sort the cores by capacity from largest to smallest, and then arrange the cores corresponding to the sorted capacities to obtain a two-dimensional core arrangement. In the two-dimensional core arrangement, the capacity of the left core is greater than or equal to the capacity of the right core among the left and right adjacent cores, and the capacity of the upper core is greater than or equal to the capacity of the lower core among the upper and lower adjacent cores.
[0031] In an optional embodiment of this application, the cores corresponding to the sorted capacity are B1, B2, B3, B4, B5 and B6. If the two-dimensional core arrangement is 2×3, then the cores of the first column from top to bottom in the two-dimensional core arrangement are B1 and B2, the cores of the second column from top to bottom are B3 and B4, and the cores of the third column from top to bottom are B5 and B6.
[0032] The large-scale matrix QR decomposition multi-core parallel computing method of this application ensures that, in the case of adjacent cores in a two-dimensional core arrangement, the capacity of the left core is greater than or equal to the capacity of the right core, and in the case of adjacent cores above and below, the capacity of the upper core is greater than or equal to the capacity of the lower core. When the number of rows of the matrix blocks obtained after partitioning the target large-scale matrix is not an integer divided by the number of rows of the two-dimensional core arrangement, it will result in more matrix blocks in the first few rows of the two-dimensional core arrangement than in the last few rows. Similarly, when the number of columns of the matrix blocks obtained after partitioning the target large-scale matrix is not an integer divided by the number of columns of the two-dimensional core arrangement, it will result in more matrix blocks in the first few columns of the two-dimensional core arrangement than in the last few columns. This ensures the smooth allocation of matrix blocks to each core.
[0033] In an optional embodiment of this application, the step of distributing multiple matrix blocks into a two-dimensional core arrangement in a cyclical manner along both the horizontal and vertical directions includes: In the two-dimensional core, K N ×K M In the case of the arrangement, the matrix in the Mth column is divided into blocks and distributed from top to bottom in a vertically cyclic manner to the mod(M, K)th column of the two-dimensional core arrangement. M In the core column, M is from 1 to the number of columns in the matrix block arrangement; Divide the Nth row matrix into blocks and distribute them horizontally in a cyclical manner from left to right to the mod(N, K)th row of the two-dimensional core arrangement. N In the core row, N is the number of rows in the matrix block arrangement from 1 to 2.
[0034] In an optional embodiment of this application, during matrix block allocation, matrix block data is distributed to each computing node according to a cyclic allocation method in both horizontal and vertical directions based on the interconnection relationship of the computing nodes (e.g., Figure 3 ).
[0035] The large-scale matrix QR decomposition multi-core parallel computing method of this application can alleviate the computational delay problem caused by the fact that later matrix elements depend on the calculation results of the preceding matrix elements in the matrix QR decomposition calculation steps in a looping manner in both horizontal and vertical directions.
[0036] In an optional embodiment of this application, the step of dividing the M-th column matrix into blocks and distributing them vertically in a cyclic manner from top to bottom to the mod(M, K)-th column of the two-dimensional core arrangement is... M The core of the column includes: Determine the block partition of the M-th column matrix and the mod(M, K)-th column matrix. M The quotient between the number of cores in each column; Based on this quotient, the corresponding blocks of the Mth column matrix are grouped to obtain multiple groups of matrix blocks; For each group of matrix blocks, the m-th matrix block in the current group of matrix blocks is assigned to the mod(M, K)-th matrix block. M ) The m-th core in column (M, K), where m is from 1 to the modulo (M, K) core. M ) Column core quantity.
[0037] In an optional embodiment of this application, when the number of matrix blocks in the Mth column is 8 and the number of cores in the Mth column is 3, the quotient between the number of matrix blocks and the number of cores in the Mth column is 2 + 2 / 3. The matrix blocks in the Mth column are divided into 3 groups: the first group has 3 matrix blocks, the second group has 3 matrix blocks, and the third group has 2 matrix blocks. The first matrix block of the first group in the Mth column is assigned to the first core in the Mth column, and the second matrix block of the first group in the Mth column is assigned to... The third matrix block of the first group of column M is assigned to the third core of column M; the first matrix block of the second group of column M is assigned to the first core of column M; the second matrix block of the second group of column M is assigned to the second core of column M; the third matrix block of the second group of column M is assigned to the third core of column M; the first matrix block of the third group of column M is assigned to the first core of column M; and the second matrix block of the third group of column M is assigned to the second core of column M.
[0038] The large-scale matrix QR decomposition multi-core parallel computing method of this application allocates adjacent matrix blocks in the M-th column matrix block to different cores, which can avoid the computing delay problem caused by the later matrix elements depending on the calculation results of the preceding matrix elements in the matrix QR decomposition calculation step.
[0039] In an optional embodiment of this application, the step of dividing the Nth row matrix into blocks and distributing them horizontally in a cyclic manner from left to right to the mod(N, K)th row of the two-dimensional core arrangement is... N The core of the column includes: Determine the Nth row matrix block and the mod(N, K)th row block. N The quotient between the number of core rows; Based on this quotient, the corresponding blocks of the Nth row matrix are grouped to obtain multiple groups of matrix blocks; For each group of matrix blocks, the nth matrix block in the current group of matrix blocks is assigned to the mod(N, K)th matrix block. N The nth core in row ) where n is from 1 to the mod (N, K)th core. N ) number of core rows.
[0040] In an optional embodiment of this application, when the number of matrix blocks in the Nth row is 8 and the number of cores in the Nth row is 3, the quotient between the number of matrix blocks in the Nth row and the number of cores in the Nth row is 2 + 2 / 3. The matrix blocks in the Nth row are divided into 3 groups, where the first group has 3 matrix blocks, the second group has 3 matrix blocks, and the third group has 2 matrix blocks. The first matrix block of the first group in the Nth row is assigned to the first core in the Nth row, and the second matrix block of the first group in the Nth row is assigned to... The third matrix block of the first group in row N is assigned to the third core in row N; the first matrix block of the second group in row N is assigned to the first core in row N; the second matrix block of the second group in row N is assigned to the second core in row N; the third matrix block of the second group in row N is assigned to the third core in row N; the first matrix block of the third group in row N is assigned to the first core in row N; and the second matrix block of the third group in row N is assigned to the second core in row N.
[0041] The large-scale matrix QR decomposition multi-core parallel computing method of this application allocates adjacent matrix blocks in the Nth row matrix block to different cores, which can avoid the computing delay problem caused by the later matrix elements depending on the calculation results of the preceding matrix elements in the matrix QR decomposition calculation step.
[0042] In an optional embodiment of this application, the step of constructing a task execution dependency graph between each matrix block in each core according to the QR decomposition principle, so that each core executes the QR decomposition task and transmission task of the matrix block according to the task execution dependency graph, includes: Perform QR decomposition on the first column matrix of each core in the first column, and update the remaining submatrices of each core except the first column according to the QR decomposition results. The QR decomposition results include orthogonal matrices and upper triangular matrices. Merge and QR decompose the upper triangular matrices corresponding to all the first column matrices of the first core to obtain the orthogonal matrix and upper triangular matrix in the binary tree structure. Based on the orthogonal matrix in the binary tree structure and the orthogonal matrix corresponding to all first column matrix blocks of the first column core, update the matrix blocks corresponding to the remaining cores other than the first column core.
[0043] In an optional embodiment of this application, the first column matrix of each core in the first column is divided into blocks for QR decomposition, and the remaining sub-matrices in each core except for the first column are updated according to the QR decomposition results, including: The topmost matrix block in the first column is taken as the target matrix block. Serial QR decomposition is performed on the target matrix block to obtain the upper triangular matrix, the b columns of Householder reflection vectors in the orthogonal matrix corresponding to the target matrix block, and the factors of the b Householder reflection vectors, where b is the order of the current matrix block. Based on the b-column Householder reflection vectors and b factors of the orthogonal matrix corresponding to the target matrix block, the matrix blocks to the right of the target matrix block are updated until all matrix blocks in the row containing the target matrix block have been updated. Based on the upper triangular matrix corresponding to the target matrix block, update the matrix blocks below the target matrix block until all matrix blocks in the column where the target matrix block is located have been updated, and then update the upper triangular matrix of the target matrix block. For each matrix block in the column containing the target matrix block, based on the b columns of Householder reflection vectors and the b factors of Householder reflection vectors in the orthogonal matrix corresponding to the current matrix block, the matrix blocks to the right of the current matrix block are updated until all matrix blocks in the row containing the current matrix block have been updated, where b is the column number of the current matrix block.
[0044] In an optional embodiment of this application, the step of performing serial QR decomposition on the target matrix blocks to obtain the upper triangular matrix, the b columns of Householder reflection vectors of the orthogonal matrix corresponding to the target matrix blocks, and the factors of the b Householder reflection vectors includes: For the target column of the target matrix block, calculate the norm of the target column, update the target column by division according to the norm, obtain the scaling factor and Householder reflection vector of the target column, and write the Householder reflection vector as the updated target column into the storage location corresponding to the target column. The updated target column is used to update the other columns of the target matrix block. The updated target column and other columns form the updated target matrix block, which serves as the upper triangular matrix corresponding to the target matrix block. The scaling factor and Householder reflection vector corresponding to all columns of the target matrix block are used as factors of the Householder reflection vector and Householder reflection vector corresponding to the target matrix block, respectively.
[0045] In an optional embodiment of this application, updating other columns of the target matrix block using the updated target column includes: The projection amount corresponding to the remaining columns of the target matrix block is determined based on the scaling factor corresponding to the target column, the Householder reflection vector, and the remaining columns of the target matrix block. The updated remaining columns are determined based on the remaining columns of the target matrix block, their corresponding projections, and the Householder reflection vectors corresponding to the target columns.
[0046] In an optional embodiment of this application, the projection amount corresponding to the remaining columns of the target matrix block is determined by the following expression, based on the scaling factor corresponding to the target column, the Householder reflection vector, and the remaining columns of the target matrix block:
[0047] in, The projection quantity corresponding to the j-th column in the remaining columns of the target matrix block. The scaling factor is the value corresponding to the target column. Let be the conjugate transpose of the Householder reflection vector corresponding to the i-th column of the target column. The vector in the j-th column of the remaining columns of the target matrix is used to divide the matrix into blocks. The updated remaining columns are determined using the following expression, based on the remaining columns of the target matrix block, their corresponding projections, and the Householder reflection vectors corresponding to the target columns:
[0048] in, For the updated vector of the j-th column, The vector in the j-th column of the remaining columns of the target matrix is used to divide the matrix into blocks. The projection quantity corresponding to the j-th column in the remaining columns of the target matrix block. The Householder reflection vector corresponding to the i-th column of the target column.
[0049] In an optional embodiment of this application, the matrix blocks to the right of the target matrix block are updated based on the b columns of Householder reflection vectors and the b factors of the orthogonal matrix corresponding to the target matrix block, using the following expression:
[0050] in, Divide the target matrix into blocks, and then divide the matrix into blocks on the right side of the updated matrix. Divide the matrix to the right of the target matrix into blocks. Householder reflection vectors of orthogonal matrices corresponding to blocks of the target matrix. Factors of the Householder reflection vector corresponding to the block partition of the target matrix.
[0051] In an optional embodiment of this application, the matrix blocks below the target matrix block are updated based on the upper triangular matrix corresponding to the target matrix block using the following expression, until all matrix blocks in the column containing the target matrix block have been updated, and the upper triangular matrix of the target matrix block is then updated: For each matrix block below the target matrix block, determine the Householder reflection vector that makes the current matrix block null and the scaling factor corresponding to the current matrix block; Update the upper triangular matrix corresponding to the current matrix block and the target matrix block based on the Householder reflection vector and scaling factor.
[0052] In an optional embodiment of this application, determining the Householder reflection vector that nullifies the current matrix block and the scaling factor corresponding to the current matrix block for each matrix block below the target matrix block includes: For each matrix block below the target matrix block, determine the Householder reflection vector that makes the current matrix block null; The scaling factor corresponding to the current matrix block is determined based on the Householder reflection vector using the following expression: τ = 2 / (1 + ||v||²) Where τ is the scaling factor corresponding to the current matrix block, and v is the Householder reflection vector corresponding to the current matrix block.
[0053] This application presents a multi-core parallel computing method for large-scale matrix QR decomposition. It performs multi-stage matrix QR decomposition by dividing the matrix into blocks based on the size of the fast memory capacity. Compared with the single-core serial QR decomposition method, this application always accesses the matrix in rectangular blocks. In the calculation steps, serial QR decomposition steps are performed in the diagonal matrix blocks, and Level-3 BLAS is used when updating the off-diagonal matrix blocks. This improves the computational complexity and memory access ratio within a single core and enhances the single-core computing efficiency.
[0054] In an optional embodiment of this application, the calculation and transmission process of this method is illustrated using the calculation of the 0th column block as an example. Since A i,0 The numbers i = 0, 1, 2, 3, 4, 5, 6 are distributed across two computing nodes P. 0,0 , P 1,0 Therefore, the process of computing large-scale matrices with a number of rows much greater than the number of columns uses the following efficient parallel TSQR algorithm: geqrf: at node P 0,0 , P 1,0 Execute separately for each and The QR decomposition was calculated to obtain , Thanks to the 2D cyclic distribution of matrix blocks, node P 0,0 A inside 0,3 A 0,6 A 0,9 Matrix block updates can be performed in A 0,0 The QR code can be expanded immediately after decomposition, without the need for high-speed interconnect chips or interconnect networks. Transmitted to the target computing node.
[0055] tsqrt: Node P 0,0 Through high-speed interconnect chips Transmit to P 1,0 Compute node, P 1,0 Node computing QR decomposition of In this example, the corresponding matrix blocks are distributed across two computing nodes, so a single merge completes the entire TSQR computation. When the computing cluster expands to P... = P r ×P c Merging is required at this time frequency.
[0056] Apply-TSQR-QT: After step-1 geqrf and step-2 tsqrt calculations, three orthogonal matrices are obtained. ,in, Stored in P 0,0 middle, Stored in P 0,1 middle, Part of it is stored in P 0,0 Another part is stored in P 0,1 In order to update the remaining matrix, these three orthogonal matrices need to be broadcast to the corresponding computation nodes in the remaining matrix.
[0057] Need to broadcast to P 0,1, P 0,2 middle; Need to broadcast to P 1,1 , P 1,2 middle; Stored in P 0,0 Parts and stored in P 0,1 All parts need to be broadcast to P 0,1 , P 0,2 , P 1,1 , P 1,2 Then, update the remaining matrix according to the binary tree structure of TSQR, specifically: It is necessary to apply the left action to the remaining submatrix at each computation node (P). 0,0 The remaining submatrix is P 0,1 The remaining submatrix is , P 0,2 The remaining submatrix is Similarly, The remaining submatrix also needs to be left-multiplied in the computation nodes of the second row (the form of the remaining submatrix is deduced in the above manner). This update method ensures that all computation nodes are simultaneously computing the matrix block task contained in the current node, unlike existing schemes where some nodes are in a waiting state in later stages of execution.
[0058] The subsequent recursive binary tree merging process applies the Q-matrix in the binary tree structure sequentially to the matrix blocks of the corresponding computation nodes, specifically: The merger process requires the use of The matrix block information, when the process updates the submatrix from left to right Synchronization required and Matrix block information ( (representing 1, 4, 7) Synchronization required and The matrix block information (# represents 2, 5, 8) is updated after the matrix block information synchronization is complete. and (The binary tree update method is consistent with the existing TSQR scheme.) The above three computational steps are executed iteratively, calculating the QR decomposition of all matrix blocks to be computed from left to right until A is completed. 6,9 Matrix block computation and update (QR decomposition of all matrices completed).
[0059] When performing QR decomposition on blocks of the same column matrix, the TSQR calculation process will merge the data along the column direction of the cluster nodes. The QR decomposition of the subtriangular matrix adds the computation of corresponding merging blocks compared to the serial Householder computation process. However, the time required for this computation accounts for a very small proportion of the overall QR decomposition and can be hidden in the transmission process between computation nodes. Therefore, the additional computation required by the method proposed in this application is negligible and has no impact on the time required for the overall QR decomposition.
[0060] It should be understood that although the steps in the flowchart are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order constraint on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the diagram may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the sub-steps or stages of other steps.
[0061] Please see Figure 5 One embodiment of this application provides a large-scale matrix QR factorization multi-core parallel computing device 500, comprising: The partitioning module 510 is used to divide the target large-scale matrix into multiple matrix blocks based on the fast memory capacity of each core; Arrangement module 520 is used to arrange multiple cores according to the core capacity to obtain a two-dimensional core arrangement; The allocation module 530 is used to allocate multiple matrices to the two-dimensional core arrangement in a cyclic manner in both the horizontal and vertical directions. Module 540 is used to construct a task execution dependency graph between each matrix block in each core according to the QR decomposition principle, so that each core executes the QR decomposition task and transmission task of the matrix block according to the task execution dependency graph.
[0062] Specific limitations regarding the aforementioned device 500 can be found in the above description of the limitations on the multi-core parallel computing method for large-scale matrix QR decomposition, and will not be repeated here. Each module in the aforementioned device 500 can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device in hardware form, or stored in the memory of a computer device in software form, so that the processor can call and execute the operations corresponding to each module.
[0063] In one embodiment, a computer device is provided, the internal structure of which can be as follows: Figure 6As shown. The computer device includes a processor, memory, network interface, and database connected via a system bus. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and the database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database stores data. The network interface communicates with external terminals via a network connection. When the computer program is executed by the processor, it implements the above-described large-scale matrix QR decomposition multi-core parallel computing method. It includes: memory and a processor; the memory stores the computer program; and the processor executes the computer program to implement any step of the above-described large-scale matrix QR decomposition multi-core parallel computing method.
[0064] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, can perform any step of the above-described large-scale matrix QR decomposition multi-core parallel computing method.
[0065] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0066] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0067] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0068] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0069] Although preferred embodiments of this application have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of this application.
[0070] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Therefore, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application also intends to include such modifications and variations.
Claims
1. A large-scale matrix QR factorization multi-core parallel computing method, characterized in that, include: The target large-scale matrix is divided into multiple matrix blocks based on the fast memory capacity of each core; Multiple cores are arranged according to their capacity to obtain a two-dimensional core arrangement; Multiple matrices are divided and distributed into a two-dimensional core arrangement in a cyclical manner in both the horizontal and vertical directions; Based on the QR decomposition principle, a task execution dependency graph is constructed between each matrix block in each core, so that each core executes the QR decomposition task and transmission task of the matrix block according to the task execution dependency graph.
2. The method according to claim 1, characterized in that, The process of dividing the target large-scale matrix into multiple matrix blocks based on the fast memory capacity of each core includes: Get the fast memory capacity for each core; Select the smallest fast memory capacity among all fast memory capacities; The corresponding block matrix is determined based on the minimum fast memory capacity; The target large-scale matrix is divided into multiple matrix blocks using square matrices as the unit.
3. The method according to claim 1, characterized in that, The arrangement of multiple cores according to their capacity to obtain a two-dimensional core arrangement includes: Get the capacity of each core; Sort the cores by capacity from largest to smallest, and then arrange the cores corresponding to the sorted capacities to obtain a two-dimensional core arrangement. In the two-dimensional core arrangement, the capacity of the left core is greater than or equal to the capacity of the right core among the left and right adjacent cores, and the capacity of the upper core is greater than or equal to the capacity of the lower core among the upper and lower adjacent cores.
4. The method according to claim 1, characterized in that, The method of distributing multiple matrices into a two-dimensional core arrangement in a cyclical manner along both the horizontal and vertical directions includes: In the two-dimensional core, K N ×K M In the case of the arrangement, the matrix in the Mth column is divided into blocks and distributed from top to bottom in a vertically cyclic manner to the mod(M, K)th column of the two-dimensional core arrangement. M In the core column, M is from 1 to the number of columns in the matrix block arrangement; Divide the Nth row matrix into blocks and distribute them horizontally in a cyclical manner from left to right to the mod(N, K)th row of the two-dimensional core arrangement. N In the core row, N is the number of rows in the matrix block arrangement from 1 to 2.
5. The method according to claim 4, characterized in that, The method of dividing the M-th column matrix into blocks and distributing them vertically in a cyclic manner from top to bottom to the mod(M, K)-th column of the two-dimensional core arrangement is described. M The core of the column includes: Determine the block partition of the M-th column matrix and the mod(M, K)-th column matrix. M The quotient between the number of cores in each column; Based on this quotient, the corresponding blocks of the Mth column matrix are grouped to obtain multiple groups of matrix blocks; For each group of matrix blocks, the m-th matrix block in the current group of matrix blocks is assigned to the mod(M, K)-th matrix block. M ) The m-th core in column (M, K), where m is from 1 to the modulo (M, K) core. M ) Column core quantity.
6. The method according to claim 4, characterized in that, The method of dividing the Nth row matrix into blocks and distributing them horizontally from left to right in a cyclical manner to the mod(N,K)th row of the two-dimensional core arrangement. N The core of the column includes: Determine the Nth row matrix block and the mod(N, K)th row block. N The quotient between the number of core rows; Based on this quotient, the corresponding blocks of the Nth row matrix are grouped to obtain multiple groups of matrix blocks; For each group of matrix blocks, the nth matrix block in the current group of matrix blocks is assigned to the mod(N, K)th matrix block. N The nth core in row ) where n is from 1 to the mod (N, K)th core. N ) number of core rows.
7. The method according to claim 1, characterized in that, The process of constructing a task execution dependency graph between each matrix block in each core based on the QR decomposition principle, enabling each core to execute the QR decomposition task and transmission task of the matrix block according to the task execution dependency graph, includes: Perform QR decomposition on the first column matrix of each core in the first column, and update the remaining submatrices of each core except the first column according to the QR decomposition results. The QR decomposition results include orthogonal matrices and upper triangular matrices. Merge and QR decompose the upper triangular matrices corresponding to all the first column matrices of the first core to obtain the orthogonal matrix and upper triangular matrix in the binary tree structure. Based on the orthogonal matrix in the binary tree structure and the orthogonal matrix corresponding to all first column matrix blocks of the first column core, update the matrix blocks corresponding to the remaining cores other than the first column core.
8. A large-scale matrix QR factorization multi-core parallel computing device, characterized in that, include: The partitioning module is used to divide the target large-scale matrix into multiple matrix blocks based on the fast memory capacity of each core; The arrangement module is used to arrange multiple cores according to their capacity to obtain a two-dimensional core arrangement; The allocation module is used to distribute multiple matrices into a two-dimensional core arrangement in a cyclical manner along both the horizontal and vertical directions. The module is used to construct a task execution dependency graph between the matrix blocks in each core according to the QR decomposition principle, so that each core can execute the QR decomposition task and transmission task of the matrix block according to the task execution dependency graph.
9. A computer device, comprising: A memory and a processor, the memory storing a computer program, characterized in that, when the processor executes the computer program, it implements the steps of the large-scale matrix QR decomposition multi-core parallel computing method according to any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the large-scale matrix QR decomposition multi-core parallel computing method according to any one of claims 1 to 7.
