Belief Propagation Method Based on Edge Coloring and Information Update Rate Optimization on GPU

By optimizing the belief propagation algorithm based on edge coloring on the GPU, we solve the problems of vertex sorting and information update order in the existing technology, achieve the effect of converging most information in a short time and maintaining a high convergence speed, and improve the confidence propagation algorithm. overall efficiency and resource utilization.

CN112257866BInactive Publication Date: 2024-09-27INSTITUTE OF INFORMATION ENGINEERING CHINESE ACADEMY OF SCIENCES
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202010940904.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-09-09
Publication Date
2024-09-27
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The existing belief propagation algorithm has the problem that the vertex sorting operation on the GPU is not suitable for parallel architecture and the order of information update is not considered, resulting in a waste of computing resources and low convergence.

Method used

The confidence propagation method based on edge coloring is used to optimize the update sequence through information residuals. Three algorithms, Color Wave, Color Extract and Random Drop, are proposed to optimize the information update rate and calculation stage according to user needs, and improve the parallel computing efficiency of confidence propagation.

Benefits of technology

It achieves the convergence of most information in a short time, maintains high convergence speed and stable convergence degree, and significantly improves the overall operating efficiency and computing resource utilization of the belief propagation algorithm.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112257866B
    Figure CN112257866B
Patent Text Reader

Abstract

The present invention discloses a belief propagation method based on edge coloring and information update rate optimization on a GPU. This method is aimed at the computational requirements of having a high convergence speed globally. The edges with large information residuals are directly used to perform a coloring operation on the edges with small information residuals. Then the edges with large information residuals will color all the edges connected to them. Only the information on the edges with large information residuals is updated, which reduces the amount of computation for each iteration of belief propagation and improves the convergence speed of the belief propagation algorithm in the entire computational process. And for the computational requirements of having a high degree of convergence after the algorithm is stable, it is proposed to gradually reduce the update rate of non-converged information so that the algorithm maintains a high convergence speed in the entire computational process, and has a high degree of convergence when the algorithm is stable. The present invention improves the overall operating efficiency of the belief propagation method.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a method for performing belief propagation calculation using a heterogeneous system, and in particular to a belief propagation method based on edge coloring and information update rate optimization on a GPU. Background Art

[0002] Belief Propagation (BP) is an information transmission algorithm for approximate inference on probabilistic random graphs. It is a basic algorithm in many important fields, including: Polar codes and low-density parity-check (LDPC) codes widely used in the field of communications, computer vision, protein folding, etc. For example: in computer vision, the application requirements related to "pixel labeling" such as stereo matching and image denoising can be directly regarded as maximum a posteriori (MAP) problems, which can be successfully solved by the maximum product belief propagation method (Max-Product BP). In the probabilistic graph model, each node represents a random variable, which takes different label values ​​according to different probabilities, and the edges between nodes represent the probabilistic relationship between these random variables. Among them, the joint probability distribution of all random variables can be expressed as the product of several random variable subsets. The belief propagation algorithm uses the information transmitted between nodes to update the labeling state of the entire current probabilistic graph model. The calculation of belief propagation often requires multiple iterations. After multiple iterations, the probabilistic graph model without loops can ensure that the confidence of all nodes will no longer change, that is, all nodes reach a converged state. The probabilistic graph model with loops cannot ensure that all nodes reach a converged state, but after multiple iterations, the number of non-converged nodes will gradually stabilize. Most of the early belief propagation methods were serial methods, which achieved performance optimization by adjusting the update order of edge information. For example, residual belief propagation (RBP) only updates the information on the edge with the largest information residual each time. Loopy BP (LBP) is the most direct parallel solution, which updates the information on all non-converged edges in each iteration. However, studies have shown that the final convergence of this method is very low. The Residual Splash (RS) method takes the point with the largest information residual as the center and updates the information on the edge in the forward and reverse directions of the breadth-first traversal order. In recent years, Graphics Processing Units (GPU) have been widely used in the field of parallel graph computing. Information update calculation is the main computing task in belief propagation, which is very suitable for parallel processing. Therefore, GPU can significantly improve the speed of belief propagation calculation. The RnBP method is a belief propagation algorithm implemented on GPU. It updates the non-converged information at a certain ratio so that the algorithm can balance the convergence speed and convergence degree. The above methods all have obvious defects. The vertex sorting operation in the RS method is not suitable for the parallel architecture of GPU, and RS needs to apply for a large amount of memory to record the vertex values ​​that need to be processed in each step. The RnBP algorithm does not consider the order of information update, resulting in a waste of computing resources. Summary of the invention

[0003] In view of the technical problems existing in the prior art, the purpose of the present invention is to provide a belief propagation method based on edge coloring and information update rate optimization on GPU. The present invention fully considers the architectural characteristics of GPU and the information update order in belief propagation as the key factor to improve the computing efficiency of parallel belief propagation. The coloring operation is used to partition the non-converged information and specify the update order, thereby improving the overall operating efficiency of the belief propagation method. Different belief propagation methods are proposed according to the different computing needs of users, and the corresponding computing stages are specially optimized.

[0004] The technical solution of the present invention is as follows:

