Block rarefaction and load balancing method and device, equipment and medium

By preprocessing and dividing the weight matrix, and concentrating non-zero elements into diagonal areas, the problem of uneven computational load and low resource utilization in many-core systems is solved, and load balancing and computing efficiency are improved.

CN118733265APending Publication Date: 2024-10-01GLOBAL ENERGY INTERCONNECTION RES INST CO LTD +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410849661.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-27
Publication Date
2024-10-01

AI Technical Summary

Technical Problem

During the brain simulation process of many-core systems, the amount of calculations of each processor core is uneven, and the utilization of computing resources is not high, resulting in low computing efficiency.

Method used

By preprocessing the original weight matrix, concentrate non-zero elements to the diagonal area to form dense diagonal areas and sparse other areas, and divide it into multiple matrix blocks horizontally or vertically, and each matrix block is allocated Processed by the core of a many-core system.

Benefits of technology

It achieves load balancing, improves computing efficiency, improves processing speed through dense computing, and solves the problems of computational difficulty and uneven load caused by ultra-large-scale matrices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118733265A_ABST
    Figure CN118733265A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of computers, and discloses a block rarefaction and load balancing method and device, equipment and a medium, and the method comprises the steps: obtaining an original weight matrix which comprises a plurality of weight coefficients; preprocessing the obtained original weight matrix to obtain a preprocessed weight matrix; the density of a diagonal region in the pre-processed weight matrix is higher than that of a diagonal region of the original weight matrix; and dividing the preprocessed weight matrix to obtain a plurality of matrix blocks, and correspondingly allocating a core of the many-core system to each matrix block for processing. According to the method, a globally sparse matrix is changed into a locally dense matrix with other coefficients, and when operation is carried out through a core, compared with a matrix before processing, more dense calculation is realized, so that the calculation efficiency is improved. The technical problems that when brain simulation is carried out through a many-core system, the calculation difficulty is large and loads are uneven due to a super-large-scale matrix are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of computer technology, and in particular relates to a block sparsification and load balancing method, device, equipment and medium. Background Art

[0002] Brain-inspired computing, also known as neuromorphic computing, is a general term for computing theories, architectures, chip designs, and application models and algorithms that draw on the information processing patterns and structures of biological nervous systems.

[0003] High-performance brain-like computing technology and brain simulation technology have become important means of studying brain science. The development of computational neuroscience has had an important impact on the fields of intelligence science, cognitive science, information processing, and artificial intelligence. The basic functions of the human brain require the joint activities of millions of neurons. To simulate brain functions more accurately, a larger-scale brain simulation system is needed.

[0004] The many-core system is a high-performance computing architecture whose core feature is that it integrates multiple processor cores on a single chip to improve performance and energy efficiency through parallel computing. When using a many-core system to simulate the brain, the number of neurons is in the billions, and the weight matrix is ​​a very large-scale matrix, so this matrix is ​​sparse, but it is actually very large, with a large amount of calculation and difficulty, resulting in uneven computing of each processor core and low utilization of computing resources, thereby reducing the computing efficiency of the many-core system. Summary of the invention

[0005] The purpose of the present invention is to provide a block sparsification and load balancing method, device, equipment and medium to solve the technical problems of uneven computing load of each processor core, low computing resource utilization and low computing efficiency when a multi-core system performs brain simulation.

[0006] In order to achieve the above object, the present invention adopts the following technical solution:

[0007] In a first aspect, the present invention provides a block sparsification and load balancing method, comprising:

[0008] Acquire an original weight matrix, wherein the original weight matrix includes a plurality of weight coefficients;

[0009] Preprocessing the obtained original weight matrix to obtain a preprocessed weight matrix; the density of the diagonal area in the preprocessed weight matrix is ​​higher than the density of the diagonal area in the original weight matrix;

[0010] The preprocessed weight matrix is ​​divided into multiple matrix blocks, and each matrix block is assigned to a core of the many-core system for processing.

[0011] A further improvement of the present invention is that in the step of obtaining an original weight matrix, wherein the original weight matrix includes a plurality of weight coefficients, the proportion of elements in the original weight matrix whose weight coefficients are greater than 0 is less than 10%.

[0012] A further improvement of the present invention is that in the step of preprocessing the acquired original weight matrix to obtain the preprocessed weight matrix, the acquired weight matrix is ​​preprocessed by a community discovery algorithm, a row-column interchange algorithm or a clustering algorithm to obtain the preprocessed weight matrix.

[0013] The present invention is further improved in that: in the step of preprocessing the acquired original weight matrix to obtain the preprocessed weight matrix, the acquired weight matrix is ​​preprocessed by a row-column interchange algorithm to obtain the preprocessed weight matrix;

[0014] The row-column swapping algorithm includes:

[0015] Swap any two rows in the original weight matrix, calculate the distance from each non-0 element in the two rows after the swap to the matrix diagonal, sum and calculate the average distance from each non-0 element to the matrix diagonal, obtain the distance average dy', and compare it with the distance average dy before the swap. If dy'<dy, perform the row swap, otherwise do not perform the row swap; then swap the columns, calculate the distance from each non-0 element in the two columns after the swap to the matrix diagonal, sum and calculate the average distance from each non-0 element to the matrix diagonal, obtain the distance average dx', and compare it with the distance average dx before the swap. If dx'<dx, perform the column swap, otherwise do not perform the column swap; iteratively perform the row and column swap, and finally concentrate the non-0 elements in the original weight matrix to the diagonal area to obtain the preprocessed weight matrix.

[0016] The present invention is further improved in that: the step of dividing the preprocessed weight matrix to obtain a plurality of matrix blocks, each matrix block being assigned a core of the many-core system for processing, specifically includes:

[0017] The number of cores N of the many-core system is obtained; according to the number of cores N of the many-core system, the preprocessed weight matrix is ​​divided into N matrix blocks horizontally or vertically, and each matrix block is allocated to a core of the many-core system for calculation.

[0018] The present invention is further improved in that: the step of dividing the preprocessed weight matrix to obtain a plurality of matrix blocks, each matrix block being assigned a core of the many-core system for processing, specifically includes:

[0019] Obtain the number of cores N of the many-core system and the storage capacity of each core; divide the preprocessed weight matrix into M matrix blocks horizontally or vertically, and each matrix block is assigned to a core of the many-core system for calculation; wherein M<N, and the computing data storage capacity of each matrix block is less than or equal to the storage capacity of each core.

[0020] In a second aspect, the present invention provides a block sparsification and load balancing method, comprising:

[0021] Acquire an original weight matrix, wherein the original weight matrix includes a plurality of weight coefficients;

[0022] Preprocessing the obtained original weight matrix to obtain a preprocessed weight matrix; the density of the diagonal area in the preprocessed weight matrix is ​​higher than the density of the diagonal area in the original weight matrix;

[0023] Acquire a signal matrix, wherein the signal matrix includes a plurality of signals to be processed that can be processed by a computer;

[0024] The acquired signal matrix is ​​processed accordingly according to the weight transposition of the preprocessed weight matrix to obtain the preprocessed signal matrix;

