Computational task allocation method, device, computer equipment and storage medium

The calculation task allocation of the DNN model is adjusted by the key relationship gain of the calculation task, which solves the problem of communication delay between devices in the existing technology, achieves faster completion of calculation tasks, and meets the needs of real-time applications.

CN114706687BActive Publication Date: 2024-09-24HUNAN UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210426012.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-22
Publication Date
2024-09-24
Estimated Expiration
2042-04-22

AI Technical Summary

Technical Problem

Existing multi-level partitioning algorithms fail to effectively consider key flow relationships when allocating DNN model calculation tasks, resulting in communication delays between devices and failing to meet real-time application requirements.

Method used

Calculate the key relationship gain of the subtask by calculating each boundary, adjust the task division to reduce the key relationship between devices, use the first gain and the second gain to determine the degree of correlation of the task, and adjust the task distribution according to the difference to ensure the key relationship The smallest computational graph is assigned to the corresponding device.

Benefits of technology

It effectively reduces the key relationships between calculation graphs, reduces communication delays, and meets the computing task completion requirements of real-time applications.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114706687B
    Figure CN114706687B
Patent Text Reader

Abstract

The present application relates to a method, device, computer equipment and storage medium for allocating computing tasks. The method includes: obtaining a first number of computing graphs corresponding to the computing task and the flow relationship between each computing subtask; calculating the key relationship gain of each boundary computing subtask, the key relationship gain including a first gain and a second gain; adjusting the boundary computing subtask to other computing graphs according to the first gain and the second gain of each boundary computing subtask, and obtaining a new first number of computing graphs; if there is a new boundary computing subtask in the new first number of computing graphs, returning to the step of determining the key relationship gain of each boundary computing subtask, until there is no new boundary computing subtask in the new first number of computing graphs, and allocating the first number of computing graphs with the smallest number of key relationships between the first number of computing graphs each time to the corresponding computing device. The use of this method can meet the requirements of real-time applications and reduce communication delays.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a method, apparatus, computer device and storage medium for allocating computing tasks. Background Art

[0002] At present, neural networks have shown extraordinary performance in many fields, such as image recognition, natural language processing, recommendation systems, etc. The accompanying problem is that the structure of DNN models is becoming more and more complex and the computational requirements for training are becoming higher and higher. In order to solve the training problem of complex DNN models. Usually, multiple computing tasks in the DNN model are divided into multiple devices, and multiple devices calculate their assigned computing tasks respectively, thereby reducing the computing requirements. The multiple computing tasks in the DNN model can form a directed graph (a directed graph is formed according to the calculation order of each computing task).

[0003] In the prior art, the main method for dividing multiple computing tasks is a multi-level division algorithm, which is mainly based on the criticality of the flow relationship between the multiple computing tasks. That is, multiple computing tasks with critical flow relationships are divided into the same device as much as possible, and multiple computing tasks with uncritical flow relationships are divided into different devices.

[0004] However, the current multi-level partitioning algorithm method, because it has to consider the load balancing of multiple devices at the same time, will inevitably divide multiple computing tasks with key flow relationships to different devices. The current multi-level partitioning algorithm method does not consider the division of key relationships to different devices, resulting in communication delays between multiple devices, which makes it impossible to meet the requirements of real-time applications. Summary of the invention

[0005] Based on this, it is necessary to provide a method, device, computer equipment and storage medium for allocating computing tasks that can meet the requirements of real-time applications in order to address the above technical problems.

[0006] In a first aspect, the present application provides a method for allocating computing tasks. The method comprises:

[0007] Obtaining a first number of computation graphs corresponding to the computation task and a flow relationship between computation subtasks in the computation task, each of the computation graphs including at least one computation subtask;

[0008] Calculate a key relationship gain for each boundary calculation subtask, where the key relationship gain includes a first gain and a second gain, wherein the first gain is obtained according to a key relationship between the boundary calculation subtask and the boundary calculation subtask in a calculation graph to which the boundary calculation subtask belongs, and the second gain is obtained according to key relationships between the boundary calculation subtask and other calculation graphs respectively;

[0009] According to the first gain and the second gain of each boundary calculation subtask, the boundary calculation subtask is adjusted to other calculation graphs to obtain a new first number of calculation graphs;

[0010] If there are new boundary calculation subtasks in the new first number of calculation graphs, return to the step of determining the key relationship gain of each boundary calculation subtask until the new first number of calculation graphs obtained do not contain new boundary calculation subtasks, and allocate the first number of calculation graphs with the smallest number of key relationships between the first number of calculation graphs obtained each time to the corresponding first number of computing devices.

[0011] In one embodiment, the calculating of the key relationship gain of each boundary calculation subtask, wherein the key relationship gain includes a first gain and a second gain, comprises:

[0012] The first gain is obtained by counting the number of computing subtasks that have a critical relationship with the boundary computing subtask in the computing graph to which the boundary computing subtask belongs; and the number of computing subtasks that have a critical relationship between the boundary computing subtask and other computing graphs are respectively counted to obtain the second gain of the boundary computing subtask relative to other computing graphs.

[0013] In a second aspect, the present application also provides a computing task allocation device. The device comprises:

[0014] A first acquisition module, used to acquire a first number of computation graphs corresponding to the computation task and a flow relationship between computation subtasks in the computation task, each of the computation graphs including at least one computation subtask;

[0015] A first calculation module is used to determine a key relationship gain of each boundary calculation subtask, wherein the key relationship gain includes a first gain and a second gain, wherein the first gain is obtained according to a key relationship between the boundary calculation subtask and the boundary calculation subtask in a calculation graph to which the boundary calculation subtask belongs, and the second gain is obtained according to key relationships between the boundary calculation subtask and other calculation graphs respectively;