[0005] A belief propagation method based on edge coloring on a GPU, the steps of which include:

[0006] 1) Load the probability graph data G(V,E,Ψ) to be processed into the device memory; V is the vertex set of the probability graph, E is the edge set of the probability graph, and Ψ is the probability set, including the probability value of each vertex in the probability graph taking different labels and the transition probability value corresponding to each edge; each vertex v i Corresponding to the set A discrete random variable X i , n is the total number of vertices, X i ∈A i , A i is a finite set of labels; each edge (v i ,v j ) corresponds to two vertices v i and v j The probability relationship between different values ​​of the above variables; set the threshold ξ for judging whether the information converges and the time threshold T for the end of the belief propagation calculation ξ ;

[0007] 2) Initialize the information variable array M and its buffer variable array M' to 0, assign an edge information calculation task to each thread, calculate the information value on each edge and record it in the variable array M; in the first iteration, calculate the information residual R on each edge in the first iteration based on the current value of the variable array M and the initial value in M'; then copy the value of the variable array M to the variable array M'; perform steps 3) to 6) in each subsequent iteration;

[0008] 3) Use E color Represents the color value of the edge. The color value of each edge is initialized to the ID of the corresponding edge.

[0009] 4) Assign an edge task to each thread, and the thread will i,j Task, traverse the edge e i,j Starting point vi The end point of the edge e k,i And the edge e i,j The end point v j The starting edge e j,l ; If edge e k,i or edge j,l The residual value of the information is greater than the edge e i,j The residual value of the information, then the edge e i,j The color value of is set to the ID of the edge with the larger information residual value;

[0010] 5) Assign an edge task to each thread. If the color value of the edge is the same as the ID of the edge, update the information value of the edge and record the update result in the variable array M;

[0011] 6) According to the information in the variable array M and the buffer variable array M', the information residual R on each edge in the current iteration is calculated; then the value of the variable array M is copied to the variable array M'; M' is used to save the information value obtained in the previous iteration;

[0012] 7) Determine whether to end the calculation based on the current information residual R and the preset threshold: if the information residual R of each edge is less than the threshold ξ, then end the calculation and jump to step 8); or if the number of variables in the information residual R that are less than the threshold ξ tends to be stable, then end the calculation and jump to step 8); if the execution time is greater than or equal to the time threshold T ξ , then the calculation ends and jumps to step 8); otherwise, continue the iterative calculation;

[0013] 8) Based on the information value of the edge finally calculated, the probability value of each vertex when taking different variables is calculated, that is, the confidence of each vertex.

[0014] Furthermore, according to the formula Calculate or update the information value m on each edge i→j According to the formula Calculate the edge e at the tth iteration i,j The residual information on Among them, x i For variable X i A value of x i The corresponding univariate potential function ψ i (x i ) is expressed as x i 、x j The binary potential function ψ i,j Expressed as x j For variable X j A value of X j∈A j , A j is a finite label set; Γ i Represents vertex v i The adjacent vertices of .

[0015] Furthermore, according to the formula Calculate the vertex v i The probability value when taking different variables.

[0016] A belief propagation method based on information update rate optimization on a GPU, the steps of which include:

[0017] 1) Load the probability graph data G(V,E,Ψ) to be processed into the device memory; V is the vertex set of the probability graph, E is the edge set of the probability graph, and Ψ is the probability set, including the probability value of each vertex in the probability graph taking different labels and the transition probability value corresponding to each edge; each vertex v i Corresponding to the set A discrete random variable X i , n is the total number of vertices, X i ∈A i , A i is a finite set of labels; each edge (v i ,v j ) corresponds to two vertices v i and v j The probability relationship between different values ​​of the above variables; set the iteration number threshold D for the information update rate u to decrease n , that is, every time D n After iterations, the information update rate u decreases by a set ratio; the threshold ξ for judging whether the information has converged and the time threshold T for the end of the belief propagation calculation are set. ξ ;

[0018] 2) Initialize the information variable array M and its buffer variable array M' to 0, assign an edge information calculation task to each thread, calculate the information value on each edge and record it in the variable array M; in the first iteration, calculate the information residual R on each edge in the first iteration based on the current value of the variable array M and the initial value in M'; then copy the value of the variable array M to the variable array M'; perform steps 3) to 5) in each subsequent iteration;

[0019] 3) Assign a calculation task of the edge information value to each thread. The thread randomly generates an r in the range of [0,1]. If r is less than u, the thread updates the information value of the assigned edge and records the update result in the variable array M.

[0020] 4) Assign a side information calculation task to each thread, calculate the information value on the corresponding side and record it in the variable array M;

[0021] 5) According to the information in the variable array M and the buffer variable array M', the information residual R on each edge in the current iteration is calculated; then the value of the variable array M is copied to the variable array M'; M' is used to save the information value obtained in the previous iteration;

[0022] 6) Determine whether to end the calculation based on the current information residual R and the preset threshold: if the information residual R of each edge is less than the threshold ξ, then end the calculation and jump to step 7); or if the number of variables in the information residual R that are less than the threshold ξ tends to be stable, then end the calculation and jump to step 7); if the execution time is greater than or equal to the time threshold T ξ , then the calculation ends and jumps to step 7); otherwise, continue the iterative calculation;