[0025] The preprocessed weight matrix is ​​divided horizontally or vertically to obtain a plurality of first matrix blocks; the preprocessed signal matrix is ​​divided accordingly to obtain a plurality of second matrix blocks; each first matrix block and the corresponding second matrix block are assigned a core of a many-core system for processing.

[0026] A further improvement of the present invention is that in the step of obtaining an original weight matrix, wherein the original weight matrix includes a plurality of weight coefficients, the proportion of elements in the original weight matrix whose weight coefficients are greater than 0 is less than 10%.

[0027] A further improvement of the present invention is that in the step of preprocessing the acquired original weight matrix to obtain the preprocessed weight matrix, the acquired weight matrix is ​​preprocessed by a community discovery algorithm, a row-column interchange algorithm or a clustering algorithm to obtain the preprocessed weight matrix.

[0028] The present invention is further improved in that: in the step of preprocessing the acquired original weight matrix to obtain the preprocessed weight matrix, the acquired weight matrix is ​​preprocessed by a row-column interchange algorithm to obtain the preprocessed weight matrix;

[0029] The row-column swapping algorithm includes:

[0030] Swap any two rows in the original weight matrix, calculate the distance from each non-0 element in the two rows after the swap to the matrix diagonal, sum and calculate the average distance from each non-0 element to the matrix diagonal, obtain the distance average dy', and compare it with the distance average dy before the swap. If dy'<dy, perform the row swap, otherwise do not perform the row swap; then swap the columns, calculate the distance from each non-0 element in the two columns after the swap to the matrix diagonal, sum and calculate the average distance from each non-0 element to the matrix diagonal, obtain the distance average dx', and compare it with the distance average dx before the swap. If dx'<dx, perform the column swap, otherwise do not perform the column swap; iteratively perform the row and column swap, and finally concentrate the non-0 elements in the original weight matrix to the diagonal area to obtain the preprocessed weight matrix.

[0031] In a third aspect, the present invention provides a block sparsification and load balancing method, comprising:

[0032] Acquire an original weight matrix, wherein the original weight matrix includes a plurality of weight coefficients;

[0033] The obtained original weight matrix is ​​split horizontally and vertically to obtain multiple original sub-weight matrices; the original sub-weight matrix is ​​preprocessed to obtain a preprocessed original sub-weight matrix; the density of the diagonal area in the preprocessed original sub-weight matrix is ​​higher than the density of the diagonal area of ​​the original sub-weight matrix; according to the transposition of the preprocessed original sub-weight matrix relative to each original sub-weight matrix, an input converter and an output converter are set for each original sub-weight matrix;

[0034] Acquire an input signal matrix, wherein the input signal matrix includes a plurality of signals to be processed that can be processed by a computer;

[0035] The obtained input signal matrix is ​​split horizontally to obtain multiple sub-input signal matrices; the sub-input signal matrices are input into corresponding input converters to obtain transposed sub-input signal matrices;

[0036] Each preprocessed original sub-weight matrix is ​​assigned to a core of the many-core system for processing, and the transposed sub-input signal matrix and the preprocessed original sub-weight matrix are budgeted to obtain the sub-weight matrix operation result; the sub-weight matrix operation result is input into the corresponding output converter to obtain the final operation result of the sub-weight matrix.

[0037] A further improvement of the present invention is that in the step of obtaining an original weight matrix, wherein the original weight matrix includes a plurality of weight coefficients, the proportion of elements in the original weight matrix whose weight coefficients are greater than 0 is less than 10%.

[0038] A further improvement of the present invention is that in the step of preprocessing the original sub-weight matrix to obtain the preprocessed original sub-weight matrix, the obtained weight matrix is ​​preprocessed by a community discovery algorithm, a row-column interchange algorithm or a clustering algorithm to obtain the preprocessed weight matrix.

[0039] The present invention is further improved in that: in the step of preprocessing the original sub-weight matrix to obtain the preprocessed original sub-weight matrix, the original sub-weight matrix is ​​preprocessed by a row-column interchange algorithm to obtain the preprocessed original sub-weight matrix;

[0040] The row-column swapping algorithm includes:

[0041] Swap any two rows in the original sub-weight matrix, calculate the distance from each non-0 element in the two rows after the swap to the matrix diagonal, sum and calculate the average distance from each non-0 element to the matrix diagonal, obtain the distance average dy', and compare it with the distance average dy before the swap. If dy'<dy, perform the row swap, otherwise do not perform the row swap; then swap the columns, calculate the distance from each non-0 element in the two columns after the swap to the matrix diagonal, sum and calculate the average distance from each non-0 element to the matrix diagonal, obtain the distance average dx', and compare it with the distance average dx before the swap. If dx'<dx, perform the column swap, otherwise do not perform the column swap; iteratively perform the row and column swap, and finally concentrate the non-0 elements in the original sub-weight matrix to the diagonal area to obtain the original sub-weight matrix after preprocessing.

[0042] In a fourth aspect, the present invention provides a block sparseness and load balancing device, comprising:

[0043] An acquisition module, used to acquire an original weight matrix, wherein the original weight matrix includes a plurality of weight coefficients;

[0044] A preprocessing module, used for preprocessing the acquired original weight matrix to obtain a preprocessed weight matrix; the density of the diagonal area in the preprocessed weight matrix is ​​higher than the density of the diagonal area in the original weight matrix;

[0045] The processing module is used to divide the preprocessed weight matrix into multiple matrix blocks, and each matrix block is allocated to a core of the many-core system for processing.

[0046] The present invention is further improved in that: the step of preprocessing the acquired original weight matrix to obtain the preprocessed weight matrix specifically includes: preprocessing the acquired weight matrix by a row-column interchange algorithm to obtain the preprocessed weight matrix;

[0047] The row-column swapping algorithm includes:

[0048] Swap any two rows in the original weight matrix, calculate the distance from each non-0 element in the two rows after the swap to the matrix diagonal, sum and calculate the average distance from each non-0 element to the matrix diagonal, obtain the distance average dy', and compare it with the distance average dy before the swap. If dy'<dy, perform the row swap, otherwise do not perform the row swap; then swap the columns, calculate the distance from each non-0 element in the two columns after the swap to the matrix diagonal, sum and calculate the average distance from each non-0 element to the matrix diagonal, obtain the distance average dx', and compare it with the distance average dx before the swap. If dx'<dx, perform the column swap, otherwise do not perform the column swap; iteratively perform the row and column swap, and finally concentrate the non-0 elements in the original weight matrix to the diagonal area to obtain the preprocessed weight matrix.

[0049] The present invention is further improved in that: the step of dividing the preprocessed weight matrix to obtain a plurality of matrix blocks, each matrix block being assigned a core of the many-core system for processing, specifically comprises:

[0050] The number of cores N of the many-core system is obtained; according to the number of cores N of the many-core system, the preprocessed weight matrix is ​​divided into N matrix blocks horizontally or vertically, and each matrix block is allocated to a core of the many-core system for calculation.

[0051] The present invention is further improved in that: the step of dividing the preprocessed weight matrix to obtain a plurality of matrix blocks, each matrix block being assigned a core of the many-core system for processing, specifically comprises:

[0052] Obtain the number of cores N of the many-core system and the storage capacity of each core; divide the preprocessed weight matrix into M matrix blocks horizontally or vertically, and each matrix block is assigned to a core of the many-core system for calculation; wherein M<N, and the computing data storage capacity of each matrix block is less than or equal to the storage capacity of each core.

[0053] In a fifth aspect, the present invention provides a block sparseness and load balancing device, comprising:

[0054] A first acquisition module is used to acquire an original weight matrix, where the original weight matrix includes a plurality of weight coefficients;

[0055] A first preprocessing module is used to preprocess the acquired original weight matrix to obtain a preprocessed weight matrix; the density of the diagonal area in the preprocessed weight matrix is ​​higher than the density of the diagonal area in the original weight matrix;

[0056] A second acquisition module is used to acquire a signal matrix, wherein the signal matrix includes a plurality of signals to be processed that can be processed by a computer;

[0057] A second preprocessing module is used to perform corresponding processing on the acquired signal matrix according to the weight transposition of the preprocessed weight matrix to obtain the preprocessed signal matrix;

[0058] The processing module is used to divide the preprocessed weight matrix horizontally or vertically to obtain multiple first matrix blocks; divide the preprocessed signal matrix accordingly to obtain multiple second matrix blocks; each first matrix block and the corresponding second matrix block are assigned a core of the many-core system for processing.

[0059] The present invention is further improved in that: the step of preprocessing the acquired original weight matrix to obtain the preprocessed weight matrix specifically includes: preprocessing the acquired weight matrix by a row-column interchange algorithm to obtain the preprocessed weight matrix;

[0060] The row-column swapping algorithm includes:

[0061] Swap any two rows in the original weight matrix, calculate the distance from each non-0 element in the two rows after the swap to the matrix diagonal, sum and calculate the average distance from each non-0 element to the matrix diagonal, obtain the distance average dy', and compare it with the distance average dy before the swap. If dy'<dy, perform the row swap, otherwise do not perform the row swap; then swap the columns, calculate the distance from each non-0 element in the two columns after the swap to the matrix diagonal, sum and calculate the average distance from each non-0 element to the matrix diagonal, obtain the distance average dx', and compare it with the distance average dx before the swap. If dx'<dx, perform the column swap, otherwise do not perform the column swap; iteratively perform the row and column swap, and finally concentrate the non-0 elements in the original weight matrix to the diagonal area to obtain the preprocessed weight matrix.

[0062] In a sixth aspect, the present invention provides a block sparseness and load balancing device, comprising:

[0063] A first acquisition module is used to acquire an original weight matrix, where the original weight matrix includes a plurality of weight coefficients;

[0064] The first preprocessing module is used to split the obtained original weight matrix horizontally and vertically to obtain multiple original sub-weight matrices; preprocess the original sub-weight matrix to obtain a preprocessed original sub-weight matrix; the density of the diagonal area in the preprocessed original sub-weight matrix is ​​higher than the density of the diagonal area of ​​the original sub-weight matrix; according to the transposition of the preprocessed original sub-weight matrix relative to each original sub-weight matrix, an input converter and an output converter are set for each original sub-weight matrix;

[0065] A second acquisition module is used to acquire an input signal matrix, wherein the input signal matrix includes a plurality of signals to be processed that can be processed by the computer;

[0066] The second preprocessing module is used to split the acquired input signal matrix horizontally to obtain multiple sub-input signal matrices; input the sub-input signal matrices into corresponding input converters to obtain transposed sub-input signal matrices;

[0067] The processing module is used to allocate a core of the many-core system to each pre-processed original sub-weight matrix for processing, and to calculate the sub-weight matrix operation results by comparing the transposed sub-input signal matrix with the pre-processed original sub-weight matrix; and to input the sub-weight matrix operation results into the corresponding output converter to obtain the final operation results of the sub-weight matrix.

[0068] The present invention is further improved in that: the step of preprocessing the original sub-weight matrix to obtain the preprocessed original sub-weight matrix specifically includes: preprocessing the obtained original sub-weight matrix by a row-column interchange algorithm to obtain the preprocessed original sub-weight matrix;

[0069] The row-column swapping algorithm includes:

[0070] Swap any two rows in the original sub-weight matrix, calculate the distance from each non-0 element in the two rows after the swap to the matrix diagonal, sum and calculate the average distance from each non-0 element to the matrix diagonal, obtain the distance average dy', and compare it with the distance average dy before the swap. If dy'<dy, perform the row swap, otherwise do not perform the row swap; then swap the columns, calculate the distance from each non-0 element in the two columns after the swap to the matrix diagonal, sum and calculate the average distance from each non-0 element to the matrix diagonal, obtain the distance average dx', and compare it with the distance average dx before the swap. If dx'<dx, perform the column swap, otherwise do not perform the column swap; iteratively perform the row and column swap, and finally concentrate the non-0 elements in the original sub-weight matrix to the diagonal area to obtain the original sub-weight matrix after preprocessing.

[0071] In a seventh aspect, the present invention provides an electronic device, comprising a processor and a memory, wherein the processor is used to execute a computer program stored in the memory to implement the block thinning and load balancing method.

[0072] In an eighth aspect, the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores at least one instruction, and when the at least one instruction is executed by a processor, the block sparsification and load balancing method is implemented.

[0073] Compared with the prior art, the present invention has the following unexpected beneficial effects:

[0074] The present invention provides a block sparsification and load balancing method, including: obtaining an original weight matrix, the original weight matrix including multiple weight coefficients; preprocessing the obtained original weight matrix to obtain a preprocessed weight matrix; the density of the diagonal area in the preprocessed weight matrix is ​​higher than the density of the diagonal area in the original weight matrix; dividing the preprocessed weight matrix to obtain multiple matrix blocks, each matrix block is assigned to a core of a many-core system for processing. The present invention preprocesses the weight matrix so that the density of the diagonal area in the preprocessed weight matrix is ​​higher than the density of the diagonal area in the original weight matrix, the density of the diagonal area is higher, and the sparsity of the rest is higher; then, it is allocated to different cores through horizontal or vertical division, and the computing tasks allocated to each core are similar, so that the processing time of each core is almost the same, and the load is balanced, and dense computing and dense storage are realized locally, and sparse computing and sparse storage are realized in the rest. The efficiency of dense computing is higher than that of sparse computing. After the above processing, a globally sparse matrix is ​​transformed into a locally dense matrix of the remaining coefficients. When the core is used for calculation, more dense calculations are achieved compared to the matrix before processing, thereby improving the calculation efficiency. This solves the technical problems of high computational difficulty and uneven load caused by ultra-large-scale matrices when performing brain simulation through a multi-core system.

[0075] Furthermore, the present invention preprocesses the weight matrix or the divided sub-weight matrix, and the density of the diagonal area in the preprocessed weight matrix or sub-weight matrix is ​​higher than the density of the diagonal area of ​​the original weight matrix; according to the transposition of the preprocessed weight matrix or sub-weight matrix relative to each original weight matrix or sub-weight matrix, an input converter and an output converter are set for each preprocessed weight matrix or sub-weight matrix; each converter stores different LUT tables for corresponding transposition of the input / output matrix without affecting the actual calculation results of the matrix. BRIEF DESCRIPTION OF THE DRAWINGS

