Multi-graph parallel graph calculation method and device, medium and terminal

By dividing multiple data graphs into data graph groups and using the shared storage area of ​​the GPU for multi-graph parallel computing, the problem of inefficiency of the CPU processor in multi-graph computing is solved, and efficient multi-graph parallel computing and real-time requirements are realized.

CN120560792APending Publication Date: 2025-08-29ZHONGHUI INFORMATION TECH (SHANGHAI) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510356609.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-25
Publication Date
2025-08-29

AI Technical Summary

Technical Problem

In the prior art, the parallel capability of a single-core or multi-core processor of CPU is limited, making it difficult to effectively support multi-graph parallel computing, resulting in low graph computing efficiency and inability to meet real-time requirements.

Method used

The multi-graph parallel graph calculation method is adopted. By dividing multiple data graphs into data graph groups, each data graph group corresponds to a thread block, and the threads of the thread block are divided into multiple thread groups. Each thread group is responsible for processing a data graph, using the shared storage area of ​​the GPU for data acquisition, reducing the number of global memory accesses, and realizing multi-graph parallel computing.

Benefits of technology

The efficiency of multi-graph parallel computing is significantly improved, and the real-time requirements are met, and the computing speed and efficiency are further improved through dynamic load adjustment and multi-stream transmission optimization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120560792A_ABST
    Figure CN120560792A_ABST
Patent Text Reader

Abstract

The invention discloses a multi-graph parallel graph calculation method and device, a medium and a terminal, relates to the technical field of data processing, and mainly aims to solve the problem that multi-graph parallel graph calculation cannot be completed in the prior art. Comprising the following steps: acquiring a plurality of data graphs related to a target task, the number of data graphs of predicted processing data graphs of each thread block and the number of threads contained in each thread block; based on the number of the data graphs, the data graphs are divided into a plurality of data graph groups, each data graph group corresponds to one thread block, threads contained in the thread blocks are divided into a plurality of thread groups according to the thread number of the thread blocks and the number of the data graphs of the corresponding data graph groups, and each thread group corresponds to one data graph; and circularly distributing the vertexes contained in the data graphs to the threads contained in the corresponding thread groups, acquiring the data contained in the data graphs from the shared storage areas of the thread blocks corresponding to the data graphs, and performing graph calculation in a multi-graph parallel mode.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a multi-graph parallel graph computing method, device, medium, and terminal. Background Art

[0002] In scenarios such as social network analysis, path planning, gene network analysis, and knowledge graph analysis, data is often presented in the form of graphs, necessitating batch processing of multiple independent or interrelated graphs. These graphs often exhibit the following characteristics: a large workload, with the number of graphs potentially reaching thousands or even millions; uneven graph size, with the number of vertices and edges per graph varying significantly; and complex computational dependencies, with computational tasks across different graphs potentially independent or interdependent. Traditional graph computation methods, due to the limited parallel capabilities of single-core or multi-core CPU processors, typically focus on single-graph computations. Processing multiple graphs requires serial processing, resulting in low efficiency and difficulty meeting real-time requirements.

[0003] With the advent of GPU (graphics processing unit), due to its parallel architecture, GPU has the advantage of parallel processing of large-scale data and is widely used in the field of graph computing.

[0004] However, GPUs are currently typically used for graph computing on a single large graph, performing batch operations on vertices and edges in a single large graph. They lack effective support for multi-graph tasks. Therefore, a GPU-based multi-graph parallel graph computing method is urgently needed. Summary of the Invention

[0005] In view of this, the present application provides a multi-graph parallel graph computing method and device, medium, and terminal, the main purpose of which is to solve the problem that multi-graph parallel graph computing cannot be completed currently.

[0006] According to one aspect of the present application, a multi-graph parallel graph computing method is provided, comprising:

[0007] Obtaining multiple data graphs involved in the target task, the number of data graphs of the data graph expected to be processed by each thread block, and the number of threads involved;

[0008] Based on the number of the data graphs, the data graphs are divided into a plurality of data graph groups, each data graph group corresponds to a thread block, and according to the number of threads in the thread block and the number of data graphs in the corresponding data graph group, the threads included in each thread block are divided into a plurality of thread groups, each thread group corresponds to a data graph;

[0009] Each vertex contained in the data graph is cyclically assigned to each thread contained in the corresponding thread group, and the data contained in the data graph is obtained from the shared storage area of ​​the thread block corresponding to each data graph, and graph calculation is performed in a multi-graph parallel manner.

[0010] Preferably, before obtaining the multiple data graphs involved in the target task, the number of data graphs of the expected processing data graph of each thread block, and the number of threads included, the method further includes:

[0011] Divide the global storage area into multiple global memory blocks in advance according to the preset number of bytes;

[0012] According to the amount of data contained in the data graph, a corresponding global memory block is allocated to each data graph, so that multiple data graphs involved in the target task are continuously stored in the global storage area.

[0013] Preferably, before respectively acquiring the data contained in the data graph from the shared storage area of ​​the thread blocks corresponding to each of the data graphs, the method further comprises:

[0014] According to the preset number of bytes, the shared storage area corresponding to each thread block is pre-divided into a plurality of shared memory blocks;

[0015] Determine the data graph group corresponding to each of the thread blocks respectively, and query the global memory area for the global memory block corresponding to the data graph contained in each of the data graph groups respectively;

[0016] The data stored in each of the global memory blocks are copied to the shared memory block corresponding to the data graph.

[0017] Preferably, the thread block contains multiple data streams; wherein, the first data stream is used to execute the graph computing task; the second data stream is used to return the execution result of the graph computing task; and the third data stream is used to asynchronously copy the data of the data graph to the shared memory block.

[0018] Preferably, the method further comprises:

[0019] According to the first data graph number of the data graphs involved in the task and the second data graph number of the data graph expected to be processed by the thread block, a grid dimension is determined based on the following formula to configure the number of thread blocks according to the grid dimension.

[0020] Grid dimension = (numGraphs + graphsPerBlock - 1) / graphsPerBlock, where numGraphs represents the number of first data graphs, and graphsPerBlock represents the number of second data graphs.