[0016] An adjustment module, configured to adjust the boundary calculation subtasks to other calculation graphs according to the first gain and the second gain of each boundary calculation subtask, so as to obtain a new first number of calculation graphs;

[0017] An allocation module is used to return to the step of determining the key relationship gain of each boundary calculation subtask if there are new boundary calculation subtasks in the new first number of calculation graphs, until the new first number of calculation graphs obtained do not have new boundary calculation subtasks, and allocate the first number of calculation graphs with the smallest number of key relationships between the first number of calculation graphs obtained each time to the corresponding first number of computing devices.

[0018] In a third aspect, the present application further provides a computer device. The computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the following steps when executing the computer program:

[0019] Obtaining a first number of computation graphs corresponding to the computation task and a flow relationship between computation subtasks in the computation task, each of the computation graphs including at least one computation subtask;

[0020] Calculate a key relationship gain for each boundary calculation subtask, where the key relationship gain includes a first gain and a second gain, wherein the first gain is obtained according to a key relationship between the boundary calculation subtask and the boundary calculation subtask in a calculation graph to which the boundary calculation subtask belongs, and the second gain is obtained according to key relationships between the boundary calculation subtask and other calculation graphs respectively;

[0021] According to the first gain and the second gain of each boundary calculation subtask, the boundary calculation subtask is adjusted to other calculation graphs to obtain a new first number of calculation graphs;

[0022] If there are new boundary calculation subtasks in the new first number of calculation graphs, return to the step of determining the key relationship gain of each boundary calculation subtask until the new first number of calculation graphs obtained do not contain new boundary calculation subtasks, and allocate the first number of calculation graphs with the smallest number of key relationships between the first number of calculation graphs obtained each time to the corresponding first number of computing devices.

[0023] In a fourth aspect, the present application further provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the following steps are implemented:

[0024] Obtaining a first number of computation graphs corresponding to the computation task and a flow relationship between computation subtasks in the computation task, each of the computation graphs including at least one computation subtask;

[0025] Calculate a key relationship gain for each boundary calculation subtask, where the key relationship gain includes a first gain and a second gain, wherein the first gain is obtained according to a key relationship between the boundary calculation subtask and the boundary calculation subtask in a calculation graph to which the boundary calculation subtask belongs, and the second gain is obtained according to key relationships between the boundary calculation subtask and other calculation graphs respectively;

[0026] According to the first gain and the second gain of each boundary calculation subtask, the boundary calculation subtask is adjusted to other calculation graphs to obtain a new first number of calculation graphs;

[0027] If there are new boundary calculation subtasks in the new first number of calculation graphs, return to the step of determining the key relationship gain of each boundary calculation subtask until the new first number of calculation graphs obtained do not contain new boundary calculation subtasks, and allocate the first number of calculation graphs with the smallest number of key relationships between the first number of calculation graphs obtained each time to the corresponding first number of computing devices.

[0028] In a fifth aspect, the present application further provides a computer program product. The computer program product includes a computer program, and when the computer program is executed by a processor, the following steps are implemented:

[0029] Obtaining a first number of computation graphs corresponding to the computation task and a flow relationship between computation subtasks in the computation task, each of the computation graphs including at least one computation subtask;

[0030] Calculate a key relationship gain for each boundary calculation subtask, where the key relationship gain includes a first gain and a second gain, wherein the first gain is obtained according to a key relationship between the boundary calculation subtask and the boundary calculation subtask in a calculation graph to which the boundary calculation subtask belongs, and the second gain is obtained according to key relationships between the boundary calculation subtask and other calculation graphs respectively;

[0031] According to the first gain and the second gain of each boundary calculation subtask, the boundary calculation subtask is adjusted to other calculation graphs to obtain a new first number of calculation graphs;

[0032] If there are new boundary calculation subtasks in the new first number of calculation graphs, return to the step of determining the key relationship gain of each boundary calculation subtask until the new first number of calculation graphs obtained do not contain new boundary calculation subtasks, and allocate the first number of calculation graphs with the smallest number of key relationships between the first number of calculation graphs obtained each time to the corresponding first number of computing devices.

[0033] The above-mentioned method, device, computer equipment and storage medium for allocating computing tasks are as follows: by obtaining a first number of computing graphs corresponding to the computing task and the flow relationship between each computing subtask in the computing task, each of the computing graphs includes at least one computing subtask; calculating the key relationship gain of each boundary computing subtask, the key relationship gain including a first gain and a second gain, wherein the first gain is obtained according to the key relationship between the boundary computing subtask and the boundary computing subtask in the computing graph to which the boundary computing subtask belongs, and the second gain is obtained according to the key relationship between the boundary computing subtask and other computing graphs respectively; adjusting the boundary computing subtask to other computing graphs according to the first gain and the second gain of each boundary computing subtask to obtain a new first number of computing graphs; if there is a new boundary computing subtask in the new first number of computing graphs, returning to the step of determining the key relationship gain of each boundary computing subtask until there is no new boundary computing subtask in the new first number of computing graphs, and allocating the first number of computing graphs with the smallest number of key relationships between the first number of computing graphs obtained each time to the corresponding first number of computing devices. Through the above method, the present application can obtain multiple calculation graphs that are preliminarily divided, and then determine the key relationship gain of each boundary calculation subtask according to the boundary calculation subtasks in each calculation graph. The key relationship gain includes a first gain and a second gain. The first gain is obtained by the calculation graph to which the boundary calculation subtask belongs, and the second gain is obtained by the boundary calculation subtask and other calculation graphs respectively. The degree of association between the boundary calculation subtask and the calculation graph and other calculation graphs can be determined from the first gain and the second gain. Therefore, according to the first gain and the second gain, it can be determined to adjust the boundary calculation subtask to other calculation graphs, thereby obtaining the adjusted first number of calculation graphs. If no new boundary calculation subtasks are generated in the new first number of calculation graphs, the number of key relationships between the calculation graphs in the new first number of calculation graphs and the number of key relationships between the calculation graphs in the first number of calculation graphs of the original calculation graph are determined, and the first number of calculation graphs with the smallest number of key relationships are selected and assigned to the corresponding first number of calculation devices. In this way, the present application can consider the key relationship between the boundary calculation subtasks on the basis of the original calculation graph, and can reduce the key relationship between the calculation graphs, that is, reduce the communication delay between the calculation graphs, so as to speed up the completion of the calculation task and meet the requirements of real-time applications. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] Figure 1 An application environment diagram of a method for allocating computing tasks in one embodiment;