[0023] 7) Based on the information value of the edge calculated finally, the probability value of each vertex when taking different variables is calculated, that is, the confidence of each vertex.

[0024] Furthermore, according to the formula Calculate or update the information value m on each edge i→j According to the formula Calculate the edge e at the tth iteration i,j The residual information on Among them, x i For variable X i A value of x i The corresponding univariate potential function ψ i (x i ) is expressed as x i 、x j The binary potential function ψ i,j Expressed as x j For variable X j A value of X j ∈A j , A j is a finite label set; Γ i Represents vertex v i The adjacent vertices of .

[0025] Furthermore, according to the formula Calculate the vertex v i The probability value when taking different variables.

[0026] Furthermore, the information update rate u is initialized to 100%, and each D nAfter iterations, the information update rate u decreases by 10%. After u decreases to 10%, u remains at 10% and does not change.

[0027] The main innovations of the present invention include:

[0028] 1. In order to achieve the computational requirement of convergence of as much information as possible in a short time, the Color Wave (CW) algorithm is proposed. By using vertices with large information residuals to perform fixed-step coloring operations on vertices with small information residuals, multiple partitions centered on vertices with large information residuals are formed on the entire graph model, and the vertex is named the center point. In each partition, the information on the edge is updated in the order from the farthest vertex to the center point and from the center point to the farthest point to complete the belief propagation calculation of each iteration. It is guaranteed that the belief propagation method converges most vertices in a short time.

[0029] 2. In response to the computational requirements of having a high convergence speed globally, a Color Extraction (CE) algorithm is proposed. This algorithm directly uses the edges with large information residuals to perform a coloring operation on the edges with small information residuals. The edges with large information residuals will then color all the edges connected to them, and only the information on these edges with large information residuals will be updated, reducing the computational complexity of each iterative belief propagation and improving the convergence speed of the belief propagation algorithm in the entire computational process.

[0030] 3. In response to the computational requirements of having a higher degree of convergence after the algorithm is stable, the Random Drop (RD) algorithm is proposed. By gradually reducing the update rate of non-convergent information, the algorithm maintains a high convergence speed throughout the entire calculation process and has a higher degree of convergence when the algorithm is stable.

[0031] The entire algorithm is as follows Figure 1 As shown in the figure, this figure describes the detailed process of performing different belief propagation operations according to different computing requirements of users.

[0032] The method of the present invention has the following advantages and effects:

[0033] 1. Three belief propagation execution schemes are proposed according to different computing requirements of users. Each execution scheme can maintain a high convergence speed in the overall operation stage of the algorithm, and has a high degree of convergence after the algorithm is stable. Each algorithm has obvious optimization effects in each adaptive computing stage.

[0034] 2. The CW algorithm enables belief propagation to converge most of the information in a short time. It divides the probability graph into several partitions by performing a fixed number of coloring operations on the vertices, and sets the vertex with the largest information residual in each partition as the center point. It updates the information on the edge in the order of distance from the center point from far to near and from near to far, which can ensure that as much information as possible is converged in each iteration, so that the CW algorithm can converge most of the information in a short time.

[0035] 3. From the beginning of the algorithm to the time when the number of converged vertices stabilizes, the CE algorithm can keep the belief propagation convergence speed high. Also with the help of the coloring operation, the CE algorithm emphasizes the running efficiency of each iteration. It performs a coloring operation on the edge, selects the edge with the largest information residual among the adjacent edges, and only updates the information on this edge, so that each iteration update can be completed quickly, and only the information that needs to be updated most is updated, which reduces the waste of computing resources and keeps the belief propagation convergence speed high throughout the operation.

[0036] 4. RD can ensure that belief propagation always maintains a high convergence speed, and when the algorithm reaches stability, it has a high degree of convergence. In the RnBP method, the author proposed that when the information update rate in the belief propagation method is set high, although its convergence speed is very fast, the convergence degree of the algorithm is very low when it reaches stability. We conducted further research and found that in the belief propagation calculation process, when the information update rate is adjusted from high to low, the convergence speed of belief propagation will be significantly improved, and when the information update rate is adjusted from low to high, the convergence degree of belief propagation will be greatly reduced, and even a lot of information will change from a convergent state to a non-convergent state. The RD algorithm gradually reduces the information update rate of the algorithm, making its convergence speed higher than the method using a fixed information update rate, and when the algorithm reaches stability, it has a high degree of convergence. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] Figure 1 It is a flow chart of a belief propagation method based on shading optimization on a GPU of the present invention.

[0038] Figure 2 It is a schematic diagram comparing the computational efficiency of the CW method of the present invention and the traditional method on different graph data;

[0039] (a) Within 100 seconds, the CW algorithm with different thresholds Cn is used to perform belief propagation calculation on the graph Ising_1250_3 to show the change of the number of unconverged information with the number of iterations;

[0040] (b) The change of the number of non-converged information of the CW algorithm with different thresholds Cn and other comparison algorithms in the belief propagation calculation on Figure Ising_1500_3 within 100 seconds.

[0041] Figure 3 It is a schematic diagram comparing the computational efficiency of the CE method of the present invention and the traditional method on different graph data;