[0021] Preferably, the method further comprises:

[0022] monitoring the computational load parameters of each of the thread blocks in real time;

[0023] When a first thread block whose computing load parameter exceeds a preset computing load maximum threshold is monitored, reducing the number of data graphs of the data graph group corresponding to the first thread block, and reallocating the reduced data graphs to idle thread blocks;

[0024] When a second thread block whose computing load parameter is lower than a preset computing load minimum threshold is monitored, the number of data graphs of the data graph group corresponding to the second thread block is increased.

[0025] Preferably, after performing graph calculation in a multi-graph parallel manner, the method further comprises:

[0026] The results of multi-graph parallel graph computing of multiple tasks are summarized through a high-speed interconnection bus, and aggregated to generate a cross-card multi-graph joint analysis report.

[0027] According to another aspect of the present application, a multi-graph parallel graph computing device is provided, comprising:

[0028] A parameter acquisition module is used to obtain multiple data graphs involved in the target task, the number of data graphs of the expected processing data graph of each thread block, and the number of threads included;

[0029] a data graph allocation module, configured to divide the plurality of data graphs into a plurality of data graph groups based on the number of the data graphs, each data graph group corresponding to a thread block, and to divide the threads contained in each thread block into a plurality of thread groups based on the number of threads in the thread block and the number of data graphs in the corresponding data graph group, each thread group corresponding to a data graph;

[0030] The graph computing module is used to cyclically distribute each vertex contained in the data graph to each thread contained in the corresponding thread group, and obtain the data contained in the data graph from the shared storage area of ​​the thread block corresponding to each data graph, and perform graph computing in a multi-graph parallel manner.

[0031] Preferably, before the parameter acquisition module, the device further includes a global storage module for:

[0032] Divide the global storage area into multiple global memory blocks in advance according to the preset number of bytes;

[0033] According to the amount of data contained in the data graph, a corresponding global memory block is allocated to each data graph, so that multiple data graphs involved in the target task are continuously stored in the global storage area.

[0034] Preferably, before the graph calculation module, the device further includes a transfer module for:

[0035] According to the preset number of bytes, the shared storage area corresponding to each thread block is pre-divided into a plurality of shared memory blocks;

[0036] Determine the data graph group corresponding to each of the thread blocks respectively, and query the global memory area for the global memory block corresponding to the data graph contained in each of the data graph groups respectively;

[0037] The data stored in each of the global memory blocks are copied to the shared memory block corresponding to the data graph.

[0038] Preferably, the thread block contains multiple data streams; wherein, the first data stream is used to execute the graph computing task; the second data stream is used to return the execution result of the graph computing task; and the third data stream is used to asynchronously copy the data of the data graph to the shared memory block.

[0039] Preferably, the device further includes a grid dimension determination module, configured to:

[0040] According to the first data graph number of the data graphs involved in the task and the second data graph number of the data graph expected to be processed by the thread block, a grid dimension is determined based on the following formula to configure the number of thread blocks according to the grid dimension.

[0041] Grid dimension = (numGraphs + graphsPerBlock - 1) / graphsPerBlock, where numGraphs represents the number of first data graphs, and graphsPerBlock represents the number of second data graphs.

[0042] Preferably, the device further includes a load adjustment module, configured to:

[0043] monitoring the computational load parameters of each of the thread blocks in real time;

[0044] When a first thread block whose computing load parameter exceeds a preset computing load maximum threshold is monitored, reducing the number of data graphs of the data graph group corresponding to the first thread block, and reallocating the reduced data graphs to idle thread blocks;

[0045] When a second thread block whose computing load parameter is lower than a preset computing load minimum threshold is monitored, the number of data graphs of the data graph group corresponding to the second thread block is increased.

[0046] Preferably, after the graph calculation module, the device further includes a summary module:

[0047] The results of multi-graph parallel graph computing of multiple tasks are summarized through a high-speed interconnection bus, and aggregated to generate a cross-card multi-graph joint analysis report.

[0048] According to another aspect of the present application, a storage medium is provided, in which at least one executable instruction is stored. The executable instruction enables a processor to perform operations corresponding to the above-mentioned multi-graph parallel graph computing method.

[0049] According to another aspect of the present application, there is provided a terminal, comprising: a processor, a memory, a communication interface, and a communication bus, wherein the processor, the memory, and the communication interface communicate with each other via the communication bus;

[0050] The memory is used to store at least one executable instruction, and the executable instruction enables the processor to perform operations corresponding to the above-mentioned multi-graph parallel graph computing method.

[0051] By means of the above technical solution, the technical solution provided by the embodiment of the present application has at least the following advantages:

[0052] The present application provides a multi-graph parallel graph computing method and apparatus, medium, and terminal. First, multiple data graphs involved in a target task, the number of data graphs of each thread block expected to process the data graph, and the number of threads included are obtained; secondly, based on the number of each data graph, the multiple data graphs are divided into multiple data graph groups, each data graph group corresponds to a thread block, and according to the number of threads in the thread block and the number of data graphs of the corresponding data graph group, the threads included in each thread block are divided into multiple thread groups, each thread group corresponds to a data graph; finally, each vertex included in the data graph is cyclically assigned to each thread included in the corresponding thread group, and the data included in the data graph is obtained from the shared storage area of ​​the thread block corresponding to each data graph, and graph computing is performed in a multi-graph parallel manner. Compared with the prior art, the embodiment of the present application divides the multiple data graphs involved in the target task into multiple groups according to the number of data graphs that the thread block is expected to process, and then divides the multiple threads contained in the thread block into multiple thread groups according to the number of data graphs contained in the data graph group. Each thread group is responsible for processing one data graph, and then the multiple vertices in the data graph are cyclically assigned to the threads in the thread group. Each thread is responsible for processing the calculation of one vertex, and all threads are started to perform graph calculations at the same time, which meets the graph calculation requirements of multiple graphs in parallel. Compared with single graph calculation, the efficiency is significantly improved and the real-time requirements are met. Moreover, in the process of thread calculation, the number of global memory accesses is reduced by obtaining the data contained in the data graph from the shared storage area of ​​the thread block corresponding to the data graph. Since the time consumed for accessing the shared storage area is shorter than that for accessing the global storage area, the overall access speed is improved, the latency is reduced, and the computing efficiency is further improved.