[0076] The accompanying drawings constituting 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 an improper limitation of the present invention. In the accompanying drawings:

[0077] Figure 1 Schematic diagram of the original weight matrix;

[0078] Figure 2 Schematic diagram of the weight matrix after preprocessing;

[0079] Figure 3 A schematic diagram of horizontal partitioning of the preprocessed weight matrix;

[0080] Figure 4Schematic diagram of a super-large-scale weight matrix;

[0081] Figure 5 Schematic diagram of transposing the input signal matrix P';

[0082] Figure 6 Schematic diagram of the input signal matrix P' being transposed by the converter;

[0083] Figure 7 A schematic diagram of a block sparseness and load balancing method of the present invention;

[0084] Figure 8 A schematic diagram of a block sparsification and load balancing transposition structure of the present invention;

[0085] Fig. 9 It is a structural schematic diagram of another block sparseness and load balanced transposition according to an embodiment of the present invention;

[0086] Fig.10 The figure is a schematic structural diagram of an electronic device of the present invention. DETAILED DESCRIPTION

[0087] The embodiments of the present invention provide a block sparsification and load balancing method, device, equipment and medium for improving the computing efficiency of a many-core system.

[0088] In order to enable those skilled in the art to better understand the technical solutions of the present disclosure, the exemplary embodiments of the present disclosure are described below in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, the description of well-known functions and structures is omitted in the following description.

[0089] In the absence of conflict, the various embodiments of the present disclosure and the various features therein may be combined with each other.

[0090] As used herein, the term "and / or" includes any and all combinations of one or more of the associated listed items.

[0091] The terms used in the present invention are only used to describe specific embodiments and are not intended to limit the present disclosure. As used herein, the singular forms "a" and "the" are also intended to include plural forms, unless the context clearly indicates otherwise. It will also be understood that when the terms "including" and / or "made of" are used in this specification, the presence of the features, wholes, steps, operations, elements and / or components is specified, but the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or groups thereof is not excluded. "Connect" or "connected" and similar words are not limited to physical or mechanical connections, but can include electrical connections, whether direct or indirect.

[0092] The terms "first", "second", and "third" and the like in the specification embodiments and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or precedence. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, including a series of steps or units. The method, system, product or device is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0093] Unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by those of ordinary skill in the art. It will also be understood that terms such as those defined in commonly used dictionaries should be interpreted as having a meaning consistent with their meaning in the context of the relevant art and the present disclosure, and will not be interpreted as having an idealized or overly formal meaning unless explicitly defined as such herein.

[0094] See also Figures 1 to 3 As shown, the present invention provides a block sparseness and load balancing method, comprising:

[0095] S1. Obtain an original weight matrix, wherein the original weight matrix includes a plurality of weight coefficients; preprocess the obtained original weight matrix to transform the matrix into Figure 2 The preprocessed weight matrix is ​​shown in Figure 2. The diagonal area in the preprocessed weight matrix has a higher density, while the rest has a higher sparsity.

[0096] In some feasible embodiments, the weight matrix is ​​a two-dimensional array (or matrix) whose elements (i.e., weight coefficients) represent the connection strength between two adjacent layers of neurons in the neural network, and the connection strength without connection is 0; specifically, if the neural network has an input layer with m neurons and a hidden layer with n neurons, then the weight matrix W from the input layer to the hidden layer will be an n×m matrix.

[0097] In some feasible embodiments, in brain simulation, the weight matrix is ​​obtained based on biological brain science and has a relatively high sparsity; the proportion of elements in the weight matrix with connection strength greater than 0 is less than 10%; specifically, for example, less than 8%, less than 6%, less than 4%, less than 2%, etc.

[0098] In some feasible embodiments, the obtained weight matrix may be preprocessed by using algorithms such as a community discovery algorithm, a row-column exchange algorithm, and a clustering algorithm.

[0099] In some feasible embodiments, the row-column swapping algorithm includes:

[0100] Swap any two rows in the original weight matrix, calculate the distance from each non-0 element in the two rows to the matrix diagonal after the swap, sum and calculate the average value according to the distance from each non-0 element to the matrix diagonal, obtain the average distance dy', and compare it with the average distance dy before the swap. If dy'<dy, then swap the rows, otherwise do not swap the rows; then swap the columns, calculate the distance from each non-0 element in the two columns to the matrix diagonal after the swap, sum and calculate the average distance according to the distance from each non-0 element to the matrix diagonal, obtain the average distance dx', and compare it with the average distance dx before the swap. If dx'<dx, then swap the columns, otherwise do not swap the columns; iteratively swap rows and columns, and finally concentrate the non-0 elements in the original weight matrix to the diagonal area to obtain the preprocessed weight matrix. It should be understood that the swap is done once, and the simulation can be simulated multiple times or used for a long time. In addition, when running, the input should also be adjusted accordingly according to the transposition of the weights.

[0101] In some feasible embodiments, the distance from an element to a matrix diagonal is a vertical distance.

[0102] In some feasible embodiments, the number of iterations of the row-column swapping algorithm is when the density reaches an expected value, or reaches a preset time, etc.

[0103] S2. Divide the preprocessed weight matrix horizontally or vertically to obtain a plurality of matrix blocks, each of which is allocated to a core of the many-core system.

[0104] In some possible embodiments, such as Figure 3 As shown in the figure, through horizontal or vertical partitioning, each matrix block is assigned to different cores, and the computing tasks assigned to each core are similar. In this way, the processing time of each core is almost the same, and the load is balanced, so that dense computing and dense storage are achieved locally, and sparse computing and sparse storage are achieved in other places.

[0105] The efficiency of dense computing is higher than that of sparse computing. After the above processing, a globally sparse matrix is ​​transformed into a locally dense and sparse matrix. When the core performs calculations again, more dense calculations are achieved compared to the matrix before processing, thereby improving the computing efficiency of the many-core system.

[0106] In addition, the processing time of each core in the multi-core system is almost the same. The next time beat is calculated only after the matrix is ​​calculated and issued. In this way, the rhythm of each core is similar, which is most efficient and saves time.

[0107] In some feasible embodiments, the preprocessed weight matrix is ​​evenly distributed according to the number of cores of the many-core system; for example, the many-core system has 6 cores, and the preprocessed weight matrix is ​​divided into 6 matrix blocks by horizontal even division, and each matrix block is allocated to a core of the many-core system for calculation.

[0108] In some feasible embodiments, the number of cores of the many-core system and the storage capacity of each core are obtained; the number of cores to be processed is allocated according to the storage capacity of each core; for example, the many-core system has 6 cores, and 5 cores can store all the operation data of the preprocessed weight matrix; the preprocessed weight matrix is ​​divided into 5 matrix blocks by horizontal division, and each matrix block is allocated to a core of the many-core system for calculation; and 1 core is idle for processing other tasks;

[0109] The preprocessed weight matrix is ​​evenly distributed according to the number of cores of the many-core system. For example, if the many-core system has 6 cores, the preprocessed weight matrix is ​​divided into 6 matrix blocks by horizontal division, and each matrix block is allocated to a core of the many-core system for calculation to balance the load.

[0110] See also Figures 4 to 6 As shown, for very large matrices:

[0111] Obtaining a very large-scale weight matrix, the weight matrix includes multiple weight coefficients;

[0112] The obtained weight matrix is ​​split to obtain multiple sub-weight matrices. Each sub-weight matrix can be processed with reference to the previous steps S1 and S2 to achieve load balancing.

[0113] like Figure 4 As shown, a very large-scale weight matrix is ​​split into 16 sub-matrices. For each sub-weight matrix, local dense processing is performed in the same manner as above, and each sub-matrix is ​​processed separately. Each sub-matrix is ​​equipped with an input converter and an output converter.

[0114] The following description is made by taking the input signal matrix P' as the input of the first row of four sub-matrices and Q(A) as the output of the first row as an example.

[0115] Among them, see Figure 6 As shown, the input signal matrix P' is transposed through four different input converters to obtain transposed input signal matrices P(A), P(B), P(C) and P(D); each input converter stores different LUT tables, which are used to process the input signal matrix P' according to the weight transposition of the preprocessed sub-weight matrix to obtain the transposed input signal matrix P(A), P(B), P(C) or P(D); the transposed input signal matrices P(A), P(B), P(C) and P(D) are respectively operated with the corresponding preprocessed sub-weight matrices to obtain operation results; the operation results of the four sub-modules are respectively transposed through four different output converters to obtain the final operation results of the four sub-modules; the final operation results of the four sub-modules are twisted and superimposed to obtain the output result Q(A).

[0116] If there are two layers, for example, layer A and layer B, layer A outputs to layer B. If layer B also needs to be locally concentrated, it needs to be converted through a converter. If it is pure input or pure output, it can be left unchanged.

[0117] See also Figure 7 As shown, an embodiment of the present invention provides a block sparseness and load balancing method, including:

[0118] S100, obtaining an original weight matrix, where the original weight matrix includes a plurality of weight coefficients;

[0119] In some feasible embodiments, in brain simulation, the weight matrix is ​​obtained based on biological brain science and has a relatively high sparsity; the proportion of elements in the weight matrix with connection strength greater than 0 is less than 10%; specifically, for example, less than 8%, less than 6%, less than 4%, less than 2%, etc.

[0120] S200, preprocessing the acquired original weight matrix to obtain a preprocessed weight matrix; the density of the diagonal area in the preprocessed weight matrix is ​​higher than the density of the diagonal area in the original weight matrix;

[0121] In some feasible embodiments, the obtained weight matrix may be preprocessed by a community discovery algorithm, a row-column interchange algorithm, or a clustering algorithm to obtain a preprocessed weight matrix.

[0122] In some feasible embodiments, the row and column swap algorithm includes: swapping any two rows in the original weight matrix, calculating the distance from each non-0 element in the two rows after the swap to the matrix diagonal, summing and calculating the average distance from each non-0 element to the matrix diagonal, obtaining the distance average dy', and comparing it with the distance average dy before the swap. If dy'<dy, the row swap is performed, otherwise the row swap is not performed; then swapping the columns, calculating the distance from each non-0 element in the two columns after the swap to the matrix diagonal, summing and calculating the average distance from each non-0 element to the matrix diagonal, obtaining the distance average dx', and comparing it with the distance average dx before the swap. If dx'<dx, the column swap is performed, otherwise the column swap is not performed; iteratively performing the row and column swaps, and finally concentrating the non-0 elements in the original weight matrix to the diagonal area to obtain the preprocessed weight matrix.

[0123] S300 , dividing the preprocessed weight matrix to obtain a plurality of matrix blocks, each matrix block being allocated to a core of the many-core system for processing.

[0124] In some feasible embodiments, the step of dividing the preprocessed weight matrix to obtain a plurality of matrix blocks, each matrix block being allocated to a core of the many-core system for processing, specifically includes:

[0125] The number of cores N of the many-core system is obtained; according to the number of cores N of the many-core system, the preprocessed weight matrix is ​​divided into N matrix blocks horizontally or vertically, and each matrix block is allocated to a core of the many-core system for calculation.

[0126] In some feasible embodiments, the step of dividing the preprocessed weight matrix to obtain a plurality of matrix blocks, each matrix block being allocated to a core of the many-core system for processing, specifically includes:

[0127] Obtain the number of cores N of the many-core system and the storage capacity of each core; divide the preprocessed weight matrix into M matrix blocks horizontally or vertically, and each matrix block is assigned to a core of the many-core system for calculation; wherein M<N, and the computing data storage capacity of each matrix block is less than or equal to the storage capacity of each core.

[0128] The embodiment of the present invention provides a block sparseness and load balancing method, including:

[0129] Acquire an original weight matrix, wherein the original weight matrix includes a plurality of weight coefficients;

[0130] Preprocessing the obtained original weight matrix to obtain a preprocessed weight matrix; the density of the diagonal area in the preprocessed weight matrix is ​​higher than the density of the diagonal area in the original weight matrix;

[0131] Acquire a signal matrix, wherein the signal matrix includes a plurality of signals to be processed that can be processed by a computer;

[0132] The acquired signal matrix is ​​processed accordingly according to the weight transposition of the preprocessed weight matrix to obtain the preprocessed signal matrix;

[0133] The preprocessed weight matrix is ​​divided horizontally or vertically to obtain a plurality of first matrix blocks; the preprocessed signal matrix is ​​divided accordingly to obtain a plurality of second matrix blocks; each first matrix block and the corresponding second matrix block are assigned a core of a many-core system for processing.

[0134] The embodiment of the present invention provides a block sparseness and load balancing method, including:

[0135] Acquire an original weight matrix, wherein the original weight matrix includes a plurality of weight coefficients;

[0136] The obtained original weight matrix is ​​split horizontally and vertically to obtain multiple original sub-weight matrices; the original sub-weight matrix is ​​preprocessed to obtain a preprocessed original sub-weight matrix; the density of the diagonal area in the preprocessed original sub-weight matrix is ​​higher than the density of the diagonal area of ​​the original sub-weight matrix; according to the transposition of the preprocessed original sub-weight matrix relative to each original sub-weight matrix, an input converter and an output converter are set for each original sub-weight matrix;

[0137] Acquire an input signal matrix, wherein the input signal matrix includes a plurality of signals to be processed that can be processed by a computer;

[0138] The obtained input signal matrix is ​​split horizontally to obtain multiple sub-input signal matrices; the sub-input signal matrices are input into corresponding input converters to obtain transposed sub-input signal matrices;

[0139] Each preprocessed original sub-weight matrix is ​​assigned to a core of the many-core system for processing, and the transposed sub-input signal matrix and the preprocessed original sub-weight matrix are budgeted to obtain the sub-weight matrix operation result; the sub-weight matrix operation result is input into the corresponding output converter to obtain the final operation result of the sub-weight matrix.

[0140] See also Figure 8 As shown, an embodiment of the present invention provides a block sparseness and load balancing device, including:

[0141] An acquisition module, used to acquire an original weight matrix, wherein the original weight matrix includes a plurality of weight coefficients;

[0142] In some feasible embodiments, in brain simulation, the weight matrix is ​​obtained based on biological brain science and has a relatively high sparsity; the proportion of elements in the weight matrix with connection strength greater than 0 is less than 10%; specifically, for example, less than 8%, less than 6%, less than 4%, less than 2%, etc.

