Load balancing method and apparatus, and device and readable storage medium
By obtaining the priority of tasks and computing nodes in a cross-domain multivariate computing system, dynamic allocation and splitting of tasks and resources, the problem of uneven load is solved, and efficient task execution and resource utilization are achieved.
Patent Information
- Application Number
- PCT/CN2023/141773
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-08-02
- Filing Date
- 2023-12-26
- Publication Date
- 2025-02-06
AI Technical Summary
The prior art cannot effectively solve the problem of uneven loading of resources in cross-domain multi-computing systems, resulting in idle or overload of resources and low task execution efficiency.
By obtaining the priority of tasks and compute nodes, the unassigned and highest priority tasks are allocated one by one to the idle and highest priority computing nodes, and after the compute node completes the task, the task part is split and reassigned to achieve load balancing.
It realizes efficient execution of tasks, avoids idleness and overload of resources, and improves the overall performance of the system and task completion efficiency.
Smart Images

Figure CN2023141773_06022025_PF_FP_ABST
Abstract
Description
A load balancing method, device, equipment and readable storage medium
[0001] CROSS-REFERENCE TO RELATED APPLICATIONS
[0002] This application claims priority to the Chinese patent application filed with the China Patent Office on August 2, 2023, with application number 202310962236.2, and application name “A load balancing method, device, equipment and readable storage medium”, all contents of which are incorporated by reference into this application. Technical Field
[0003] The present application relates to the field of computer application technology, and in particular to a load balancing method, apparatus, device, and readable storage medium. Background Art
[0004] Existing network traffic or resource scheduling methods have improved system performance to a certain extent, but still cannot fundamentally solve the problem of uneven load.
[0005] Specifically, in terms of hardware resource utilization, cross-domain multi-computing systems contain a variety of different types of computing resources, which are not fully and rationally utilized, resulting in idle or overloaded resources. In terms of task allocation, existing systems simply and crudely assign tasks to available computing nodes, resulting in inefficient task execution.
[0006] In summary, how to effectively solve problems such as load balancing is a technical problem that those skilled in the art urgently need to solve.
[0007] Summary of the Invention
[0008] The purpose of this application is to provide a load balancing method, device, equipment and readable storage medium, which can perform task allocation and split and redistribute the assigned tasks based on the task situation and the specific situation of the computing node, so that tasks can be executed efficiently, resources will not be idle or overloaded, and load balancing can be achieved.
[0009] To solve the above technical problems, this application provides the following technical solutions:
[0010] A load balancing method, comprising:
[0011] Get the priorities of multiple tasks and multiple computing nodes;
[0012] Assign the unassigned and highest priority tasks to the idle and highest priority computing nodes one by one until there are no idle computing nodes or all tasks are assigned;
[0013] If the first computing node completes the currently assigned task, subtasks are split from the uncompleted portion of the assigned first task, and the subtasks are assigned to the first computing node.
[0014] In some embodiments of the present application, if the first computing node completes the currently assigned task, splitting the uncompleted portion of the assigned first task into subtasks and assigning the subtasks to the first computing node includes:
[0015] In the case where tasks are not fully assigned, if the first computing node completes the currently assigned task, the first task with the highest priority among the unassigned tasks is assigned to the first computing node;
[0016] When the first task has not been completed by the first computing node, if the second computing node completes the currently assigned task, the unfinished part of the first task is split and the resulting subtasks are respectively assigned to the first computing node and the second computing node.
[0017] In some embodiments of the present application, if the first computing node completes the currently assigned task, splitting the uncompleted portion of the assigned first task into subtasks and assigning the subtasks to the first computing node includes:
[0018] In the case of no unassigned tasks, if the N first computing nodes complete the currently assigned tasks, the unprocessed part of the first task assigned to the third computing node is split into N+1 subtasks, and the N subtasks after splitting are respectively assigned to the N first computing nodes.
[0019] In some embodiments of the present application, the unprocessed portion of the first task assigned to the third computing node is split into N+1 subtasks, including:
[0020] From the assigned tasks, the task with the longest pending execution time is selected as the first task;
[0021] Split the part to be executed into N+1 subtasks.
[0022] In some embodiments of the present application, the to-be-executed portion is split into N+1 subtasks, including:
[0023] The part to be executed is split into N+1 equal parts to obtain N+1 subtasks.
[0024] In some embodiments of the present application, the unprocessed portion of the first task assigned to the third computing node is split into N+1 subtasks, including:
[0025] From the assigned tasks, randomly select an unfinished task as the first task;
[0026] Split the unprocessed part of the first task into N+1 parts, obtaining N+1 subtasks.
[0027] In some embodiments of the present application, obtaining the priorities of multiple tasks includes:
[0028] Get unit benefits for multiple tasks;
[0029] Leverage unit efficiency to prioritize multiple tasks.
[0030] In some embodiments of the present application, obtaining unit benefits of multiple tasks includes:
[0031] Get the execution time, task benefits and task costs of multiple tasks;
[0032] The difference between the task benefit and the task cost of a single task is calculated, and the ratio of the difference to the execution time is determined as the unit benefit of the task.
[0033] In some embodiments of the present application, obtaining the priorities of multiple computing nodes includes:
[0034] Read the priority of the compute node from the storage medium.
[0035] In some embodiments of the present application, before reading the priority of the computing node from the storage medium, the method further includes:
[0036] Obtain the performance-cost ratio of multiple computing nodes;
[0037] Use performance-cost ratio to determine the priority of multiple computing nodes;
[0038] The priority information is stored in a storage medium.
[0039] In some embodiments of the present application, obtaining the performance-cost ratio of multiple computing nodes includes:
[0040] Obtain the computing power, communication bandwidth, failure rate, and power consumption of multiple computing nodes;
[0041] For a single computing node, the product of 1 minus the failure rate, computing power, and communication bandwidth is calculated, and the ratio of the product to the power consumption is determined as the performance-cost ratio of the computing node.
[0042] In some embodiments of the present application, unassigned tasks with the highest priority are assigned one by one to the computing nodes with the highest priority that are in an idle state, including:
[0043] Sort the tasks according to their priorities to get a task queue;
[0044] Sort the idle computing nodes according to their priorities to obtain a node queue.
[0045] Assign tasks in the task queue to the computing nodes in the node queue one by one.
[0046] In some embodiments of the present application, unassigned tasks with the highest priority are assigned one by one to the computing nodes with the highest priority that are in an idle state, including:
[0047] Assign the unassigned and highest priority tasks one by one to the idle and highest priority computing nodes in the cross-domain multi-heterogeneous computing system.
[0048] In some embodiments of the present application, computing nodes in a cross-domain multi-heterogeneous computing system are located in multiple regions, and the multiple computing nodes include homogeneous nodes and heterogeneous nodes.
[0049] In some embodiments of the present application, a cross-domain multi-heterogeneous computing system includes: a local tree topology and a global mesh topology.
[0050] In some embodiments of the present application, including:
[0051] The root node of the local tree topology is the local master node;
[0052] In the local tree topology, there are tree-topology communication connections between computing nodes;
[0053] In the global mesh topology, local master nodes have mesh topology communication connections.
[0054] In some embodiments of the present application, the process of obtaining the local tree topology includes:
[0055] For the same domain, obtain the comprehensive communication cost between every two computing nodes;
[0056] Based on the comprehensive communication cost, a local tree topology is established within the domain.
[0057] In some embodiments of the present application, obtaining the comprehensive communication cost between every two computing nodes includes:
[0058] Obtain the inherent overhead and latency overhead between each two computing nodes;
[0059] The comprehensive communication cost between the two computing nodes is calculated based on the inherent overhead and the delay overhead.
[0060] In some embodiments of the present application, a local tree topology is established within a domain based on comprehensive communication costs, including:
[0061] In the same domain, a mesh topology is built based on computing nodes, and the corresponding comprehensive communication cost is represented on the edges of the mesh topology.
[0062] Randomly select a computing node from the mesh topology as the starting point, retain only the edge with the minimum comprehensive communication cost connected to the computing node, and retain only the edge with the minimum comprehensive communication cost connected to the next computing node until a chain topology is obtained;
[0063] Based on the chain topology, a local tree topology is established.
[0064] In some embodiments of the present application, a local tree topology is established based on a chain topology, including:
[0065] Select a midpoint from the chain topology and determine the midpoint as the root node of the local tree topology;
[0066] The nodes directly or indirectly connected to the root node are determined as leaf nodes of the local tree topology to obtain the local tree topology.
[0067] In some embodiments of the present application, it further includes:
[0068] If the height of the local tree topology is greater than the specified value, the leaf node at the bottom level is moved to the upper level.
[0069] In some embodiments of the present application, the process of obtaining the global network topology includes:
[0070] Determine the root node of the local tree topology as the local master node;
[0071] A communication connection is established between every two local master nodes to obtain a global network topology.
[0072] In some embodiments of the present application, if the first computing node completes the currently assigned task, splitting the uncompleted portion of the assigned first task into subtasks and assigning the subtasks to the first computing node includes:
[0073] If the tasks have not been assigned yet, if the first computing node completes the currently assigned tasks, the first task with the highest priority among the unassigned tasks is assigned to the first computing node;
[0074] If the first task is not completed by the first computing node, and the second computing node completes the currently assigned task, the second computing node splits the unfinished part of the first task and assigns the resulting subtasks to the first computing node and the second computing node respectively.
[0075] When the subtasks of the first task are completed, if the tasks have not been assigned yet, the second task with the highest priority among the unassigned tasks is split to obtain subtasks of the second task, and the subtasks of the second task are assigned to the first computing node and the second computing node;
[0076] In the case where the subtasks of the second task have not been completed, if the tasks have been assigned and the fourth computing node has completed the currently assigned tasks, the unfinished parts of the subtasks after the second task is split are split to obtain new subtasks, and the new subtasks are assigned to the first computing node, the second computing node, and the fourth computing node;
[0077] When the second task is completed, if the tasks have been assigned and there is an unfinished third task, split the unfinished part of the third task and assign the subtasks of the split third task to the computing node executing the second task;
[0078] When the subtasks of the second task are completed, if the tasks have been assigned and there is no uncompleted third task, it is determined that the plurality of tasks are completed.
[0079] A load balancing device, comprising:
[0080] Priority acquisition module, used to obtain the priorities of multiple tasks and multiple computing nodes;
[0081] The task initialization allocation module is used to allocate the unassigned and highest priority tasks to the idle and highest priority computing nodes one by one until there are no idle computing nodes or the tasks are allocated;
[0082] The task splitting and assigning module is used to split subtasks from the unfinished part of the assigned first task and assign the subtasks to the first computing node if the first computing node completes the currently assigned task.
[0083] An electronic device, comprising:
[0084] memory for storing computer programs;
[0085] A processor is used to implement the steps of the above load balancing method when executing a computer program.
[0086] A non-volatile readable storage medium stores a computer program, which implements the steps of the above-mentioned load balancing method when executed by a processor.
[0087] Apply the method provided in the embodiment of the present application to obtain the priorities of multiple tasks and the priorities of multiple computing nodes; assign the unassigned and highest-priority tasks to the idle and highest-priority computing nodes one by one until there are no idle computing nodes or the tasks are assigned; if the first computing node completes the currently assigned task, split the unfinished part of the assigned first task into subtasks and assign the subtasks to the first computing node.
[0088] In this application, the priorities of multiple tasks and multiple compute nodes are first obtained. Then, the task with the highest priority is assigned to the highest-priority, idle compute node among the compute nodes. That is, when assigning tasks, not only the task priority but also the compute node priority and whether the compute node is idle are considered. By assigning tasks one by one, the highest-priority task is assigned to the idle compute node with the highest priority, while the next-highest-priority task is assigned to the next-highest-priority idle compute node, and so on, until no idle compute nodes are available or all tasks have been assigned. If the first compute node completes the currently assigned task, subtasks are split from the unfinished portion of the assigned first task and assigned to the first compute node. The unfinished portion of the first task is split, and the resulting subtasks are assigned to the first compute node. That is, for the same task, if idle compute nodes become available after compute nodes have been assigned, the task can be split and redistributed to avoid overloading some compute nodes or leaving others idle. Having multiple compute nodes handle the same task can also shorten the time it takes to complete the task.
[0089] The technical effect of this application is: based on the priority of tasks and computing nodes, and the idle status of computing nodes, on-demand allocation and multiple splitting and redistribution are performed to achieve load balancing, thereby accelerating the completion efficiency of the overall task and improving the overall performance of the system.
[0090] Correspondingly, the embodiments of the present application also provide a load balancing device, equipment and readable storage medium corresponding to the above-mentioned load balancing method, which have the above-mentioned technical effects and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0091] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the following briefly introduces the drawings required for use in the embodiments or related technical descriptions. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0092] FIG1 is a flow chart of an implementation of a load balancing method in an embodiment of the present application;
[0093] FIG2 is a topological structure diagram of six nodes in an embodiment of the present application, where the weight of each edge is the comprehensive communication cost;
[0094] FIG3 is a schematic diagram of a topology result of retaining the minimum cost edge of node 1 according to an embodiment of the present application;
[0095] FIG4 is a schematic diagram of a topology result of a minimum edge cost with 3 nodes retained in an embodiment of the present application;
[0096] FIG5 is a schematic diagram of a network topology result with the lowest comprehensive communication cost according to an embodiment of the present application;
[0097] FIG6 is a schematic diagram of a binary tree with node 2 as the root node in an embodiment of the present application;
[0098] FIG7 is a schematic diagram of a final binary tree topology after modification in an embodiment of the present application;
[0099] FIG8 is a schematic diagram of a distributed communication topology design module according to an embodiment of the present application;
[0100] FIG9 is a schematic diagram of five computing tasks and their durations according to an embodiment of the present application;
[0101] FIG10 is a schematic diagram of the distribution of computing tasks A, B, and C in an embodiment of the present application;
[0102] FIG11 is a schematic diagram of the distribution of a computing task D in an embodiment of the present application;
[0103] FIG12 is a schematic diagram of a load balancing strategy for evenly allocating computing task D to computing node 1 and computing node 2 in an embodiment of the present application;
[0104] FIG13 is a schematic diagram showing a computing task E being evenly distributed between computing nodes 1 and 2 in an embodiment of the present application;
[0105] FIG14 is a schematic diagram showing load balancing of a computing task E in an embodiment of the present application so as to minimize the execution time of the global computing task;
[0106] FIG15 is a schematic diagram showing a computing task D completely allocated to computing node 2;
[0107] FIG16 is a schematic diagram showing a computing task E completely allocated to computing node 1;
[0108] FIG17 is a schematic structural diagram of a load balancing device according to an embodiment of the present application;
[0109] FIG18 is a schematic structural diagram of an electronic device according to an embodiment of the present application;
[0110] FIG19 is a schematic diagram of the specific structure of an electronic device in an embodiment of the present application. DETAILED DESCRIPTION
[0111] In order to enable those skilled in the art to better understand the present application, the present application is further described in detail below in conjunction with the accompanying drawings and specific embodiments. Obviously, the embodiments described are only a part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without making any creative efforts are within the scope of protection of the present application.
[0112] Please refer to FIG1 , which is a flow chart of a load balancing method according to an embodiment of the present application. The method includes the following steps:
[0113] S101: Obtain priorities of multiple tasks and priorities of multiple computing nodes.
[0114] In this application, the priority of a task can be determined based on one or more factors, such as the importance of the task, processing time, benefits, and difficulty. For example, the more important the task, the higher its priority; for processing time, the longer the processing time, the higher the priority; for benefits, the greater the benefits, the higher the priority; and the greater the difficulty, the higher the priority. When multiple factors are jointly determined, they can be clarified by setting weight levels or calculating relevant ratios.
[0115] In a specific implementation of the present application, obtaining the priorities of multiple tasks includes:
[0116] Step 1: Obtain unit benefits of multiple tasks;
[0117] Step 2: Use unit efficiency to determine the priorities of multiple tasks.
[0118] For ease of description, the above two steps are combined for explanation below.
[0119] Unit benefit refers to the benefit value per unit time. The higher the unit benefit, the higher the task priority. In this application, different unit benefit intervals can be pre-set for different priority levels, thereby clarifying the priorities of multiple tasks based on unit benefits. Tasks can also be directly sorted from largest to smallest based on unit benefits, with the sorting order representing the order of task priority.
[0120] In a specific embodiment of the present application, obtaining unit benefits of multiple tasks includes:
[0121] Step 1: Obtain the execution time, task benefits, and task costs of multiple tasks;
[0122] Step 2: Subtract the task benefit from the task cost of a single task, and determine the ratio of the difference to the execution time as the unit benefit of the task.
[0123] For ease of description, the above two steps are combined for explanation below.
[0124] That is, in the embodiment of the present application, considering the time factor (T) of the computing task execution, the computing task benefit factor (S), and the computing task cost factor (H), a unit benefit evaluation index (UB) of the computing task is proposed, that is, the benefit value per unit time is defined, and its formula is defined as follows:
[0125] UB(x) = (SH) / T. The unit benefit indicator UB(x) of computing task X is defined as the ratio of the difference between the computing task benefit S and cost H to the execution time T.
[0126] The task benefits, task costs and task execution time of the task can be clarified by referring to the relevant task measurement algorithm, and will not be described in detail in this application.
[0127] Since the resource situation of the computing node itself is relatively fixed, the priority of the computing node can be clarified in advance and the priority information can be stored in a non-volatile readable storage medium. Therefore, the priority of multiple computing nodes can be directly clarified by reading the storage medium, etc., without having to confirm in real time. Of course, in order to avoid large differences in computing nodes, the priority of the computing node can also be updated regularly. The update frequency can be determined according to the actual situation. For example, in a scenario with high frequency changes, it can be updated once a day, and for a scenario with low frequency changes, it can be updated once a week. That is to say, in a specific embodiment of the present application, the priority of the computing node can be read from the storage medium.
[0128] Accordingly, before reading the priority of the computing node from the storage medium, the priority information needs to be stored in the storage medium. The specific implementation process includes:
[0129] Step 1: Obtain the performance-cost ratio of multiple computing nodes;
[0130] Step 2: Use the performance-cost ratio to determine the priorities of multiple computing nodes;
[0131] Step 3: Store the priority information in a storage medium.
[0132] For ease of description, the above three steps are combined and explained below.
[0133] The performance-cost ratio can be specifically the ratio of its performance-related parameters to power consumption. Specifically, step 1 obtains the performance-cost ratio of multiple computing nodes, including:
[0134] Step 1: Obtain the computing power, communication bandwidth, failure rate, and power consumption of multiple computing nodes;
[0135] Step 2: For each computing node, calculate the product of 1 minus the failure rate, computing power, and communication bandwidth. The ratio of this product to power consumption is used to determine the performance-cost ratio of the computing node. The node's importance evaluation index depends on factors such as computing power, reliability, communication capabilities, and energy efficiency.
[0136] The node's computing power is expressed in floating-point operations per second (FLOPS), its reliability is characterized by its failure rate (β), its communication capacity is represented by its communication bandwidth (G), and its energy efficiency is described by its power consumption (W). Therefore, the performance-cost ratio (Inf) of node Y is calculated and defined as follows:
[0137] Inf(x)=FLOPS·G(1-β) / W, where 1-β indicates the non-fault probability, that is, the normal probability.
[0138] The method of determining the priority of computing nodes based on the performance-cost ratio can refer to the method of determining the priority of tasks based on unit benefits, and will not be described in detail here.
[0139] S102 , allocating the unassigned tasks with the highest priority to the computing nodes with the highest priority that are in the idle state one by one, until there are no idle computing nodes or all tasks are allocated.
[0140] After clarifying the priority of each task and the priority of each computing node, the tasks can be assigned.
[0141] Specifically, in scenarios where a factor is of concern, the priority of tasks or computing nodes is set based on that factor, and tasks are then assigned based on that priority. This allows for effective reference to that factor in task assignment, thereby achieving the desired effect. For example, when focusing on the reliability of task execution, the priority of tasks can be determined based on their importance. For example, more important tasks have higher priorities, and for corresponding computing nodes, the lower the failure rate, the higher the priority. In this way, when assigning tasks, more important tasks can be assigned to computing nodes with lower failure rates, thereby ensuring the reliability of important tasks.
[0142] In this application, unassigned tasks with the highest priority can be assigned to the idle computing nodes with the highest priority until there are no idle computing nodes or the tasks are assigned. For example, when there are 5 tasks with the priority order of a, b, c, d and e, if there are 3 corresponding computing nodes with the priority order of 1, 2 and 3, and all three computing nodes are idle, then the highest priority task a is assigned to the highest priority computing node 1, task b is assigned to computing node 2, and task c is assigned to computing node 3. At this point, the tasks have not been assigned yet, but since there are no idle computing nodes, the task assignment is suspended.
[0143] For example, when there are two tasks with priority a and b, if there are three corresponding computing nodes with priority 1, 2 and 3, and computing nodes 1 and 3 are in idle state, then the highest priority task a is assigned to the highest priority computing node 1, and task b is assigned to computing node 3. The tasks have been assigned and there are no idle computing nodes, so task assignment is suspended.
[0144] In a specific implementation of the present application, unassigned tasks with the highest priority are assigned one by one to the computing nodes with the highest priority that are in an idle state, including:
[0145] Step 1: Sort the tasks according to their priorities to get a task queue;
[0146] Step 2: Sort the idle computing nodes according to their priorities to obtain a node queue.
[0147] Step 3: Assign the tasks in the task queue to the computing nodes in the node queue one by one.
[0148] For ease of description, the above three steps are combined and explained below.
[0149] To facilitate task allocation, tasks can be sorted based on priority to form a task queue, and idle compute nodes can be sorted based on their priorities to form a node queue. Then, tasks in the task queue are assigned one by one to the compute nodes in the node queue.
[0150] For example, when there are 5 tasks, the task queues based on priority sorting are: a, b, c, d and e. If there are 3 corresponding computing nodes, and the idle node queues based on priority sorting are: 1 and 3, then the highest priority task a is assigned to the highest priority computing node 1, and task b is assigned to computing node 3. At this time, the tasks have not been assigned yet, but because there are no idle computing nodes, the task assignment is suspended.
[0151] S103: If the first computing node completes the currently assigned task, split the unfinished portion of the assigned first task into subtasks, and assign the subtasks to the first computing node.
[0152] Because different tasks take different execution times, different computing nodes may also have different execution times when processing the same task. Therefore, after executing step S102, computing nodes may complete their currently assigned tasks one after another. Specifically, when the first computing node completes its currently assigned task, it can split a subtask from the unfinished portion of the assigned first task and assign the subtask to the first computing node. In other words, for the unfinished portion of the first task, after splitting, the computing node originally assigned the first task only needs to complete the portion of the unfinished portion that has not been split away, and the remaining portion that has been split away is assigned to the first computing node as a subtask of the first task.
[0153] It should be noted that the first, second, third and fourth descriptions in this application are used to distinguish the existence of certain types of nodes or tasks, and are not intended to limit the master-slave or sequence of nodes or tasks.
[0154] The first computing node may be any one or more computing nodes that have completed the currently assigned task. The first task is also not limited to a specific task.
[0155] In a specific embodiment of the present application, if the first computing node completes the currently assigned task, splitting the uncompleted portion of the assigned first task into subtasks and assigning the subtasks to the first computing node includes:
[0156] Step 1: If the first computing node completes the currently assigned task when the tasks are not yet assigned, then the first task with the highest priority among the unassigned tasks is assigned to the first computing node;
[0157] Step 2: When the first task has not been completed by the first computing node, if the second computing node has completed the currently assigned task, the unfinished part of the first task is split and the resulting subtasks are respectively assigned to the first computing node and the second computing node.
[0158] For ease of description, the above two steps are combined for explanation below.
[0159] That is, the first task may be a task with the highest priority among the tasks that have not yet been assigned during the assignment process.
[0160] When there is one first computing node, the first task is directly assigned to the first computing node; if there are multiple first computing nodes, the first task is assigned to the multiple first computing nodes. Specifically, the first task can be split and then assigned to the multiple first computing nodes.
[0161] For example, during the task allocation process of executing step S102, task allocation is suspended because there are no idle computing nodes, leaving two tasks unassigned. After a computing node completes the assigned task, the first task with the highest priority among the two tasks can be assigned to the computing node.
[0162] The second computing node can be any computing node or nodes that have been assigned tasks and have completed them. In this case, the unfinished portion of the first task can be split, and then the split tasks can be assigned to the first and second computing nodes, respectively. In other words, when a new idle computing node appears, the unfinished portion of the assigned task can be split and reassigned, allowing two or more computing nodes to process the same first task.
[0163] Of course, in the actual splitting process, any task that has been assigned but not completed can be split, that is, the object to be split can be the latest assigned task, that is, the first task, or the task assigned before the latest assigned task.
[0164] Apply the method provided in the embodiment of the present application to obtain the priorities of multiple tasks and the priorities of multiple computing nodes; assign the unassigned and highest-priority tasks to the idle and highest-priority computing nodes one by one until there are no idle computing nodes or the tasks are assigned; if the first computing node completes the currently assigned task, split the unfinished part of the assigned first task into subtasks and assign the subtasks to the first computing node.
[0165] In this application, the priorities of multiple tasks and multiple compute nodes are first obtained. Then, the task with the highest priority is assigned to the highest-priority, idle compute node among the compute nodes. That is, when assigning tasks, not only the task priority but also the compute node priority and whether the compute node is idle are considered. By assigning tasks one by one, the highest-priority task is assigned to the idle compute node with the highest priority, while the next-highest-priority task is assigned to the next-highest-priority idle compute node, and so on, until no idle compute nodes are available or all tasks have been assigned. If the first compute node completes the currently assigned task, subtasks are split from the unfinished portion of the assigned first task and assigned to the first compute node. The unfinished portion of the first task is split, and the resulting subtasks are assigned to the first compute node. That is, for the same task, if idle compute nodes become available after compute nodes have been assigned, the task can be split and redistributed to avoid overloading some compute nodes or leaving others idle. Having multiple compute nodes handle the same task can also shorten the time it takes to complete the task.
[0166] The technical effect of this application is: based on the priority of tasks and computing nodes, and the idle status of computing nodes, on-demand allocation and multiple splitting and redistribution are performed to achieve load balancing, thereby accelerating the completion efficiency of the overall task and improving the overall performance of the system.
[0167] It should be noted that, based on the above embodiments, the embodiments of the present application also provide corresponding improved solutions. In the preferred / improved embodiments, the same steps or corresponding steps as those in the above embodiments can be referenced to each other, and the corresponding beneficial effects can also be referenced to each other, and will not be described in detail in the preferred / improved embodiments of this document.
[0168] In a specific embodiment of the present application, if the first computing node completes the currently assigned task, splitting the uncompleted portion of the assigned first task into subtasks and assigning the subtasks to the first computing node includes:
[0169] In the case of no unassigned tasks, if N first computing nodes have completed the currently assigned tasks, the unprocessed part of the first task assigned to the third computing node is split into N+1 subtasks, and the N subtasks after splitting are respectively assigned to the N first computing nodes.
[0170] When there are no unassigned tasks, the assigned tasks can be further split to improve task execution efficiency. Specifically, if there are no unassigned tasks and there are N idle nodes, the unprocessed portion of the assigned second task is split into N+1 parts, and the split tasks are respectively assigned to the N idle nodes and the third computing node; the second task was originally assigned to the third computing node.
[0171] That is to say, when there are no unassigned tasks, the assigned but unprocessed tasks will be split and redistributed, so that multiple computing nodes will not be idle before all tasks are completed. The splitting and redistribution of tasks can also allow a single task to be processed by multiple computing nodes at the same time, shortening the overall task execution time and effectively improving efficiency.
[0172] In a specific implementation of the present application, the unprocessed portion of the first task assigned to the third computing node is split into N+1 subtasks, including:
[0173] Step 1: Randomly select an unfinished task from the assigned tasks and determine it as the second task;
[0174] Step 2: Split the unprocessed part of the first task into N+1 parts, obtaining N+1 subtasks.
[0175] For ease of description, the above two steps are combined for explanation below.
[0176] When selecting a second task, you can randomly select an unfinished task from the assigned tasks. Then, split the unfinished portion. For example, if there are currently four assigned but unfinished tasks, you can randomly select one of them as the second task.
[0177] In a specific implementation of the present application, the unprocessed portion of the assigned second task is split into N+1 parts, including:
[0178] Step 1: From the assigned tasks, select the task with the longest pending execution time as the second task;
[0179] Step 2: Split the part to be executed into N+1 subtasks.
[0180] For ease of description, the above two steps are combined for explanation below.
[0181] In this application, when determining the second task to be split, the task with the longest pending execution time can be pre-determined as the second task. Then, when splitting the second task, the longest pending task can be processed by multiple computing nodes, shortening the overall execution time and reducing the number of tasks that need to be split, that is, reducing the number of task splits.
[0182] In one embodiment of the present application, splitting the portion to be executed into N+1 subtasks includes splitting the portion to be executed into N+1 equal parts, resulting in N+1 subtasks. For example, when N is 1, the portion to be executed is split into two equal parts. In this way, after the second task is split, the two subtasks can be completed simultaneously.
[0183] In a specific embodiment of the present application, if the first computing node completes the currently assigned task, splitting the uncompleted portion of the assigned first task into subtasks and assigning the subtasks to the first computing node includes:
[0184] If the tasks have not been assigned yet, if the first computing node completes the currently assigned tasks, the first task with the highest priority among the unassigned tasks is assigned to the first computing node;
[0185] If the first task is not completed by the first computing node, and the second computing node completes the currently assigned task, the second computing node splits the unfinished part of the first task and assigns the resulting subtasks to the first computing node and the second computing node respectively.
[0186] When the subtasks of the first task are completed, if the tasks have not been assigned yet, the second task with the highest priority among the unassigned tasks is split to obtain subtasks of the second task, and the subtasks of the second task are assigned to the first computing node and the second computing node;
[0187] In the case where the subtasks of the second task have not been completed, if the tasks have been assigned and the fourth computing node has completed the currently assigned tasks, the unfinished parts of the subtasks after the second task is split are split to obtain new subtasks, and the new subtasks are assigned to the first computing node, the second computing node, and the fourth computing node;
[0188] When the second task is completed, if the tasks have been assigned and there is an unfinished third task, split the unfinished part of the third task and assign the subtasks of the split third task to the computing node executing the second task;
[0189] When the subtasks of the second task are completed, if the tasks have been assigned and there is no uncompleted third task, it is determined that the plurality of tasks are completed.
[0190] For example, suppose there are 10 pending tasks and 5 available compute nodes. These 10 tasks are prioritized as Task 1, Task 2, Task 3, ..., Task 10, and the 5 technology nodes are prioritized as Compute Node 1, Compute Node 2, Compute Node 3, ..., Compute Node 5. Assuming all five compute nodes are initially idle, high-priority tasks are assigned to high-priority compute nodes: Task 1 is assigned to Compute Node 1, Task 2 to Compute Node 2, ..., and Task 5 to Compute Node 5. Since there are no idle nodes, the allocation is suspended. During the execution of these five tasks, Task 5 takes less time, so Compute Node 5 completes it first and becomes idle. Therefore, Compute Node 5 is designated as the first compute node. Since tasks have not yet been assigned, Task 6 is the currently unassigned task with the highest priority, so Task 6 is designated as the first task and assigned to Compute Node 5. As time goes by, while Task 6 is still incomplete, Compute Node 1 completes Task 1 and becomes an idle node, corresponding to the second compute node. At this point, the unfinished portion of Task 6 can be split into subtasks, and the subtasks can be assigned to Compute Node 1. As time goes by, after Task 6 is executed, Compute Node 1 and Compute Node 5 can be released. At this time, the tasks have not yet been fully assigned, so Task 7, the highest priority among the currently unassigned tasks, can be split in half and assigned to Compute Node 1 and Compute Node 5. If there are idle nodes, Task 7 will be split again until Task 10 is assigned. After Task 10 is assigned, if there are idle nodes, the assigned but unfinished Task 9 can be split so that Task 9 can be executed quickly. This continues until the last task is split across multiple compute nodes for parallel processing, at which point it can be determined that all 10 tasks have been processed.
[0191] In a specific embodiment of the present application, unassigned and highest priority tasks are assigned one by one to the computing nodes in an idle state and with the highest priority, including: assigning unassigned and highest priority tasks one by one to the computing nodes in an idle state and with the highest priority in the cross-domain multi-heterogeneous computing system. That is to say, when performing task assignment, tasks can be evenly assigned to the computing nodes in an idle state and with the highest priority in the cross-domain multi-heterogeneous computing system based on the principle of highest priority and unassigned.
[0192] In an embodiment of the present application, considering that the relevant multi-heterogeneous computing system may cause large communication overhead due to its network architecture, which affects the execution of tasks, a cross-domain multi-heterogeneous computing system is proposed, wherein the computing nodes in the cross-domain multi-heterogeneous computing system are located in multiple regions, and the multiple computing nodes include homogeneous nodes and heterogeneous nodes. For computing nodes located in multiple regions, for example, computing nodes 1-5 are in region 1, computing nodes 6-10 are in region 2, and computing nodes 11-15 are in region 3. The multiple computing nodes include homogeneous nodes and heterogeneous nodes, that is, there can be computing nodes with the same structure or computing nodes with different structures. For example, computing nodes 1-10 are all GPUs, and computing nodes 10-15 are all FPGAs.
[0193] The cross-domain multi-heterogeneous computing system includes: local tree topology and global mesh topology. Specifically, within the same region, computing nodes have a tree topology, while between different regions, a global mesh topology corresponds. Specifically, the root node of the local tree topology is the local master node; within the local tree topology, computing nodes have a tree-like topology communication connection; within the global mesh topology, local master nodes have a mesh-like topology communication connection.
[0194] Before allocating unassigned tasks with the highest priority one by one to idle computing nodes with the highest priority in the cross-domain multi-heterogeneous computing system, a cross-domain multi-heterogeneous computing system may be established between the multiple computing nodes.
[0195] Among them, a cross-domain multi-heterogeneous computing system is established between multiple computing nodes, including:
[0196] Step 1: Build a local tree topology of a cross-domain heterogeneous computing system within the domain;
[0197] Step 2: Build a global network topology of cross-domain multi-heterogeneous computing systems between different domains.
[0198] For ease of description, the above two steps are combined for explanation below.
[0199] Generally speaking, the topology design of a multi-heterogeneous computing system aims to fully utilize different types of computing resources and provide high-performance and efficient computing capabilities. Representative topologies include centralized topology and distributed topology.
[0200] Centralized topology: A central control node is typically used to manage and schedule multiple heterogeneous compute nodes. This architecture is suitable for small- and medium-scale cross-domain scenarios, where the centralized control node can monitor and adjust the task allocation and resource utilization of compute nodes in real time, while the edge compute nodes are primarily responsible for actual model training tasks.
[0201] Distributed topology: Heterogeneous computing nodes are distributed across multiple geographic locations, communicating and coordinating through network connections. This architecture is suitable for large-scale and distributed cross-domain scenarios, where computing nodes can select appropriate computing resources based on the characteristics and resource requirements of the task.
[0202] The two mainstream topologies mentioned above have different advantages and disadvantages. The following is a more detailed analysis of them:
[0203] The advantages of a centralized topology include:
[0204] ① Simple management: In a centralized topology, computing resources and control nodes are concentrated in a central location, which makes resource management and control easier and reduces the complexity of system management;
[0205] ② Communication efficiency: Since all computing nodes are connected to a central node, the communication paths between nodes are shorter, resulting in lower communication latency and higher bandwidth.
[0206] ③. Resource sharing: The centralized topology can more conveniently realize the sharing of computing resources. Different nodes can share data and computing results, thereby improving resource utilization.
[0207] Disadvantages of a centralized topology include:
[0208] ① Single point of failure: There is a central node in the centralized topology. If this node fails, the entire system will be severely affected or even unable to work, resulting in poor fault tolerance.
[0209] ② Scalability limitations: The centralized topology has poor scalability. When the number of computing nodes increases, the central node may become a bottleneck of the system, limiting the system's performance and scalability.
[0210] ③. Communication overhead: Since all nodes need to connect to the central node, when the number of nodes increases, the communication overhead between nodes will also increase, which may lead to communication bottlenecks.
[0211] The advantages of a distributed topology include:
[0212] ① High reliability: In a distributed topology, computing nodes in the system are dispersed across different locations. If a node fails, other nodes can still continue to work, improving the system's fault tolerance and reliability.
[0213] 2. High scalability: Distributed topology can expand the system's performance and capacity by adding more computing nodes. Nodes can process tasks in parallel, enabling the system to handle larger-scale computing tasks.
[0214] ③. Load balancing: Distributed topology can better achieve load balancing of tasks, reasonably distribute tasks to different computing nodes, and improve the overall performance and throughput of the system.
[0215] Disadvantages of a distributed topology include:
[0216] 1. Management complexity: Distributed topologies involve multiple computing nodes and network components. Managing and scheduling these nodes and components requires more complex management mechanisms and algorithms, increasing the complexity of system management.
[0217] Communication overhead: Computing nodes in a distributed topology may be located in different locations. Communication between nodes needs to be conducted over the network, which may result in high communication latency and bandwidth limitations.
[0218] ③. Data consistency: In a distributed topology, data consistency may be a challenge. Data on different nodes may need to be synchronized and shared, and a suitable data consistency mechanism needs to be designed.
[0219] In summary, centralized topologies are suitable for scenarios requiring simple management, high communication efficiency, and high resource sharing, but they have certain limitations in fault tolerance and scalability. Distributed topologies, on the other hand, are suitable for scenarios requiring high reliability, high scalability, and load balancing, but they must address management complexity, communication overhead, and data consistency. Therefore, the design of a cross-domain, multi-compute system architecture requires comprehensive consideration of factors such as specific application requirements, system scale, and resource constraints. A single topology architecture is difficult to adapt to diverse, heterogeneous scenarios, making selecting the right topology a primary challenge.
[0220] The embodiments of the present application adopt a cross-domain multi-heterogeneous computing node layered communication topology architecture. In a cross-domain scenario, the training system inevitably involves information exchange between multiple computing nodes distributed in different regions. Therefore, different types of computing nodes are hierarchically connected according to different network topologies to achieve efficient information fusion of local and global information. That is, within the same region, a local tree topology is built, while between different regions, a cross-domain multi-heterogeneous global network topology is built.
[0221] In the same area, when building a local tree topology, the communication cost between the calculation nodes can be used to build a local tree topology with the minimum communication cost.
[0222] Specifically, the process of obtaining the local tree topology includes:
[0223] Step 1: For the same domain, obtain the comprehensive communication cost between every two computing nodes.
[0224] The comprehensive communication cost is the comprehensive cost of communication between every two computing nodes.
[0225] The comprehensive communication cost may include the inherent overhead and delay overhead between each two computing nodes. That is, obtaining the comprehensive communication cost between each two computing nodes includes:
[0226] Obtain the inherent overhead and latency overhead between each two computing nodes;
[0227] The comprehensive communication cost between the two computing nodes is calculated based on the inherent overhead and the delay overhead.
[0228] The overall communication cost can be clarified by superimposing the inherent overhead and delay overhead. When superimposing, different weights can be set for the inherent overhead and delay overhead based on actual application requirements, thereby achieving weighted superposition.
[0229] For example, the overall communication cost between computing nodes A and B is: Cost(A, B). The specific calculation is: Cost(A, B) = α·I(A, B) + (1-α)D(A, B), where I(A, B) is the inherent cost and D(A, B) is the delay cost. That is, the overall cost between computing nodes A and B is equal to the linear combination of the inherent cost I(A, B) and the delay cost D(A, B), with the combination coefficient α, where 0 ≤ α ≤ 1. α = 0.5, or other values can be used.
[0230] Step 2: Based on the comprehensive communication cost, a local tree topology is established within the domain.
[0231] In other words, when building a local tree topology, it will be built based on the comprehensive communication cost. Specifically, the comprehensive communication cost can be used to select the root node and leaf nodes, as well as the connection relationship between nodes.
[0232] In a specific embodiment of the present application, a local tree topology is established within a domain based on the comprehensive communication cost, including:
[0233] In the same domain, a mesh topology is built based on computing nodes, and the corresponding comprehensive communication cost is represented on the edges of the mesh topology.
[0234] Randomly select a computing node from the mesh topology as the starting point, retain only the edge with the minimum comprehensive communication cost connected to the computing node, and retain only the edge with the minimum comprehensive communication cost connected to the next computing node until a chain topology is obtained;
[0235] Based on the chain topology, a local tree topology is established.
[0236] Among them, based on the chain topology, a local tree topology is established, including:
[0237] Select a midpoint from the chain topology and determine the midpoint as the root node of the local tree topology;
[0238] The nodes directly or indirectly connected to the root node are determined as leaf nodes of the local tree topology to obtain the local tree topology.
[0239] In a specific implementation of the present application, if the height of the local tree topology is greater than a specified value, the bottom leaf node is moved to the upper level.
[0240] For example, first obtain the inherent overhead caused by the communication distance between computing nodes (normalized data), as shown in Table 1. Assume that there are 6 computing nodes in the same area, and the inherent communication overhead between any two points is shown in Table 1 (Inherent Overhead Table between Computing Nodes).
[0241] Table 1
[0242] The communication delay overhead (normalized data) between computing nodes is obtained, as shown in Table 2. Assuming that there are 6 computing nodes in the same area, the communication delay overhead between any two of them is shown in Table 2 (Inter-computing Node Delay Overhead Table).
[0243] Table 2
[0244] Based on the comprehensive communication cost calculation formula, the comprehensive communication cost corresponding to the information in Table 1 and Table 2 is calculated, and the comprehensive communication cost is obtained, as shown in Table 3 (comprehensive communication cost between nodes).
[0245] Table 3
[0246] According to the comprehensive communication cost in Table 3, a topological structure diagram of 6 computing nodes is built, as shown in Figure 2, where the edge weight represents the comprehensive communication cost.
[0247] In Figure 2, a node is randomly selected as the starting point, and the edges with the minimum cost connected to it are retained. For example, if we select computation node 1 as the starting point and only retain the edges with the minimum weight connected to it, the result is shown in Figure 3.
[0248] Starting from node 3, only the minimum cost edge connected to it is retained, and the result after removing other edges is shown in Figure 4.
[0249] Repeat the above steps starting from node 2 until all minimum cost edges are selected. The result is shown in Figure 5.
[0250] Count the number of computing nodes N in the network topology and determine the parity of N to determine the link midpoint. For example, Figure 5 contains 6 computing nodes, so node 2 or node 3 can be selected as the midpoint.
[0251] The binary tree shown in FIG6 is constructed with the selected midpoint, that is, node 2, as the root node of the tree.
[0252] Considering that the height of the binary tree in Figure 6 is greater than [log2N]+1, the binary tree in Figure 6 can be adjusted. The specific adjustment process is as follows: move node 4 to the upper level, that is, hang node 4 below node 6, and adjust the cost accordingly (the combined communication cost from node 4 to node 6 is 7.5, so after the modification, the cost between node 4 and node 6 is 7.5), as shown in Figure 7.
[0253] The construction of the tree topology of the local nodes is completed, and the root node of the tree structure is the local leader node, that is, the local master node.
[0254] In a specific embodiment of the present application, the process of obtaining the global network topology includes:
[0255] Step 1: Determine the root node of the local tree topology as the local master node;
[0256] Step 2: Establish a communication connection between every two local master nodes to obtain a global network topology.
[0257] That is to say, for the global situation, the root node of the local tree topology can be directly determined as the local master node, and then every two local master nodes can be interconnected to obtain the global network topology.
[0258] As shown in Figure 8, assume that all computing nodes are distributed across four regions, designated Region A, Region B, Region C, and Region D. Computing nodes within the same region are called local nodes, and these nodes are organized in a hierarchical tree topology. Furthermore, a leader node, or local master node, is selected within each region based on specific metrics. Leader nodes across regions are connected in a mesh topology. Therefore, through the local tree topology and the global mesh topology, computing nodes in different regions can synchronize and exchange information.
[0259] In order to facilitate those skilled in the art to better understand the load balancing method provided in the embodiments of the present application, the load balancing method is described in detail below with reference to specific examples.
[0260] Implementing this load balancing method includes:
[0261] Step 1. Calculate the unit benefits UB(X) for each of the five computing tasks A, B, C, D, and E, and arrange them in descending order. Without loss of generality, assume that UB(A) > UB(B) > UB(C) > UB(D) > UB(E). Please refer to Figure 9, which is a schematic diagram of the execution time of a task in this embodiment.
[0262] Step 2: Calculate the importance indices of the three computing nodes based on the computing node importance evaluation index Inf(X) and sort them in descending order. Without loss of generality, assume that Inf(node 1) > Inf(node 2) > Inf(node 3).
[0263] Step 3: According to the principle of allocating important computing tasks to important computing nodes, assuming that all three nodes are idle, computing task A is allocated to node 1, computing task B is allocated to node 2, and computing task C is allocated to node 3, as shown in Figure 10.
[0264] Step 4: Since computing task B has the shortest execution time, computing task D is immediately assigned to computing node 2 after computing task B is completed, thereby avoiding idle resources. The execution status of computing tasks is shown in Figure 11.
[0265] Step 5: After computing task A is completed, consider splitting computing task D equally between computing nodes 1 and 2 (as shown in Figure 12, where D1 and D2 are assigned to computing nodes 1 and 2, respectively). The specific implementation is shown in Figure 12.
[0266] Step 6: After computing task D is completed, computing node 3 is still working, and computing nodes 1 and 2 are idle. Therefore, consider evenly distributing computing task E between computing nodes 1 and 2 (as shown in the figure, E1 and E2 are assigned to computing nodes 1 and 2, respectively). The specific implementation is shown in Figure 13.
[0267] Step 7: After computing task C is completed, consider spreading computing task E to computing node 3 to achieve load balancing. The specific execution is shown in Figure 14.
[0268] In summary, the total execution time of the computing task under the load balancing strategy of this application is:
[0269] To compare the load balancing strategy of the present application to shorten the total execution time of tasks, another load balancing strategy and its corresponding total execution time are listed below.
[0270] Step 1: Following the principle of assigning important computing tasks to important computing nodes, assign computing task A to node 1, computing task B to node 2, and computing task C to node 3. This is shown in Figure 10. The execution times of tasks A, B, C, D, and E can be found in Figure 9.
[0271] Step 2: After computing task B is completed, computing task D is assigned to computing node 2, as shown in Figure 15.
[0272] Step 3: After computing task A is completed, computing task E is completely allocated to computing node 1, as shown in Figure 16.
[0273] In summary, the total execution time of the computing task under this load balancing strategy is: t1+t5.
[0274] Comparing the two, it can be found that the execution time of the computing task of this application is In addition, the computing nodes in this application will not be idle, so the load is more balanced.
[0275] This application proposes a load balancing solution for multi-heterogeneous computing systems in cross-domain scenarios. To this end, two main functional modules are designed: a distributed system communication topology design module and a load balancing design module.
[0276] The technical effects of this application include but are not limited to the following two aspects:
[0277] 1. Considering cross-domain scenarios, a hierarchical hybrid tree-mesh distributed computing system architecture was proposed. On the one hand, the tree topology offers advantages such as low latency and data isolation, avoiding the communication congestion issues inherent in the parameter server architecture. On the other hand, the mesh topology offers greater flexibility, higher communication efficiency, and improved scalability.
[0278] 2. This application proposes a load balancing strategy, designs key evaluation indicators for computing tasks and computing resources, and a strategy for optimal matching of tasks and resources. These measures or methods facilitate load balancing.
[0279] This invention can be widely applied to task-intensive and computation-intensive application scenarios, such as artificial intelligence model training, data centers, intelligent network systems, distributed computing systems, and wireless sensor networks. This invention touches upon numerous fields, including artificial intelligence, data centers, cloud computing, and network traffic scheduling. Researchers can use the invented algorithm to understand how the dynamic balance between memory usage and communication overhead is achieved during parallel training, thereby better solving similar problems within the field. Therefore, the potential market is large.
[0280] Corresponding to the above method embodiment, the embodiment of the present application further provides a load balancing device. The load balancing device described below and the load balancing method described above can refer to each other.
[0281] As shown in FIG17 , the device includes the following modules:
[0282] A priority acquisition module 101 is used to acquire the priorities of multiple tasks and multiple computing nodes;
[0283] The task initialization allocation module 102 is used to allocate the unassigned tasks with the highest priority to the computing nodes with the highest priority in the idle state one by one until there are no idle computing nodes or the tasks are allocated;
[0284] The task splitting and assigning module 103 is configured to split the unfinished portion of the assigned first task into subtasks if the first computing node completes the currently assigned task, and assign the subtasks to the first computing node.
[0285] By using the device provided in the embodiment of the present application, the priorities of multiple tasks and the priorities of multiple computing nodes are obtained; the unassigned and highest-priority tasks are assigned to the idle and highest-priority computing nodes one by one until there are no idle computing nodes or the tasks are assigned; if the first computing node completes the currently assigned task, subtasks are split from the unfinished part of the assigned first task and the subtasks are assigned to the first computing node.
[0286] In this application, the priorities of multiple tasks and multiple compute nodes are first obtained. Then, the task with the highest priority is assigned to the highest-priority, idle compute node among the compute nodes. That is, when assigning tasks, not only the task priority but also the compute node priority and whether the compute node is idle are considered. By assigning tasks one by one, the highest-priority task is assigned to the idle compute node with the highest priority, while the next-highest-priority task is assigned to the next-highest-priority idle compute node, and so on, until no idle compute nodes are available or all tasks have been assigned. If the first compute node completes the currently assigned task, subtasks are split from the unfinished portion of the assigned first task and assigned to the first compute node. The unfinished portion of the first task is split, and the resulting subtasks are assigned to the first compute node. That is, for the same task, if idle compute nodes become available after compute nodes have been assigned, the task can be split and redistributed to avoid overloading some compute nodes or leaving others idle. Having multiple compute nodes handle the same task can also shorten the time it takes to complete the task.
[0287] The technical effect of this application is: based on the priority of tasks and computing nodes, and the idle status of computing nodes, on-demand allocation and multiple splitting and redistribution are performed to achieve load balancing, thereby accelerating the completion efficiency of the overall task and improving the overall performance of the system.
[0288] In a specific embodiment of the present application, the task splitting and allocation module is specifically configured to allocate a first task with the highest priority among the unallocated tasks to the first computing node if the first computing node completes the currently allocated task when the tasks are not yet allocated;
[0289] When the first task has not been completed by the first computing node, if the second computing node completes the currently assigned task, the unfinished part of the first task is split and the resulting subtasks are respectively assigned to the first computing node and the second computing node.
[0290] In a specific embodiment of the present application, the task splitting and allocation module is specifically used to, when there are no unassigned tasks, if N first computing nodes have completed the currently assigned tasks, split the unprocessed part of the first task assigned to the third computing node into N+1 subtasks, and assign the N subtasks after splitting to the N first computing nodes respectively.
[0291] In a specific embodiment of the present application, the task splitting and assigning module is specifically configured to select, from the assigned tasks, a task with a longest pending execution time as the first task;
[0292] Split the part to be executed into N+1 subtasks.
[0293] In a specific implementation of the present application, the task splitting and allocation module is specifically used to split the to-be-executed part into N+1 equal parts to obtain N+1 subtasks.
[0294] In a specific embodiment of the present application, the task splitting and assigning module is specifically configured to randomly select an unfinished task from the assigned tasks and determine it as the first task;
[0295] Split the unprocessed part of the first task into N+1 parts, obtaining N+1 subtasks.
[0296] In a specific embodiment of the present application, the priority acquisition module is specifically used to obtain the unit benefits of multiple tasks;
[0297] Leverage unit efficiency to prioritize multiple tasks.
[0298] In a specific embodiment of the present application, the priority acquisition module is specifically used to obtain the execution time, task benefits and task costs of multiple tasks;
[0299] The difference between the task benefit and the task cost of a single task is calculated, and the ratio of the difference to the execution time is determined as the unit benefit of the task.
[0300] In a specific implementation of the present application, the priority acquisition module is specifically configured to read the priority of the computing node from a storage medium.
[0301] In a specific embodiment of the present application, the priority acquisition module is specifically configured to obtain a performance-cost ratio of a plurality of computing nodes before reading the priority of the computing node from the storage medium;
[0302] Use performance-cost ratio to determine the priority of multiple computing nodes;
[0303] The priority information is stored in a storage medium.
[0304] In a specific embodiment of the present application, the priority acquisition module is specifically used to obtain the computing capacity, communication bandwidth, failure rate and power consumption of multiple computing nodes;
[0305] For a single computing node, the product of 1 minus the failure rate, computing power, and communication bandwidth is calculated, and the ratio of the product to the power consumption is determined as the performance-cost ratio of the computing node.
[0306] In a specific embodiment of the present application, unassigned tasks with the highest priority are assigned one by one to the computing nodes with the highest priority that are in an idle state, including:
[0307] Sort the tasks according to their priorities to get a task queue;
[0308] Sort the idle computing nodes according to their priorities to obtain a node queue.
[0309] Assign tasks in the task queue to the computing nodes in the node queue one by one.
[0310] In a specific embodiment of the present application, the task initialization allocation module is specifically used to allocate unassigned and highest priority tasks one by one to the idle and highest priority computing nodes in the cross-domain multi-heterogeneous computing system.
[0311] In a specific embodiment of the present application, computing nodes in a cross-domain multi-heterogeneous computing system are located in multiple regions, and the multiple computing nodes include homogeneous nodes and heterogeneous nodes.
[0312] In a specific embodiment of the present application, the cross-domain multi-heterogeneous computing system includes: a local tree topology and a global network topology.
[0313] In a specific embodiment of the present application, the root node of the local tree topology is the local master node;
[0314] In the local tree topology, there are tree-topology communication connections between computing nodes;
[0315] In the global mesh topology, local master nodes have mesh topology communication connections.
[0316] In a specific embodiment of the present application, the process of obtaining the local tree topology includes:
[0317] For the same domain, obtain the comprehensive communication cost between every two computing nodes;
[0318] Based on the comprehensive communication cost, a local tree topology is established within the domain.
[0319] In a specific embodiment of the present application, obtaining the comprehensive communication cost between every two computing nodes includes:
[0320] Obtain the inherent overhead and latency overhead between each two computing nodes;
[0321] The comprehensive communication cost between the two computing nodes is calculated based on the inherent overhead and the delay overhead.
[0322] In a specific embodiment of the present application, a local tree topology is established within a domain based on the comprehensive communication cost, including:
[0323] In the same domain, a mesh topology is built based on computing nodes, and the corresponding comprehensive communication cost is represented on the edges of the mesh topology.
[0324] Randomly select a computing node from the mesh topology as the starting point, retain only the edge with the minimum comprehensive communication cost connected to the computing node, and retain only the edge with the minimum comprehensive communication cost connected to the next computing node until a chain topology is obtained;
[0325] Based on the chain topology, a local tree topology is established.
[0326] In a specific embodiment of the present application, establishing a local tree topology includes:
[0327] Select a midpoint from the chain topology and determine the midpoint as the root node of the local tree topology;
[0328] The nodes directly or indirectly connected to the root node are determined as leaf nodes of the local tree topology to obtain the local tree topology.
[0329] In a specific embodiment of the present application, it also includes:
[0330] If the height of the local tree topology is greater than the specified value, the leaf node at the bottom level is moved to the upper level.
[0331] In a specific embodiment of the present application, the process of obtaining the global network topology includes:
[0332] Determine the root node of the local tree topology as the local master node;
[0333] A communication connection is established between every two local master nodes to obtain a global network topology.
[0334] In a specific embodiment of the present application, the task splitting and allocation module is specifically configured to allocate a first task with the highest priority among the unallocated tasks to the first computing node if the first computing node completes the currently allocated task when the tasks have not yet been allocated;
[0335] If the first task is not completed by the first computing node, and the second computing node completes the currently assigned task, the second computing node splits the unfinished part of the first task and assigns the resulting subtasks to the first computing node and the second computing node respectively.
[0336] When the subtasks of the first task are completed, if the tasks have not been assigned yet, the second task with the highest priority among the unassigned tasks is split to obtain subtasks of the second task, and the subtasks of the second task are assigned to the first computing node and the second computing node;
[0337] In the case where the subtasks of the second task have not been completed, if the tasks have been assigned and the fourth computing node has completed the currently assigned tasks, the unfinished parts of the subtasks after the second task is split are split to obtain new subtasks, and the new subtasks are assigned to the first computing node, the second computing node, and the fourth computing node;
[0338] When the second task is completed, if the tasks have been assigned and there is an unfinished third task, split the unfinished part of the third task and assign the subtasks of the split third task to the computing node executing the second task;
[0339] When the subtasks of the second task are completed, if the tasks have been assigned and there is no uncompleted third task, it is determined that the plurality of tasks are completed.
[0340] Corresponding to the above method embodiment, an embodiment of the present application further provides an electronic device. The electronic device described below and the load balancing method described above can refer to each other.
[0341] As shown in FIG18 , the electronic device includes:
[0342] Memory 332, for storing computer programs;
[0343] The processor 322 is configured to implement the steps of the load balancing method of the above method embodiment when executing a computer program.
[0344] Specifically, please refer to Figure 19, which is a schematic diagram of the specific structure of an electronic device provided in this embodiment. The electronic device may have relatively large differences due to different configurations or performances, and may include one or more processors (central processing units, CPU) 322 (for example, one or more processors) and a memory 332, and the memory 332 stores one or more computer programs 342 or data 344. Among them, the memory 332 can be a temporary storage or a permanent storage. The program stored in the memory 332 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations in the data processing device. Furthermore, the processor 322 can be configured to communicate with the memory 332 to execute a series of instruction operations in the memory 332 on the electronic device 301.
[0345] The electronic device 301 may further include one or more power supplies 326 , one or more wired or wireless network interfaces 350 , one or more input / output interfaces 358 , and / or one or more operating systems 341 .
[0346] The steps in the load balancing method described above can be implemented by the structure of an electronic device.
[0347] Corresponding to the above method embodiment, an embodiment of the present application further provides a non-volatile readable storage medium. The non-volatile readable storage medium described below and the load balancing method described above can refer to each other.
[0348] A non-volatile readable storage medium stores a computer program, which implements the steps of the load balancing method of the above method embodiment when executed by a processor.
[0349] The non-volatile readable storage medium can specifically be any non-volatile readable storage medium that can store program code, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0350] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from the other embodiments. Reference can be made to the descriptions of the identical or similar parts of the various embodiments. The devices disclosed in the embodiments are described briefly because they correspond to the methods disclosed in the embodiments. For relevant details, refer to the descriptions of the methods.
[0351] Those skilled in the art may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0352] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0353] Finally, it should be noted that, in this document, relationships such as first and second, etc., are used solely to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms include, comprise, or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that includes a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus.
[0354] This document uses specific examples to illustrate the principles and implementation methods of this application. The description of the above embodiments is only used to help understand the method and core ideas of this application. At the same time, for those skilled in the art, based on the ideas of this application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as limiting this application.
Claims
1. A load balancing method, characterized in that: include: Get the priorities of multiple tasks and multiple computing nodes; Assign the unassigned and highest priority tasks to the idle and highest priority computing nodes one by one until there are no idle computing nodes or all tasks are assigned; If the first computing node completes the currently assigned task, a subtask is split from the uncompleted portion of the assigned first task, and the subtask is assigned to the first computing node.
2. The load balancing method according to claim 1, characterized in that: If the first computing node completes the currently assigned task, splitting the uncompleted part of the assigned first task into subtasks, and assigning the subtasks to the first computing node, includes: In the case where the tasks have not been allocated, if the first computing node has completed the currently allocated tasks, the first task with the highest priority among the unallocated tasks is allocated to the first computing node; When the first task has not been completed by the first computing node, if the second computing node completes the currently assigned task, the unfinished part of the first task is split and the resulting subtasks are respectively assigned to the first computing node and the second computing node.
3. The load balancing method according to claim 1, characterized in that: If the first computing node completes the currently assigned task, splitting the uncompleted part of the assigned first task into subtasks, and assigning the subtasks to the first computing node, includes: In the case where there are no unassigned tasks, if the N first computing nodes complete the currently assigned tasks, the unprocessed part of the first task assigned to the third computing node is split into N+1 subtasks, and the N subtasks after the split are respectively assigned to the N first computing nodes.
4. The load balancing method according to claim 3, characterized in that: The step of splitting the unprocessed portion of the first task assigned to the third computing node into N+1 subtasks includes: From the assigned tasks, the task with the longest waiting time to be executed is selected as the first task; The to-be-executed part is split into N+1 subtasks.
5. The load balancing method according to claim 4, characterized in that: The to-be-executed part is divided into N+1 subtasks, including: The to-be-executed part is divided into N+1 equal parts to obtain N+1 subtasks.
6. The load balancing method according to claim 3, characterized in that: The step of splitting the unprocessed portion of the first task assigned to the third computing node into N+1 subtasks includes: Randomly select an unfinished task from the assigned tasks to be determined as the first task; The unprocessed part of the first task is split into N+1 parts to obtain N+1 subtasks.
7. The load balancing method according to claim 1, characterized in that: The obtaining of priorities of multiple tasks includes: Get unit benefits for multiple tasks; The unit benefits are used to determine priorities of the plurality of tasks.
8. The load balancing method according to claim 7, characterized in that: The unit benefits of obtaining multiple tasks include: Get the execution time, task benefits and task costs of multiple tasks; The task benefit of a single task is subtracted from the task cost, and the ratio of the difference to the execution time is determined as the unit benefit of the task.
9. The load balancing method according to claim 1, characterized in that: Get the priorities of multiple compute nodes, including: The priority of the computing node is read from a storage medium.
10. The load balancing method according to claim 9, characterized in that: Before reading the priority of the computing node from the storage medium, the method further includes: Obtain the performance-cost ratio of multiple computing nodes; Determining the priorities of multiple computing nodes using the performance-cost ratio; The priority information is stored in the storage medium.
11. The load balancing method according to claim 10, characterized in that: Get the performance-cost ratio of multiple computing nodes, including: Obtain the computing power, communication bandwidth, failure rate, and power consumption of multiple computing nodes; For a single computing node, 1 minus the product of the failure rate, the computing capacity and the communication bandwidth is calculated, and a ratio of the product to the power consumption is determined as the performance cost ratio of the computing node.
12. The load balancing method according to claim 1, characterized in that: Assign the unassigned and highest priority tasks to the idle and highest priority computing nodes one by one, including: Sort the tasks according to their priorities to obtain a task queue; Sort the idle computing nodes according to their priorities to obtain a node queue; The tasks in the task queue are assigned to the computing nodes in the node queue one by one in sequence.
13. The load balancing method according to any one of claims 1 to 12, characterized in that: Assign the unassigned and highest priority tasks to the idle and highest priority computing nodes one by one, including: The unassigned tasks with the highest priority are assigned one by one to the computing nodes with the highest priority in the idle state in the cross-domain multi-heterogeneous computing system.
14. The load balancing method according to claim 13, characterized in that: The computing nodes in the cross-domain multi-heterogeneous computing system are located in multiple regions, and the multiple computing nodes include homogeneous nodes and heterogeneous nodes.
15. The load balancing method according to claim 13, characterized in that: The cross-domain multi-heterogeneous computing system includes: a local tree topology and a global network topology.
16. The load balancing method according to claim 15, characterized in that: include: The root node of the local tree topology is the local master node; In the local tree topology, there are tree topology communication connections between computing nodes; In the global mesh topology, the local master nodes are connected in mesh topology communication.
17. The load balancing method according to claim 16, characterized in that: The process of obtaining the local tree topology includes: For the same domain, obtain the comprehensive communication cost between every two computing nodes; Based on the comprehensive communication cost, a local tree topology is established within the domain.
18. The load balancing method according to claim 17, characterized in that: Get the comprehensive communication cost between each two computing nodes, including: Obtain the inherent overhead and latency overhead between every two computing nodes; The comprehensive communication cost between the two computing nodes is calculated based on the inherent overhead and the delay overhead.
19. The load balancing method according to claim 17, characterized in that: Based on the comprehensive communication cost, a local tree topology is established in the domain, including: In the same domain, a mesh topology is built based on computing nodes, and corresponding comprehensive communication costs are represented on the edges of the mesh topology; Randomly select a computing node from the mesh topology as a starting point, retain only the edge with the minimum comprehensive communication cost connected to the computing node, and retain only the edge with the minimum comprehensive communication cost connected to the next computing node until a chain topology is obtained; Based on the chain topology, the local tree topology is established.
20. The load balancing method according to claim 19, characterized in that: Based on the chain topology, establishing the local tree topology includes: Selecting a midpoint from the chain topology and determining the midpoint as a root node of the local tree topology; The nodes directly or indirectly connected to the root node are determined as leaf nodes of the local tree topology to obtain the local tree topology.
21. The load balancing method according to claim 20, characterized in that: Also includes: If the height of the local tree topology is greater than a specified value, the bottom leaf node is moved to the upper level.
22. The load balancing method according to claim 16, characterized in that: The process of acquiring the global network topology includes: Determine the root node of the local tree topology as the local master node; A communication connection is established between every two local master nodes to obtain the global network topology.
23. The load balancing method according to claim 1, characterized in that: If the first computing node completes the currently assigned task, splitting a subtask from an uncompleted portion of the assigned first task, and assigning the subtask to the first computing node includes: In the case where the tasks have not been allocated, if the first computing node completes the currently allocated tasks, the first task with the highest priority among the unallocated tasks is allocated to the first computing node; In the case that the first task has not been completed by the first computing node, if the second computing node completes the currently assigned task, after splitting the unfinished part of the first task, the subtasks obtained by splitting are respectively assigned to the first computing node and the second computing node; When the subtasks of the first task are executed, if the tasks have not been allocated, split the second task with the highest priority among the unallocated tasks to obtain subtasks of the second task, and allocate the subtasks of the second task to the first computing node and the second computing node; In the case where the subtasks of the second task have not been completed, if the tasks have been allocated and the fourth computing node has completed the currently allocated tasks, the uncompleted parts of the subtasks after the second task is split are split to obtain new subtasks, and the new subtasks are allocated to the first computing node, the second computing node and the fourth computing node; When the second task is completed, if the tasks have been assigned and there is currently an uncompleted third task, split the unfinished part of the third task, and assign the split subtasks of the third task to the computing node executing the second task; In the case that the subtasks of the second task are completed, if the tasks have been assigned and there is no uncompleted third task, it is determined that the plurality of tasks are completed.
24. A load balancing device, characterized in that: include: A priority acquisition module is used to obtain the priorities of multiple tasks and multiple computing nodes; The task initialization allocation module is used to allocate the unallocated tasks with the highest priority to the computing nodes with the highest priority in the idle state one by one until there are no idle computing nodes or the tasks are allocated; The task splitting and assigning module is used to split the unfinished part of the assigned first task into subtasks if the first computing node completes the currently assigned task, and assign the subtasks to the first computing node.
25. An electronic device, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the steps of the load balancing method as claimed in any one of claims 1 to 23 when executing the computer program.
26. A non-volatile readable storage medium, characterized in that: The non-volatile readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the load balancing method according to any one of claims 1 to 23 are implemented.
Citation Information
Patent Citations
Task scheduling method and system based on distributed configurable weighting algorithm
CN103984594A
Distributed computing method and system and computer equipment
CN109769032A
Task scheduling method and device based on CPU-GPU cooperative computing
CN112596902A
Load balancing method, device and equipment and readable storage medium
CN116700993A
Decentralized load distribution in an event-driven system
US20110047555A1
Cited By
Large model training method and system based on green distributed computing power center
CN120450088A