[0053] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0054] Various other advantages and benefits will become apparent to those skilled in the art upon reading the detailed description of the preferred embodiment below. The accompanying drawings are for illustration purposes only and are not to be considered as limiting the present application. The same reference symbols are used throughout the drawings to represent the same components. In the drawings:

[0055] Figure 1 A flowchart of a multi-graph parallel graph computing method provided in an embodiment of the present application is shown;

[0056] Figure 2A flowchart of another multi-graph parallel graph computing method provided by an embodiment of the present application is shown;

[0057] Figure 3 A block diagram of a multi-graph parallel graph computing device provided in an embodiment of the present application is shown;

[0058] Figure 4 A schematic diagram of the structure of a terminal provided in an embodiment of the present application is shown. DETAILED DESCRIPTION

[0059] Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. Rather, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.

[0060] At the same time, it should be understood that for the convenience of description, the sizes of the various parts shown in the drawings are not drawn according to the actual proportional relationship.

[0061] The following description of at least one exemplary embodiment is merely illustrative in nature and is in no way intended to limit the present disclosure, its application, or uses.

[0062] Technologies, methods, and equipment known to ordinary technicians in the relevant art may not be discussed in detail, but where appropriate, the technologies, methods, and equipment should be considered part of the specification.

[0063] It should be noted that like reference numerals and letters refer to like items in the following figures, and therefore, once an item is defined in one figure, it need not be further discussed in subsequent figures.

[0064] Embodiments of the present application may be applied to a computer system / server that is operable with numerous other general-purpose or special-purpose computing system environments or configurations. Examples of well-known computing systems, environments, and / or configurations suitable for use with the computer system / server include, but are not limited to, personal computer systems, server computer systems, thin clients, thick clients, handheld or laptop devices, microprocessor-based systems, set-top boxes, programmable consumer electronics, network personal computers, minicomputer systems, mainframe computer systems, and distributed cloud computing technology environments including any of the foregoing.

[0065] Computer systems / servers may be described in the general context of computer system-executable instructions, such as program modules, executed by a computer system. Generally, program modules may include routines, programs, objects, components, logic, data structures, and the like, that perform specific tasks or implement specific abstract data types. Computer systems / servers may be implemented in a distributed cloud computing environment where tasks are performed by remote processing devices linked through a communications network. In a distributed cloud computing environment, program modules may be located on local or remote computer system storage media, including storage devices.

[0066] The present application embodiment provides a multi-graph parallel graph computing method, such as Figure 1 As shown, the method includes:

[0067] 101. Obtain multiple data graphs involved in the target task, the number of data graphs of the data graph expected to be processed by each thread block, and the number of threads included.

[0068] Among them, tasks can be tasks in any scenario, for example, in the financial field, calculating the risk contagion path between multiple financial markets; in the field of route planning, calculating the optimal delivery path between multiple cities, etc. Based on the above example, in the scenario of calculating the optimal delivery path between multiple cities, the data graph is used to record the delivery points and their road data in each city. In the graph, vertices can represent distribution centers, warehouses, customer addresses, etc., and edges can represent road connections, including distance, real-time traffic status, transportation costs, etc.; in the scenario of calculating the risk contagion path between multiple financial markets, the data graph is used to record each market and its associated assets. In the graph, vertices can represent financial assets, including stock codes, currency pairs, futures contracts, etc., and edges can represent risk transmission relationships between assets, including volatility correlation, cross-market arbitrage links, etc. Threads are used to represent the smallest unit used to perform specific computing tasks in a graphics processing unit (GPU), that is, the lowest level; thread blocks contain multiple threads and are the middle level. The number of data graphs of the data graph that a thread block is expected to process is the number of data graphs that the thread block can process. In the embodiment of the present application, the current execution end can be a graphics processing unit (GPU).

[0069] It should be noted that the number of data graphs of the data graph expected to be processed by each thread block can be the same or different, and the number of threads contained in each thread block can be the same or different, which is not specifically limited in the embodiments of the present application.

[0070] 102. Based on the number of data graphs, the multiple data graphs are divided into multiple data graph groups, each data graph group corresponds to a thread block, and according to the number of threads in the thread block and the number of data graphs in the corresponding data graph group, the threads contained in each thread block are divided into multiple thread groups, each thread group corresponds to a data graph.

[0071] It should be noted that when the number of data graphs expected to be processed by each thread block is the same, the number of data graphs involved in the target task can be divided by the number of data graphs expected to be processed by the thread block to determine the number of data graph groups, and then each data graph group can be mapped to each thread block.

[0072] When the number of data graphs of the data graphs expected to be processed by each thread block is different, the data graphs involved in the target task can be arranged into a sequence, and the sequence can be divided according to the number of data graphs of the data graphs expected to be processed by each thread block, so that each data graph group can be mapped to each thread block. For example, the number of data graphs of the data graph expected to be processed by thread block 1 is 4, the number of data graphs of the data graph expected to be processed by thread block 2 is 3, and the number of data graphs of the data graph expected to be processed by thread block 3 is 3. The sequence formed by the data graphs involved in the target task is data Figure 1 ,data Figure 2 ......Data Figure 10, according to the above method, it can be determined that thread block 1 is responsible for processing data Figure 1-4 , thread block 2 is responsible for processing data graphs 5-7, and thread block 3 is responsible for processing data graphs 8-10.

[0073] When each thread block contains the same number of threads, the number of thread groups can be determined by dividing the number of threads contained in the thread block by the number of data graphs contained in the data graph group. Then, each thread group is mapped to each data graph, that is, which threads are responsible for processing which graph.

[0074] When each thread block includes a different number of threads, each data graph may be allocated to a corresponding thread group based on the method for when the number of data graphs of the data graphs expected to be processed by the thread block is different.