[0143] A preprocessing module, used for preprocessing the acquired original weight matrix to obtain a preprocessed weight matrix; the density of the diagonal area in the preprocessed weight matrix is ​​higher than the density of the diagonal area in the original weight matrix;

[0144] In some feasible embodiments, the obtained weight matrix may be preprocessed by a community discovery algorithm, a row-column interchange algorithm, or a clustering algorithm to obtain a preprocessed weight matrix.

[0145] In some feasible embodiments, the row and column swap algorithm includes: swapping any two rows in the original weight matrix, calculating the distance from each non-0 element in the two rows after the swap to the matrix diagonal, summing and calculating the average distance from each non-0 element to the matrix diagonal, obtaining the distance average dy', and comparing it with the distance average dy before the swap. If dy'<dy, the row swap is performed, otherwise the row swap is not performed; then swapping the columns, calculating the distance from each non-0 element in the two columns after the swap to the matrix diagonal, summing and calculating the average distance from each non-0 element to the matrix diagonal, obtaining the distance average dx', and comparing it with the distance average dx before the swap. If dx'<dx, the column swap is performed, otherwise the column swap is not performed; iteratively performing the row and column swaps, and finally concentrating the non-0 elements in the original weight matrix to the diagonal area to obtain the preprocessed weight matrix.

[0146] The processing module is used to divide the preprocessed weight matrix into multiple matrix blocks, and each matrix block is allocated to a core of the many-core system for processing.

[0147] In some feasible embodiments, the step of dividing the preprocessed weight matrix to obtain a plurality of matrix blocks, each matrix block being allocated to a core of the many-core system for processing, specifically includes:

[0148] The number of cores N of the many-core system is obtained; according to the number of cores N of the many-core system, the preprocessed weight matrix is ​​divided into N matrix blocks horizontally or vertically, and each matrix block is allocated to a core of the many-core system for calculation.

[0149] In some feasible embodiments, the step of dividing the preprocessed weight matrix to obtain a plurality of matrix blocks, each matrix block being allocated to a core of the many-core system for processing, specifically includes:

[0150] Obtain the number of cores N of the many-core system and the storage capacity of each core; divide the preprocessed weight matrix into M matrix blocks horizontally or vertically, and each matrix block is assigned to a core of the many-core system for calculation; wherein M<N, and the computing data storage capacity of each matrix block is less than or equal to the storage capacity of each core.

[0151] See also Fig. 9 As shown, an embodiment of the present invention provides a block sparseness and load balancing device, including:

[0152] A first acquisition module is used to acquire an original weight matrix, where the original weight matrix includes a plurality of weight coefficients;

[0153] A first preprocessing module is used to preprocess the acquired original weight matrix to obtain a preprocessed weight matrix; the density of the diagonal area in the preprocessed weight matrix is ​​higher than the density of the diagonal area in the original weight matrix;

[0154] In some feasible embodiments, the step of preprocessing the acquired original weight matrix to obtain a preprocessed weight matrix specifically includes: preprocessing the acquired weight matrix by a row-column interchange algorithm to obtain a preprocessed weight matrix;

[0155] The row-column swapping algorithm includes:

[0156] Swap any two rows in the original weight matrix, calculate the distance from each non-0 element in the two rows after the swap to the matrix diagonal, sum and calculate the average distance from each non-0 element to the matrix diagonal, obtain the distance average dy', and compare it with the distance average dy before the swap. If dy'<dy, perform the row swap, otherwise do not perform the row swap; then swap the columns, calculate the distance from each non-0 element in the two columns after the swap to the matrix diagonal, sum and calculate the average distance from each non-0 element to the matrix diagonal, obtain the distance average dx', and compare it with the distance average dx before the swap. If dx'<dx, perform the column swap, otherwise do not perform the column swap; iteratively perform the row and column swap, and finally concentrate the non-0 elements in the original weight matrix to the diagonal area to obtain the preprocessed weight matrix.

[0157] A second acquisition module is used to acquire a signal matrix, wherein the signal matrix includes a plurality of signals to be processed that can be processed by a computer;

[0158] A second preprocessing module is used to perform corresponding processing on the acquired signal matrix according to the weight transposition of the preprocessed weight matrix to obtain the preprocessed signal matrix;

[0159] The processing module is used to divide the preprocessed weight matrix horizontally or vertically to obtain multiple first matrix blocks; divide the preprocessed signal matrix accordingly to obtain multiple second matrix blocks; each first matrix block and the corresponding second matrix block are assigned a core of the many-core system for processing.

[0160] The embodiment of the present invention provides a block sparseness and load balancing device, including:

[0161] A first acquisition module is used to acquire an original weight matrix, where the original weight matrix includes a plurality of weight coefficients;

[0162] The first preprocessing module is used to split the obtained original weight matrix horizontally and vertically to obtain multiple original sub-weight matrices; preprocess the original sub-weight matrix to obtain a preprocessed original sub-weight matrix; the density of the diagonal area in the preprocessed original sub-weight matrix is ​​higher than the density of the diagonal area of ​​the original sub-weight matrix; according to the transposition of the preprocessed original sub-weight matrix relative to each original sub-weight matrix, an input converter and an output converter are set for each original sub-weight matrix;

[0163] In some feasible embodiments, the step of preprocessing the original sub-weight matrix to obtain the preprocessed original sub-weight matrix specifically includes: preprocessing the obtained original sub-weight matrix by a row-column interchange algorithm to obtain the preprocessed original sub-weight matrix;

[0164] The row-column swapping algorithm includes:

[0165] Swap any two rows in the original sub-weight matrix, calculate the distance from each non-0 element in the two rows after the swap to the matrix diagonal, sum and calculate the average distance from each non-0 element to the matrix diagonal, obtain the distance average dy', and compare it with the distance average dy before the swap. If dy'<dy, perform the row swap, otherwise do not perform the row swap; then swap the columns, calculate the distance from each non-0 element in the two columns after the swap to the matrix diagonal, sum and calculate the average distance from each non-0 element to the matrix diagonal, obtain the distance average dx', and compare it with the distance average dx before the swap. If dx'<dx, perform the column swap, otherwise do not perform the column swap; iteratively perform the row and column swap, and finally concentrate the non-0 elements in the original sub-weight matrix to the diagonal area to obtain the original sub-weight matrix after preprocessing.

[0166] A second acquisition module is used to acquire an input signal matrix, wherein the input signal matrix includes a plurality of signals to be processed that can be processed by the computer;

[0167] The second preprocessing module is used to split the acquired input signal matrix horizontally to obtain multiple sub-input signal matrices; input the sub-input signal matrices into corresponding input converters to obtain transposed sub-input signal matrices;

[0168] The processing module is used to allocate a core of the many-core system to each pre-processed original sub-weight matrix for processing, and to calculate the sub-weight matrix operation results by comparing the transposed sub-input signal matrix with the pre-processed original sub-weight matrix; and to input the sub-weight matrix operation results into the corresponding output converter to obtain the final operation results of the sub-weight matrix.