[0042] (a) In the first 50 iterations of the belief propagation calculation, the number of non-converged information of the CE algorithm and the CW algorithm with different thresholds Cn changes with the number of iterations in Figure Ising_1500_3;

[0043] (b) The number of unconverged information calculated by different algorithms on the graph Ising_1500_3 changes over time within 100 seconds.

[0044] Figure 4 It is a schematic diagram comparing the computational efficiency of the RD method of the present invention and the traditional method on different graph data;

[0045] (a) The number of unconverged information calculated by the random algorithm with different information update rates on the graph Ising_1500_2.5 changes with the number of iterations;

[0046] (b) The change of the number of non-converged information with the number of iterations of the belief propagation calculation of RD algorithm and other comparison algorithms on Figure Ising_1500_3.

[0047] Figure 5 It is a schematic diagram comparing the computational efficiency of all methods in the present invention and traditional methods on different hardware devices;

[0048] (a) On the hardware GeForce 1050ti, the change of the number of unconverged information in the belief propagation calculation of different algorithms on the graph Ising_1500_3 within 100 seconds;

[0049] (b) On the hardware Tesla K80, the number of non-converged information calculated by different algorithms for belief propagation on the graph Ising_1500_3 changes over time within 100 seconds. DETAILED DESCRIPTION

[0050] The present invention is further described in detail below through specific embodiments and drawings.

[0051] As attached Figure 1As shown, the implementation process of the method of the present invention consists of three main calculation schemes, and different calculation schemes are selected according to different calculation requirements of users. Among them, the CW scheme is suitable for the calculation requirements of converging most information in a very short time. The scheme is divided into two stages. The first stage is centered on the coloring operation. After initializing the color and wave values, the color value and wave value of each vertex or edge are marked through the coloring process, and the wave value of the information that does not need to be calculated is set to 0 through the filtering operation; the second stage is mainly to update the information according to the wave value. The update operation includes two directions in positive and negative order. Finally, the residual is calculated and it is judged whether to end the calculation of the information update. The CE scheme is suitable for the calculation requirements of maintaining a high convergence speed throughout the calculation process. The scheme is also divided into two stages. The first stage is centered on the coloring operation. Only one coloring operation is performed on all edges, and the color value of the edge is marked; the second stage updates the information according to the above marking, and finally the residual is calculated and it is judged whether to end the calculation of the information update. The RD scheme is suitable for the calculation requirements of maintaining a high convergence speed throughout the calculation process and a high convergence degree when the algorithm is stable. This scheme is relatively simple. It mainly updates the information randomly and iteratively by gradually reducing the update rate of non-convergent information. Finally, the confidence of each vertex is calculated and the result is output. Specifically, it can be divided into 24 small parts. The implementation of each part is described in detail below.

[0052] 1. Load probability map data and user preset parameters

[0053] Load the probability graph data to be processed into the device memory. Use G(V,E,Ψ) to represent the probability graph data to be processed, where V is the vertex set, E is the edge set, and Ψ is the probability set, including the probability value of each vertex in the probability graph taking different labels and the transition probability value corresponding to each edge. The parameters that need to be preset by the user are: the number of iterations C of each coloring operation in the CW scheme n ; In the RD scheme, the iteration number threshold D at which the information update rate u decreases n , that is, every time D n After iterations, the information update rate u of the non-convergent information decreases by a set ratio (e.g. 10%); the threshold ξ for judging whether the information has converged; the time threshold T for the end of the belief propagation calculation ξ. Belief propagation is a message passing algorithm, which mainly performs approximate derivation calculations on probabilistic graphical models (PGMs). Probabilistic graphs refer to graph data given by users, which can be extracted from the real world, such as the underlying graph structure of decoding operations such as polar codes, Low-Density Parity-Check (LDPC), the underlying graph structure of some machine learning, and the graph structure of protein folding. These are all probabilistic graph models, and the corresponding data can be extracted as probabilistic graph data; they can also be generated by themselves. The Markov random field (MRFs) model is a representative probabilistic graph model. The Ising graph used later is a graph data of a paired Markov random field (MRFs) model, which is generated by the present invention for experiments. The present invention performs belief propagation calculations on various types of probabilistic graph data. As long as the calculation task is on the probabilistic graph, the method of the present invention can be used for calculation.

[0054] 2. Determine the usage plan based on user needs

[0055] We provide three belief propagation computing schemes to meet different computing requirements. If the user's computing requirement is to converge most of the information in a short time, the CW scheme is used; if the user's computing requirement is to maintain a high convergence speed throughout the entire computing stage, the CE scheme is used; if the user's computing requirement is to maintain a high convergence speed throughout the entire computing stage and have a high degree of convergence when the algorithm reaches a stable state, the RD scheme is used.

[0056] CW Solution:

[0057] The CW solution mainly includes the Color process and the Wave process.

[0058] Color process:

[0059] 3. Calculation of information residual (I)