[0075] In the embodiments of the present application, the following situations are included: the number of data graphs of the expected processing data graphs of the thread blocks is the same, and the number of threads of the threads included in the thread blocks is the same; the number of data graphs of the expected processing data graphs of the thread blocks is the same, and the number of threads of the threads included in the thread blocks is different; the number of data graphs of the expected processing data graphs of the thread blocks is different, and the number of threads of the threads included in the thread blocks is the same; the number of data graphs of the expected processing data graphs of the thread blocks is different, and the number of threads of the threads included in the thread blocks is different.

[0076] 103. Allocate each vertex contained in the data graph cyclically to each thread contained in the corresponding thread group, and obtain the data contained in the data graph from the shared storage area of ​​the thread block corresponding to each data graph, and perform graph calculation in a multi-graph parallel manner.

[0077] In an embodiment of the present application, after determining which threads are responsible for processing which graph, the vertices contained in the data graph can be cyclically assigned to the responsible threads. For example, data graph a contains 1000 vertices, and threads 0-256 are responsible for processing data graph a. The 1000 vertices in data graph a are cyclically assigned to threads 0-256, that is, thread 0 processes vertices 0, 256, 512, 768, and thread 1 processes vertices 1, 257, 513, 769, and so on, covering all vertices. Further, according to the content of step 102 of the embodiment, the thread block corresponding to the data graph can be known, and the data contained in the data graph can be obtained from the shared storage area of ​​the thread block, and graph calculation can be performed. It can be understood that all threads are started at the same time, and multi-graph parallel row graph calculation can be realized.

[0078] It should be noted that each thread block has an independent shared storage space, which can store shared resources such as distance, predecessor nodes, and weights.

[0079] In specific application scenarios, the vertex processing mechanism can be implemented based on the following statements,

[0080] for(size_t i=threadIdx.x;i <vertexCount;i+=blockDim.x){

[0081] / / Process the calculation task of vertex i

[0082] }

[0083] Each thread processes multiple vertices in a loop to ensure that all vertices are processed and not repeated.

[0084] The edge processing mechanism can be implemented based on the following statements,

[0085] for(size_t i=threadIdx.x;i <edgeCount;i+=blockDim.x){

[0086] / / Process the calculation task of edge i

[0087] }

[0088] To support parallel access and update of edges.

[0089] In addition, warp-level optimization techniques can be used to implement efficient reduction operations (such as finding the minimum distance), broadcast operations (such as updating vertex states), and shared memory access. Furthermore, in terms of data access optimization, shared memory is used to cache frequently accessed data, a merged access mode is used to reduce memory transactions, and thread collaboration is used to reduce access conflicts.

[0090] Compared with the prior art, the embodiment of the present application divides the multiple data graphs involved in the target task into multiple groups according to the number of data graphs that the thread block is expected to process, and then divides the multiple threads contained in the thread block into multiple thread groups according to the number of data graphs contained in the data graph group. Each thread group is responsible for processing one data graph, and then the multiple vertices in the data graph are cyclically assigned to the threads in the thread group. Each thread is responsible for processing the calculation of one vertex, and all threads are started to perform graph calculations at the same time, which meets the graph calculation requirements of multiple graphs in parallel. Compared with single graph calculation, the efficiency is significantly improved and the real-time requirements are met. Moreover, in the process of thread calculation, the number of global memory accesses is reduced by obtaining the data contained in the data graph from the shared storage area of ​​the thread block corresponding to the data graph. Since the time consumed for accessing the shared storage area is shorter than that for accessing the global storage area, the overall access speed is improved, the latency is reduced, and the computing efficiency is further improved.

[0091] The present application embodiment provides another multi-graph parallel graph computing method, such as Figure 2 As shown, the method includes:

[0092] 201. Store multiple data graphs involved in the target task in a global storage area.

[0093] Specifically, the global storage area is pre-divided into multiple global memory blocks according to a preset number of bytes; and a corresponding global memory block is allocated to each data graph according to the amount of data contained in the data graph, so that multiple data graphs involved in the target task are continuously stored in the global storage area.

[0094] The global memory area is used to represent the memory area in the CPU. In the embodiment of the present application, when the amount of data contained in the data graph is small, one global memory block can be allocated to it. When the amount of data contained in the data graph is large, multiple global memory blocks can be allocated to it. It should be noted that each data graph is stored independently, that is, when the global memory block is not full, no other data graphs are stored, and the next data graph is continuously stored in the next global memory block.

[0095] In addition, the storage of each data graph is divided into three parts, including the metadata of the data graph (number of vertices, number of edges); vertex features (stored in sequence in vertex order); and edge lists (used to store the starting point, end point, and edge weight of each edge). Based on this, the starting position of the data in each data graph can be quickly located through offsets or pointer marks, which improves the speed of data access and thus improves computing efficiency.

[0096] 202. Obtain multiple data graphs involved in the target task, the number of data graphs of the data graph expected to be processed by each thread block, and the number of threads included.

[0097] 203. Based on the number of data graphs, the multiple data graphs are divided into multiple data graph groups, each data graph group corresponds to a thread block, and according to the number of threads in the thread block and the number of data graphs in the corresponding data graph group, the threads contained in each thread block are divided into multiple thread groups, each thread group corresponds to a data graph.

[0098] The steps 202 and 203 of the embodiment can refer to the detailed description of the steps 101 and 102 of the aforementioned embodiment, which will not be repeated here.

[0099] 204. Copy the data graph from the global storage area to the shared storage area of ​​the corresponding thread block.

[0100] Specifically, according to a preset number of bytes, the shared storage area corresponding to each thread block is pre-divided into multiple shared memory blocks; the data graph group corresponding to each thread block is determined respectively, and the global memory block corresponding to the data graph contained in each data graph group is queried in the global storage area respectively; the data stored in each global memory block is copied to the shared memory block corresponding to the data graph.