[0169] See also Fig.10 As shown, the present invention also provides an electronic device 100 for implementing a block sparsification and load balancing method; the electronic device 100 includes a memory 101, at least one processor 102, a computer program 103 stored in the memory 101 and executable on the at least one processor 102, and at least one communication bus 104.

[0170] The memory 101 can be used to store the computer program 103, and the processor 102 implements the steps of a block sparseness and load balancing method described in the above embodiment by running or executing the computer program stored in the memory 101 and calling the data stored in the memory 101. The memory 101 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area can store data (such as audio data) created according to the use of the electronic device 100, etc. In addition, the memory 101 can include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other non-volatile solid-state storage devices.

[0171] The at least one processor 102 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The processor 102 may be a microprocessor or any conventional processor, etc. The processor 102 is the control center of the electronic device 100, and uses various interfaces and lines to connect various parts of the entire electronic device 100.

[0172] The memory 101 in the electronic device 100 stores a plurality of instructions to implement a block sparseness and load balancing method, and the processor 102 can execute the plurality of instructions to implement:

[0173] Acquire an original weight matrix, wherein the original weight matrix includes a plurality of weight coefficients;

[0174] Preprocessing the obtained original weight matrix to obtain a preprocessed weight matrix; the density of the diagonal area in the preprocessed weight matrix is ​​higher than the density of the diagonal area in the original weight matrix;

[0175] The preprocessed weight matrix is ​​divided into multiple matrix blocks, and each matrix block is assigned to a core of the many-core system for processing.

[0176] If the module / unit integrated in the electronic device 100 is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present invention implements all or part of the process in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device that can carry the computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory and read-only memory (ROM, Read-Only Memory).

[0177] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented 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.

[0178] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0179] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0180] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0181] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the above embodiments, ordinary technicians in the relevant field should understand that the specific implementation methods of the present invention can still be modified or replaced by equivalents. Any modification or equivalent replacement that does not depart from the spirit and scope of the present invention should be covered within the scope of protection of the claims of the present invention.

Claims

1. A block sparsification and load balancing method, characterized in that: include: Acquire an original weight matrix, wherein the original weight matrix includes a plurality of weight coefficients; Preprocessing the obtained original weight matrix to obtain a preprocessed weight matrix; The density of the diagonal area in the preprocessed weight matrix is ​​higher than the density of the diagonal area in the original weight matrix; The preprocessed weight matrix is ​​divided into multiple matrix blocks, and each matrix block is assigned to a core of the many-core system for processing.

2. The block sparseness and load balancing method according to claim 1, characterized in that: In the step of preprocessing the obtained original weight matrix to obtain the preprocessed weight matrix, the obtained weight matrix is ​​preprocessed by a community discovery algorithm, a row-column interchange algorithm or a clustering algorithm to obtain the preprocessed weight matrix.

3. The block sparseness and load balancing method according to claim 1, characterized in that: In the step of preprocessing the obtained original weight matrix to obtain the preprocessed weight matrix, the obtained weight matrix is ​​preprocessed by a row-column interchange algorithm to obtain the preprocessed weight matrix; The row-column swapping algorithm includes: Swap any two rows in the original weight matrix, calculate the distance from each non-0 element in the two rows after the swap to the matrix diagonal, sum and calculate the average distance from each non-0 element to the matrix diagonal, obtain the distance average dy', and compare it with the distance average dy before the swap. If dy'<dy, perform the row swap, otherwise do not perform the row swap; then swap the columns, calculate the distance from each non-0 element in the two columns after the swap to the matrix diagonal, sum and calculate the average distance from each non-0 element to the matrix diagonal, obtain the distance average dx', and compare it with the distance average dx before the swap. If dx'<dx, perform the column swap, otherwise do not perform the column swap; iteratively perform the row and column swap, and finally concentrate the non-0 elements in the original weight matrix to the diagonal area to obtain the preprocessed weight matrix.

4. The block sparseness and load balancing method according to claim 1, characterized in that: The step of dividing the preprocessed weight matrix to obtain a plurality of matrix blocks, wherein each matrix block is allocated to a core of the many-core system for processing, specifically includes: The number of cores N of the many-core system is obtained; according to the number of cores N of the many-core system, the preprocessed weight matrix is ​​divided into N matrix blocks horizontally or vertically, and each matrix block is allocated to a core of the many-core system for calculation.

5. The block sparseness and load balancing method according to claim 1, characterized in that: The step of dividing the preprocessed weight matrix to obtain a plurality of matrix blocks, wherein each matrix block is allocated to a core of the many-core system for processing, specifically includes: Obtain the number of cores N of the many-core system and the storage capacity of each core; divide the preprocessed weight matrix into M matrix blocks horizontally or vertically, and each matrix block is assigned to a core of the many-core system for calculation; wherein M<N, and the computing data storage capacity of each matrix block is less than or equal to the storage capacity of each core.

6. A block sparsification and load balancing method, characterized in that: include: Acquire an original weight matrix, wherein the original weight matrix includes a plurality of weight coefficients; Preprocessing the obtained original weight matrix to obtain a preprocessed weight matrix; The density of the diagonal area in the preprocessed weight matrix is ​​higher than the density of the diagonal area in the original weight matrix; Acquire a signal matrix, wherein the signal matrix includes a plurality of signals to be processed that can be processed by a computer; The acquired signal matrix is ​​processed accordingly according to the weight transposition of the preprocessed weight matrix to obtain the preprocessed signal matrix; Dividing the preprocessed weight matrix horizontally or vertically to obtain a plurality of first matrix blocks; The preprocessed signal matrix is ​​divided accordingly to obtain a plurality of second matrix blocks; each first matrix block and the corresponding second matrix block are allocated a core of the many-core system for processing.

7. A block sparsification and load balancing method, characterized in that: include: Acquire an original weight matrix, wherein the original weight matrix includes a plurality of weight coefficients; The obtained original weight matrix is ​​split horizontally and vertically to obtain multiple original sub-weight matrices; the original sub-weight matrix is ​​preprocessed to obtain a preprocessed original sub-weight matrix; the density of the diagonal area in the preprocessed original sub-weight matrix is ​​higher than the density of the diagonal area of ​​the original sub-weight matrix; according to the transposition of the preprocessed original sub-weight matrix relative to each original sub-weight matrix, an input converter and an output converter are set for each original sub-weight matrix; Acquire an input signal matrix, wherein the input signal matrix includes a plurality of signals to be processed that can be processed by a computer; The obtained input signal matrix is ​​split horizontally to obtain multiple sub-input signal matrices; the sub-input signal matrices are input into corresponding input converters to obtain transposed sub-input signal matrices; Each preprocessed original sub-weight matrix is ​​assigned to a core of the many-core system for processing, and the transposed sub-input signal matrix and the preprocessed original sub-weight matrix are budgeted to obtain the sub-weight matrix operation result; the sub-weight matrix operation result is input into the corresponding output converter to obtain the final operation result of the sub-weight matrix.

