A power-law distribution-oriented GPU graph computing acceleration method and device
By optimizing the GPU graph computation process through fine-grained push-pull strategies and block-based work pool strategies, the load balancing and coarse-grained push-pull problems in power-law distribution graph data are solved, thereby improving the efficiency and performance of GPU graph computation.
Patent Information
- Application Number
- CN202411339123.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-25
- Publication Date
- 2025-11-28
- Estimated Expiration
- 2044-09-25
AI Technical Summary
Existing technologies fail to effectively handle load balancing issues and coarse-grained push-pull operations in power-law distribution graph data, resulting in low GPU graph computation efficiency.
A fine-grained push-pull strategy and a block-based work pool strategy are adopted. Vertices are divided into large vertices and small vertices based on their in-degree and out-degree. A greedy strategy is combined to allocate tasks, thereby optimizing the GPU graph computation process.
It improves the load balancing and computational efficiency of GPU graph computing, reduces write conflicts, and enhances algorithm execution efficiency.
Smart Images

Figure CN119168840B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the technical field of graph computing, and particularly relates to a GPU graph computing acceleration method and device for power-law distribution. BACKGROUND
[0002] Common graph algorithms in a graph database include BFS (Breadth-First Search), SSSP (Single Source Shortest Path), WCC (Weakly Connected Components), CD (Community Detection), and the like. In social network analysis, these are important algorithms that are frequently used. These algorithms are usually calculated in the BSP model (Bulk Synchronous Parallel) framework, that is, iterative calculation is performed in units of "rounds", synchronization is performed after each round, data exchange is performed, and preparation is made for the next round of calculation. In each round of calculation, the calculation on each vertex or each edge is lightweight, but the number of vertices or edges is very large. This is consistent with the large-scale lightweight parallel computing mode of a GPU (Graphic Processing Unit). A GPU has tens of thousands of cores, and each core has weak computing power, forming this large-scale lightweight parallel computing mode. Numerous studies have shown that a GPU is effective and has good results for accelerating graph computation.
[0003] In the prior art, in each round of calculation, if the number of active vertices in the current round is small, a "push" mode is used; otherwise, a "pull" mode is used. In the push mode, each vertex calculates according to its own information and the information on the outgoing edge (if any) and pushes the result to its neighbor vertices. The push is an atomic operation to ensure the correctness of the result of the target vertex when it is repeatedly pushed. In the pull mode, each vertex pulls the information on its incoming neighbor and the incoming edge (if any) and saves it in a temporary array, and obtains the new information of the vertex through reduction. Reduction usually uses parallel reduction to further improve efficiency. At the beginning of each round, whether to use push or pull is determined according to the number of active vertices in the current round. Generally, a threshold k is obtained according to experience or experiment, and it is agreed that the pull mode is used when the proportion of active vertices is greater than the threshold, and the push mode is used otherwise.
[0004] The graph data abstracted from real social networks mostly satisfies the power-law distribution, that is, there are a small number of super vertices, and the degrees of the super vertices are huge, causing serious skew of the graph data distribution. The existing technical solutions do not consider processing this type of graph, and this type of graph is ubiquitous, so the defects caused thereby are divided into two parts and discussed respectively.
[0005] Defect one: the existing solutions do not consider the load balancing problem, and adopt a random division method to allocate computing tasks, which has no guarantee of load balancing, and cannot guarantee efficient calculation in the face of power-law distribution. As a parallel algorithm on GPU, load balancing is an important factor, and a better load balancing strategy can better cope with the power-law distribution.
[0006] Defect two: coarse-grained push and pull. The existing methods all adopt coarse-grained push and pull. In each iteration, all active vertices push or all vertices pull. This method does not consider the problem of large vertex push and pull. The pull operation on large vertices requires frequent reduction, which consumes a lot of resources, so large vertices are more suitable for push operation. In the power-law distribution graph, this defect caused by super large vertices is particularly obvious. SUMMARY
[0007] In view of the deficiencies of the prior art, the present application provides a GPU graph computing acceleration method and device for power-law distribution.
[0008] In a first aspect, the present application provides a GPU graph computing acceleration method for power-law distribution, comprising:
[0009] Step S1: obtaining graph data, the graph data conforming to power-law distribution, comprising: a plurality of vertices and a plurality of edges of the graph;
[0010] Step S2: storing the graph data by using GPU, and initializing the stored graph data according to a graph algorithm;
[0011] Step S3: counting the number of active vertices, large vertices and small vertices in the initialized graph data, and saving the active vertices in a work pool, wherein the vertices with out-degree or in-degree greater than the number of threads in the work group are regarded as large vertices, the vertices with out-degree and in-degree not greater than the number of threads in the work group are regarded as small vertices, and the vertices participating in the current round of calculation are regarded as active vertices;
[0012] Step S4: setting a corresponding mailbox for each vertex, the mailbox being used to save the temporary results of the current round of calculation of the corresponding vertex;
[0013] Step S5: determining the push operation or pull operation of the corresponding vertex according to the number of active vertices, the number of large vertices and the number of small vertices, and saving the push operation or pull operation of the corresponding vertex in the work pool;
[0014] Step S6: updating the information in the corresponding mailbox, the next round of active vertices and the number of round active vertices according to the push operation or the pull operation of the corresponding vertex;
[0015] Step S7: updating the corresponding vertex with the updated information in the mailbox to obtain updated graph data;
[0016] Step S8: in the case where the number of next round of active vertices is zero, outputting the updated graph data as the accelerated result, and in the case where the number of next round of active vertices is not zero, returning to step S3 to re-count the large vertices and the small vertices in the updated graph data and perform the next round of calculation.
[0017] The storing of the graph data by the GPU comprises storing the structure information of the graph data in a row-compressed form into the GPU, the structure information being composed of a CSRO structure and a CSRI structure, wherein the CSRO structure stores the out-edges and out-neighbors of all vertices, and the CSRI structure stores the in-edges and in-neighbors of all vertices, and the CSRO structure is read in the push operation and the CSRI structure is read in the pull operation.
[0018] The initialization of the stored graph data according to the graph algorithm comprises judging whether to adopt the push operation or the pull operation in the first round of calculation according to different types of the graph algorithm, initializing the first round of active vertices, initializing the values in the mailbox, and initializing the values on each vertex.
[0019] The judging whether to adopt the push operation or the pull operation in the first round of calculation according to different types of the graph algorithm comprises adopting the push operation for the starting vertex in the case where the graph algorithm is a BFS algorithm or an SSSP algorithm, and adopting the pull operation for the active vertices in the first round of calculation in the case where the graph algorithm is a WCC algorithm or a CDLP algorithm.
[0020] The determining the push operation or the pull operation of the corresponding vertex according to the number of active vertices, the number of large vertices and the number of small vertices comprises:
[0021] Step S5.1: calculating the proportion of the large vertices according to the number of large vertices and the number of small vertices;
[0022] Step S5.2: in the case where the number of active vertices is greater than a preset percentage of the total number of vertices, adopting the pull operation for the current all active vertices and turning to step S6;
[0023] Step S5.3: in the case where the number of active vertices is less than or equal to a preset percentage of the total number of vertices, adopting the push operation for the current all active vertices and turning to step S5.4;
[0024] Step S5.4: in the case that the proportion of large vertices is greater than the first preset percentage, performing a push operation on the large vertices and a pull operation on the small vertices, and proceeding to step S6;
[0025] Step S5.5: in the case that the proportion of large vertices is less than or equal to the first preset percentage, performing a push operation on all vertices, and proceeding to step S6.
[0026] The GPU graph calculation acceleration method for the power-law distribution further comprises: achieving load balancing by using a block work pool strategy, specifically:
[0027] Step S100: dividing the work pool into k parts by using a greedy strategy, numbering each work pool, and taking Where m is the total number of edges to be processed in the current round of calculation;
[0028] Step S101: each thread bundle obtains its own starting work pool number w;
[0029] Step S102: taking a task at the (w+i)th work pool, the task comprising: a push operation or a pull operation of a vertex, and setting i to an initial value of 0;
[0030] Step S103: in the case that a task is taken, performing a push operation or a pull operation of a vertex corresponding to the task, and proceeding to step S102; in the case that no task is taken, setting i to i+1, at this time if i=k, proceeding to step S104, and if i≠k, proceeding to S102;
[0031] Step S104: ending the work pool task processing procedure of the current round, returning to step S3, and waiting for the next round to save the active vertices in the work pool before proceeding to step S100 to perform the next work pool task processing.
[0032] In a second aspect, the application provides a GPU graph calculation acceleration device for a power-law distribution, comprising: a data acquisition module, a storage and initialization module, a quantity counting module, a mailbox setting module, an operation determination module, a data updating module, a vertex updating module, and a result output module;
[0033] The data acquisition module is connected to the storage and initialization module, the storage and initialization module is connected to the quantity counting module, the quantity counting module is connected to the mailbox setting module, the mailbox setting module is connected to the operation determination module, the operation determination module is connected to the data updating module, the data updating module is connected to the vertex updating module, the vertex updating module is connected to the result output module, and the result output module is connected to the quantity counting module.
[0034] The data acquisition module is configured to acquire graph data conforming to a power-law distribution, the graph data including a plurality of vertices and a plurality of edges.
[0035] The storage and initialization module is configured to store the graph data by using a GPU and initialize the stored graph data according to a graph algorithm.
[0036] The quantity counting module is configured to count the number of active vertices, large vertices and small vertices in the initialized graph data, and save the active vertices in a work pool, wherein a vertex with an out-degree or an in-degree greater than the number of threads in a work group is regarded as a large vertex, a vertex with an out-degree and an in-degree not greater than the number of threads in the work group is regarded as a small vertex, and a vertex participating in current round calculation is regarded as an active vertex.
[0037] The mailbox setting module is configured to set a corresponding mailbox for each vertex, the mailbox being configured to save a temporary result of current round calculation of the corresponding vertex.
[0038] The operation determining module is configured to determine a push operation or a pull operation of the corresponding vertex according to the number of active vertices, the number of large vertices and the number of small vertices, and save the push operation or the pull operation of the corresponding vertex in the work pool.
[0039] The data updating module is configured to update information in the corresponding mailbox, next round active vertices and the number of round active vertices according to the push operation or the pull operation of the corresponding vertex.
[0040] The vertex updating module is configured to update the corresponding vertex by using the updated information in the mailbox, to obtain updated graph data.
[0041] The result output module is configured to output the updated graph data as accelerated result in a case where the number of next round active vertices is zero, and return to the quantity counting module to re-count the large vertices and the small vertices in the updated graph data and perform next round calculation in a case where the number of next round active vertices is not zero.
[0042] In a third aspect, an electronic device is provided, which includes one or more processors and a memory configured to store instructions and data, when the instructions are executed by the one or more processors, the one or more processors are caused to perform the GPU graph calculation acceleration method for power-law distribution.
[0043] In a fourth aspect, a computer readable storage medium is provided, which stores data and executable instructions, when the instructions are executed, the processor is caused to perform the GPU graph calculation acceleration method for power-law distribution.
[0044] In a fifth aspect, the present application provides a computer program product, comprising computer programs or instructions, which, when executed by a processor, implement the GPU graph computing acceleration method for power-law distribution.
[0045] Advantages:
[0046] The present application proposes a GPU graph computing acceleration method and device for power-law distribution, which adopts a k-work pool strategy to balance the load. In the face of the power-law distribution phenomenon of real graphs, the load can be better allocated to achieve higher performance. In addition, further fine-grained push-pull strategies are added on the basis of the existing push-pull hybrid mode to overcome the difficulties brought by large vertices in power-law graphs and further reduce the negative impact of write conflicts. Overall, the above two innovations improve the utilization of GPU and improve the execution efficiency of the algorithm. BRIEF DESCRIPTION OF DRAWINGS
[0047] Figure 1 The flowchart of the GPU graph computing acceleration method for power-law distribution of the present application embodiment;
[0048] Figure 2 The flowchart of the GPU graph computing acceleration method for power-law distribution of the present application embodiment;
[0049] Figure 3 The schematic diagram of the k-work pool mechanism of the present application embodiment;
[0050] Figure 4 The principle block diagram of the GPU graph computing acceleration device for power-law distribution of the present application embodiment. DETAILED DESCRIPTION
[0051] The specific implementation of the present application will be described in further detail below in combination with the drawings and embodiments.
[0052] The present application improves the two defects in the background art, ensures load balancing, refines the push-pull granularity, improves the graph computing efficiency, and can well cope with real graphs with power-law distribution. Two innovations are proposed to address the power-law distribution phenomenon commonly found in real graph data to make up for the shortcomings of existing solutions in this scenario. On the basis of the existing push-pull hybrid processing mode, a load balancing strategy is added to achieve more reasonable task division and better performance. For the push-pull problem on super vertices in power-law distribution graphs, a fine-grained push-pull hybrid algorithm based on vertex degree is proposed to avoid inefficient pull operations on super vertices, reduce the probability of write conflicts, and improve the execution efficiency of the algorithm.
[0053] Embodiment 1:
[0054] The present embodiment proposes a GPU graph computing acceleration method for power-law distribution, as shown in Figure 1 ,Figure 2 As shown, comprising:
[0055] Step S1: obtaining graph data conforming to a power-law distribution, including a plurality of vertices and a plurality of edges of a graph;
[0056] Step S2: storing the graph data by using a GPU, and initializing the stored graph data according to a graph algorithm;
[0057] In this embodiment, after reading the graph data from a file system, the structural information of the graph is stored in the GPU end in the form of CSR (Compressed Sparse Row). The present application is applicable to the case that the whole graph can be stored in the GPU display memory. For a particularly large graph, it is not within the scope of the present application. In particular, since the algorithm is a hybrid of push and pull modes, two CSR structures, CSRO (Compressed Sparse Row Out) and CSRI (Compressed Sparse Row In) need to be stored. The CSRO stores the out edges and out neighbors of all vertices, and the CSRI stores the in edges and in neighbors of all vertices. The CSRO is read in the push operation, and the CSRI is read in the pull operation.
[0058] In addition, for different algorithms, the additional information is different. For example, the BFS only needs the information on each vertex, and is stored in an integer type, while the SSSP needs the information on the vertices and edges, and the data type of the information on the vertices is determined according to the actual needs, which is generally a floating-point number. Therefore, the GPU end not only needs to store the CSR representing the graph structure, but also needs to store other data required by the algorithm.
[0059] In the initialization stage, it is determined whether the push operation or the pull operation is used in the first round according to the characteristics of the algorithm. The BFS and SSSP algorithms start from a starting point for exploration, so there is only 1 active vertex in the first round, and the push mode is used. The WCC and CDLP (Community Detection using Label Propagation) algorithms involve all vertices at the beginning, so the pull mode is used.
[0060] Step S3: counting the number of active vertices, large vertices and small vertices in the initialized graph data, and saving the active vertices in a work pool, wherein the vertices with an out-degree or in-degree greater than the number of threads in a work group are regarded as large vertices, the vertices with an out-degree and in-degree not greater than the number of threads in a work group are regarded as small vertices, and the vertices participating in the current round of calculation are regarded as active vertices;
[0061] In this embodiment, the work group is defined as: when performing parallel computing on the GPU, a larger group (which can be understood as a basic scheduling unit) formed by organizing threads, so as to perform efficient computing and memory access. The work group corresponds to the concept of thread block in CUDA, work group in OpenCL, tile in C++AMP, etc. The developer can customize the number of threads in the work group according to the hardware conditions and algorithm requirements, and the common values are 256 or 512, etc. It can be understood that no matter in which framework, as long as it is a basic scheduling unit, no matter what the specific name is, it is within the protection scope of the present application.
[0062] In this embodiment, it can be understood that if the out-degree or in-degree of a vertex is greater than the number of threads in the work group, such a vertex can be referred to as a large vertex, and correspondingly, if the out-degree and in-degree of a vertex are not greater than the number of threads in the work group, such a vertex can be referred to as a small vertex, and those vertices participating in the current round of calculation can be referred to as active vertices.
[0063] Step S4: setting a corresponding mailbox for each vertex, the mailbox being used to save the temporary result of the current round of calculation of the corresponding vertex;
[0064] Step S5: determining the push operation or pull operation of the corresponding vertex according to the number of active vertices, the number of large vertices and the number of small vertices, and saving the push operation or pull operation of the corresponding vertex in the work pool;
[0065] Step S6: updating the information in the corresponding mailbox, the next round of active vertices and the number of the next round of active vertices according to the push operation or pull operation of the corresponding vertex;
[0066] Step S7: updating the corresponding vertex by using the updated information in the mailbox to obtain updated graph data;
[0067] Step S8: in the case where the number of the next round of active vertices is zero, outputting the updated graph data as the accelerated result, and in the case where the number of the next round of active vertices is not zero, returning to step S3 to re-count the large vertices and small vertices in the updated graph data and perform the next round of calculation.
[0068] The determination of the push operation or pull operation of the corresponding vertex according to the number of active vertices, the number of large vertices and the number of small vertices, as shown in Figure 2 , comprises:
[0069] Step S5.1: calculating the proportion of large vertices according to the number of large vertices and the number of small vertices;
[0070] Step S5.2: In the case that the number of active vertices is greater than 50% of the total number of vertices, pull operation is adopted for all the current active vertices, and step S6 is turned to;
[0071] Step S5.3: In the case that the number of active vertices is less than or equal to 50% of the total number of vertices, push operation is adopted for all the current active vertices, and step S5.4 is turned to;
[0072] Step S5.4: In the case that the proportion of large vertices is greater than 20%, push operation is adopted for large vertices, and pull operation is adopted for small vertices, and step S6 is turned to;
[0073] Step S5.5: In the case that the proportion of large vertices is less than or equal to 20%, push operation is adopted for all vertices, and step S6 is turned to.
[0074] In the embodiment, on the basis of the existing coarse-grained push-pull computing mode, a fine-grained push-pull mode is proposed. When the push mode starts, the proportion of large vertices is counted. If the proportion is small, push operation is performed on each active vertex. For an active vertex, it is assigned to a thread bundle, and at most 32 out-neighbor vertices are taken in each loop, and 32 threads in the thread bundle are responsible for the 32 neighbor vertices respectively. After the calculation is completed, whether the update is needed is judged according to the vertex information obtained in the last iteration, if the update is needed, the update mark is marked, and the mailbox information of the target vertex is updated through the atomic operation; otherwise, the operation is ended. If the proportion is large, the large vertices with large degrees are selected for push operation, and the small vertices are pulled. The pull operation of the small vertex does not involve the write conflict problem, and does not need to use the atomic operation, and the number of neighbors of the small vertex is small, and the efficiency of the pull operation is higher. Compared with the existing unified push-pull, the push-pull proposed by the application is subdivided to each vertex, classified according to the degree, realizes more fine-grained push-pull scheduling, and further improves the efficiency.
[0075] In the pull mode, all vertices participate in the current calculation, but the large vertices still perform the push operation. If the pull operation is performed on the large vertices, the intermediate result is large and the cost of reduction is high, so the large vertices still retain the simple push operation mode.
[0076] After each round of calculation is completed, the information in the mailbox is directly copied to the vertex information, and according to the recorded update mark, the active vertex array and the number of the next round are obtained, and finally the number of active vertices is transmitted to the host end to judge the execution strategy of the next round.
[0077] The GPU graph computing acceleration method for power-law distribution, as shown in Figure 3 , further comprises the following steps of:
[0078] Step S100: the work pool is divided into k parts by using a greedy strategy, each work pool is numbered, and the first work pool is taken wherein m is the total number of edges to be processed in the current round of calculation;
[0079] Step S101: Each thread bundle acquires its own starting work pool number w;
[0080] Step S102: Take tasks at the (w+i)th work pool, the tasks including: push operation or pull operation of a vertex, and set i to the initial value 0;
[0081] Step S103: If the tasks are taken, execute the push operation or pull operation of the vertex corresponding to the tasks, and go to step S102; if the tasks are not taken, set i = i + 1, and at this time if i = k, go to step S104, and if i ≠ k, go to S102;
[0082] Step S104: End the current round of work pool task processing procedure, return to step S3, and wait for the next round to save the active vertex in the work pool, and then go to step S100 to perform the next work pool task processing again.
[0083] In the embodiment, the existing scheme does not consider the load balancing element, and the application adopts the k-work pool mode to perform load balancing and process the uneven phenomenon caused by the power law distribution. In the case of using the traditional single work pool, each task execution unit takes the task number through an atomic operation, which causes a very heavy atomic operation on the variable that performs the atomic operation, and seriously affects the algorithm efficiency. Because the tasks are allocated according to the vertex coarse granularity, but the number of neighbors of each vertex is different, so the actual calculation amount on each vertex is different. For example, the first thread bundle processes a vertex with 512 neighbors, and the second thread bundle can process two vertices with 256 neighbors in the same time. Therefore, when allocating tasks, the tasks are not allocated according to the number of vertices, but according to the actual work load. The work pool is a mode of dynamically adjusting the work load to avoid task allocation deviation. In order to alleviate this phenomenon, the work pool is divided into k parts, and k variables are used to share the performance pressure caused by the atomic operation, and the advantages of the work pool are exerted to achieve load balancing. Generally, the task is taken from the (w+i)th work pool, and the value of i is increased by 1 each time. wherein m is the total number of edges to be processed in the current round of calculation; is the integer operation, and when dividing the work pool, the number of edges in each work pool is close to In the embodiment, a synchronous calculation model is adopted, that is, only when all the active vertices in the work pool are calculated, the next round of calculation is started.
[0084] The present application adopts a greedy strategy to divide the work pool. Although the division result obtained by the greedy strategy is not optimal, the greedy strategy is simple and efficient to implement, and the obtained result is sufficient to meet the requirements. The work pool is divided in advance before each round of calculation, which requires that the division of the work pool cannot occupy too much time, which is the main reason for adopting the greedy strategy. For the first few rounds or the last few rounds of the algorithm, generally, there are very few vertices to be processed, at this time, k=1 is taken.
[0085] The present application takes tasks in k work pools in units of thread bundles and performs calculations in units of thread bundles. The present application sets a "mailbox" for each vertex. Whether in push mode or pull mode, the new results generated in this round are updated into the mailbox, and after the calculation is completed, the contents in the mailbox are updated into the vertex information at one time. The purpose of this is to combine the scattered and random read and write into a whole read and write, which is more in line with the memory mode of the GPU.
[0086] In social network analysis (SNA), the application of algorithms helps researchers extract useful information from complex social network structures. Common algorithms such as BFS (breadth-first search), SSSP (single-source shortest path), PageRank, WCC (weakly connected component), and community detection play an important role in analyzing node relationships and network structures in social networks.
[0087] First, BFS (breadth-first search) is a basic algorithm for graph traversal, used to find the distance between nodes in a social network or determine whether there is a path between two points. In social networks, BFS can quickly find the friends or contact groups of a specific user, helping to analyze the paths of behavior or information diffusion in the network.
[0088] SSSP (single-source shortest path) algorithm is used to calculate the shortest path from a node to all other nodes in the network. This is crucial in scenarios such as analyzing influence propagation, user recommendations, etc. Through SSSP, researchers can find out how a key node in a social network can quickly affect other nodes or how to most effectively spread information.
[0089] WCC (weakly connected component) algorithm is used to find all weakly connected subgraphs in a graph, i.e. find connected components in the base graph of a directed graph. Social networks are often composed of multiple small groups, and WCC can effectively identify these groups and reveal the relationships between different groups.
[0090] Finally, community detection algorithms are used to identify groups of nodes in a network that are closely connected to each other. Communities often reflect user interests, friend circles, or collaboration relationships in a network. Through community detection, we can identify different interest groups or potential collaboration opportunities in a social network, and also use it for marketing, recommendation systems, etc. Community detection can be achieved through graph iteration algorithms, such as label propagation, so the iterative computing framework proposed in this application can also accelerate community detection.
[0091] In summary, social network analysis relies on algorithms such as BFS, SSSP, WCC, and community detection, which help us better understand the complex interactions and importance of nodes in the network by revealing the relationships between nodes, group structures, and information propagation methods. The application of these algorithms has become an important tool for understanding social network behavior patterns and network evolution. Technically, these algorithms can all be implemented through the synchronous iteration computing model of the graph, and the framework proposed in this application can well support the fast running of the above calculations.
[0092] Embodiment 2:
[0093] This embodiment proposes a GPU graph computing acceleration device for power-law distribution, as shown in Figure 4 including a data acquisition module, a storage and initialization module, a quantity statistics module, a mailbox setting module, an operation determination module, a data update module, a vertex update module, and a result output module;
[0094] The data acquisition module is connected to the storage and initialization module, the storage and initialization module is connected to the quantity statistics module, the quantity statistics module is connected to the mailbox setting module, the mailbox setting module is connected to the operation determination module, the operation determination module is connected to the data update module, the data update module is connected to the vertex update module, the vertex update module is connected to the result output module, and the result output module is connected to the quantity statistics module.
[0095] The data acquisition module is used to acquire graph data, and the graph data conforms to the power-law distribution, including a plurality of vertices and a plurality of edges;
[0096] The storage and initialization module is used to store the graph data by using GPU, and initialize the stored graph data according to the graph algorithm;
[0097] A quantity counting module is configured to count the number of active vertices, large vertices and small vertices in the initialized graph data, and save the active vertices in a work pool, wherein a vertex with an out-degree or an in-degree greater than the number of threads in a work group is regarded as a large vertex, a vertex with an out-degree and an in-degree not greater than the number of threads in the work group is regarded as a small vertex, and a vertex participating in the current round of calculation is regarded as an active vertex.
[0098] A mailbox setting module is configured to set a corresponding mailbox for each vertex, and the mailbox is used to save the temporary result of the current round of calculation of the corresponding vertex.
[0099] An operation determining module is configured to determine a push operation or a pull operation of the corresponding vertex according to the number of active vertices, the number of large vertices and the number of small vertices, and save the push operation or the pull operation of the corresponding vertex in the work pool.
[0100] A data updating module is configured to update the information in the corresponding mailbox, the next round of active vertices and the number of round active vertices according to the push operation or the pull operation of the corresponding vertex.
[0101] A vertex updating module is configured to update the corresponding vertex by using the updated information in the mailbox, to obtain updated graph data.
[0102] A result output module is configured to output the updated graph data as the accelerated result when the number of next round of active vertices is zero, and return to the quantity counting module to re-count the large vertices and the small vertices in the updated graph data and perform the next round of calculation when the number of next round of active vertices is not zero.
[0103] Embodiment 3
[0104] The embodiment provides an electronic device, which comprises one or more processors and a memory configured to store instructions and data, wherein the instructions, when executed by the one or more processors, cause the one or more processors to perform the GPU graph calculation based acceleration method.
[0105] The electronic device can be a mobile phone, a computer or a tablet computer, and comprises a memory and a processor, wherein the memory stores a computer program and data, and the computer program is executed by the processor to implement the power-law distribution oriented GPU graph calculation acceleration method. It can be understood that the electronic device can further comprise an input / output (I / O) interface and a communication component.
[0106] The processor is configured to perform all or part of the steps of the power-law distribution oriented GPU graph computing acceleration method described in the above embodiments. The memory is configured to store various types of data, which may, for example, include instructions of any application program or method in the electronic device, and application program related data.
[0107] The processor can be an Application Specific Integrated Cricuit (ASIC), a Digital Signal Processor (DSP), a Programmable Logic Device (PLD), a Field Programmable Gate Array (FPGA), a controller, a microcontroller, a microprocessor, or other electronic elements, and is configured to perform the power-law distribution oriented GPU graph computing acceleration method described in the above embodiments.
[0108] Embodiment 4
[0109] The embodiment provides a computer readable storage medium storing data and executable instructions, which, when executed, can be stored in a computer readable storage medium if implemented in the form of a software function unit and sold or used as an independent product.
[0110] The computer software product is stored in a storage medium and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the power-law distribution oriented GPU graph computing acceleration method described in the embodiments of the present application.
[0111] The aforementioned storage medium includes a flash memory, a hard disk, a multimedia card, a card type memory (for example, a Secure Digital Memory Card (SD) or a DX (Memory Data Register, MDR) memory, etc.), a random access memory (RAM), a static random access memory (SRAM), a read only memory (ROM), an electrically erasable programmable read only memory (EEPROM), a programmable read only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, a server, an Application (APP) application store, and various media that can store a program check code, on which a computer program is stored, and the computer program, when executed by a processor, can implement each step of the power-law distribution oriented GPU graph computing acceleration method described above.
[0112] Embodiment 5:
[0113] The embodiment provides a computer program product comprising computer programs or instructions, which, when executed by a processor, implement the GPU graph computing acceleration method for power-law distribution.
[0114] Based on such understanding, the technical solution of the present application or the part of the technical solution which essentially contributes to the prior art or the part of the technical solution can be embodied in the form of a computer program product.
[0115] The embodiments in the present application are described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other. Each embodiment mainly describes the difference from other embodiments.
[0116] The protection scope of the present application is not limited to the above-mentioned embodiments. Obviously, those skilled in the art can make various modifications and changes to the present disclosure without departing from the scope and spirit of the present disclosure. If these modifications and changes belong to the scope of the claims of the present disclosure and its equivalent technologies, the present disclosure also includes these modifications and changes.
Claims
1. A GPU graph computation acceleration method for power-law distributions, characterized in that, include: Step S1: Obtain graph data, which conforms to a power-law distribution and includes: multiple vertices and multiple edges of the graph; Step S2: Use a GPU to store the graph data and initialize the stored graph data according to the graph algorithm; Step S3: Count the number of active vertices, large vertices, and small vertices in the initialized graph data, and save the active vertices in the working pool. Among them, vertices whose out-degree or in-degree is greater than the number of threads in the working group are designated as large vertices, vertices whose out-degree and in-degree are not greater than the number of threads in the working group are designated as small vertices, and vertices participating in the current round of calculation are designated as active vertices. Step S4: Set up a corresponding mailbox for each vertex, and the mailbox is used to store the temporary result of the current round of calculation for the corresponding vertex; Step S5: Determine the push or pull operation for the corresponding vertex based on the number of active vertices, the number of large vertices, and the number of small vertices, and save the push or pull operation for the corresponding vertex in the work pool. Step S6: Update the information in the corresponding mailbox, the next round of active vertices, and the number of active vertices in the round based on the push or pull operation of the corresponding vertex; Step S7: Update the corresponding vertices using the updated mailbox information to obtain the updated graph data; Step S8: If the number of active vertices in the next round is zero, output the updated graph data as the accelerated result. If the number of active vertices in the next round is not zero, return to step S3, recount the large and small vertices in the updated graph data, and perform the next round of calculation. The process of determining the push or pull operation for a corresponding vertex based on the number of active vertices, the number of large vertices, and the number of small vertices includes: Step S5.1: Calculate the proportion of large vertices based on the number of large vertices and the number of small vertices; Step S5.2: If the number of active vertices is greater than a preset percentage of the total number of vertices, apply a pull operation to all currently active vertices and proceed to step S6; Step S5.3: If the number of active vertices is less than or equal to a preset percentage of the total number of vertices, perform a push operation on all currently active vertices and proceed to step S5.4; Step S5.4: If the proportion of large vertices is greater than the first preset percentage, push operation is applied to large vertices and pull operation is applied to small vertices, then proceed to step S6; Step S5.5: If the proportion of large vertices is less than or equal to the first preset percentage, apply the push operation to all vertices and proceed to step S6; The GPU graph computation acceleration method for power-law distribution further includes: employing a block-based work pool strategy to achieve load balancing, specifically: Step S100: Divide the work pool into k parts using a greedy strategy, and number each work pool, taking k = , where m is the total number of edges that need to be processed in the current round of calculation; Step S101: Each thread bundle obtains its own starting worker pool number w; Step S102: Take a task from the (w+i)%kth work pool. The task includes: push or pull operation of a vertex. Set the initial value of i to 0. Step S103: If a task is obtained, perform a push or pull operation on the vertex corresponding to the task, and proceed to step S102; if no task is obtained, let i = i + 1. If i = k, then proceed to step S104. If k, then proceed to S102; Step S104: End the current round of work pool processing task flow, return to step S3, wait for the next round to save the active vertices in the work pool, and then go to step S100 to start the next work pool processing task.
2. The GPU graph computation acceleration method for power-law distributions according to claim 1, characterized in that, The method of storing the graph data using a GPU includes: storing the structural information of the graph data in the GPU in the form of row compression. The structural information consists of a CSRO structure and a CSRI structure. The CSRO structure stores the outgoing edges and outgoing neighbors of all vertices, and the CSRI structure stores the incoming edges and incoming neighbors of all vertices. The CSRO structure is read in the push operation, and the CSRI structure is read in the pull operation.
3. The GPU graph computation acceleration method for power-law distributions according to claim 1, characterized in that, The process of initializing the stored graph data according to the graph algorithm includes: determining whether a push or pull operation is used in the first round of calculation based on the different types of graph algorithms, initializing the active vertices in the first round, initializing the values in the mailbox, and initializing the values on each vertex.
4. The GPU graph computation acceleration method for power-law distributions according to claim 3, characterized in that, The step of determining whether to use a push or pull operation in the first round of computation based on the different types of graph algorithms includes: when the graph algorithm is BFS or SSSP, using a push operation on the initial vertex; when the graph algorithm is WCC or CDLP, using a pull operation on the active vertices in the first round of computation.
5. A GPU graph computing acceleration device for power-law distributions, characterized in that, include: The module includes a data acquisition module, a storage and initialization module, a quantity statistics module, a mailbox setting module, an operation confirmation module, a data update module, a vertex update module, and a result output module. The data acquisition module is connected to the storage and initialization module, the storage and initialization module is connected to the quantity statistics module, the quantity statistics module is connected to the mailbox setting module, the mailbox setting module is connected to the operation determination module, the operation determination module is connected to the data update module, the data update module is connected to the vertex update module, the vertex update module is connected to the result output module, and the result output module is connected to the quantity statistics module. The data acquisition module is used to acquire graph data, which conforms to a power-law distribution and includes multiple vertices and multiple edges; The storage and initialization module is used to store the graph data using the GPU and initialize the stored graph data according to the graph algorithm. The quantity statistics module is used to count the number of active vertices, large vertices, and small vertices in the initialized graph data. Active vertices are stored in the working pool. Vertices whose out-degree or in-degree is greater than the number of threads in the working group are considered large vertices, vertices whose out-degree and in-degree are not greater than the number of threads in the working group are considered small vertices, and vertices participating in the current round of calculation are considered active vertices. The mailbox setting module is used to set a corresponding mailbox for each vertex, and the mailbox is used to store the temporary results of the current round of calculation for the corresponding vertex; The operation determination module is used to determine the push or pull operation of the corresponding vertex based on the number of active vertices, the number of large vertices, and the number of small vertices, and save the push or pull operation of the corresponding vertex in the work pool. The data update module is used to update the information in the corresponding mailbox, the next round of active vertices, and the number of active vertices in the round based on the push or pull operation of the corresponding vertex. The vertex update module is used to update the corresponding vertices with the updated information in the mailbox, and obtain the updated graph data. The result output module is used to output the accelerated result using the updated graph data when the number of active vertices in the next round is zero. If the number of active vertices in the next round is not zero, it returns to the count module to recount the large and small vertices in the updated graph data for the next round of calculation. The step of determining the push or pull operation for the corresponding vertex based on the number of active vertices, the number of large vertices, and the number of small vertices includes: Step S5.1: Calculate the proportion of large vertices based on the number of large vertices and the number of small vertices; Step S5.2: If the number of active vertices is greater than a preset percentage of the total number of vertices, perform a pull operation on all currently active vertices and proceed to the data update module; Step S5.3: If the number of active vertices is less than or equal to a preset percentage of the total number of vertices, perform a push operation on all currently active vertices and proceed to step S5.4; Step S5.4: If the proportion of large vertices is greater than the first preset percentage, push operation is applied to large vertices and pull operation is applied to small vertices, and then proceed to the data update module; Step S5.5: If the proportion of large vertices is less than or equal to the first preset percentage, push operation is applied to all vertices, and the process proceeds to the data update module; The GPU graph computation acceleration method for power-law distribution further includes: employing a block-based work pool strategy to achieve load balancing, specifically: Step S100: Divide the work pool into k parts using a greedy strategy, and number each work pool, taking k = , where m is the total number of edges that need to be processed in the current round of calculation; Step S101: Each thread bundle obtains its own starting worker pool number w; Step S102: Take a task from the (w+i)%kth work pool. The task includes: push or pull operation of a vertex. Set the initial value of i to 0. Step S103: If a task is obtained, perform a push or pull operation on the vertex corresponding to the task, and proceed to step S102; if no task is obtained, let i = i + 1. If i = k, then proceed to step S104. If k, then proceed to S102; Step S104: End the current round of work pool processing task flow, return to step S3, wait for the next round to save the active vertices in the work pool, and then go to step S100 to start the next work pool processing task.
6. An electronic device, characterized in that, include: One or more processors, and a memory for storing instructions and data, wherein when the instructions are executed by the one or more processors, the one or more processors perform the GPU graph computation acceleration method for power-law distribution as described in any one of claims 1 to 4.
7. A computer-readable storage medium, characterized in that, It stores data and executable instructions, which, when executed, cause the processor to perform the GPU graph computation acceleration method for power-law distribution as described in any one of claims 1 to 4.
8. A computer program product, comprising a computer program or instructions, characterized in that, When the computer program or instructions are executed by the processor, they implement the GPU graph computation acceleration method for power-law distribution as described in any one of claims 1 to 4.
Citation Information
Patent Citations
Graph data processing acceleration method in heterogeneous computing environment
CN110187968A
Dynamic power law diagram storage method based on LSM tree
CN112817982A