[0060] In the probability graph data G(V,E,Ψ), each vertex v i ∈V corresponds to the set A discrete random variable X i .Right now n is the total number of vertices, X i The value range is X i ∈A i , A i is a finite set of labels. Each edge (v i ,v j )∈E corresponds to two vertices v i and v j The probability relationship between different values ​​of the above variables. Let xi For variable X i A value of , then x i The corresponding univariate potential function ψ i (x i ) can be expressed as x i 、x j The binary potential function between can be expressed as x j For variable X j A value of X j ∈A j , A j is a finite set of labels. Then the value of each edge information can be calculated according to the following formula (1). i→j Represents edge e i,j =(v i ,v j ) on the information value, Γ i Represents vertex v i The adjacent vertices of . i,j The information value on Then edge e i,j The above information residual is shown in formula (2). The parallel calculation process of information residual is as follows: Initialize the information variable array M and its buffer variable array M' to 0, and the size of the variable array M and M' is equal to the amount of information in the probability graph. Assign an information calculation task to each thread, and calculate the information value m on the corresponding edge according to formula (1). i→j And record it in the variable array M, take M' as the information value obtained in the last iteration, and calculate the information residual R on the edge according to formula (2). Finally, copy the value of the variable array M to the variable array M'.

[0061]

[0062]

[0063] 4. Initialize color and wave values

[0064] The color and wave values ​​are important variables in the color process, which are used to mark the coloring of the vertices in the probability graph and the distance from each edge or vertex to the center point. color Indicates the color value of the current vertex. The color value of each vertex is initialized to the ID of the corresponding vertex. wave With E wave They represent the wave values ​​on vertices and edges respectively, and all wave values ​​are initialized to 0.

[0065] 5. Calculate vertex residuals

[0066] The vertex residual is defined as the maximum residual of the edge information ending at the vertex. The parallel calculation of vertex residual operation process is: assign a vertex v to each thread i Task, the number of threads and the number of tasks (number of vertices) are the same, the current vertex v i The vertex residual is initialized to 0, and then traverse the vertex v i For the edge with the end point, if the information residual R on the edge is greater than the vertex v i The vertex residual is assigned to the current vertex v i The vertex residuals.

[0067] 6. Coloring operation and marking color and wave values

[0068] C based on vertex residuals n The parallel shading operation process is: assign a vertex calculation task to each thread, and assign vertex v i The thread of the computing task traverses the vertex v i The end point of the edge e j,i , if edge e j,i Starting point v j The vertex residual of is greater than the vertex v i The vertex residual of the vertex v j The color value of the vertex is assigned to the ID of the vertex, called vertex v j The vertex v i Coloring. At the same time, the vertex v i The wave value is equal to the vertex v j The wave value of edge e is increased by 1; j,i The wave value is equal to the vertex v i The above process is repeated for C n Second-rate.

[0069] 7. Filtering Operation

[0070] After the coloring operation is completed, vertices with the same color value are divided into the same partition, and the vertex with the same ID and color value is the center point of this partition. In the same partition, the closer the vertex or edge is to the center point, the smaller its wave value. If a center point has been colored by other vertices, the partition formed by the vertices with the same color value as the center point is incomplete. We filter the information in the incomplete partition to save computing resources. The parallel filtering operation process is: assign a vertex task to each thread, check the vertex v with the vertex v i The color value of the vertex with ID v j The color value of vertex v j The color value of vertex vj If the IDs of the vertices v i belongs to an incomplete partition, and will be represented by vertex v i Set the wave value of all edges at the end point to 0.

[0071] Wave process:

[0072] 8. Update the edge information value in reverse order of the edge wave value

[0073] The main operation of the Wave process is to update information according to the wave value. The parallel reverse order information update operation process is: assign an information calculation task to each thread, if the wave value of the corresponding edge is C n , then update the information value of the edge according to formula (1), and record the calculation result in the variable array M; iterate the above process, where the wave value is [C n -1,…,1]; in the i-th iteration, the wave value is C n-i+1 The information value of the edge is updated.

[0074] 9. Update the edge information value in the positive order of the edge wave value

[0075] Depending on the starting point and the end point, there are two pieces of information between the two vertices, namely the edge e i,j and edge j,i The corresponding information is different. If the information is updated in reverse order of the wave value, the edge e is updated. i,j The corresponding information needs to be updated when the information is updated in the positive order of the wave value. j,i The parallel forward information update operation process is: assign an information calculation task to each thread, if its corresponding edge e j,i The wave value is 1, then according to formula (1) for edge e j,i The information on the , and the calculation results are recorded in the variable array M; the above process is iterated, and the wave values ​​are [1,…,C n -1].

[0076] 10. Calculating information residuals (Part 2)

[0077] In the above operation process, the information obtained by the previous belief propagation calculation is recorded in M', and the information obtained by the current belief propagation calculation is recorded in M. The information residual R on the edge is calculated according to formula (2). Finally, M is copied to M'.

[0078] 11. Whether to end the calculation

[0079] Determine whether to end the calculation based on the calculation result and the user-preset threshold. If all values ​​in the information residual R are less than the threshold ξ, all information reaches the convergence state, the calculation ends, and jumps to step 23; if the number of variables in the information residual R that are less than the threshold ξ (that is, the number of converged information) tends to be stable, the number of information that reaches the convergence state tends to be stable, the calculation ends, and jumps to step 23; if the execution time of the above operation process is greater than or equal to the time threshold T ξ , end the calculation and jump to step 23; otherwise jump to step 4 to continue the calculation.