[0035] Figure 2 A schematic diagram of a flow chart of a method for allocating computing tasks in one embodiment;

[0036] Figure 3A schematic diagram of the partitioning result of the original calculation graph obtained in one embodiment;

[0037] Figure 4 A schematic diagram of a partitioning result of a computation graph in one embodiment;

[0038] Figure 5 A schematic diagram of the partitioning result of a computation graph in another embodiment;

[0039] Figure 6 is a structural block diagram of a computing task allocation device in one embodiment;

[0040] Figure 7 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0041] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0042] The computing task allocation method provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown in FIG. 1 , the terminals 10 communicate with the servers 20 through the network. The number of terminals 10 is Figure 1 There are only 2 in the figure. In the specific implementation, the number can be set according to the actual situation and is not limited here. The terminals 10 can communicate with each other to jointly complete the computing tasks.

[0043] The server 20 is used as a distribution terminal for computing tasks, that is, the server 20 can divide the computing tasks into multiple computing graphs, each of which includes at least one computing subtask, and then distribute them to multiple terminals 10, and the multiple terminals 10 execute the computing subtasks in the corresponding computing graphs. Of course, the server 20 that divides the computing tasks into multiple computing graphs can also be used as one of the devices for executing computing tasks, that is, Figure 1 The server 20 can divide the computing task into two computing graphs, and then assign the two computing graphs to two terminals 10, and the two terminals execute the computing subtasks in the corresponding computing graphs to jointly complete the computing task; the server 20 can also divide the computing task into three computing graphs, and then assign the three computing graphs to the server 20 and the two terminals, and the server 20 and the two terminals 10 respectively execute the computing subtasks in the computing graphs to jointly complete the computing task. It can be understood that the present application can also be applied to an application environment composed of multiple servers, that is, each server is used as a device for executing computing tasks, or one of the multiple servers is used as a distribution terminal for distributing tasks, and the other servers are used as terminals for executing computing tasks.

[0044] The terminal 10 may be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, IoT devices, and portable wearable devices. IoT devices may be smart speakers, smart TVs, smart air conditioners, smart car-mounted devices, etc. Portable wearable devices may be smart watches, smart bracelets, head-mounted devices, etc. The server 20 may be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, etc.

[0045] In one embodiment, Figure 2 As shown, a method for allocating computing tasks is provided, comprising the following steps:

[0046] Step 200, obtaining a first number of computing graphs corresponding to the computing task and a flow relationship between computing subtasks in the computing task, each of the computing graphs including at least one computing subtask.

[0047] For the convenience of explanation, in this embodiment, the Figure 1 The server shown is used as an example for explanation. In this embodiment, the server also serves as one of the devices for executing the computing subtask and completes the computing task together with other terminals.

[0048] The server can obtain a first number of computation graphs corresponding to the computation task to be assigned and a flow relationship between the computation subtasks in the computation task, wherein the first number is the number of devices that jointly complete the computation. For example, in this embodiment, Figure 1 Taking the server shown as an example, the first number is 3, that is, in this embodiment, the computing devices that are jointly completed are a server and two terminals.

[0049] The computing tasks to be allocated may be the first number of computing graphs divided by the prior art. It can be understood by those skilled in the art that each computing graph includes at least one computing subtask, and the resources required by each computing graph need to satisfy the load balancing of the corresponding computing device.

[0050] Exemplarily, the first number of computation graphs obtained by the server and the flow relationship between the computation subtasks in the computation task can be as follows: Figure 3As shown, the server obtains three computational graphs. For the convenience of explanation, each computational graph is named A, B, and C. The computational task includes 14 computational subtasks, which are numbered 1-14. There will be a corresponding flow relationship between each computational subtask. A line is used to represent the flow relationship between any two computational subtasks in the figure. The lines include solid lines and dotted lines. The solid line indicates that the two computational subtasks are in a critical relationship, and the dotted line indicates that the two computational subtasks are in a non-critical relationship. The direction of the arrow of each line indicates the flow direction. Computational graph A includes computational subtasks numbered 2, 3, 4, and 7, computational graph B includes computational subtasks numbered 6, 8, 9, and 11, and computational graph C includes computational subtasks numbered 1, 5, 10, 12, 13, and 14. There is a critical relationship between computational subtask 1 and computational subtask 3, and there is a non-critical relationship between computational subtask 3 and computational subtask 9.

[0051] Step 210, calculate the key relationship gain of each boundary calculation subtask, the key relationship gain includes a first gain and a second gain, wherein the first gain is obtained according to the key relationship between the boundary calculation subtask and the calculation graph to which the boundary calculation subtask belongs, and the second gain is obtained according to the key relationship between the boundary calculation subtask and other calculation graphs.