[0101] Among them, the preset number of bytes is the same as the preset number of bytes when the global storage area is divided in step 201 of the embodiment, so as to avoid data misalignment when copying data; the shared storage area is used to characterize the storage area in the GPU, and each thread block in the GPU corresponds to a shared storage area. In the embodiment of the present application, after determining which threads are responsible for processing which data graph, the data of the data graph can be obtained from the global storage area of ​​the CPU and copied to the shared storage area of ​​the current thread block. It can be understood that since each data graph is stored in the corresponding global memory block in the global storage area of ​​the CPU, and the shared memory block of the shared storage area in the GPU is the same size as the global memory block, direct copying is sufficient without the need for additional complex operations, shortening the copying time, thereby improving computing efficiency. In addition, in the shared storage area in the GPU, the offset of each data graph in the thread block can be determined by localGraphIndex (local graph index), and the offset is used for memory access to ensure data isolation and avoid data interference between different graph tasks.

[0102] It should be noted that since all threads in a thread block need to collaboratively process different parts of the same data graph, synchronization primitives such as __syncthreads() can be used to ensure the order of calculation.

[0103] In specific application scenarios, in order to achieve a unified multi-image data storage format for CPU and GPU, the following configuration can be performed:

[0104] 1. Multi-image data storage format

[0105] 1.1 Graph Data Structure Design

[0106] The data structure of each graph consists of three consecutively stored parts:

[0107] (1) Graph element information: including basic information such as the number of vertices, the number of edges, and data offset;

[0108] (2) Vertex features: vertex attribute data stored in the order of vertex identification;

[0109] (3) Edge list: stores the starting point, end point and weight information of the edge.

[0110] 1.2 Continuous Storage Strategy

[0111] All graph data is arranged continuously in memory and located by offset, including:

[0112] (1) The storage space of each image is independent and continuous;

[0113] (2) Adjacent graphs are separated by data alignment;

[0114] (3) Quickly access data of any graph through offset.

[0115] 2.Multi-card independent memory pool management mechanism

[0116] 2.1 Memory Pool Initialization

[0117] (1) Allocate an independent memory pool to each GPU based on the number of available GPU devices;

[0118] (2) Each GPU device corresponds to a Device Memory pool and a Pinned Memory pool;

[0119] (3) The memory pool size is dynamically configured based on device capabilities and task requirements.

[0120] 2.2 Device Memory Allocation Strategy

[0121] (1) Independent memory pool management:

[0122] -Each GPU device has its own dedicated memory pool;

[0123] -Avoid memory resource competition between multiple GPU devices;

[0124] -Supports device-level memory isolation.

[0125] (2) Memory mapping mechanism:

[0126] - Keep the memory layout of the CPU and GPU consistent;

[0127] -Support direct memory copy operation;

[0128] -Reduce the overhead of data reorganization.

[0129] 205. Distribute each vertex contained in the data graph cyclically to each thread contained in the corresponding thread group, and obtain the data contained in the data graph from the shared storage area of ​​the thread block corresponding to each data graph, and perform graph calculation in a multi-graph parallel manner.

[0130] For step 205 of the embodiment, reference may be made to the detailed description of step 103 of the aforementioned embodiment, which will not be repeated here.

[0131] 206. Dynamically adjust the load of the thread block.

[0132] Specifically, the computing load parameters of each thread block are monitored in real time; when a first thread block is monitored whose computing load parameter exceeds a preset computing load maximum threshold, the number of data graphs in the data graph group corresponding to the first thread block is reduced, and the reduced data graphs are reallocated to idle thread blocks; when a second thread block is monitored whose computing load parameter is lower than a preset computing load minimum threshold, the number of data graphs in the data graph group corresponding to the second thread block is increased.

[0133] Among them, the preset maximum computing load threshold is used to represent the maximum computing load that the thread block can withstand while ensuring normal operation; the preset minimum computing load threshold is used to represent that when it is lower than the minimum threshold, it means that the thread block is not fully utilized; the first thread block is used to represent the thread block that exceeds the preset maximum computing load threshold, that is, the overloaded thread block; the second thread block is used to represent the thread block that is lower than the preset minimum computing load threshold, that is, the under-saturated thread block.

[0134] It should be noted that, in the embodiment of the present application, by monitoring the computing load parameters of each thread block in real time, when an overloaded thread block is found, some of the data graphs allocated to it are extracted and reallocated to other idle thread blocks for calculation; when an underworked thread block is found, a data graph is added to it to adjust the load imbalance through dynamic adjustment, thereby avoiding the problem of idle or overloaded thread blocks and improving overall efficiency.

[0135] In a specific application scenario, in order to achieve dynamic adjustment of thread block load, the following configuration can be performed:

[0136] 1. Load monitoring indicator design

[0137] 1.1 Thread block load parameters include:

[0138] -Number of active threads: The number of threads currently executing computing tasks

[0139] -Memory usage: shared memory and register usage

[0140] - Computation time: the time required to process the assignment graph task

[0141] -Task queue length: the number of graph tasks to be processed

[0142] 1.2 Monitoring implementation method:

[0143] -Set a counter in each thread block to record the statistics of the processing graph task

[0144] -Update shared load statistics through atomic operations

[0145] -Periodically sample the execution status of each thread block

[0146] 2. Dynamic load balancing strategy

[0147] 2.1 Task migration trigger conditions:

[0148] -When the thread block load exceeds the preset maximum threshold (such as the calculation time exceeds 150% of the average value)

[0149] -When the thread block load is below a preset minimum threshold (such as computation time is below 50% of the average)

[0150] -A significant load imbalance is detected (the load difference between thread blocks exceeds the preset ratio)

[0151] 207. The results of multi-graph parallel graph calculations of multiple tasks are aggregated through a high-speed interconnection bus, and a cross-card multi-graph joint analysis report is generated.

[0152] In an embodiment of the present application, each GPU is responsible for processing a task, obtaining the graph calculation result of the task, and then aggregating the graph calculation results of multiple GPUs through a high-speed interconnection bus, thereby realizing ultra-large-scale graph calculation tasks and improving the computing power of multi-graph parallel graph calculation.

[0153] In one embodiment of the present application, for further limitation and explanation, a thread block includes multiple data streams; wherein, the first data stream is used to execute a graph computing task; the second data stream is used to return the execution result of the graph computing task; and the third data stream is used to asynchronously copy the data of the data graph to a shared memory block.

[0154] It should be noted that three data streams are configured in the thread block to overlap data transmission and calculation in order to improve the overall throughput.

[0155] In specific application scenarios, in order to achieve multi-stream transmission, the following configuration can be performed:

[0156] 1. Multi-stream mechanism enables overlapping of computing and data transmission

[0157] 1.1 Pipeline Scheduling Mechanism

[0158] (1) Task segmentation:

[0159] -Divide graph computing tasks into three stages: data preparation, calculation execution, and result return;

[0160] - Each stage is executed on a different stream;

[0161] -Realize pipeline parallelism of multiple tasks.

[0162] (2) Overlapping execution strategy:

[0163] -The calculation of the current batch is carried out simultaneously with the data transmission of the next batch; -The transmission of the completed results is carried out simultaneously with the calculation of the new task; -Maximize GPU utilization.

[0164] 2. Data transmission optimization strategy

[0165] 2.1 Batch transfer optimization

[0166] (1) Data aggregation:

[0167] - Combine multiple small data transfers into a large one;

[0168] -Determine the optimal transfer batch size based on PCIe transfer characteristics;

[0169] - Reduce transfer startup overhead.

[0170] (2) Transmission scheduling:

[0171] -Dynamic evaluation of transmit queue length;

[0172] -Adjust the transmission order according to task priority;

[0173] -Avoid transfer queue backlogs.

[0174] 3. Multi-GPU collaborative computing mechanism

[0175] 3.1 Task Allocation Strategy

[0176] (1) Load balancing:

[0177] -Assign tasks based on GPU computing power;

[0178] -Task division taking into account device memory capacity;

[0179] -Dynamically adjust task allocation ratio.

[0180] 3.2 Optimization of communication between devices

[0181] (1) Point-to-point transmission:

[0182] -Support direct data transmission between GPU devices;

[0183] -Avoid transiting through the host;

[0184] - Reduce communication latency.

[0185] 4. Asynchronous execution control mechanism

[0186] 4.1 Event Synchronization

[0187] (1) Set the synchronization point:

[0188] - Insert event markers at key execution stages;

[0189] - Ensure data consistency;

[0190] -Control the execution order.

[0191] In one embodiment of the present application, for further definition and explanation, the embodiment method further includes: determining a grid dimension based on the following formula according to a first data graph number of data graphs involved in the task and a second data graph number of data graphs expected to be processed by the thread block, so as to configure the number of thread blocks according to the grid dimension:

[0192] Grid dimension = (numGraphs + graphsPerBlock - 1) / graphsPerBlock, where numGraphs represents the number of first data graphs, and graphsPerBlock represents the number of second data graphs.

[0193] It should be noted that designing the grid dimension Grid based on the above formula can ensure that each thread block processes graphsPerBlock data graphs, and all data graphs can be processed by rounding up. In addition, graphsPerBlock can be dynamically adjusted according to GPU resource usage to adapt to graphs of different sizes and hardware configurations, thereby maximizing parallelism while ensuring computational correctness.

[0194] The present application provides a multi-graph parallel graph computing method, which first obtains multiple data graphs involved in the target task, the number of data graphs of the expected processing data graph of each thread block, and the number of threads contained therein; secondly, based on the number of each data graph, the multiple data graphs are divided into multiple data graph groups, each data graph group corresponds to a thread block, and according to the number of threads in the thread block and the number of data graphs of the corresponding data graph group, the threads contained in each thread block are divided into multiple thread groups, each thread group corresponds to a data graph; finally, each vertex contained in the data graph is cyclically assigned to each thread contained in the corresponding thread group, and the data contained in the data graph is obtained from the shared storage area of ​​the thread block corresponding to each data graph, and graph computing is performed in a multi-graph parallel manner. Compared with the prior art, the embodiment of the present application divides the multiple data graphs involved in the target task into multiple groups according to the number of data graphs that the thread block is expected to process, and then divides the multiple threads contained in the thread block into multiple thread groups according to the number of data graphs contained in the data graph group. Each thread group is responsible for processing one data graph, and then the multiple vertices in the data graph are cyclically assigned to the threads in the thread group. Each thread is responsible for processing the calculation of one vertex, and all threads are started to perform graph calculations at the same time, which meets the graph calculation requirements of multiple graphs in parallel. Compared with single graph calculation, the efficiency is significantly improved and the real-time requirements are met. Moreover, in the process of thread calculation, the number of global memory accesses is reduced by obtaining the data contained in the data graph from the shared storage area of ​​the thread block corresponding to the data graph. Since the time consumed for accessing the shared storage area is shorter than that for accessing the global storage area, the overall access speed is improved, the latency is reduced, and the computing efficiency is further improved.

[0195] Furthermore, as a response to the above Figure 1 The embodiment of the present application provides a multi-graph parallel graph computing device, such as Figure 3 As shown, the device includes:

[0196] Parameter acquisition module 31, data graph allocation module 32, graph calculation module 33;

[0197] A parameter acquisition module 31 is used to acquire multiple data graphs involved in the target task, the number of data graphs of the expected processing data graph of each thread block, and the number of threads included;

[0198] a data graph allocation module 32 for dividing the plurality of data graphs into a plurality of data graph groups based on the number of the data graphs, each data graph group corresponding to a thread block, and dividing the threads contained in each thread block into a plurality of thread groups based on the number of threads in the thread block and the number of data graphs in the corresponding data graph group, each thread group corresponding to a data graph;

[0199] The graph computing module 33 is used to cyclically distribute each vertex contained in the data graph to each thread contained in the corresponding thread group, and obtain the data contained in the data graph from the shared storage area of ​​the thread block corresponding to each data graph, and perform graph computing in a multi-graph parallel manner.

[0200] In a specific application scenario, before the parameter acquisition module, the device further includes a global storage module for:

[0201] Divide the global storage area into multiple global memory blocks in advance according to the preset number of bytes;

[0202] According to the amount of data contained in the data graph, a corresponding global memory block is allocated to each data graph, so that multiple data graphs involved in the target task are continuously stored in the global storage area.