[0080] CE Solution:

[0081] The CE solution mainly includes the Color process and the Calculate process.

[0082] Color process:

[0083] 12. Calculation of information residual (I)

[0084] According to the method in step 3, initialize the information variable array M and its buffer variable array M' to 0, calculate the information value M on each edge in parallel according to formula (1), calculate the information residual R on the edge according to formula (2), and copy M to M'.

[0085] 13. Initialize color value

[0086] The CE method is a method to directly color the residual information on the edge, so it is necessary to mark the color value of each edge, using E color Represents the color value of the edge. The color value of each edge is initialized to the ID of the corresponding edge, that is, the color value of the i-th edge is initialized to the ID of the i-th edge.

[0087] 14. Coloring operation and marking color value

[0088] The edge is colored according to the residual information on the edge. The parallel coloring operation process is as follows: determine the number of threads required according to the number of edges; assign an edge task to each thread, traverse the edge e i,j Starting point v i The end point of the edge e k,i And the edge e i,j The end point v j The starting edge e j,l If edge e k,i or edge j,l The residual value of the information is greater than the edge e i,j The residual value of the information, then the edge e i,j The color value is set to the ID of the edge with the larger information residual value.

[0089] Calculate process:

[0090] 15. Update the information on the selected edge

[0091] In the CE algorithm, we only update the information on the edges whose information residual is greater than that of all adjacent edges to reduce unnecessary information update calculations. The parallel update process of edge information is as follows: assign an edge task to each thread. If the color value of the edge is the same as the ID of the edge, use formula (1) to update the information and record the calculation results in the variable array M.

[0092] 16. Calculating information residuals (Part 2)

[0093] In the above operation process, the information obtained by the previous belief propagation calculation is recorded in M', and the information obtained by this belief propagation calculation is recorded in M. The residual R of the edge information is calculated according to formula (2). Finally, M is copied to M'.

[0094] 17. Whether to end the calculation

[0095] Use a similar method to step 11 to determine whether to end the calculation based on the calculation results and the user-preset threshold. That is: if all values ​​in the information residual R are less than the threshold ξ, all information reaches a convergence state, the calculation ends, and jumps to step 23; if the number of variables in the information residual R that are less than the threshold ξ tends to be stable, the number of information that reaches a convergence state tends to be stable, the calculation ends, and jumps to step 23; if the execution time of the above operation process is greater than or equal to the time threshold T ξ , end the calculation and jump to step 23; otherwise jump to step 13 to continue the calculation.

[0096] RD Solution:

[0097] 18. Calculating information residuals (I)

[0098] According to the method in step 3, initialize the information variable array M and its buffer variable array M' to 0, calculate the information value M on each edge in parallel according to formula (1), calculate the information residual R on the edge according to formula (2), and copy M to M'.

[0099] 19. Calculate the information update rate

[0100] The information update rate u is the ratio of the number of information that needs to be updated this time (each edge contains information values ​​in both the positive and negative directions) to the number of all non-converged information. The RD scheme gradually reduces the information update rate to ensure that the algorithm always maintains a high convergence speed throughout the calculation process, and has a high degree of convergence when the algorithm reaches stability. The method of gradually reducing the information update rate is: initialize the information update rate u to 100%, and each D nAfter iterations, the information update rate u decreases by 10%. After u decreases to 10%, u remains at 10% and does not change.

[0101] 20. Perform random information updates

[0102] The information is updated randomly according to the calculated information update rate u. The parallel random information update process is as follows: each thread is assigned a task to calculate the information value on the edge, and a decimal r in the range of [0,1] is randomly generated. If the value of r is less than u, the thread updates the information value of the assigned edge using formula (1) and records the calculation result in the variable array M.

[0103] 21. Calculating information residuals (Part 2)

[0104] In the above operation process, the information obtained by the previous belief propagation calculation is recorded in M', and the information obtained by this belief propagation calculation is recorded in M. The residual R of the edge information is calculated according to formula (2). Finally, M is copied to M'.

[0105] 22. Whether to end the calculation

[0106] Use a similar method to step 11 to determine whether to end the calculation based on the calculation results and the user-preset threshold. That is: if all values ​​in the information residual R are less than the threshold ξ, all information reaches a convergence state, the calculation ends, and jumps to step 23; if the number of variables in the information residual R that are less than the threshold ξ tends to be stable, the number of information that reaches a convergence state tends to be stable, the calculation ends, and jumps to step 23; if the execution time of the above operation process is greater than or equal to the time threshold T ξ , end the calculation and jump to step 23; otherwise jump to step 19 to continue the calculation.

[0107] 23. Calculate the confidence of each vertex

[0108] Based on the edge information value calculated above, the probability value of each vertex taking different variables can be calculated, that is, the confidence of each vertex. The calculation is performed according to the following formula (3). The process of parallel calculation of the confidence of each vertex is: assign a confidence calculation task to each thread, and calculate the confidence of each vertex taking different variables according to formula (3).

[0109]