[0052] Among them, the boundary computing subtask refers to the computing subtask in each computing graph that has a flow relationship with other computing graphs. For example, Figure 3 As shown, the boundary calculation subtasks in calculation graph A are calculation subtasks numbered 2, 3, and 7, the boundary calculation subtasks in calculation graph B are calculation subtasks numbered 6 and 9, and the boundary calculation subtasks in calculation graph C are calculation subtasks numbered 1 and 10.

[0053] In this embodiment, the key relationship gain of each boundary calculation subtask is first calculated. The key relationship gain of each boundary calculation subtask includes a first gain and a second gain, wherein the first gain is obtained according to the key relationship between the boundary calculation subtask and the boundary calculation subtask in the calculation graph to which the boundary calculation subtask belongs, and the second gain is obtained according to the key relationship between the boundary calculation subtask and other calculation graphs, that is, a key relationship gain (first gain) of the calculation graph to which each boundary calculation subtask belongs, and one or more key relationship gains (second gain) of each boundary calculation subtask relative to other calculation graphs are calculated. For example, Figure 3As shown, for the boundary calculation subtask 1, the calculation graph to which the boundary calculation subtask 1 belongs is the calculation graph C. Therefore, the first gain of the boundary calculation subtask 1 is obtained according to the key relationship between the boundary calculation subtask 1 in the calculation graph C (the key relationship between the boundary calculation subtask 1 in the calculation graph C is 0 key relationship), and the second gain of the boundary calculation subtask 1 relative to the calculation graph A is obtained by the key relationship between the boundary calculation subtask 1 and the calculation graph A (the key relationship between the boundary calculation subtask 1 and the calculation graph A includes the key relationship between the boundary calculation subtask 1 and the calculation subtask 2 and the calculation subtask 3, respectively); the second gain of the boundary calculation subtask 1 relative to the calculation graph B is obtained by the key relationship between the boundary calculation subtask 1 and the calculation graph B (the key relationship between the boundary calculation subtask 1 in the calculation graph B is 0 key relationship).

[0054] As an embodiment, the calculating of the key relationship gain of each boundary calculation subtask, wherein the key relationship gain includes a first gain and a second gain, includes:

[0055] The first gain is obtained by counting the number of computing subtasks that have a critical relationship with the boundary computing subtask in the computing graph to which the boundary computing subtask belongs; and the number of computing subtasks that have a critical relationship between the boundary computing subtask and other computing graphs are respectively counted to obtain the second gain of the boundary computing subtask relative to other computing graphs.

[0056] Specifically, as an embodiment, the server calculates the first gain and the second gain of the boundary calculation subtask by counting the number of calculation subtasks in the calculation graph to which the boundary calculation subtask belongs that have a key relationship with the boundary calculation subtask to obtain the first gain; and counting the number of calculation subtasks in the calculation graph to which the boundary calculation subtask belongs that have a key relationship with other calculation graphs to obtain the second gain of the boundary calculation subtask relative to other calculation graphs. For example, Figure 3 As shown, when the server calculates the first gain and the second gain of the boundary calculation subtask 1, the first gain of the boundary calculation subtask 1 is 0 (the critical relationship between the boundary calculation subtask 1 and the calculation graph C to which the boundary calculation subtask 1 belongs is 0), and the second gain between the boundary calculation subtask 1 and the calculation graph A is 2 (the critical relationship between the boundary calculation subtask 1 and the calculation graph A includes the critical relationship between the boundary calculation subtask 1 and the calculation subtask 2 and the calculation subtask 3, respectively, so the statistical result is 2); the second gain between the boundary calculation subtask 1 and the calculation graph B is 0 (the critical relationship between the boundary calculation subtask 1 and the calculation graph B is 0). By analogy, the first gain and the second gain of each boundary calculation subtask can be calculated.

[0057] As another embodiment, the calculating of the key relationship gain of each boundary calculation subtask, wherein the key relationship gain includes a first gain and a second gain, includes:

[0058] Assigning a first value to a key relationship in a flow relationship of the boundary calculation subtask;

[0059] The first gain is obtained by calculating according to the key relationship between the boundary calculation subtask and the calculation graph to which the boundary calculation subtask belongs, and the first value; and the second gain is obtained by calculating according to the key relationship between the boundary calculation subtask and other calculation graphs, respectively, and the first value.

[0060] As another embodiment, when it is necessary to calculate the boundary calculation subtask, only the key relationship in the flow relationship of the boundary calculation subtask is assigned the first value. Of course, to facilitate subsequent calculations, all key relationships in the flow relationship can also be assigned the first value respectively, such as Figure 3 As shown, illustratively, the first value is assigned between calculation subtasks 2 and 4, and the first value is assigned between calculation subtasks 1 and 2. The first value can be 1 or any other natural number as long as it is convenient for subsequent calculations.

[0061] Then the first gain and the second gain of each boundary calculation subtask are calculated.

[0062] like Figure 3 As shown, taking the first value of 1 as an example, when the server calculates the first gain and the second gain of the boundary calculation subtask 1, the first gain of the boundary calculation subtask 1 is 0 (the critical relationship between the boundary calculation subtask 1 and the calculation graph C to which the boundary calculation subtask 1 belongs is 0, so the calculation result is 0), and the second gain between the boundary calculation subtask 1 and the calculation graph A is 2 (the critical relationship between the boundary calculation subtask 1 and the calculation graph A includes the critical relationship between the boundary calculation subtask 1 and the calculation subtask 2 and the calculation subtask 3, respectively, so the calculation result is 2); the second gain between the boundary calculation subtask 1 and the calculation graph B is 0 (the critical relationship between the boundary calculation subtask 1 and the calculation graph B is 0, so the calculation result is 0). The first gain and the second gain of other boundary calculation subtasks are calculated in the same way.

[0063] Step 220: adjust the boundary calculation subtasks to other calculation graphs according to the first gain and the second gain of each boundary calculation subtask to obtain a new first number of calculation graphs.

[0064] According to step 210, the first gain and the second gain of all boundary calculation subtasks in the three calculation graphs can be obtained. For example, Figure 3All boundary computing subtasks in the three computing graphs include computing subtasks 1, 2, 3, 6, 7, 9, and 10. Each boundary computing subtask has a key relationship gain relative to the three computing graphs.

[0065] Specifically, adjusting the boundary calculation subtask to other calculation graphs according to the first gain and the second gain of each boundary calculation subtask to obtain a new first number of calculation graphs includes:

[0066] Calculating a difference between the second gain and the first gain of each of the boundary calculation subtasks;

[0067] The boundary calculation subtasks whose difference is greater than a preset threshold are allocated to the calculation graph corresponding to the second gain to obtain a first number of calculation graphs after re-division.

[0068] As an embodiment, in this embodiment, according to the first gain and the second gain of each boundary calculation subtask, the boundary calculation subtask is adjusted to other calculation graphs, and the process of obtaining a new first number of calculation graphs may include: first calculating the difference between the second gain and the first gain of each boundary calculation subtask, and determining the boundary calculation subtask whose difference is greater than a preset threshold. For example, Figure 3 As shown, the difference between the first gain and the second gain of each boundary calculation subtask is calculated by subtracting the first gain from the second gain. The difference between the first gain and the second gain (relative to calculation graph B) of the boundary calculation subtask 3 in calculation graph A is 1, and the difference between the first gain and the second gain (relative to calculation graph C) of the boundary calculation subtask 3 in calculation graph A is -1; the difference between the first gain and the second gain (relative to calculation graph B) of the boundary calculation subtask 2 in calculation graph A is 0. Since there is no flow relationship between the boundary calculation subtask 2 and the calculation graph C in calculation graph A, there is no need to calculate the difference between the first gain and the second gain of the boundary calculation subtask 2 relative to the calculation graph C. In a specific implementation, since there is no flow relationship between the boundary calculation subtask 2 and the calculation graph C in calculation graph A, the difference between the first gain and the second gain of the boundary calculation subtask 2 relative to the calculation graph C is -1. In this embodiment, the preset threshold is 0. In a specific implementation, the preset threshold can be set according to actual conditions, for example, set to 1.

[0069] The boundary calculation subtasks whose difference between calculation graph A and calculation graph C is greater than 0 include boundary calculation subtask 3;

[0070] The boundary calculation subtasks for which the difference between the calculation graph A and the calculation graph B is greater than 0 include the boundary calculation subtask 3;

[0071] The boundary calculation subtasks whose difference value of calculation graph C is greater than 0 relative to calculation graph A include boundary calculation subtask 1;

[0072] There is no boundary computing subtask whose difference between computing graph C and computing graph B is greater than 0;

[0073] There is no boundary computing subtask whose difference between computing graph B and computing graph A is greater than 0;

[0074] There is no boundary computing subtask whose difference between computing graph B and computing graph C is greater than 0;

[0075] Therefore, the boundary calculation subtasks that can be moved are boundary calculation subtasks 1 and 3. Further, according to the above calculation process, it can be determined that boundary calculation subtask 1 can be moved from calculation graph C to calculation graph A, and boundary calculation subtask 3 can be moved from calculation graph A to calculation graph B. That is, the moving direction of the boundary calculation subtask can also be determined according to the process of calculating the difference. In the specific implementation process, the boundary calculation subtasks 1 and / or 3 can also be randomly moved.

[0076] As an embodiment, the step of allocating the boundary calculation subtask whose difference is greater than a preset threshold to the calculation graph corresponding to the second gain to obtain a first preset number of calculation graphs after redivision includes:

[0077] Determine, according to the flow relationship, a target boundary calculation subtask among the boundary calculation subtasks whose difference is greater than a preset threshold;

[0078] The target boundary calculation subtask is assigned to the calculation graph corresponding to the second gain to obtain a first preset number of calculation graphs after re-division.

[0079] Specifically, in the present embodiment, in the process of re-dividing the calculation graph according to the difference calculated above, the target boundary calculation subtask can be determined according to the flow relationship, that is, the target boundary calculation subtask is determined from the movable boundary calculation subtasks 1 and 3 according to the flow relationship, and not all movable boundary calculation subtasks are moved. For example, boundary calculation subtask 1 can be selected as the target boundary calculation subtask to be moved according to the flow relationship (the process relationship of boundary calculation subtask 1 is before boundary calculation subtask 3, so boundary calculation subtask 1 is selected as the target boundary calculation subtask), and the moving result is as follows Figure 4 shown.

[0080] As another embodiment, it is also possible to redivide the target boundary calculation subtasks according to the flow relationship without determining the target boundary calculation subtasks according to the movable boundary calculation subtasks 1 and 3, and the division results may be in two situations: Figure 4 and Figure 5 shown.

[0081] It should be noted that the method of determining the target boundary calculation subtask based on the flow relationship (referred to as the first method) can reduce the amount of calculation compared to the method of calculating subtasks based on all movable boundaries (referred to as the second method), but the effect of the division result of the second method may be better than the effect of the division result of the first method.

[0082] Step 230, if there are new boundary calculation subtasks in the new first number of calculation graphs, return to the step of determining the key relationship gain of each boundary calculation subtask until the new first number of calculation graphs obtained do not contain new boundary calculation subtasks, and allocate the first number of calculation graphs with the smallest number of key relationships between the first number of calculation graphs obtained each time to the corresponding first number of computing devices.