[0203] In a specific application scenario, before the graph calculation module, the device further includes a transfer module for:

[0204] According to the preset number of bytes, the shared storage area corresponding to each thread block is pre-divided into a plurality of shared memory blocks;

[0205] Determine the data graph group corresponding to each of the thread blocks respectively, and query the global memory area for the global memory block corresponding to the data graph contained in each of the data graph groups respectively;

[0206] The data stored in each of the global memory blocks are copied to the shared memory block corresponding to the data graph.

[0207] In a specific application scenario, the thread block contains multiple data streams; among them, the first data stream is used to execute the graph computing task; the second data stream is used to return the execution result of the graph computing task; and the third data stream is used to asynchronously copy the data of the data graph to the shared memory block.

[0208] In a specific application scenario, the device further includes a grid dimension determination module, which is used to:

[0209] According to the first data graph number of the data graphs involved in the task and the second data graph number of the data graph expected to be processed by the thread block, a grid dimension is determined based on the following formula to configure the number of thread blocks according to the grid dimension.

[0210] Grid dimension = (numGraphs + graphsPerBlock - 1) / graphsPerBlock, where numGraphs represents the number of first data graphs, and graphsPerBlock represents the number of second data graphs.

[0211] In a specific application scenario, the device further includes a load adjustment module for:

[0212] monitoring the computational load parameters of each of the thread blocks in real time;

[0213] When a first thread block whose computing load parameter exceeds a preset computing load maximum threshold is monitored, reducing the number of data graphs of the data graph group corresponding to the first thread block, and reallocating the reduced data graphs to idle thread blocks;

[0214] When a second thread block whose computing load parameter is lower than a preset computing load minimum threshold is monitored, the number of data graphs of the data graph group corresponding to the second thread block is increased.

[0215] In a specific application scenario, after the graph calculation module, the device further includes a summary module:

[0216] The results of multi-graph parallel graph computing of multiple tasks are summarized through a high-speed interconnection bus, and aggregated to generate a cross-card multi-graph joint analysis report.

[0217] The present application provides a multi-graph parallel graph computing device, which first obtains multiple data graphs involved in the target task, the number of data graphs of the expected processing data graph of each thread block, and the number of threads contained therein; secondly, based on the number of each data graph, the multiple data graphs are divided into multiple data graph groups, each data graph group corresponds to a thread block, and according to the number of threads in the thread block and the number of data graphs of the corresponding data graph group, the threads contained in each thread block are divided into multiple thread groups, each thread group corresponds to a data graph; finally, each vertex contained in the data graph is cyclically assigned to each thread contained in the corresponding thread group, and the data contained in the data graph is obtained from the shared storage area of ​​the thread block corresponding to each data graph, and graph computing is performed in a multi-graph parallel manner. Compared with the prior art, the embodiment of the present application divides the multiple data graphs involved in the target task into multiple groups according to the number of data graphs that the thread block is expected to process, and then divides the multiple threads contained in the thread block into multiple thread groups according to the number of data graphs contained in the data graph group. Each thread group is responsible for processing one data graph, and then the multiple vertices in the data graph are cyclically assigned to the threads in the thread group. Each thread is responsible for processing the calculation of one vertex, and all threads are started to perform graph calculations at the same time, which meets the graph calculation requirements of multiple graphs in parallel. Compared with single graph calculation, the efficiency is significantly improved and the real-time requirements are met. Moreover, in the process of thread calculation, the number of global memory accesses is reduced by obtaining the data contained in the data graph from the shared storage area of ​​the thread block corresponding to the data graph. Since the time consumed for accessing the shared storage area is shorter than that for accessing the global storage area, the overall access speed is improved, the latency is reduced, and the computing efficiency is further improved.

[0218] According to one embodiment of the present application, a storage medium is provided, wherein the storage medium stores at least one executable instruction, and the computer executable instruction can execute the multi-graph parallel graph computing method in any of the above method embodiments.

[0219] Based on this understanding, the technical solution of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, USB flash drive, mobile hard disk, etc.), including a number of instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute the methods described in each implementation scenario of the present application.

[0220] Figure 4 A schematic diagram of the structure of a terminal provided according to an embodiment of the present application is shown. The specific embodiment of the present application does not limit the specific implementation of the terminal.

[0221] like Figure 4As shown, the terminal may include: a processor (processor) 402 , a communications interface (Communications Interface) 404 , a memory (memory) 406 , and a communication bus 408 .

[0222] The processor 402 , the communication interface 404 , and the memory 406 communicate with each other via a communication bus 408 .

[0223] The communication interface 404 is used to communicate with other devices such as clients or other servers.

[0224] The processor 402 is configured to execute the program 410 , and specifically may execute the relevant steps in the above-mentioned multi-graph parallel graph computing method embodiment.

[0225] Specifically, the program 410 may include program codes, which include computer operation instructions.

[0226] Processor 402 may be a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present application. The one or more processors included in a computer device may be processors of the same type, such as one or more CPUs, or may be processors of different types, such as one or more CPUs and one or more ASICs.

[0227] The memory 406 is used to store the program 410. The memory 406 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.

[0228] The program 410 may be specifically configured to cause the processor 402 to perform the following operations:

[0229] Obtaining multiple data graphs involved in the target task, the number of data graphs of the data graph expected to be processed by each thread block, and the number of threads involved;

[0230] Based on the number of the data graphs, the data graphs are divided into a plurality of data graph groups, each data graph group corresponds to a thread block, and according to the number of threads in the thread block and the number of data graphs in the corresponding data graph group, the threads included in each thread block are divided into a plurality of thread groups, each thread group corresponds to a data graph;

[0231] Each vertex contained in the data graph is cyclically assigned to each thread contained in the corresponding thread group, and the data contained in the data graph is obtained from the shared storage area of ​​the thread block corresponding to each data graph, and graph calculation is performed in a multi-graph parallel manner.

[0232] The storage medium may also include an operating system and a network communication module. The operating system is a program that manages the hardware and software resources of the physical device used for the multi-graph parallel graph computing method, supporting the execution of the information processing program and other software and / or programs. The network communication module is used to enable communication between components within the storage medium and with other hardware and software within the physical information processing device.