[0110] 24. Output results

[0111] Complete the belief propagation calculation and output the result.

[0112] Experimental data and conclusions

[0113] The experimental data compared in this invention are all Ising graph data, which are commonly used experimental graph data in the comparison method of belief propagation. The Ising graph data model is a regular N×N grid structure, and each vertex has two possible variable values. The potential function ψ of the variable on the vertex i Randomly select values ​​in the range [0,1]. i =x j When the potential function ψ i,j =e λC ; otherwise, ψ i,j =e -λC . Among them, λ randomly takes values ​​in the range of [-0.5, 0.5], so that ψ i,j Randomly select values ​​within a fixed range, and by setting a larger C value, the potential function ψ i,j The range of values ​​of increases, and the difficulty of belief propagation calculation increases. In the experimental analysis, we verify the universal performance of the algorithm by executing the belief propagation scheme on Ising graph data with different parameters and on different hardware. The graph data used in the experiment is uniformly named Ising_N_C, which represents the Ising graph with N×N vertices under the parameter value C. This experiment compares 6 schemes: (1) LBP: Murphy et al. proposed a scheme that updates all non-converged information in parallel on the GPU. (2) RnBP1: Der et al. proposed a scheme that uses a fixed information update rate and randomly updates only a part of the non-converged vertices each time. (3) RnBP2: Der et al. proposed a scheme that uses a variable information update rate. It presets an information update rate r'. If the convergence speed in the current iterative calculation process is fast, all non-converged information is updated in parallel. Otherwise, only a part of the non-converged vertices is randomly updated according to the information update rate r'. (4) CW: our proposed Color Wave scheme; (5) CE: our proposed Color Extract scheme; (6) RD: our proposed Random Drop scheme.

[0114] 1) Color Wave solution performance analysis

[0115] In order to verify that the Color Wave solution in the present invention can make most information reach a convergence state in a short time, this experiment conducted multiple groups of comparative experiments. Figure 2 (a) is the change of the number of unconverged information in the belief propagation algorithm of the CW algorithm on the Ising graph Ising_1250_3 within 100 seconds as the number of iterations changes. The value in brackets is the threshold C we set. n It is obvious from the figure that the CW algorithm can make more than half of the information in the graph data converge in the first few iterations, and as the threshold C nAs the number of converged information increases, the number of converged information in the first few iterations will also increase significantly, and this convergence advantage will always be maintained, except for C n The convergence of the CW algorithm with a value of 3 is reduced by C after the 21st iteration. n = 2. Therefore, the main advantage of the CW algorithm is that most of the information can reach the convergence state in a short time, and as the threshold C n As the threshold C increases, the amount of information that converges in each iteration increases. The disadvantage of this method is that the time for each iteration increases with the threshold C. n In the 100-second running time, C n = 2, the CW algorithm can perform 132 iterations, but n = 8, the CW algorithm can only perform 45 iterations. Figure 2 This can also be seen from the change in the number of non-converged information obtained by different algorithms in the Ising graph Ising_1500_3 in (b). The RnBP1 algorithm is a solution that only updates a part of the non-converged information, and the update percentage is shown in brackets. LBP is a solution that updates all non-converged information in parallel. Figure 2 As shown in (b), the CW algorithm has an obvious advantage in the first 20 seconds, but because each iteration consumes a lot of time, its convergence degree in the subsequent operations is lower than that of other methods, and when the final convergence is stable, its convergence degree is similar to that of other methods.

[0116] 2)Performance Analysis of Color Extraction Solution

[0117] The Color Extraction solution is proposed based on the drawbacks of the Color Wave algorithm obtained from the above analysis. Its performance is as follows: Figure 3 Attached Figure 3 (a) is the CE algorithm and C on the Ising graph Ising_1500_3 n Comparison of the number of non-converged information in each iteration of the CW algorithm in the first 50 iterations of the belief propagation calculation when different values ​​are taken. It can be seen that since the update order of all non-converged information is strictly specified in the CW algorithm, it is guaranteed that more information can be converged in each iteration. Therefore, in the first 50 iterations, the convergence degree of the CE algorithm can hardly surpass the CW algorithm, except that it surpassed the CW algorithm after the 42nd iteration. n = 3. However, the design purpose of the CE algorithm is to reduce the computation time of each iteration, so that the algorithm as a whole can ensure a higher convergence speed. Figure 3 (b) is the variation of the number of unconverged information over time when different schemes perform belief propagation on the Ising graph Ising_1500_3. It can be seen that although the convergence degree of algorithm CE is much lower than that of C in the first 20 seconds,n The CW algorithm takes different values, but it maintains a high convergence speed afterwards, and the convergence degree of the CE algorithm before reaching stability is much better than that of the RnBP1 and LBP algorithms. This shows that the CE algorithm is an algorithm that can maintain a high convergence speed and convergence degree as a whole.

[0118] 3) Performance Analysis of Random Drop Solution