[0083] After obtaining the newly divided computation graph, determine whether there is a new boundary computation subtask in the new computation graph, such as Figure 4 As shown in the figure, the boundary calculation subtasks in the new calculation graph are all in the original calculation graph ( Figure 3 ), that is, the new Figure 4 No new boundary calculation subtask is generated. Then, the division method with the smallest number of key relationships between the calculation graphs is selected in the newly divided calculation graph and the original calculation graph. For example, as an embodiment, Figure 3 and Figure 4 Choose the division method between Figure 4 The number of key relationships between the computational graphs in (a total of 3 key relationships, between 7 and 9, between 3 and 6, and between 9 and 10) is less than Figure 3 (There are 5 key relationships, namely between 7 and 9, between 3 and 6, between 9 and 10, between 1 and 2, and between 1 and 3), so choose Figure 4 The division method will Figure 4 In the calculation, computation graphs A, B, and C are assigned to three devices.

[0084] If the moving boundary calculation subtasks 1 and 3 are used to obtain Figure 4 and Figure 5 The calculation diagram shown is compared Figure 3 , 4 , the number of key relationships between the computational graphs in 5, Figure 3 The number of key relationships between the computational graphs in is 5. Figure 4 The number of key relationships between the computation graphs in is 3. Figure 5 The number of key relationships between the computational graphs in is 4, so we choose Figure 4 As the distribution method, it is distributed to each computing device.

[0085] After obtaining the newly divided calculation graph, if it is determined that there are new boundary calculation subtasks in the new calculation graph, return to step 210, recalculate the key relationship gain of each boundary calculation subtask, and then compare the number of key relationships between the calculation graphs in the new calculation graph, execute the above steps in sequence, and allocate by selecting the method with the smallest number of key relationships.

[0086] As another embodiment, the difference between the first gain and the second gain may not be calculated, and the magnitude relationship between the first gain and the second gain may be directly compared, and the boundary calculation subtask in which the first gain is greater than the second gain is selected for allocation. The rest of the process is the same as the previous embodiment and will not be repeated here.

[0087] According to the above description, after being processed by the present application, the key relationships between the computational graphs are reduced, which correspondingly reduces the communication time between the devices due to the key relationships, thereby reducing the overall communication delay.

[0088] The above-mentioned method for allocating computing tasks is as follows: by obtaining a first number of computing graphs corresponding to the computing task and the flow relationship between each computing subtask in the computing task, each of the computing graphs includes at least one computing subtask; calculating the critical relationship gain of each boundary computing subtask, the critical relationship gain including a first gain and a second gain, wherein the first gain is obtained according to the critical relationship between the boundary computing subtask and the boundary computing subtask in the computing graph to which the boundary computing subtask belongs, and the second gain is obtained according to the critical relationship between the boundary computing subtask and other computing graphs respectively; adjusting the boundary computing subtask to other computing graphs according to the first gain and the second gain of each boundary computing subtask to obtain a new first number of computing graphs; if there is a new boundary computing subtask in the new first number of computing graphs, returning to the step of determining the critical relationship gain of each boundary computing subtask until there is no new boundary computing subtask in the new first number of computing graphs, and allocating the first number of computing graphs with the smallest number of critical relationships between the first number of computing graphs obtained each time to the corresponding first number of computing devices. Through the above method, the present application can obtain multiple calculation graphs that are preliminarily divided, and then determine the key relationship gain of each boundary calculation subtask according to the boundary calculation subtasks in each calculation graph. The key relationship gain includes a first gain and a second gain. The first gain is obtained by the calculation graph to which the boundary calculation subtask belongs, and the second gain is obtained by the boundary calculation subtask and other calculation graphs respectively. The degree of association between the boundary calculation subtask and the calculation graph and other calculation graphs can be determined from the first gain and the second gain. Therefore, according to the first gain and the second gain, it can be determined to adjust the boundary calculation subtask to other calculation graphs, thereby obtaining the adjusted first number of calculation graphs. If no new boundary calculation subtasks are generated in the new first number of calculation graphs, the number of key relationships between the calculation graphs in the new first number of calculation graphs and the number of key relationships between the calculation graphs in the original first number of calculation graphs are determined, and the first number of calculation graphs with the smallest number of key relationships are selected and assigned to the corresponding first number of calculation devices. In this way, the present application can consider the key relationship between the boundary calculation subtasks on the basis of the original calculation graph, and can reduce the key relationship between the calculation graphs, that is, reduce the communication delay between the calculation graphs, so as to speed up the completion of the calculation task and meet the requirements of real-time applications.

[0089] In one embodiment, the obtaining of a first preset number of computing graphs corresponding to the computing task and a flow relationship between computing subtasks in the computing task includes:

[0090] Obtaining a directed graph corresponding to the computing task and the number of computing devices executing the computing task, wherein the directed graph includes a second number of computing subtasks and flow relationships between the computing subtasks, wherein the flow relationships include key relationships and non-key relationships, and the second number is greater than the first number;

[0091] The directed graph is divided into a first number of computation graphs according to a preset rule.

[0092] Specifically, in this implementation, the server can also directly obtain the computing task, the directed graph corresponding to the computing task, and the number of computing devices that execute the computing task. The server itself uses an existing method to obtain a first number of computing graphs corresponding to the computing task and the flow relationship between each computing subtask in the computing task. As another embodiment, the server divides the directed graph into a first number of computing graphs according to a preset rule, including:

[0093] Perform clustering processing according to the flow relationship of each computing subtask in the directed graph to obtain multiple sets;

[0094] The plurality of sets are partitioned into a first number of computation graphs.

[0095] Clustering is performed based on the flow relationship of each computing subtask in the directed graph of the computing task obtained to obtain multiple sets. For example, Figure 3 The computing subtasks 1, 2, and 3 shown in the figure are clustered as a set, and 10, 5, 12, 13, and 14 are clustered as a set, and so on, thereby obtaining multiple sets, which are then divided into three computing graphs according to the obtained multiple sets.