[0233] Each embodiment in this specification is described in a progressive manner, with each embodiment focusing on its differences from the other embodiments. References to the same or similar parts between the various embodiments are sufficient. For system embodiments, since they largely correspond to method embodiments, their description is relatively simple. For relevant parts, references to the description of the method embodiments are sufficient.

[0234] The methods and systems of the present application may be implemented in many ways. For example, the methods and systems of the present application may be implemented by software, hardware, firmware, or any combination of software, hardware, and firmware. The above order of steps for the method is for illustration only, and the steps of the method of the present application are not limited to the order specifically described above, unless otherwise specifically stated. In addition, in some embodiments, the present application may also be implemented as programs recorded in a recording medium, which include machine-readable instructions for implementing the methods according to the present application. Therefore, the present application also covers recording media that store programs for executing the methods according to the present application.

[0235] Obviously, those skilled in the art should understand that the modules or steps of the present application described above can be implemented using a general-purpose computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices. Alternatively, they can be implemented using program code executable by the computing device, so that they can be stored in a storage device and executed by the computing device. In some cases, the steps shown or described can be performed in a different order than herein, or they can be made into separate integrated circuit modules, or multiple modules or steps can be made into a single integrated circuit module for implementation. Thus, the present application is not limited to any specific combination of hardware and software.

[0236] The above description is merely a preferred embodiment of the present application and is not intended to limit the present application. Persons skilled in the art will readily appreciate that various modifications and variations are possible. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of the present application shall be included within the scope of protection of the present application.

Claims

1. A multi-graph parallel graph computing method, characterized in that: include: Obtaining multiple data graphs involved in the target task, the number of data graphs of the data graph expected to be processed by each thread block, and the number of threads involved; Based on the number of the data graphs, the data graphs are divided into a plurality of data graph groups, each data graph group corresponds to a thread block, and according to the number of threads in the thread block and the number of data graphs in the corresponding data graph group, the threads included in each thread block are divided into a plurality of thread groups, each thread group corresponds to a data graph; Each vertex contained in the data graph is cyclically assigned to each thread contained in the corresponding thread group, and the data contained in the data graph is obtained from the shared storage area of ​​the thread block corresponding to each data graph, and graph calculation is performed in a multi-graph parallel manner.

2. The method according to claim 1, characterized in that Before obtaining the plurality of data graphs involved in the target task, the number of data graphs of the data graphs expected to be processed by each thread block, and the number of threads included, the method further includes: Divide the global storage area into multiple global memory blocks in advance according to the preset number of bytes; According to the amount of data contained in the data graph, a corresponding global memory block is allocated to each data graph, so that multiple data graphs involved in the target task are continuously stored in the global storage area.

3. The method according to claim 2, characterized in that Before respectively acquiring the data contained in the data graph from the shared storage area of ​​the thread blocks corresponding to each of the data graphs, the method further includes: According to the preset number of bytes, the shared storage area corresponding to each thread block is pre-divided into a plurality of shared memory blocks; Determine the data graph group corresponding to each of the thread blocks respectively, and query the global memory area for the global memory block corresponding to the data graph contained in each of the data graph groups respectively; The data stored in each of the global memory blocks are copied to the shared memory block corresponding to the data graph.

4. The method according to claim 1, wherein The thread block contains multiple data streams; among them, the first data stream is used to execute the graph computing task; the second data stream is used to return the execution result of the graph computing task; and the third data stream is used to asynchronously copy the data of the data graph to the shared memory block.

5. The method according to claim 1, characterized in that The method further comprises: According to the first data graph number of the data graphs involved in the task and the second data graph number of the data graph expected to be processed by the thread block, a grid dimension is determined based on the following formula to configure the number of thread blocks according to the grid dimension. Grid dimension = (numGraphs + graphsPerBlock - 1) / graphsPerBlock, where numGraphs represents the number of first data graphs, and graphsPerBlock represents the number of second data graphs.

6. The method according to claim 1, characterized in that The method further comprises: monitoring the computational load parameters of each of the thread blocks in real time; When a first thread block whose computing load parameter exceeds a preset computing load maximum threshold is monitored, reducing the number of data graphs of the data graph group corresponding to the first thread block, and reallocating the reduced data graphs to idle thread blocks; When a second thread block whose computing load parameter is lower than a preset computing load minimum threshold is monitored, the number of data graphs of the data graph group corresponding to the second thread block is increased.

7. The method according to claim 1, characterized in that After performing graph calculation in a multi-graph parallel manner, the method further includes: The results of multi-graph parallel graph computing of multiple tasks are summarized through a high-speed interconnection bus, and aggregated to generate a cross-card multi-graph joint analysis report.

8. A multi-graph parallel graph computing device, characterized in that: include: A parameter acquisition module is used to obtain multiple data graphs involved in the target task, the number of data graphs of the expected processing data graph of each thread block, and the number of threads included; a data graph allocation module, configured to divide the plurality of data graphs into a plurality of data graph groups based on the number of the data graphs, each data graph group corresponding to a thread block, and to divide the threads contained in each thread block into a plurality of thread groups based on the number of threads in the thread block and the number of data graphs in the corresponding data graph group, each thread group corresponding to a data graph; The graph computing module is used to cyclically distribute each vertex contained in the data graph to each thread contained in the corresponding thread group, and obtain the data contained in the data graph from the shared storage area of ​​the thread block corresponding to each data graph, and perform graph computing in a multi-graph parallel manner.

9. A storage medium storing at least one executable instruction, characterized in that: The executable instructions enable the processor to perform operations corresponding to the multi-graph parallel graph computing method according to any one of claims 1 to 7.

10. A terminal comprising: A processor, a memory, a communication interface, and a communication bus, wherein the processor, the memory, and the communication interface communicate with each other via the communication bus; The memory is used to store at least one executable instruction, wherein the executable instruction enables the processor to execute operations corresponding to the multi-graph parallel graph computing method according to any one of claims 1 to 7.