[0119] Der et al. proposed a random belief propagation scheme with high parallelism, which can make the algorithm converge quickly, but its convergence speed is low. We tested random algorithms with different information update rates on the Ising graph Ising_1500_2.5. The results are shown in the attached figure. Figure 4 (a), although there is an opposite phenomenon in the first 25 iterations, the belief propagation calculation results in most iterations are consistent with this law. Figure 4 In (b), we analyze the optimization performance of the RD algorithm and the scheme of changing the information update rate proposed by Der et al. on the Ising graph Ising_1500_3 on the algorithm that only randomly updates a part of the non-converged information. In the first 90 iterations, the information update rate of the RD algorithm gradually decreases from 100% to 10% and remains at 10%. Figure 4 (b) It can be seen that the result curve of the scheme with a variable information update rate is almost the same as the result curve of the algorithm that directly updates only a part of the non-converged information randomly, and its acceleration advantage is not obvious. However, our RD scheme is slightly inferior in the first 20 iterations, and surpasses all other algorithms in the rest. Therefore, the RD algorithm is a scheme that converges very quickly in almost the entire calculation process, and has a high degree of convergence when the algorithm reaches a stable state.

[0120] 4) Overall performance analysis of all solutions

[0121] In order to verify the overall performance of all the calculation schemes, we analyzed the performance of all the above schemes on the Ising graph Ising_1500_3 for belief propagation calculation on different hardware. The results are shown in the attached figure. Figure 5 As shown in Figure 1, Figure (a) shows the computing performance of different solutions on the hardware GeForce 1050ti, and Figure (b) shows the computing performance of different solutions on the hardware Tesla K80. It can be seen that regardless of C nNo matter what value is taken, the convergence degree of the CW algorithm in the first 10 seconds (Tesla K80) or 20 seconds (GeForce1050ti) is much greater than any other method, and when the algorithm reaches a stable state, its convergence degree is also close to other methods. Therefore, the CW algorithm is very suitable for the need to converge most information in a short time. Before reaching stability, the convergence degree of the CE algorithm is always greater than that of other methods except the CW algorithm, and for a period of time after 10 seconds (Tesla K80) or 20 seconds (GeForce1050ti), the convergence degree of the CE algorithm also exceeds that of the CW algorithm. Therefore, the CE algorithm is suitable for the calculation requirement of maintaining a high convergence speed before stability. Although the convergence degree of the RD algorithm is lower than that of the CW and CE algorithms in most of the time, the convergence degree of the RD algorithm is higher than that of the algorithm that randomly updates part of the non-converged information and updates all the non-converged information in the entire calculation process, and the convergence degree of the algorithm when it reaches a stable state is also very high. Therefore, the RD algorithm is suitable for the need to maintain a high convergence speed and have a high convergence degree after the algorithm is stable.

[0122] The above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit the same. A person skilled in the art may modify or make equivalent substitutions for the technical solutions of the present invention without departing from the spirit and scope of the present invention. The protection scope of the present invention shall be subject to the claims.

Claims

1. A belief propagation method based on edge coloring on a GPU, the steps comprising: 1) Load the probability graph data G(V, E, Ψ) to be processed into the device memory; Where V is the vertex set of the probability graph, E is the edge set of the probability graph, and Ψ is the probability set, including the probability value of each vertex in the probability graph taking different labels and the transition probability value corresponding to each edge; each vertex v i Corresponding to the set A discrete random variable X i , n is the total number of vertices, X i ∈A i , A i is a finite set of labels; each edge (v i ,v j ) corresponds to two vertices v i and v j The probability relationship between different values ​​of the above variables; set the threshold ξ for judging whether the information converges and the time threshold T for the end of the belief propagation calculation ξ ; 2) Initialize the information variable array M and its buffer variable array M' to 0, assign an edge information calculation task to each thread, calculate the information value on each edge and record it in the variable array M; in the first iteration, calculate the information residual R on each edge in the first iteration based on the current value of the variable array M and the initial value in M'; then copy the value of the variable array M to the variable array M'; perform steps 3) to 6) in each subsequent iteration; 3) Use E color Represents the color value of the edge. The color value of each edge is initialized to the ID of the corresponding edge. 4) Assign an edge task to each thread, and the thread will i,j Task, traverse the edge e i,j Starting point v i The end point of the edge e k,i And the edge e i,j The end point v j The starting edge e j,l ; If edge e k,i or edge j,l The residual value of the information is greater than the edge e i,j The residual value of the information, then the edge e i,j The color value of is set to the ID of the edge with the larger information residual value; 5) Assign an edge task to each thread. If the color value of the edge is the same as the ID of the edge, update the information value of the edge and record the update result in the variable array M; 6) Calculate the information residual R on each edge in the current iteration based on the information in the variable array M and the buffer variable array M'; Then copy the value of variable array M to variable array M'; M' is used to save the information value obtained in the last iteration; 7) Determine whether to end the calculation based on the current information residual R and the preset threshold: if the information residual R of each edge is less than the threshold ξ, then end the calculation and jump to step 8); or if the number of variables in the information residual R that are less than the threshold ξ tends to be stable, then end the calculation and jump to step 8); If the execution time is greater than or equal to the time threshold T ξ , then the calculation ends and jumps to step 8); otherwise, continue the iterative calculation; 8) Based on the information value of the edge finally calculated, the probability value of each vertex when taking different variables is calculated, that is, the confidence of each vertex.