8. A block sparseness and load balancing device, characterized in that: include: An acquisition module, used to acquire an original weight matrix, wherein the original weight matrix includes a plurality of weight coefficients; A preprocessing module, used for preprocessing the acquired original weight matrix to obtain a preprocessed weight matrix; the density of the diagonal area in the preprocessed weight matrix is ​​higher than the density of the diagonal area in the original weight matrix; The processing module is used to divide the preprocessed weight matrix into multiple matrix blocks, and each matrix block is allocated to a core of the many-core system for processing.

9. The block sparseness and load balancing device according to claim 8, characterized in that: The step of preprocessing the acquired original weight matrix to obtain a preprocessed weight matrix specifically includes: preprocessing the acquired weight matrix by a row-column interchange algorithm to obtain a preprocessed weight matrix; The row-column swapping algorithm includes: Swap any two rows in the original weight matrix, calculate the distance from each non-0 element in the two rows after the swap to the matrix diagonal, sum and calculate the average distance from each non-0 element to the matrix diagonal, obtain the distance average dy', and compare it with the distance average dy before the swap. If dy'<dy, perform the row swap, otherwise do not perform the row swap; then swap the columns, calculate the distance from each non-0 element in the two columns after the swap to the matrix diagonal, sum and calculate the average distance from each non-0 element to the matrix diagonal, obtain the distance average dx', and compare it with the distance average dx before the swap. If dx'<dx, perform the column swap, otherwise do not perform the column swap; iteratively perform the row and column swap, and finally concentrate the non-0 elements in the original weight matrix to the diagonal area to obtain the preprocessed weight matrix.

10. The block sparseness and load balancing device according to claim 8, characterized in that: The step of dividing the preprocessed weight matrix to obtain a plurality of matrix blocks, each matrix block being allocated to a core of the many-core system for processing, specifically includes: The number of cores N of the many-core system is obtained; according to the number of cores N of the many-core system, the preprocessed weight matrix is ​​divided into N matrix blocks horizontally or vertically, and each matrix block is allocated to a core of the many-core system for calculation.

11. The block sparseness and load balancing device according to claim 8, characterized in that: The step of dividing the preprocessed weight matrix to obtain a plurality of matrix blocks, each matrix block being allocated to a core of the many-core system for processing, specifically includes: Obtain the number of cores N of the many-core system and the storage capacity of each core; divide the preprocessed weight matrix into M matrix blocks horizontally or vertically, and each matrix block is assigned to a core of the many-core system for calculation; wherein M<N, and the computing data storage capacity of each matrix block is less than or equal to the storage capacity of each core.

12. A block sparseness and load balancing device, characterized in that: include: A first acquisition module is used to acquire an original weight matrix, where the original weight matrix includes a plurality of weight coefficients; A first preprocessing module is used to preprocess the acquired original weight matrix to obtain a preprocessed weight matrix; the density of the diagonal area in the preprocessed weight matrix is ​​higher than the density of the diagonal area in the original weight matrix; A second acquisition module is used to acquire a signal matrix, wherein the signal matrix includes a plurality of signals to be processed that can be processed by a computer; A second preprocessing module is used to perform corresponding processing on the acquired signal matrix according to the weight transposition of the preprocessed weight matrix to obtain the preprocessed signal matrix; A processing module, used for dividing the preprocessed weight matrix horizontally or vertically to obtain a plurality of first matrix blocks; The preprocessed signal matrix is ​​divided accordingly to obtain a plurality of second matrix blocks; each first matrix block and the corresponding second matrix block are allocated a core of the many-core system for processing.

13. The block sparseness and load balancing device according to claim 12, characterized in that: The step of preprocessing the acquired original weight matrix to obtain a preprocessed weight matrix specifically includes: preprocessing the acquired weight matrix by a row-column interchange algorithm to obtain a preprocessed weight matrix; The row-column swapping algorithm includes: Swap any two rows in the original weight matrix, calculate the distance from each non-0 element in the two rows after the swap to the matrix diagonal, sum and calculate the average distance from each non-0 element to the matrix diagonal, obtain the distance average dy', and compare it with the distance average dy before the swap. If dy'<dy, perform the row swap, otherwise do not perform the row swap; then swap the columns, calculate the distance from each non-0 element in the two columns after the swap to the matrix diagonal, sum and calculate the average distance from each non-0 element to the matrix diagonal, obtain the distance average dx', and compare it with the distance average dx before the swap. If dx'<dx, perform the column swap, otherwise do not perform the column swap; iteratively perform the row and column swap, and finally concentrate the non-0 elements in the original weight matrix to the diagonal area to obtain the preprocessed weight matrix.

14. A block sparseness and load balancing device, characterized in that: include: A first acquisition module is used to acquire an original weight matrix, where the original weight matrix includes a plurality of weight coefficients; The first preprocessing module is used to split the obtained original weight matrix horizontally and vertically to obtain multiple original sub-weight matrices; preprocess the original sub-weight matrix to obtain a preprocessed original sub-weight matrix; the density of the diagonal area in the preprocessed original sub-weight matrix is ​​higher than the density of the diagonal area of ​​the original sub-weight matrix; according to the transposition of the preprocessed original sub-weight matrix relative to each original sub-weight matrix, an input converter and an output converter are set for each original sub-weight matrix; A second acquisition module is used to acquire an input signal matrix, wherein the input signal matrix includes a plurality of signals to be processed that can be processed by the computer; The second preprocessing module is used to split the acquired input signal matrix horizontally to obtain multiple sub-input signal matrices; input the sub-input signal matrices into corresponding input converters to obtain transposed sub-input signal matrices; The processing module is used to allocate a core of the many-core system to each pre-processed original sub-weight matrix for processing, and to calculate the sub-weight matrix operation results by comparing the transposed sub-input signal matrix with the pre-processed original sub-weight matrix; and to input the sub-weight matrix operation results into the corresponding output converter to obtain the final operation results of the sub-weight matrix.

15. The block sparseness and load balancing device according to claim 14, characterized in that: The step of preprocessing the original sub-weight matrix to obtain the preprocessed original sub-weight matrix specifically includes: preprocessing the obtained original sub-weight matrix by a row-column interchange algorithm to obtain the preprocessed original sub-weight matrix; The row-column swapping algorithm includes: Swap any two rows in the original sub-weight matrix, calculate the distance from each non-0 element in the two rows after the swap to the matrix diagonal, sum and calculate the average distance from each non-0 element to the matrix diagonal, obtain the distance average dy', and compare it with the distance average dy before the swap. If dy'<dy, perform the row swap, otherwise do not perform the row swap; then swap the columns, calculate the distance from each non-0 element in the two columns after the swap to the matrix diagonal, sum and calculate the average distance from each non-0 element to the matrix diagonal, obtain the distance average dx', and compare it with the distance average dx before the swap. If dx'<dx, perform the column swap, otherwise do not perform the column swap; iteratively perform the row and column swap, and finally concentrate the non-0 elements in the original sub-weight matrix to the diagonal area to obtain the original sub-weight matrix after preprocessing.

16. An electronic device, characterized in that: It comprises a processor and a memory, wherein the processor is used to execute a computer program stored in the memory to implement a block sparseness and load balancing method as claimed in any one of claims 1 to 7.

17. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores at least one instruction, and when the at least one instruction is executed by a processor, a block sparseness and load balancing method as described in any one of claims 1 to 7 is implemented.