[0096] As another embodiment, dividing the multiple sets into a first number of computation graphs may further include:

[0097] randomly partitioning the plurality of sets into a first number of partitions;

[0098] Randomly select any set from any partition and divide it into other partitions, and calculate the number of cut edges between all new partitions after each random selection of any set from any partition and division into other partitions;

[0099] The partitions corresponding to the minimum number of cut edges are used as the calculation graph.

[0100] Specifically, in the process of dividing multiple sets into multiple computational graphs, multiple sets may be optimized first, that is, multiple sets are randomly divided into a first preset number of partitions, and then any set is randomly selected from any partition to be divided into other partitions, and the sum of the number of cut edges between all new partitions is calculated after any set is randomly selected from any partition to be divided into other partitions each time (because the computational subtasks are assigned to different partitions, it is considered that the flow relationship between the partitions is cut off, but in fact it is not cut off, so the flow relationship between the partitions is defined as the cut edge, and the number of cut edges is the total number of cut edges, for example Figure 3 The number of cut edges is 6, which are between 7 and 9, between 3 and 6, between 9 and 10, between 1 and 2, between 1 and 3, and between 9 and 3. The partitioning method with the smallest number of cut edges in the process of partitioning any set into other partitions is selected as the calculation graph.

[0101] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0102] Based on the same inventive concept, the embodiment of the present application also provides a computing task allocation device for implementing the computing task allocation method involved in the above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in the embodiments of the allocation device for one or more computing tasks provided below can refer to the limitations of the computing task allocation method in the above text, and will not be repeated here.

[0103] In one embodiment, Figure 6 As shown, a computing task allocation device is provided, comprising:

[0104] A first acquisition module 610 is used to acquire a first number of computation graphs corresponding to the computation task and a flow relationship between computation subtasks in the computation task, each of the computation graphs including at least one computation subtask;

[0105] A first calculation module 620 is used to determine a key relationship gain of each boundary calculation subtask, wherein the key relationship gain includes a first gain and a second gain, wherein the first gain is obtained according to a key relationship between the boundary calculation subtask and the boundary calculation subtask in a calculation graph to which the boundary calculation subtask belongs, and the second gain is obtained according to key relationships between the boundary calculation subtask and other calculation graphs respectively;

[0106] An adjustment module 630 is used to adjust the boundary calculation subtask to other calculation graphs according to the first gain and the second gain of each boundary calculation subtask to obtain a new first number of calculation graphs;

[0107] The allocation module 640 is used to return to the step of determining the key relationship gain of each boundary calculation subtask if there are new boundary calculation subtasks in the new first number of calculation graphs, until the new first number of calculation graphs obtained do not have new boundary calculation subtasks, and allocate the first number of calculation graphs with the smallest number of key relationships between the first number of calculation graphs obtained each time to the corresponding first number of computing devices.

[0108] The first calculation module 620 is further used for:

[0109] The first gain is obtained by counting the number of computing subtasks that have a critical relationship with the boundary computing subtask in the computing graph to which the boundary computing subtask belongs; and the number of computing subtasks that have a critical relationship between the boundary computing subtask and other computing graphs are respectively counted to obtain the second gain of the boundary computing subtask relative to other computing graphs.

[0110] The first calculation module 620 is further used for:

[0111] Assigning a first value to a key relationship in a flow relationship of the boundary calculation subtask;

[0112] The first gain is obtained by calculating according to the key relationship between the boundary calculation subtask and the calculation graph to which the boundary calculation subtask belongs, and the first value; and the second gain is obtained by calculating according to the key relationship between the boundary calculation subtask and other calculation graphs, respectively, and the first value.

[0113] The first calculation module 620 is further used for:

[0114] Calculating a difference between the second gain and the first gain of each of the boundary calculation subtasks;

[0115] The boundary calculation subtasks whose difference is greater than a preset threshold are allocated to the calculation graph corresponding to the second gain to obtain a first number of calculation graphs after re-division.

[0116] The first calculation module 620 is further used for:

[0117] Determine, according to the flow relationship, a target boundary calculation subtask among the boundary calculation subtasks whose difference is greater than a preset threshold;

[0118] The target boundary calculation subtask is assigned to the calculation graph corresponding to the second gain to obtain a first preset number of calculation graphs after re-division.

[0119] The first acquisition module 610 is further used to: acquire a directed graph corresponding to the computing task and the number of computing devices executing the computing task, wherein the directed graph includes a second number of computing subtasks and a flow relationship between the computing subtasks, wherein the flow relationship includes a key relationship and a non-key relationship, and the second number is greater than the first number;

[0120] The directed graph is divided into a first number of computation graphs according to a preset rule.

[0121] The first acquisition module 610 is further used for:

[0122] Perform clustering processing according to the flow relationship of each computing subtask in the directed graph to obtain multiple sets;

[0123] The plurality of sets are partitioned into a first number of computation graphs.

[0124] The first acquisition module 610 is further used for:

[0125] randomly partitioning the plurality of sets into a first number of partitions;

[0126] Randomly select any set from any partition and divide it into other partitions, and calculate the number of cut edges between all new partitions after each random selection of any set from any partition and division into other partitions;

[0127] The partitions corresponding to the minimum number of cut edges are used as the calculation graph.

[0128] Each module in the above-mentioned computing task allocation device can be implemented in whole or in part by software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module above.

[0129] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 7As shown. The computer device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store relevant data of the computing task, including each computing subtask and flow relationship, etc. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a method for allocating computing tasks is implemented.

[0130] Those skilled in the art will understand that Figure 7 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0131] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the steps of the method for allocating computing tasks as described in any of the above embodiments are implemented.

[0132] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method for allocating computing tasks as described in any of the above embodiments are implemented.

[0133] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the steps of the method for allocating computing tasks as described in any of the above embodiments.

[0134] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.

[0135] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0136] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A method for allocating computing tasks, characterized in that: The method comprises: Obtaining a first number of computation graphs corresponding to the computation task and a flow relationship between computation subtasks in the computation task, each of the computation graphs including at least one computation subtask; Calculate a key relationship gain for each boundary calculation subtask, where the key relationship gain includes a first gain and a second gain, wherein the first gain is obtained according to a key relationship between the boundary calculation subtask and the boundary calculation subtask in a calculation graph to which the boundary calculation subtask belongs, and the second gain is obtained according to key relationships between the boundary calculation subtask and other calculation graphs respectively; According to the first gain and the second gain of each boundary calculation subtask, the boundary calculation subtask is adjusted to other calculation graphs to obtain a new first number of calculation graphs; If there are new boundary calculation subtasks in the new first number of calculation graphs, return to the step of determining the key relationship gain of each boundary calculation subtask until the new first number of calculation graphs obtained do not contain new boundary calculation subtasks, and allocate the first number of calculation graphs with the smallest number of key relationships between the first number of calculation graphs obtained each time to the corresponding first number of computing devices.

2. The method according to claim 1, characterized in that: The calculating of the key relationship gain of each boundary calculation subtask, wherein the key relationship gain includes a first gain and a second gain, comprises: The first gain is obtained by counting the number of computing subtasks that have a critical relationship with the boundary computing subtask in the computing graph to which the boundary computing subtask belongs; and the number of computing subtasks that have a critical relationship between the boundary computing subtask and other computing graphs are respectively counted to obtain the second gain of the boundary computing subtask relative to other computing graphs.

3. The method according to claim 1, characterized in that The calculating of the key relationship gain of each boundary calculation subtask, wherein the key relationship gain includes a first gain and a second gain, comprises: Assigning a first value to a key relationship in a flow relationship of the boundary calculation subtask; The first gain is obtained by calculating according to the key relationship between the boundary calculation subtask and the calculation graph to which the boundary calculation subtask belongs, and the first value; and the second gain is obtained by calculating according to the key relationship between the boundary calculation subtask and other calculation graphs, respectively, and the first value.

4. The method according to any one of claims 1 to 3, characterized in that: The step of adjusting the boundary calculation subtasks to other calculation graphs according to the first gain and the second gain of each boundary calculation subtask to obtain a new first number of calculation graphs includes: Calculating a difference between the second gain and the first gain of each of the boundary calculation subtasks; The boundary calculation subtasks whose difference is greater than a preset threshold are allocated to the calculation graph corresponding to the second gain to obtain a first number of calculation graphs after re-division.

5. The method according to claim 4, characterized in that The step of allocating the boundary calculation subtasks whose difference is greater than a preset threshold to the calculation graph corresponding to the second gain to obtain a first preset number of calculation graphs after redivision includes: Determine, according to the flow relationship, a target boundary calculation subtask among the boundary calculation subtasks whose difference is greater than a preset threshold; The target boundary calculation subtask is assigned to the calculation graph corresponding to the second gain to obtain a first preset number of calculation graphs after re-division.

6. The method according to claim 1, characterized in that The obtaining of a first preset number of computation graphs corresponding to the computation task and a flow relationship between computation subtasks in the computation task includes: Obtaining a directed graph corresponding to the computing task and the number of computing devices executing the computing task, wherein the directed graph includes a second number of computing subtasks and flow relationships between the computing subtasks, wherein the flow relationships include key relationships and non-key relationships, and the second number is greater than the first number; The directed graph is divided into a first number of computation graphs according to a preset rule.

7. The method according to claim 6, characterized in that The step of dividing the directed graph into a first number of computation graphs according to a preset rule includes: Perform clustering processing according to the flow relationship of each computing subtask in the directed graph to obtain multiple sets; The plurality of sets are partitioned into a first number of computation graphs.

8. The method according to claim 7, characterized in that The dividing the multiple sets into a first number of computation graphs includes: randomly partitioning the plurality of sets into a first number of partitions; Randomly select any set from any partition and divide it into other partitions, and calculate the number of cut edges between all new partitions after each random selection of any set from any partition and division into other partitions; The partitions corresponding to the minimum number of cut edges are used as the calculation graph.

9. A computing task allocation device, characterized in that: The device comprises: A first acquisition module, used to acquire a first number of computation graphs corresponding to the computation task and a flow relationship between computation subtasks in the computation task, each of the computation graphs including at least one computation subtask; A first calculation module is used to determine a key relationship gain of each boundary calculation subtask, wherein the key relationship gain includes a first gain and a second gain, wherein the first gain is obtained according to a key relationship between the boundary calculation subtask and the boundary calculation subtask in a calculation graph to which the boundary calculation subtask belongs, and the second gain is obtained according to key relationships between the boundary calculation subtask and other calculation graphs respectively; An adjustment module, configured to adjust the boundary calculation subtasks to other calculation graphs according to the first gain and the second gain of each boundary calculation subtask, so as to obtain a new first number of calculation graphs; An allocation module is used to return to the step of determining the key relationship gain of each boundary calculation subtask if there are new boundary calculation subtasks in the new first number of calculation graphs, until the new first number of calculation graphs obtained do not have new boundary calculation subtasks, and allocate the first number of calculation graphs with the smallest number of key relationships between the first number of calculation graphs obtained each time to the corresponding first number of computing devices.

10. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 8 are implemented.

11. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.