CN117807246A - Method and device for executing graph neural network task, electronic equipment and storage medium - Google Patents
Method and device for executing graph neural network task, electronic equipment and storage medium Download PDFInfo
- Publication number
- CN117807246A CN117807246A CN202311845287.3A CN202311845287A CN117807246A CN 117807246 A CN117807246 A CN 117807246A CN 202311845287 A CN202311845287 A CN 202311845287A CN 117807246 A CN117807246 A CN 117807246A
- Authority
- CN
- China
- Prior art keywords
- node
- edge
- partition
- expansion
- neighbor
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 233
- 238000013528 artificial neural network Methods 0.000 title claims abstract description 83
- 238000003860 storage Methods 0.000 title claims abstract description 23
- 238000005192 partition Methods 0.000 claims abstract description 269
- 230000008569 process Effects 0.000 claims abstract description 168
- 238000010276 construction Methods 0.000 claims abstract description 29
- 230000000875 corresponding effect Effects 0.000 claims description 119
- 238000012549 training Methods 0.000 claims description 55
- 238000009826 distribution Methods 0.000 claims description 17
- 238000006243 chemical reaction Methods 0.000 claims description 11
- 238000012163 sequencing technique Methods 0.000 claims description 4
- 230000002596 correlated effect Effects 0.000 claims description 3
- 230000006854 communication Effects 0.000 abstract description 29
- 238000004891 communication Methods 0.000 abstract description 28
- 238000000638 solvent extraction Methods 0.000 description 15
- 238000010586 diagram Methods 0.000 description 14
- 238000004590 computer program Methods 0.000 description 9
- 238000004364 calculation method Methods 0.000 description 8
- 230000006870 function Effects 0.000 description 8
- 238000012545 processing Methods 0.000 description 5
- 238000012360 testing method Methods 0.000 description 5
- 230000000694 effects Effects 0.000 description 4
- 238000005516 engineering process Methods 0.000 description 4
- 239000011159 matrix material Substances 0.000 description 4
- 238000012795 verification Methods 0.000 description 4
- 230000007246 mechanism Effects 0.000 description 3
- 230000005540 biological transmission Effects 0.000 description 2
- 238000004422 calculation algorithm Methods 0.000 description 2
- 238000013135 deep learning Methods 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 239000007787 solid Substances 0.000 description 2
- 230000002159 abnormal effect Effects 0.000 description 1
- 238000013475 authorization Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000001413 cellular effect Effects 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 230000010339 dilation Effects 0.000 description 1
- 238000012804 iterative process Methods 0.000 description 1
- 238000011068 loading method Methods 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 230000005055 memory storage Effects 0.000 description 1
- 238000005457 optimization Methods 0.000 description 1
- 230000002085 persistent effect Effects 0.000 description 1
- 238000007781 pre-processing Methods 0.000 description 1
- 230000000750 progressive effect Effects 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
- 230000001052 transient effect Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/30—Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
- G06F16/36—Creation of semantic tools, e.g. ontology or thesauri
- G06F16/367—Ontology
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5005—Allocation of resources, e.g. of the central processing unit [CPU] to service a request
- G06F9/5027—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/54—Interprogram communication
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Software Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Data Mining & Analysis (AREA)
- Life Sciences & Earth Sciences (AREA)
- Computational Linguistics (AREA)
- Biophysics (AREA)
- Biomedical Technology (AREA)
- Artificial Intelligence (AREA)
- Health & Medical Sciences (AREA)
- Evolutionary Computation (AREA)
- General Health & Medical Sciences (AREA)
- Molecular Biology (AREA)
- Computing Systems (AREA)
- Mathematical Physics (AREA)
- Animal Behavior & Ethology (AREA)
- Databases & Information Systems (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The application discloses a method and a device for executing a graph neural network task, electronic equipment and a storage medium. Wherein the method comprises the following steps: randomly dividing the knowledge graph to be divided into a plurality of sub-graphs by adopting an edge division mode, wherein each sub-graph corresponds to one partition; determining the expansion direction of the neighbor edge according to the construction mode of the node characteristics in the downstream graph neural network task; and for each partition, calling a process corresponding to the partition based on the expansion direction of the neighbor edge, performing iterative operation based on neighbor expansion on the partition to obtain an iterative expansion result corresponding to the partition, determining the iterative expansion results of the plurality of partitions as edge division results of the knowledge graph, converting to obtain node division results of the knowledge graph, and executing a downstream graph neural network task based on the node division results. The method and the device improve the dividing efficiency, reduce the waiting time of downstream GNN task execution and reduce the communication consumption among processes in the downstream GNN task execution process.
Description
Technical Field
The application belongs to the technical field of computers, and particularly relates to a method and a device for executing a graph neural network task, electronic equipment and a storage medium.
Background
A graph, such as a knowledge graph, is a knowledge network that includes entities, which are nodes in the graph, and relationships, which are edges in the graph, between the entities. Graph partitioning is the partitioning of a complete graph into several sub-graphs for operation in a distributed system. The graph division can be divided into: the method comprises the steps of point division and edge division, wherein the point division is to divide a node set of the graph, and the edge division is to divide an edge set of the graph.
In the related art, in the process of dividing the graph by adopting an edge dividing mode, when two nodes on one edge are respectively selected as expansion nodes by two partitions, the problem of preempting the edge occurs, a process of locking the edge first occupies the final ownership of the edge, then the process is globally transmitted, and all processes continue to iterate after determining the selection of the current edge, so that the dividing efficiency is low due to the communication and waiting time of each process, the waiting time of the task execution of a downstream graph neural network (Graph Neural Networks, GNN) is increased, the problem of preempting the edge distribution possibly exists that the neighboring edges of more nodes are positioned in different partitions, and the communication consumption among the processes in the downstream GNN task execution process is increased.
Disclosure of Invention
The embodiment of the application aims to provide a method, a device, electronic equipment and a storage medium for executing a graph neural network task, so as to solve the problems that the partition efficiency is low, the waiting time of downstream GNN task execution is increased, the neighboring edges with more nodes are positioned in different partitions, and the communication consumption among processes in the downstream GNN task execution process is increased.
In order to achieve the above purpose, the following technical solutions are adopted in the embodiments of the present application:
in a first aspect, an embodiment of the present application provides a method for executing a task of a graph neural network, including: randomly dividing an input knowledge graph to be divided into a plurality of sub-graphs by adopting an edge division mode, wherein each sub-graph corresponds to one partition; determining the expansion direction of the neighbor edge of the knowledge graph according to the construction mode of the node characteristics in the downstream graph neural network task, wherein the expansion direction comprises any one of the following directions: an incident direction and an exit direction; inputting the sub-graphs into a plurality of sub-servers respectively, wherein one sub-server corresponds to one sub-graph, and executing the following steps in parallel through the plurality of sub-servers: aiming at the subareas corresponding to the sub-servers, calling processes corresponding to the subareas based on the expansion directions of the neighbor edges, and performing iterative operation based on neighbor expansion on the subareas to obtain iterative expansion results corresponding to the subareas; determining iterative expansion results corresponding to a plurality of partitions output by the plurality of sub-servers as edge division results of the knowledge graph; according to the edge division result of the knowledge graph, converting to obtain a node division result of the knowledge graph; and executing the downstream graph neural network task based on the node division result.
In a second aspect, an embodiment of the present application provides a device for performing a task of a neural network, including: the first dividing module is used for randomly dividing the input knowledge graph to be divided into a plurality of sub-graphs in an edge dividing mode, and each sub-graph corresponds to one partition; the determining module is used for determining the expansion direction of the neighbor edge of the knowledge graph according to the construction mode of the node characteristics in the downstream graph neural network task, wherein the expansion direction comprises any one of the following directions: an incident direction and an exit direction; the second dividing module is used for inputting the sub-graphs into a plurality of sub-servers respectively, one sub-server corresponds to one sub-graph, and the following steps are executed in parallel through the plurality of sub-servers: aiming at the subareas corresponding to the sub-servers, calling processes corresponding to the subareas based on the expansion directions of the neighbor edges, and performing iterative operation based on neighbor expansion on the subareas to obtain iterative expansion results corresponding to the subareas; determining iterative expansion results corresponding to a plurality of partitions output by the plurality of sub-servers as edge division results of the knowledge graph; and the conversion module is used for converting the edge division result of the knowledge graph to obtain a node division result of the knowledge graph, and executing the downstream graph neural network task based on the node division result.
In a third aspect, an embodiment of the present application provides an electronic device, including: a processor, a memory, and a program or instructions stored on the memory and executable on the processor, which when executed by the processor, implement the steps of the method for performing the task of the graph neural network as described in the embodiments of the first aspect of the present application.
In a fourth aspect, embodiments of the present application provide a readable storage medium having stored thereon a program or instructions that, when executed by a processor, implement the steps of a method for performing tasks of a neural network according to embodiments of the first aspect of the present application.
The above-mentioned at least one technical scheme that this application embodiment adopted can reach following beneficial effect:
according to the embodiment of the application, an edge division mode is adopted, a knowledge graph to be divided is randomly divided into a plurality of sub-graphs, each sub-graph corresponds to one partition, the expansion direction of the neighbor edge of the knowledge graph is determined according to the construction mode of node characteristics in a neural network task of a downstream graph, the expansion direction comprises an incident direction and an emergent direction, the sub-graphs are respectively input into a plurality of sub-servers, one sub-server corresponds to one sub-graph, and the following steps are executed in parallel through the sub-servers: aiming at the subareas corresponding to the sub-servers, calling a process corresponding to the subareas based on the expansion direction of the neighbor edges, performing iterative operation based on neighbor expansion on the subareas to obtain iterative expansion results corresponding to the subareas, determining the iterative expansion results corresponding to the subareas output by the plurality of sub-servers as edge division results of the knowledge graph, converting the edge division results of the knowledge graph to obtain node division results of the knowledge graph, and executing a downstream graph neural network task based on the node division results. According to the embodiment of the application, the expansion direction of the neighbor edge of the knowledge graph is determined according to the construction mode of the node characteristics in the downstream graph neural network task, namely, the expansion direction of the neighbor edge when the iteration operation based on neighbor expansion is carried out on each partition is determined, the problem of edge allocation and preemption in the subsequent neighbor expansion process is avoided, on one hand, the communication and waiting time of each process after edge preemption are omitted, the dividing efficiency is improved, the waiting time of downstream GNN task execution is reduced, on the other hand, the edge is preferentially allocated to the partition consistent with the node in the expansion direction, and because the expansion direction is determined according to the construction mode of the node characteristics in the downstream graph neural network task, the effect that the neighbor edge affecting the node characteristics is preferentially converged in one partition is achieved, the fact that the neighbor edges of more nodes are located in different partitions is avoided, and the communication consumption among processes in the downstream GNN task execution process is reduced.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiments of the application and together with the description serve to explain the application and do not constitute an undue limitation to the application. In the drawings:
fig. 1 is a flowchart of a method for executing a task of a neural network according to an embodiment of the present application;
FIG. 2 is a schematic diagram of a sub-graph partitioning provided in one embodiment of the present application;
fig. 3 is a flowchart of a method for executing a task of the neural network according to another embodiment of the present application;
FIG. 4 is a schematic illustration of a neighbor expansion provided by an embodiment of the present application;
FIG. 5 is a schematic diagram of a first order neighbor edge and second order neighbor edge assignment provided by an embodiment of the present application;
fig. 6 is a flowchart of a method for executing a task of the neural network according to another embodiment of the present application;
fig. 7 is a flowchart of a method for executing a task of the neural network according to another embodiment of the present application;
FIG. 8 is a schematic overall flow chart of a graph partitioning method according to an embodiment of the present application
Fig. 9 is a schematic structural diagram of a device for performing tasks of the neural network according to an embodiment of the present application;
Fig. 10 is a schematic structural diagram of a device for performing tasks of the neural network according to another embodiment of the present application;
fig. 11 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
For the purposes, technical solutions and advantages of the present application, the technical solutions of the present application will be clearly and completely described below with reference to specific embodiments of the present application and corresponding drawings. It will be apparent that the described embodiments are only some, but not all, of the embodiments of the present application. All other embodiments, which can be made by one of ordinary skill in the art without undue burden from the present disclosure, are within the scope of the present disclosure.
The terms "first," "second," and the like in this application are used for distinguishing between similar objects and not for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that embodiments of the present application may be implemented in sequences other than those illustrated or described herein. Further, "and/or" in this application means at least one of the connected objects, and the character "/" generally means a relationship in which the associated object is an "or" before and after. It should be noted that, the data related to the present application are all obtained on the premise of obtaining the authorization of the user.
In the deep learning application scene of the super-large scale graph, the development of the GNN model training and reasoning tasks has the limitation of single-machine computing resources, in order to meet the task requirements of a distributed system, the complete graph needs to be divided into a plurality of sub-graphs before the model is built, and each node (corresponding to each process) in the distributed cluster only receives the storage and computation of one sub-graph.
The graph division can be divided into: dot division and edge division. Point partitioning, i.e., point (or node) allocation, is to divide a set of nodes in a graph into several parts, where each node and its related information is stored in a divided sub-graph, and edges in the graph may become edges because two vertices are divided in different sub-graphs. Edge division, i.e. edge allocation, is to divide an edge set in a graph into several parts, each edge and its related information are stored in one divided sub-graph, and when multiple neighboring edges of a node are divided in different sub-graphs, this point will exist in multiple sub-graphs, and such a point is called a cut point.
In the related technology, in the process of dividing the graph by adopting an edge dividing mode, when two nodes on one edge are respectively selected as expansion nodes by two partitions, the problem of preempting the edge occurs, a process of locking the edge first occupies the final ownership of the edge, then the process is globally transmitted, and all processes continue to iterate after determining the selection of the current edge, so that the dividing efficiency is low, the waiting time of the execution of the downstream GNN task is increased, the problem of preempting the edge distribution is likely to exist, the situation that the neighbor edges of more nodes are positioned in different partitions, and the communication consumption among the processes in the execution process of the downstream GNN task is increased. Therefore, the application provides a method, a device, electronic equipment and a storage medium for executing the graph neural network task, so that the problems of low dividing efficiency, increased waiting time for executing the downstream GNN task, more nodes with neighboring edges located in different partitions and increased communication consumption among processes in the process of executing the downstream GNN task caused by the problem of edge allocation and preemption in the related technology are solved.
The following describes in detail the technical solutions provided by the embodiments of the present application with reference to the accompanying drawings.
Fig. 1 is a flowchart of a method for executing tasks of a neural network according to an embodiment of the present application. As shown in fig. 1, the method for executing the task of the neural network in the embodiment of the present application may specifically include the following steps:
s101, randomly dividing an input knowledge graph to be divided into a plurality of sub-graphs by adopting an edge division mode, wherein each sub-graph corresponds to one partition.
In the embodiment of the present application, the execution main body of the execution method of the graph neural network task in the embodiment of the present application is an execution device of the graph neural network task, and the execution device of the graph neural network task may be disposed in an electronic device. The electronic device may be a terminal device or a server. The terminal equipment can be a mobile phone, a tablet computer, a desktop computer, a portable notebook computer, vehicle-mounted equipment and the like; the server may be an independent server or a server cluster composed of a plurality of servers.
The execution method of the graph neural network task can be applied to application scenes in various fields, such as a wind control scene, a marketing scene and a traffic scene.
In a wind-controlled scenario, the nodes in the knowledge graph may specifically include, but are not limited to, at least one of the following entities: the edges in the knowledge graph may include, but are not limited to, at least one relationship of holding, transferring, purchasing, etc. between entities. Correspondingly, graph partitioning downstream GNN tasks may specifically include, but are not limited to, at least one of the following tasks: a funds link tracking task, an abnormal transfer risk discovery task, etc.
In a marketing scenario, the nodes in the knowledge-graph may specifically include, but are not limited to, at least one of the following entities: the edges in the knowledge-graph may include, but are not limited to, at least one relationship between entities such as browsing and purchasing, among customers (or users) and products, among others. Correspondingly, graph partitioning downstream GNN tasks may specifically include, but are not limited to, at least one of the following tasks: product recommendation tasks, customer (or user) reach path tasks, and customer group (or user group) division tasks, among others.
In a traffic scenario, the nodes in the knowledge-graph may specifically include, but are not limited to, at least one of the following entities: road network, bayonet, vehicle, etc., edges in the knowledge-graph may include, but are not limited to, communication relationships between entities in particular. Correspondingly, graph partitioning downstream GNN tasks may specifically include, but are not limited to, at least one of the following tasks: shortest path planning tasks, traffic flow control tasks, and the like.
Because the execution of the graph dividing downstream GNN task requires the input of a node allocation (or division) result, the graph dividing algorithm integrated into the graph deep learning framework generally prefers a method using the point division, but the edge division form naturally supports a large-scale graph dividing task, and the traditional point division method is balanced considering the number of edges, and complex balancing mechanisms are required to be mixed in an iterative process. Therefore, the embodiment of the application adopts an edge division mode to cut in, and then converts the edge division result into a node division result which is used as the input of the downstream GNN task.
The graph to be divided in the embodiment of the present application may be a knowledge graph. The knowledge graph is a knowledge network comprising entities and relationships between the entities, wherein the entities are nodes in the graph, and the relationships are edges in the graph. Each node has a respective label (table), denoted as a node label, and different nodes may correspond to the same or different node labels. The number of feature dimensions corresponding to each node label may be the same or different. All nodes in the graph are divided into a training set, a verification set and a test set, wherein the nodes in the training set are called training nodes, the nodes in the verification set are called verification nodes, and the nodes in the test set are called test nodes.
And randomly dividing the input knowledge graph to be divided into a plurality of sub-graphs by adopting an edge division mode, wherein each sub-graph comprises a plurality of edges in the knowledge graph, each process is responsible for storing and calculating one sub-graph, and each process and each sub-graph correspond to one partition.
It should be noted that the number of divided sub-graphs may be preset, the knowledge graph to be divided is randomly divided into a corresponding number of sub-graphs, and the number of edges in the randomly divided sub-graphs is relatively balanced in consideration of the balance of the number of edges.
For example, as shown in fig. 2, the knowledge graph includes 10 nodes and 13 edges, and the knowledge graph is randomly divided into 3 subgraphs: subgraph 1, subgraph 2, and subgraph 3.
The 10 nodes in fig. 2 share 2 types of node labels A, B, the number of feature dimensions corresponding to the node label a is 64, the number of feature dimensions corresponding to the node label B is 128, and the training set (train): verification set (valid): test set (test) =7: 2:1, node data corresponding to the knowledge graph are shown in table 1, and corresponding edge data are shown in table 2:
TABLE 1 node data corresponding to knowledge graph
TABLE 2 edge data corresponding to knowledge graph
Exit node (src) | Incidence node (dst) |
0 | 1 |
1 | 2 |
2 | 3 |
1 | 4 |
2 | 4 |
4 | 3 |
4 | 5 |
0 | 6 |
5 | 6 |
5 | 8 |
7 | 6 |
7 | 8 |
8 | 9 |
The corresponding edge data for sub-graph 1 is shown in table 3:
TABLE 3 edge data corresponding to sub-FIG. 1
The corresponding edge data for sub-graph 2 is shown in table 4:
table 4 edge data corresponding to sub-graph 2
Exit node (src) | Incidence node (dst) |
1 | 2 |
2 | 4 |
4 | 3 |
7 | 6 |
5 | 8 |
The corresponding edge data for sub-graph 3 is shown in table 5:
TABLE 5 edge data corresponding to sub-figure 3
Exit node (src) | Incidence node (dst) |
1 | 4 |
2 | 3 |
5 | 6 |
8 | 9 |
S102, determining the expansion direction of the neighbor edges of the knowledge graph according to the construction mode of the node characteristics in the downstream graph neural network task.
In the embodiment of the application, the neighboring edge is also called an adjacent edge. The neighboring edge of the node, namely the edge taking the node as an incident node or an emergent node. The direction of expansion may specifically include any one of the following directions: an incident direction and an exit direction.
And carrying out edge division optimization on each partition by adopting an edge division mode based on neighbor expansion. In consideration of the problem of preempting an edge when two nodes on the edge are respectively selected as expansion nodes by two partitions, the expansion direction of the neighboring edge when the neighboring expansion is performed based on the expansion nodes in the plurality of partitions can be determined in advance. The direction of the neighbor edge of the expansion node comprises an incident direction and an emergent direction, one of the two directions can be determined as the expansion direction of the neighbor edge, when two nodes on one edge are respectively selected as expansion nodes by two subareas, the subarea where the expansion node is located is determined according to the direction of the edge, and the problem of preempting the edge is avoided.
The expansion direction of the neighbor edge can be determined according to the construction mode of the node characteristics in the downstream GNN task. Specifically, the node features in different GNN tasks are constructed in different manners, for example, when the main stream GNN framework DistDGL trains the node features, the node features are sampled from the incident neighboring nodes of the node, so that the edges are distributed to the partitions consistent with the incident nodes of the edges, and each node can be ensured to obtain the neighboring features only from the local process in the training process. In order to realize that the edges are distributed to the subareas consistent with the incident nodes of the edges, the expansion direction of the neighbor edges during neighbor expansion is determined to be the incident direction, so that the incident neighbor edges affecting the node characteristics can be converged in one subarea, the incident neighbor edges of more nodes are prevented from being positioned in different subareas, and communication consumption among processes in the GNN training and reasoning process is reduced. In addition, the problem of side preemption is avoided, communication and waiting time of each process after side preemption are omitted, and dividing efficiency is improved.
S103, respectively inputting the plurality of sub-graphs into a plurality of sub-servers, wherein one sub-server corresponds to one sub-graph, and executing the following steps in parallel through the plurality of sub-servers: aiming at the subareas corresponding to the sub-servers, calling processes corresponding to the subareas based on the expansion directions of the neighbor edges, and performing iterative operation based on neighbor expansion on the subareas to obtain iterative expansion results corresponding to the subareas; and determining iterative expansion results corresponding to the partitions output by the sub-servers as edge division results of the knowledge graph.
In this embodiment of the present application, a plurality of distributed sub-servers may be preset, and the plurality of sub-servers are in communication connection with each other. And respectively inputting the multiple subgraphs into the corresponding sub-servers, wherein each partition corresponds to one process, each process is executed by one sub-server, each process performs iterative operation based on neighbor expansion on the partition responsible for the process, and an iterative expansion result corresponding to the partition is obtained, namely, the edges are divided in the partition. Each process locks based on the expansion direction of the neighbor edge determined in step S102 when the expansion node locks the neighbor edge in the process of performing the edge division based on the neighbor expansion for the partition that it is responsible for. And determining the iterative expansion results of a plurality of partitions corresponding to the knowledge graph output by the plurality of sub-servers as the edge division results of the knowledge graph, namely dividing edges in each partition or dividing edges in each partition into which partition in the knowledge graph.
And S104, converting to obtain a node division result of the knowledge graph according to the edge division result of the knowledge graph, and executing a downstream graph neural network task based on the node division result.
In the embodiment of the present application, since the execution of the graph dividing downstream GNN task requires the input of the node allocation (or dividing) result, the edge dividing result of each sub-graph obtained in step S103 needs to be converted into the node dividing result of the knowledge graph, that is, the node dividing result conversion step is executed, and the node dividing result is input to the downstream GNN task execution module, which executes the graph neural network task according to the input node dividing result.
In summary, in the method for executing the graph neural network task according to the embodiment of the present application, an edge division manner is adopted to randomly divide a knowledge graph to be divided into a plurality of sub-graphs, each sub-graph corresponds to a partition, an expansion direction of a neighbor edge of the knowledge graph is determined according to a construction manner of node features in a downstream graph neural network task, the expansion direction includes an incident direction and an emergent direction, the plurality of sub-graphs are respectively input into a plurality of sub-servers, one sub-server corresponds to one sub-graph, and the following steps are executed in parallel through the plurality of sub-servers: aiming at the subareas corresponding to the sub-servers, calling a process corresponding to the subareas based on the expansion direction of the neighbor edges, performing iterative operation based on neighbor expansion on the subareas to obtain iterative expansion results corresponding to the subareas, determining the iterative expansion results corresponding to the subareas output by the plurality of sub-servers as edge division results of the knowledge graph, converting the edge division results of the knowledge graph to obtain node division results of the knowledge graph, and executing a downstream graph neural network task based on the node division results. According to the embodiment of the application, the expansion direction of the neighbor edge of the knowledge graph is determined according to the construction mode of the node characteristics in the downstream graph neural network task, namely, the expansion direction of the neighbor edge when the iteration operation based on neighbor expansion is carried out on each partition is determined, the problem of edge allocation and preemption in the subsequent neighbor expansion process is avoided, on one hand, the communication and waiting time of each process after edge preemption are omitted, the dividing efficiency is improved, the waiting time of downstream GNN task execution is reduced, on the other hand, the edge is preferentially allocated to the partition consistent with the node in the expansion direction, and because the expansion direction is determined according to the construction mode of the node characteristics in the downstream graph neural network task, the effect that the neighbor edge affecting the node characteristics is preferentially converged in one partition is achieved, the fact that the neighbor edges of more nodes are located in different partitions is avoided, and the communication consumption among processes in the downstream GNN task execution process is reduced.
Fig. 3 is a flowchart of a method for executing tasks of the neural network according to another embodiment of the present application. As shown in fig. 3, on the basis of the embodiment shown in fig. 1, the method for executing the task of the graph neural network according to the embodiment of the present application specifically may include the following steps:
s301, randomly dividing an input knowledge graph to be divided into a plurality of sub-graphs by adopting an edge division mode, wherein each sub-graph corresponds to one partition.
S302, determining the expansion direction of the neighbor edge of the knowledge graph according to the construction mode of the node characteristics in the downstream graph neural network task, wherein the expansion direction comprises any one of the following directions: an incident direction and an exit direction.
In the embodiment of the present application, steps S301 to S302 are the same as steps S101 to S102 in the above embodiment, and will not be described here again.
Step S103 "in the above embodiment inputs a plurality of sub-graphs into a plurality of sub-servers, respectively, one sub-server corresponds to one sub-graph, and the following steps are executed in parallel by the plurality of sub-servers: for the partition corresponding to the sub-server, based on the expansion direction of the neighbor edge, invoking the process corresponding to the partition, and performing the iterative operation based on the neighbor expansion on the partition to obtain the iterative expansion result "corresponding to the partition, which specifically may include the following steps S303-S310.
S303, respectively inputting a plurality of sub-graphs into a plurality of sub-servers, wherein one sub-server corresponds to one sub-graph, and executing the following steps in parallel through the plurality of sub-servers: the calling process initializes the first node set, the second node set, and the assigned edge set of the corresponding partition to an empty set.
In the embodiment of the present application, the neighbor expansion in the edge partitioning process is shown in fig. 4, and each process initializes a first node set that is empty, a second node set that is empty, and an allocated edge set that is empty.
The first node set, i.e., the boundary (boundary) node set, is referred to as B set for short. Set B refers to that after the edge division is completed, only part of the neighboring edges of each node in the set belong to the partition corresponding to the process, for example, node 2 in fig. 4, fig. 4.
The second set of nodes, the Core set of nodes, is referred to as the C set. Set C refers to the partition to which the process corresponds for all neighbor edges of each node in the set, e.g., nodes 1, 3, and 4 in figure 4, after the edge partitioning is complete.
An assigned edge (AllocEdges) set refers to each edge in the set belonging to the partition to which the process corresponds after the edge partitioning is completed, e.g., the edge between nodes 1, 2, 3, 4 in fig. 4, fig. 4.
The idea of neighbor expansion is that nodes are strategically selected from the B set to be added into the C set (when no node exists in the B set in the initial state or the iteration process, the nodes are randomly selected from unassigned nodes to be added into the B set), all neighbor edges of the nodes are added into an allocedge set, namely the nodes are assigned to the partition corresponding to the process, the nodes, which are not assigned to the partition corresponding to the process, on the neighbor edges are added into the B set, and the operation is repeated in the next iteration until all edges are assigned.
S304, judging whether the first node set is an empty set.
In the embodiment of the present application, the process determines whether the B set is an empty set, that is, determines whether there is no node in the B set. If yes, step S305 is performed. If not, step S306 is performed.
It will be understood by those skilled in the art that, in the initial state, the B set is an initialized empty set, so that the step of "determining whether the B set is an empty set" may be skipped, and the step S305 may be directly performed.
S305, randomly selecting one node from unassigned nodes in the subgraph, and adding the selected node to the first node set.
In this embodiment of the present application, when the B set is an empty set, a node may be randomly selected from the unassigned nodes of the sub-graph and added to the B set, for example, a node with a small number of neighbor edges (for example, less than or equal to 2) in the sub-graph may be randomly selected from the unassigned nodes of the sub-graph and added to the B set. The unassigned nodes of the sub-graph, i.e., the nodes in the B-set and C-set corresponding to the sub-graph (vertices of the edges within the sub-graph, e.g., the incident and exit nodes in table 3) are not added to the nodes in the sub-graph.
S306, determining the node with the minimum number of unassigned neighbor edges in the expansion direction in the first node set as the current expansion node, and adding the current expansion node into the second node set.
In the embodiment of the application, each process locks a node in a respective set B as a current expansion node and adds the current expansion node to a respective set C.
When only one node Vi is in the B set, the node Vi is determined as the current expansion node, and the node Vi is added to the C set.
When there are a plurality of nodes in the B set, the number of unassigned neighboring edges in the expansion direction of each node may be obtained, for example, when the expansion direction determined in step S302 is the incident direction, the number of unassigned incident neighboring edges of each node may be obtained, the node Vi with the smallest number of unassigned incident neighboring edges may be determined as the current expanded node, and the node Vi may be added to the C set.
Here, when each process determines the current expansion node, a level of the first priority may be set when each process determines the current expansion node, where the level of the first priority is positively related to the number of unassigned edges corresponding to the process.
That is, when each process locks the current expansion node, the greater the number of unassigned sides corresponding to the process, the higher the level of priority (denoted as first priority) of the process locking the current expansion node, that is, the higher the first priority of the process with the higher number of unassigned sides is higher than the first priority of the process with the lower number of unassigned sides, and when the process with the higher first priority completes locking the current expansion node, the process with the lower first priority locks the current expansion node.
S307, adding the expansion direction first-order neighbor edges of the current expansion node to the allocated edge set, and adding the nodes which are not in the current partition on the first-order neighbor edges to the first node set.
In the embodiment of the application, each process allocates a first-order neighbor edge and a second-order neighbor edge of the expansion direction of the current expansion node based on the current expansion node Vi determined by each process.
This step S307 is a process of assigning (or locking) a first-order neighbor edge of the expansion direction of the current expansion node Vi. The first-order neighbor edge of the expansion direction of the current expansion node Vi, for example, the first-order incident neighbor edge is added to the allocedge set, and the node Ui of the first-order neighbor edge which is not in the current partition is added to the B set.
S308, judging whether the expansion direction second-order neighbor node of the current expansion node is already in the corresponding partition.
If yes, go to step S309. If not, returning to the step S304, and executing the next iteration.
S309, adding the expansion direction second-order neighbor edges of the current expansion node into the allocated edge set. Returning to step S304, the next iteration is performed.
In the embodiment of the present application, steps S308 to S309 are processes of assigning (or locking) the second-order neighbor edge of the expansion direction of the current expansion node Vi.
If the second-order incident neighbor node Wi of the current expansion node Vi is already in the corresponding partition, adding the second-order incident neighbor edges (Ui, wi) of the current expansion node Vi into the allocedge set, and updating the number of unassigned incident neighbor edges of each node in the B set.
When each process adds a first-order neighbor edge or a second-order neighbor edge to the assigned edge set, the second priority of the process where the expansion direction node of the first-order neighbor edge or the second-order neighbor edge is located is set higher than the second priority of the process where the expansion direction node is not located.
That is, when each process locks a first-order neighbor edge or a second-order neighbor edge, the process where the expansion direction node of the first-order neighbor edge or the second-order neighbor edge is located has a higher priority of the locked edge.
FIG. 5 is a schematic diagram of an allocation process of first-order neighbor edges and second-order neighbor edges, as shown in FIG. 5, with open nodes representing unassigned nodes, solid nodes representing assigned nodes, dashed edges representing unassigned edges, and solid edges representing assigned edges. And preferentially selecting a node v with the minimum number of unassigned edges in the Boundary set, assigning the first-order neighbor edges (v, u) of the node v to the corresponding partition, judging that the second-order neighbor point w of the node v is already in the corresponding partition, and assigning the second-order neighbor edges (u, w) of the node v to the corresponding partition.
It will be appreciated by those skilled in the art that in the allocation process of the first-order neighbor edge and the second-order neighbor edge, the node v with the smaller number of unallocated edges is preferentially selected, so as to reduce the number of nodes located in the B set at the end of partition division, i.e., reduce the number of divided node copies (i.e., cut points). In addition, the allocation of the second-order neighbor edges is synchronously considered in one round of iteration, so that the iteration and expansion speed can be accelerated.
It should be noted that, in the process of locking the current expansion node by each process and the process of distributing the first-order neighbor edge and the second-order neighbor edge by each process, based on the cross-process message communication, the priority order of locking the current expansion node or edge by each process can be determined, and each process is sequentially locked according to the order, so that the problem of single-point bottleneck caused by additionally setting a coordinator process to control the distribution and iterative expansion of edges is avoided.
Examples are as follows:
the specific process of performing the iterative operation based on the neighbor expansion on the three partitions corresponding to the three sub-graphs obtained by dividing in fig. 1 to obtain the iterative expansion result corresponding to each partition is shown in table 6, taking the expansion direction as the incident direction as an example:
table 6 edge partitioning procedure based on neighbor expansion for each subgraph
/>
And S310, determining iteration expansion results corresponding to the partitions output by the sub-servers as edge division results of the knowledge graph.
In the embodiment of the present application, the final iteration expansion result of each partition, that is, the edge division result of the knowledge graph is shown in the following table 7:
TABLE 7 iterative dilation results for partitions
/>
After the step S309 of adding the first-order neighbor edges of the expansion direction of the current expansion node to the allocated edge set, it may also be determined whether the number of edges in the allocated edge set reaches the preset first edge number threshold, if yes, the iteration operation based on the neighbor expansion performed on the current partition is ended, and the iteration operation based on the neighbor expansion performed on the other partition is waited for ending, if no, the step S304 is returned to and the next iteration is performed.
And determining whether the iteration operation based on neighbor expansion performed on the current partition is finished or not by judging whether the number of the edges in the assigned edge set reaches a preset first edge number threshold value, so that the balance of the number of the edges of each partition is ensured.
In the above embodiment, the "the node division result according to the edge division result of the knowledge graph, which is converted into the node division result of the knowledge graph" in step S104 may specifically include the following steps S311-S313:
s311, for each partition, the core nodes in the partition are allocated to the partition.
In the embodiment of the application, after all edges in the knowledge graph are distributed, a node division result conversion process is executed.
And the core node is a node with the number of edges which takes the node as the node in the expansion direction in the partition and is equal to or larger than a preset second edge number threshold value, for example, the node with the number of edges which takes the node as the incident node in the partition being more than or equal to 2 is determined as the core node. Core nodes in the partition are assigned to the partition.
For example, the edge division result shown in table 7 is assigned to partition 1 with node 6 in partition 1 as the core node. Node 3 and node 8 in partition 2 are used as core nodes and assigned to partition 2. Node 4 in partition 3 is taken as the core node and assigned to partition 3.
S312, the number of the core nodes connected with the opposite-side neighbor nodes of the core node in different partitions is obtained, and the opposite-side neighbor nodes are distributed to the partition with the largest number of the connected core nodes.
In the embodiment of the application, the node is adjacent to the edge of the node, namely another node on the adjacent edge of the node.
And aiming at opposite side neighbor nodes of the core node, acquiring the number of the core nodes connected with the opposite side neighbor nodes in different partitions, namely determining that the opposite side neighbor nodes are connected with a plurality of core nodes in different partitions, and allocating the opposite side neighbor nodes to the partition with the largest number of the connected core nodes.
For example, the opposite edge neighbor nodes of core node 6 are nodes 0, 7 and 5, the opposite edge neighbor node of core node 3 is node 2, the opposite edge neighbor node of core node 8 is nodes 5 and 7, and the opposite edge neighbor node of core node 4 is nodes 1 and 2.
And counting the number of connected core nodes of the node 0 in different partitions, configuring the node 0 to the partition with the largest number of connected core nodes, and finally distributing the node 0 to the partition 1. Similarly, the number of core nodes connected by the node 7 in different partitions is counted, the node 7 is configured to the partition with the largest number of the core nodes connected, and finally the partition of the node 7 is undetermined. Similarly, the number of connected core nodes of the node 5 in different partitions is counted, the node 5 is configured to the partition with the largest number of connected core nodes, and finally the node 5 is distributed to the partition 1. Similarly, the number of connected core nodes of the node 2 in different partitions is counted, the node 2 is configured to the partition with the largest number of connected core nodes, and finally the node 2 is distributed to the partition 2. Similarly, the number of connected core nodes of the node 1 in different partitions is counted, the node 1 is configured to the partition with the largest number of connected core nodes, and finally the partition of the node 1 is undetermined.
S313, distributing unassigned nodes based on node label equalization and training set equalization.
In the embodiment of the application, node labels are balanced, namely the number of characteristic dimensions of labels of all nodes in each partition is balanced. The training set is balanced, i.e. the number of training nodes belonging to the training set in each partition is balanced.
For other nodes (i.e., unassigned nodes) than the nodes assigned in steps S311, S312 (i.e., assigned nodes), the assignment is based on node tag balancing and training set balancing policies.
And S314, executing the downstream graph neural network task based on the node division result.
In the embodiment of the present application, step S314 is the same as steps S101 to S102 in the above embodiment, and will not be described here again.
It should be noted that in the node allocation result conversion process, after the edge division method based on neighbor expansion is executed, the advantages of the edge division method are reserved by defining the core node and the allocation result of the edge neighbor node, meanwhile, in the process of allocating the rest nodes, multi-constraint load balancing is achieved by combining node label balancing and training set balancing, load balancing of each partition is guaranteed, and therefore the calculation efficiency of downstream GNN tasks is improved.
In addition, the load balancing of the traditional edge dividing algorithm only limits the quantity of edges to be balanced, and when facing to the downstream GNN task, the characteristic dimension quantity of the node labels and the quantity of training nodes are balanced or not, so that the calculation efficiency of the downstream GNN task is also affected. According to the method, the edge quantity balance is controlled by executing the edge dividing method based on neighbor expansion, meanwhile, in the process of distributing the rest nodes, node label balance and training set balance are combined, and load balance (node label balance and training set balance) deviation of each partition is minimized in node distribution result conversion. The multi-constraint load balancing (edge balancing, node label balancing and training set balancing) mechanism is integrated in the graph dividing process, so that the load balancing of each partition is ensured, and the calculation efficiency of the downstream GNN task is improved.
Further, as shown in fig. 6, the step S313 "allocating unallocated nodes based on node label balancing and training set balancing" may specifically include the following steps:
s601, calculating the average load balancing amount according to the number of training nodes corresponding to the node labels in the training set and the feature dimension number of the node labels.
In this embodiment of the present application, the number x of training nodes corresponding to each node label in the training set may be counted according to the node data corresponding to the knowledge graph shown in table 1, specifically according to the node labels corresponding to each training node in the training set in table 1 i . According to the number x of training nodes corresponding to each node label in the statistical training set i And the number n of characteristic dimensions of each node label i The total load balance D is calculated according to the following formula:
where T is the total number of node labels.
From the total load balancing amount D, an average load balancing amount=d/P is calculated, where P is the total number of divided partitions, i.e. the total number of sub-graphs of the initial division.
For example, based on the node data corresponding to the knowledge graph shown in table 1, the total load balancing amount d= (3×64+4×128)/(64+128) =11/3, the average load balancing amount=d/p= (11/3)/3=11/9 is calculated.
S602, calculating the load balancing amount of each partition according to the distribution result of the distributed nodes, the node labels corresponding to each training node in the training set and the feature dimension quantity of each node label.
In the embodiment of the application, in the downstream GNN task, the feature dimension number n of different node labels i Number of training nodes within partition p ji The traffic of the cross-partition pull feature is directly affected, so that the computing efficiency of the partition is affected, and therefore, a load balancing matrix shown in table 8 can be defined, and the feature dimension number n of each node label is defined i Training node number p corresponding to each node label in each partition ji In combination, the component zone loadings are defined:
table 8 load balancing matrix
Where P is the total number of partitions divided, i.e., the total number of sub-graphs initially divided, P j For the j-th partition, j is E (1, P), T is the total number of categories of node labels, L i For class i node labels, n i Is that
Number of training nodes.
For example, the node division results of steps S311, S312, that is, the allocation results of the allocated nodes are shown in table 9:
table 9 assignment results for assigned nodes
Wherein, node label A is 64 dimension, node label B is 128 dimension, and w is calculated 1 =64/(64+128)=1/3,w 2 =128/(64+128) =2/3. Based on w 1 、w 2 And table 8 a load balancing matrix is constructed as shown in table 10 below:
table 10 load balancing matrix
S603, calculating the load balancing deviation value of each partition according to the load balancing amount and the average load balancing amount of each partition.
In the embodiment of the application, a load balancing calculation paradigm, that is, a calculation formula of a load balancing deviation value, is defined to fuse node label balancing and training set balancing.
Specifically, the absolute value of the load balancing amount and the average load balancing amount difference value of each partition is defined as the load balancing deviation value epsilon j The corresponding calculation formula is (taking the jth partition as an example):
s604, distributing the unassigned nodes according to the load balance deviation values of the partitions.
In the embodiment of the application, the unallocated nodes are allocated in sequence. It should be noted that, for each unassigned node after steps S311 and S312, if there is an unassigned node that has been assigned based on the load balancing offset value, the load balancing offset value of the partition that joins the new assigned node needs to be recalculated, and the load balancing offset values of the other partitions (i.e., the partition that does not join the new assigned node) remain unchanged.
For example, as shown in table 9, after steps S311 and S312, the unassigned nodes are node 1, node 7 and node 9, and if the nodes 7 and 9 are also training nodes in the training set, the 3 nodes may be randomly ordered, for example, the nodes 1, 7 and 9 are sequentially assigned, and after the node 1 completes the assignment, the load balance bias values of each partition need to be recalculated when the node 7 is assigned, for example, if the node 1 is assigned to the partition 1, the load balance bias values of the partition 1 need to be recalculated, the load balance bias values of the partitions 2 and 3 are unchanged, and the node 7 is assigned based on the recalculated load balance bias values of each partition.
As shown in fig. 7, in some embodiments, the step S604 "allocate unallocated nodes according to the load balancing offset value of each partition" may specifically include the following steps:
s701, sorting the partitions according to the number of neighbor edges corresponding to the partitions of the unassigned nodes, wherein the number of neighbor edges corresponding to the partitions is positively correlated with the sorting position of the partitions.
In the embodiment of the present application, for a node that is not currently allocated, the number of neighboring edges corresponding to each partition of the node may be obtained, where the more the number of neighboring edges corresponding to the node is, the more forward the ordering is.
For example, node 1 in table 9 is assigned, the number of neighboring edges corresponding to node 1 in partition 1 is obtained as 1, the number of neighboring edges corresponding to node 1 in partition 1 is 1, and since the number of neighboring edges corresponding to each partition is 1, the 3 partitions may be randomly ordered, for example, ordered as partition 1, partition 2, and partition 3.
S702, judging whether unallocated nodes are allocated to the current partition according to the ordering positions of the partitions in sequence: and if the load balancing deviation value of the current partition is smaller than a preset load balancing deviation threshold value, distributing the unassigned node to the current partition.
In the embodiment of the application, for a node which is not allocated currently, whether the node is allocated to the current partition is sequentially judged according to the ordering positions of all the partitions. When judging whether the node is distributed to the current partition, if the load balancing deviation value of the current partition is smaller than the preset load balancing deviation threshold value, the node is distributed to the current partition, and if the load balancing deviation value of the current partition is equal to or larger than the preset load balancing deviation threshold value, whether the node can be distributed to the next partition is judged.
For example, node 1 in table 9 is assigned, assuming that the corresponding partitions are ordered as partition 1, partition 2, and partition 3, the load balancing deviation threshold is 0.35. First, it is determined whether node 1 is assigned to partition 1: the load balance deviation value of partition 1 is epsilon 1 = |5/3-11/9|=4/9=0.444, then the load balancing offset value is 0.444>The load balancing deviation threshold is 0.35, and therefore node 1 is not assigned to partition 1. Continuing to determine whether node 1 isWhether to allocate to partition 2: the load balancing deviation value of the partition 2 is epsilon 2 = |1-11/9|=2/9=0.222, then the load balancing offset value is 0.222<The load balancing deviation threshold is 0.35, thus node 1 is assigned to partition 2.
For the unassigned nodes 7 and 9, since the nodes 7 and 9 are not training nodes in the training set, node label equalization and training set equalization do not need to be considered, the nodes 7 and 9 can be assigned according to node number equalization, specifically, the number of assigned nodes in the partition 1 is 4, the number of assigned nodes in the partition 2 is 3, and the number of assigned nodes in the partition 3 is 1, and then the nodes 7 and 9 can be assigned to the partition 3 to ensure the node number equalization of each partition.
In summary, the execution method of the graph neural network task in the embodiment of the application determines the expansion directions of the neighbor edges of a plurality of knowledge maps according to the construction mode of the node features in the downstream graph neural network task, namely determines the expansion directions of the neighbor edges when each partition is subjected to the iterative operation based on the neighbor expansion, so that the problem of edge allocation and preemption in the subsequent neighbor expansion process is avoided, on one hand, the communication and waiting time of each process after the edge preemption are omitted, the partition efficiency is improved, the waiting time of the downstream GNN task execution is reduced, on the other hand, the edges are preferentially allocated to the partition consistent with the node in the expansion directions, and because the expansion directions are determined according to the construction mode of the node features in the downstream graph neural network task, the effect that the neighbor edges affecting the node features are preferentially converged in one partition is realized, the fact that the neighbor edges of more nodes are located in different partitions is avoided, and the communication consumption among the processes in the downstream GNN task execution process is reduced. When each partition is subjected to iteration operation based on neighbor expansion, the first-order neighbor edge and the second-order neighbor edge of the current expansion node are synchronously considered in one round of iteration process, so that the iteration and expansion speed are increased, and the division efficiency is improved. In the process of locking the current expansion node by each process and the distribution of each process to the first-order neighbor edge and the second-order neighbor edge, the priority order of locking the current expansion node or the edge by each process can be determined based on the cross-process message communication, and each process is sequentially locked according to the order, so that the problem of single-point bottleneck caused by additionally arranging a coordinator process to control the distribution and the iterative expansion of the edge is avoided. After the edge dividing method based on neighbor expansion is executed, the advantages of the edge dividing method are reserved by defining the core node and the distribution results of the edge neighbor nodes in the node distribution result conversion process, meanwhile, in the distribution process of the rest nodes, multi-constraint load balancing (edge balancing, node label balancing and training set balancing) is realized by combining node label balancing and training set balancing, the load balancing of each partition is guaranteed, and the calculation efficiency of downstream GNN tasks is further improved. By defining the load balancing paradigm, node label balancing and training set balancing can be conveniently and rapidly realized.
In order to clearly illustrate the graph dividing method according to the embodiment of the present application, the overall flow of the graph dividing method according to the embodiment of the present application will be described in detail with reference to fig. 8. As shown in fig. 8, the graph partitioning method in the embodiment of the present application may specifically include the following processes: the preprocessing process, the iteration process, the cross-process message communication process, the multi-constraint load balancing mechanism and the node allocation result conversion process specifically comprise the following steps:
s801, randomly dividing a knowledge graph to be divided into a plurality of sub-graphs by adopting an edge division mode, wherein each sub-graph corresponds to one partition.
S802, determining the expansion direction of the neighbor edge of the knowledge graph as the incident direction according to the construction mode of the node characteristics in the downstream graph neural network task.
S803, for each partition, the calling process initializes the B set, the C set and the alloedge set of the corresponding partition to be null sets.
S804, judging whether the B set is an empty set. If yes, step S805 is executed. If not, step S806 is performed.
S805, randomly selecting a node from unassigned nodes in the subgraph, and adding the node to the B set.
S806, determining the node Vi with the smallest number of unassigned incident neighbor edges in the set B as the current expansion node, and adding the current expansion node Vi into the set C.
The more the number of unassigned sides corresponding to the process is, the higher the priority of locking the current expansion node is.
S807, adding the first-order incident neighbor edge of the current expansion node Vi to the AlloEdges set, and adding the node Ui which is not in the current partition on the first-order neighbor edge to the B set.
S808, if the second-order incident neighbor node Wi of the current expansion node Vi is judged to be in the corresponding partition, adding the second-order incident neighbor edges (Ui, wi) of the current expansion node Vi to the allocedge set, and updating the number of unassigned incident neighbor edges of each node in the B set.
The process where the incident node of the first-order neighbor edge or the second-order neighbor edge is located has higher priority of the locking edge.
S809, judging whether the number of edges in the allocEdges set reaches a preset first edge number threshold. If yes, the iteration operation based on neighbor expansion performed on the current partition is ended, and the iteration operation of all the partitions is waited to be ended. If not, return to step S804, and execute the next iteration.
And S810, distributing the core nodes in each partition to the partition.
S811, obtaining the number of the core nodes connected with the opposite-side neighbor nodes of the core node in different partitions, and distributing the opposite-side neighbor nodes to the partition with the largest number of the connected core nodes.
S812, constructing a load balancing paradigm based on node label balancing and training set balancing.
S813, according to the node division results of the steps S810 and S811, the load balancing amount of each partition is calculated.
S814, calculating the load balancing deviation value of each partition according to the load balancing amount and the load balancing normal form of each partition.
And S815, distributing the unassigned nodes according to the load balance deviation values of the partitions.
Fig. 9 is a schematic structural diagram of a device for performing tasks of the neural network according to an embodiment of the present application. As shown in fig. 9, the device 900 for performing a task on a neural network in the embodiment of the present application may specifically include: a first partitioning module 901, a determining module 902, a second partitioning module 903, and a converting module 904.
Wherein:
the first dividing module 901 is configured to divide an input knowledge graph to be divided into a plurality of sub-graphs randomly in an edge division manner, where each sub-graph corresponds to one partition.
The determining module 902 is configured to determine, according to a construction manner of a node feature in a downstream graph neural network task, an expansion direction of a neighboring edge of the knowledge graph, where the expansion direction includes any one of the following directions: an incident direction and an exit direction.
The second dividing module 903 is configured to input the plurality of sub-graphs into a plurality of sub-servers, where one sub-server corresponds to one sub-graph, and execute the following steps in parallel through the plurality of sub-servers: aiming at the subareas corresponding to the sub-servers, calling processes corresponding to the subareas based on the expansion directions of the neighbor edges, and performing iterative operation based on neighbor expansion on the subareas to obtain iterative expansion results corresponding to the subareas; and determining iterative expansion results corresponding to the partitions output by the sub-servers as edge division results of the knowledge graph.
The conversion module 904 is configured to convert the edge division result of the knowledge graph to a node division result of the knowledge graph, and execute the downstream graph neural network task based on the node division result.
In the embodiment of the present application, specific processes of implementing functions of each module and unit in the execution device of the graph neural network task in the embodiment of the present application may be referred to the related description in the embodiment of the execution method of the graph neural network task, which is not repeated herein.
In summary, the device for executing a graph neural network task in the embodiment of the present application adopts an edge division manner to randomly divide a knowledge graph to be divided into a plurality of sub-graphs, each sub-graph corresponds to a partition, and determines an expansion direction of a neighbor edge of the multi-knowledge graph according to a construction manner of node features in a downstream graph neural network task, where the expansion direction includes an incident direction and an exit direction, the plurality of sub-graphs are respectively input into a plurality of sub-servers, one sub-server corresponds to one sub-graph, and the following steps are executed in parallel by the plurality of sub-servers: aiming at the subareas corresponding to the sub-servers, calling a process corresponding to the subareas based on the expansion direction of the neighbor edges, performing iterative operation based on neighbor expansion on the subareas to obtain iterative expansion results corresponding to the subareas, determining the iterative expansion results corresponding to the subareas output by the plurality of sub-servers as edge division results of the knowledge graph, converting the edge division results of the knowledge graph to obtain node division results of the knowledge graph, and executing a downstream graph neural network task based on the node division results. According to the embodiment of the application, the expansion direction of the neighbor edge of the knowledge graph is determined according to the construction mode of the node characteristics in the downstream graph neural network task, namely, the expansion direction of the neighbor edge when the iteration operation based on neighbor expansion is carried out on each partition is determined, the problem of edge allocation and preemption in the subsequent neighbor expansion process is avoided, on one hand, the communication and waiting time of each process after edge preemption are omitted, the dividing efficiency is improved, the waiting time of downstream GNN task execution is reduced, on the other hand, the edge is preferentially allocated to the partition consistent with the node in the expansion direction, and because the expansion direction is determined according to the construction mode of the node characteristics in the downstream graph neural network task, the effect that the neighbor edge affecting the node characteristics is preferentially converged in one partition is achieved, the fact that the neighbor edges of more nodes are located in different partitions is avoided, and the communication consumption among processes in the downstream GNN task execution process is reduced.
Fig. 10 is a schematic structural diagram of a device for performing tasks on a neural network according to another embodiment of the present application. As shown in fig. 10, in the device 900 for executing a task of a neural network according to the embodiment of the present application based on the embodiment shown in fig. 9, the second dividing module 903 is further configured to:
the calling process initializes a first node set, a second node set and an allocated edge set of the corresponding partition to be an empty set; judging whether the first node set is an empty set or not; if the node is the empty set, randomly selecting one node from unassigned nodes in the subgraph, and adding the node into the first node set; if the node is not the empty set, determining the node with the minimum number of neighbor edges which are not distributed in the expansion direction in the first node set as the current expansion node, and adding the current expansion node into the second node set; adding the expansion direction first-order neighbor edges of the current expansion node into an allocated edge set, and adding the nodes, which are not in the corresponding partition, on the first-order neighbor edges into a first node set; if the expansion direction second-order neighbor node of the current expansion node is already in the corresponding partition, adding the expansion direction second-order neighbor edge of the current expansion node into the allocated edge set, and returning to the step of judging whether the first node set is an empty set.
In one possible implementation manner of the embodiment of the present application, the second dividing module 903 is further configured to: after adding the first-order neighbor edges of the expansion direction of the current expansion node to the allocated edge set, judging whether the number of edges in the allocated edge set reaches a preset first edge number threshold value or not; if yes, ending the iteration operation based on neighbor expansion of the partition; if not, executing the step of returning to judge whether the first node set is an empty set.
In one possible implementation manner of the embodiment of the present application, the second dividing module 903 is further configured to: when each process is called to determine the current expansion node, setting a first priority level when each process determines the current expansion node, wherein the first priority level is positively related to the number of unassigned edges corresponding to the process.
In one possible implementation manner of the embodiment of the present application, the second dividing module 903 is further configured to: when each process is called to add the first-order neighbor edge or the second-order neighbor edge to the allocated edge set, setting the second priority of the process where the expansion direction node of the first-order neighbor edge or the second-order neighbor edge is located, and setting the second priority of the process where the expansion direction node is not located higher than the second priority of the process where the expansion direction node is not located.
In one possible implementation of the embodiment of the present application, the conversion module 904 further includes: a first allocation unit 1001, a second allocation unit 1002, and a third allocation unit 1003. Wherein: the first allocation unit 1001 is configured to allocate, for each partition, core nodes in the partition to the partition, where the core nodes are nodes in the partition, and the number of edges taking the node as a node in an expansion direction is equal to or greater than a preset second edge number threshold. The second allocation unit 1002 is configured to obtain the number of core nodes connected to opposite edge neighboring nodes of the core nodes in different partitions, and allocate the opposite edge neighboring nodes to the partition with the largest number of connected core nodes. A third allocation unit 1003, configured to allocate unallocated nodes based on node label equalization and training set equalization.
In a possible implementation of the embodiment of the present application, the third allocation unit 1003 is further configured to: calculating average load balancing quantity according to the number of training nodes corresponding to each node label in the training set and the feature dimension number of each node label; calculating the load balancing amount of each partition according to the distribution result of the distributed nodes, the node labels corresponding to each training node in the training set and the characteristic dimension quantity of each node label; calculating the load balancing deviation value of each partition according to the load balancing quantity and the average load balancing quantity of each partition; and distributing the unassigned nodes according to the load balance deviation values of the partitions.
In a possible implementation of the embodiment of the present application, the third allocation unit 1003 is further configured to: sequencing each partition according to the number of neighbor edges of the unassigned node corresponding to each partition, wherein the number of neighbor edges corresponding to each partition is positively correlated with the sequencing position of each partition; judging whether unallocated nodes are allocated to the current partition or not in sequence according to the ordering positions of the partitions: and if the load balancing deviation value of the current partition is smaller than a preset load balancing deviation threshold value, distributing the unassigned node to the current partition.
In the embodiment of the present application, specific processes of implementing functions of each module and unit in the execution device of the graph neural network task in the embodiment of the present application may be referred to the related description in the embodiment of the execution method of the graph neural network task, which is not repeated herein.
In summary, the execution device of the graph neural network task in the embodiment of the application determines the expansion direction of the neighbor edges of the knowledge graph according to the construction mode of the node features in the downstream graph neural network task, namely determines the expansion direction of the neighbor edges when each partition is subjected to the iterative operation based on the neighbor expansion, so that the problem of edge allocation and preemption in the subsequent neighbor expansion process is avoided, on one hand, the communication and waiting time of each process after the edge preemption are omitted, the partition efficiency is improved, the waiting time of the downstream GNN task execution is reduced, on the other hand, the edges are preferentially allocated to the partition consistent with the node in the expansion direction, and because the expansion direction is determined according to the construction mode of the node features in the downstream graph neural network task, the situation that the neighbor edges affecting the node features are preferentially converged in one partition is realized, the situation that the neighbor edges of more nodes are located in different partitions is avoided, and the communication consumption among the processes in the downstream GNN task execution process is reduced. When each partition is subjected to iteration operation based on neighbor expansion, the first-order neighbor edge and the second-order neighbor edge of the current expansion node are synchronously considered in one round of iteration process, so that the iteration and expansion speed are increased, and the division efficiency is improved. In the process of locking the current expansion node by each process and the distribution of each process to the first-order neighbor edge and the second-order neighbor edge, the priority order of locking the current expansion node or the edge by each process can be determined based on the cross-process message communication, and each process is sequentially locked according to the order, so that the problem of single-point bottleneck caused by additionally arranging a coordinator process to control the distribution and the iterative expansion of the edge is avoided. After the edge dividing method based on neighbor expansion is executed, the advantages of the edge dividing method are reserved by defining the core node and the distribution results of the edge neighbor nodes in the node distribution result conversion process, meanwhile, in the distribution process of the rest nodes, multi-constraint load balancing (edge balancing, node label balancing and training set balancing) is realized by combining node label balancing and training set balancing, the load balancing of each partition is guaranteed, and the calculation efficiency of downstream GNN tasks is further improved. By defining the load balancing paradigm, node label balancing and training set balancing can be conveniently and rapidly realized.
The embodiment of the application also provides electronic equipment. As shown in fig. 11, the electronic device 1100 may have a relatively large difference between configurations or performances, and may include one or more processors 1101 and a memory 1102, where the memory 1102 may store one or more storage applications or data. Wherein the memory 1102 may be transient storage or persistent storage. The application programs stored in the memory 1102 may include one or more modules (not shown), each of which may include a series of computer-executable instructions for the electronic device 1100. Still further, the processor 1101 may be arranged to communicate with the memory 1102 and execute a series of computer executable instructions in the memory 1102 on the electronic device 1100. The electronic device 1100 may also include one or more power supplies 1103, one or more wired or wireless network interfaces 1104, one or more input output interfaces 1105, one or more keyboards 1106.
In particular, in this embodiment, an electronic device includes a memory, and one or more programs, where the one or more programs are stored in the memory, and the one or more programs may include one or more modules, and each module may include a series of computer-executable instructions for execution by one or more processors in the electronic device, the one or more programs including computer-executable instructions for:
Randomly dividing an input knowledge graph to be divided into a plurality of sub-graphs by adopting an edge division mode, wherein each sub-graph corresponds to one partition;
according to the construction mode of node characteristics in the downstream graph neural network task, determining the expansion direction of the neighbor edges of the knowledge graph, wherein the expansion direction comprises any one of the following directions: an incident direction and an exit direction;
the sub-graphs are respectively input into a plurality of sub-servers, one sub-server corresponds to one sub-graph, and the following steps are executed in parallel through the plurality of sub-servers: aiming at the subareas corresponding to the sub-servers, calling processes corresponding to the subareas based on the expansion directions of the neighbor edges, and performing iterative operation based on neighbor expansion on the subareas to obtain iterative expansion results corresponding to the subareas; determining iterative expansion results corresponding to a plurality of partitions output by a plurality of sub-servers as edge division results of the knowledge graph;
according to the edge division result of the knowledge graph, converting to obtain a node division result of the knowledge graph;
and executing the downstream graph neural network task based on the node division result.
According to the electronic equipment provided by the embodiment of the application, the expansion direction of the neighbor edges of the knowledge graph is determined according to the construction mode of the node characteristics in the downstream graph neural network task, namely, the expansion direction of the neighbor edges when the subsequent iteration operation based on neighbor expansion is carried out on each partition is determined, the problem of edge allocation and preemption in the subsequent neighbor expansion process is avoided, on one hand, the communication and waiting time of each process after edge preemption are omitted, the dividing efficiency is improved, the waiting time of downstream GNN task execution is reduced, on the other hand, the edges are preferentially allocated to the partition consistent with the node in the expansion direction, and because the expansion direction is determined according to the construction mode of the node characteristics in the downstream graph neural network task, the situation that the neighbor edges affecting the node characteristics are converged in one partition is preferentially realized, the situation that the neighbor edges of more nodes are located in different partitions is avoided, and the communication consumption among processes in the downstream GNN task execution process is reduced.
The embodiment of the application also provides a readable storage medium, on which one or more computer programs are stored, where the one or more computer programs include instructions, where the program or the instructions are executed by a processor in an electronic device including a plurality of application programs, enable the processor in the electronic device to execute each process of the embodiment of the execution method of the neural network task, and are specifically configured to execute:
randomly dividing an input knowledge graph to be divided into a plurality of sub-graphs by adopting an edge division mode, wherein each sub-graph corresponds to one partition;
according to the construction mode of node characteristics in the downstream graph neural network task, determining the expansion direction of the neighbor edges of the knowledge graph, wherein the expansion direction comprises any one of the following directions: an incident direction and an exit direction;
the sub-graphs are respectively input into a plurality of sub-servers, one sub-server corresponds to one sub-graph, and the following steps are executed in parallel through the plurality of sub-servers: aiming at the subareas corresponding to the sub-servers, calling processes corresponding to the subareas based on the expansion directions of the neighbor edges, and performing iterative operation based on neighbor expansion on the subareas to obtain iterative expansion results corresponding to the subareas; determining iterative expansion results corresponding to a plurality of partitions output by a plurality of sub-servers as edge division results of the knowledge graph;
According to the edge division result of the knowledge graph, converting to obtain a node division result of the knowledge graph;
and executing the downstream graph neural network task based on the node division result.
According to the readable storage medium, the expansion direction of the neighbor edges of the knowledge graph is determined according to the construction mode of the node characteristics in the downstream graph neural network task, namely, the expansion direction of the neighbor edges when the iterative operation based on neighbor expansion is carried out on each partition is determined, the problem of edge allocation and preemption in the subsequent neighbor expansion process is avoided, on one hand, the communication and waiting time of each process after edge preemption are omitted, the dividing efficiency is improved, the waiting time of downstream GNN task execution is reduced, on the other hand, the edges are preferentially allocated to the partition consistent with the node in the expansion direction, and because the expansion direction is determined according to the construction mode of the node characteristics in the downstream graph neural network task, the situation that the neighbor edges affecting the node characteristics are converged in one partition preferentially is realized, the situation that the neighbor edges of more nodes are located in different partitions is avoided, and the communication consumption among processes in the downstream GNN task execution process is reduced.
The system, apparatus, module or unit set forth in the above embodiments may be implemented in particular by a computer chip or entity, or by a product having a certain function. One typical implementation is a computer. In particular, the computer may be, for example, a personal computer, a laptop computer, a cellular telephone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
For convenience of description, the above devices are described as being functionally divided into various units, respectively. Of course, the functions of each element may be implemented in one or more software and/or hardware elements when implemented in the present application.
It will be appreciated by those skilled in the art that embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In one typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include volatile memory in a computer-readable medium, random Access Memory (RAM) and/or nonvolatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of computer-readable media.
Computer readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of storage media for a computer include, but are not limited to, phase change memory (PRAM), static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium, which can be used to store information that can be accessed by a computing device. Computer-readable media, as defined herein, does not include transitory computer-readable media (transmission media), such as modulated data signals and carrier waves.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article or apparatus that comprises an element.
The application may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The application may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
In this specification, each embodiment is described in a progressive manner, and identical and similar parts of each embodiment are all referred to each other, and each embodiment mainly describes differences from other embodiments. In particular, for system embodiments, since they are substantially similar to method embodiments, the description is relatively simple, as relevant to see a section of the description of method embodiments.
The foregoing is merely exemplary of the present application and is not intended to limit the present application. Various modifications and changes may be made to the present application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc. which are within the spirit and principles of the present application are intended to be included within the scope of the claims of the present application.
Claims (11)
1. The method for executing the task of the graph neural network is characterized by comprising the following steps of:
randomly dividing an input knowledge graph to be divided into a plurality of sub-graphs by adopting an edge division mode, wherein each sub-graph corresponds to one partition;
determining the expansion direction of the neighbor edge of the knowledge graph according to the construction mode of the node characteristics in the downstream graph neural network task, wherein the expansion direction comprises any one of the following directions: an incident direction and an exit direction;
inputting the sub-graphs into a plurality of sub-servers respectively, wherein one sub-server corresponds to one sub-graph, and executing the following steps in parallel through the plurality of sub-servers: aiming at the subareas corresponding to the sub-servers, calling processes corresponding to the subareas based on the expansion directions of the neighbor edges, and performing iterative operation based on neighbor expansion on the subareas to obtain iterative expansion results corresponding to the subareas; determining iterative expansion results corresponding to a plurality of partitions output by the plurality of sub-servers as edge division results of the knowledge graph;
according to the edge division result of the knowledge graph, converting to obtain a node division result of the knowledge graph;
And executing the downstream graph neural network task based on the node division result.
2. The method of claim 1, wherein the calling the process corresponding to the partition based on the expansion direction of the neighbor edge performs an iterative operation based on neighbor expansion on the partition to obtain an iterative expansion result corresponding to the partition, and the method comprises:
invoking the process to initialize a first node set, a second node set and an allocated edge set of a corresponding partition to be an empty set;
judging whether the first node set is an empty set or not;
if the node is the empty set, randomly selecting one node from unassigned nodes in the subgraph, and adding the node into the first node set;
if the node is not an empty set, determining the node with the minimum number of the neighbor edges which are not distributed in the expansion direction in the first node set as a current expansion node, and adding the current expansion node into the second node set;
adding the expansion direction first-order neighbor edge of the current expansion node to the allocated edge set, and adding nodes, which are not in the corresponding partition, on the first-order neighbor edge to the first node set;
And if the expansion direction second-order neighbor node of the current expansion node is already in the corresponding partition, adding the expansion direction second-order neighbor edge of the current expansion node into the allocated edge set, and returning to the step of judging whether the first node set is an empty set.
3. The method of claim 2, wherein the adding the expansion-direction first-order neighbor edge of the current expansion node to the set of allocated edges, further comprises:
judging whether the number of edges in the assigned edge set reaches a preset first edge number threshold value or not;
if yes, ending the iteration operation based on neighbor expansion and carried out on the partition;
if not, executing the step of returning to the step of judging whether the first node set is an empty set.
4. The method as recited in claim 2, further comprising:
and when each process determines the current expansion node, setting a level of a first priority when each process determines the current expansion node, wherein the level of the first priority is positively related to the number of unassigned edges corresponding to the process.
5. The method as recited in claim 2, further comprising:
And when each process adds the first-order neighbor edge or the second-order neighbor edge to the allocated edge set, setting a second priority of the process where the expansion direction node of the first-order neighbor edge or the second-order neighbor edge is located, and setting the second priority of the process higher than the second priority of the process where the expansion direction node is not located.
6. The method according to claim 1, wherein the converting the node division result of the knowledge-graph according to the edge division result of the knowledge-graph includes:
for each partition, distributing core nodes in the partition to the partition, wherein the core nodes are nodes with the number of edges taking the nodes as the expansion direction nodes in the partition equal to or larger than a preset second edge number threshold;
acquiring the number of the core nodes connected with opposite edge neighbor nodes of the core nodes in different partitions, and distributing the opposite edge neighbor nodes to the partition with the largest number connected with the core nodes;
and distributing the unassigned nodes based on node label equalization and training set equalization.
7. The method of claim 6, wherein assigning unassigned nodes based on node label equalization and training set equalization comprises:
Calculating average load balancing quantity according to the number of training nodes corresponding to each node label in the training set and the feature dimension number of each node label;
calculating the load balancing amount of each partition according to the distribution result of the distributed nodes, the node labels corresponding to each training node in the training set and the feature dimension quantity of each node label;
calculating the load balancing deviation value of each partition according to the load balancing quantity of each partition and the average load balancing quantity;
and distributing the unassigned nodes according to the load balancing deviation values of the partitions.
8. The method of claim 7, wherein assigning unassigned nodes according to the load balancing bias values of the partitions comprises:
sequencing each partition according to the number of neighbor edges of the unassigned node corresponding to each partition, wherein the number of neighbor edges corresponding to each partition is positively correlated with the sequencing position of each partition;
judging whether unallocated nodes are allocated to the current partition or not according to the ordering positions of the partitions in sequence: and if the load balancing deviation value of the current partition is smaller than a preset load balancing deviation threshold value, distributing the unassigned node to the current partition.
9. An apparatus for performing a task on a graph neural network, comprising:
the first dividing module is used for randomly dividing the input knowledge graph to be divided into a plurality of sub-graphs in an edge dividing mode, and each sub-graph corresponds to one partition;
the determining module is used for determining the expansion direction of the neighbor edge of the knowledge graph according to the construction mode of the node characteristics in the downstream graph neural network task, wherein the expansion direction comprises any one of the following directions: an incident direction and an exit direction;
the second dividing module is used for inputting the sub-graphs into a plurality of sub-servers respectively, one sub-server corresponds to one sub-graph, and the following steps are executed in parallel through the plurality of sub-servers: aiming at the subareas corresponding to the sub-servers, calling processes corresponding to the subareas based on the expansion directions of the neighbor edges, and performing iterative operation based on neighbor expansion on the subareas to obtain iterative expansion results corresponding to the subareas; determining iterative expansion results corresponding to a plurality of partitions output by the plurality of sub-servers as edge division results of the knowledge graph;
and the conversion module is used for converting the edge division result of the knowledge graph to obtain a node division result of the knowledge graph, and executing the downstream graph neural network task based on the node division result.
10. An electronic device comprising a processor, a memory and a program or instruction stored on the memory and executable on the processor, which program or instruction when executed by the processor implements the steps of the method of any of claims 1-8.
11. A readable storage medium, characterized in that it stores thereon a program or instructions, which when executed by a processor, implement the steps of the method according to any of claims 1-8.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311845287.3A CN117807246A (en) | 2023-12-28 | 2023-12-28 | Method and device for executing graph neural network task, electronic equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311845287.3A CN117807246A (en) | 2023-12-28 | 2023-12-28 | Method and device for executing graph neural network task, electronic equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN117807246A true CN117807246A (en) | 2024-04-02 |
Family
ID=90425036
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202311845287.3A Pending CN117807246A (en) | 2023-12-28 | 2023-12-28 | Method and device for executing graph neural network task, electronic equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN117807246A (en) |
-
2023
- 2023-12-28 CN CN202311845287.3A patent/CN117807246A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Xia et al. | Cost-effective app data distribution in edge computing | |
Brogi et al. | How to place your apps in the fog: State of the art and open challenges | |
Li et al. | READ: Robustness-oriented edge application deployment in edge computing environment | |
Leivadeas et al. | Efficient resource mapping framework over networked clouds via iterated local search-based request partitioning | |
WO2018176385A1 (en) | System and method for network slicing for service-oriented networks | |
WO2022171066A1 (en) | Task allocation method and apparatus based on internet-of-things device, and network training method and apparatus | |
Gao et al. | A truthful auction for graph job allocation in vehicular cloud-assisted networks | |
US20200052885A1 (en) | File storage method and apparatus for blockchain network | |
CN113037800B (en) | Job scheduling method and job scheduling device | |
Zhao et al. | Joint coverage-reliability for budgeted edge application deployment in mobile edge computing environment | |
CN117041330A (en) | Edge micro-service fine granularity deployment method and system based on reinforcement learning | |
Nguyen et al. | Rethinking virtual link mapping in network virtualization | |
Liu et al. | On spectrum allocation in cognitive radio networks: a double auction-based methodology | |
Henna et al. | Distributed and collaborative high-speed inference deep learning for mobile edge with topological dependencies | |
Cao et al. | Mapping strategy for virtual networks in one stage | |
Dimolitsas et al. | Time-efficient distributed virtual network embedding for round-trip delay minimization | |
CN115495056B (en) | Distributed graph computing system and method | |
US11410023B2 (en) | Lexicographic deep reinforcement learning using state constraints and conditional policies | |
CN113992520B (en) | Virtual network resource deployment method and system | |
CN117807246A (en) | Method and device for executing graph neural network task, electronic equipment and storage medium | |
Lin et al. | Scheduling algorithms for time-constrained big-file transfers in the Internet of Vehicles | |
Anwar et al. | Recommender system for optimal distributed deep learning in cloud datacenters | |
CN115002215A (en) | Cloud-based government and enterprise-oriented resource allocation model training method and resource allocation method | |
CN110234167B (en) | Channel allocation method, channel allocation device and electronic equipment | |
Bakhshi et al. | Model-based reinforcement learning framework of online network resource allocation |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |