Task scheduling method, device, equipment, storage medium and product
By constructing the task dependency matrix, cost matrix and task allocation matrix, the task scheduling is optimized, the problem of node computing overhead and communication time coordination in the heterogeneous communication network is solved, and the task processing efficiency is improved.
Patent Information
- Application Number
- CN202411040491.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-31
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2044-07-31
AI Technical Summary
In heterogeneous communication networks, it is difficult for the existing ant colony algorithm to effectively coordinate the computing overhead and communication time of nodes, resulting in an increase in the overall overhead during task processing. Especially in the case of a large number of nodes and tasks, the computational complexity increases significantly. Unable to meet task processing needs.
By determining the task dependency matrix, cost matrix and task allocation matrix, the final completion cost of each subtask is calculated, and the subtasks with priority in execution order are assigned to the node with the lowest final completion cost to achieve task scheduling.
It reduces the computational overhead during task processing, improves communication efficiency, enables task scheduling and processing in a shorter time, and meets the needs of different types of tasks in heterogeneous communication networks.
Smart Images

Figure CN118567818B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a task scheduling method, device, equipment, storage medium and product. Background Art
[0002] With the continuous development of communication technology and the continuous expansion of application scenarios, HCN (Heterogeneous Communication Network) has become an important architecture in the field of modern communications. Distributed heterogeneous communication networks use different types of nodes to complete the calculation of different types of tasks. Nodes will generate corresponding overhead in the process of computing tasks. Different types of tasks have different focuses on overhead. Some computing tasks have high requirements for the computing overhead of nodes, and some communication tasks focus on the data transmission of nodes. For heterogeneous communication modes, task scheduling algorithms need to meet the needs of both types of tasks at the same time, that is, task scheduling algorithms should meet the coordination and balance between the computing overhead and communication time of nodes to reduce the overall overhead in the task processing process.
[0003] In related technologies, the idea of ant colony algorithm is adopted to allocate tasks by comprehensively considering factors such as the load capacity of cloud computing system nodes, task waiting time, load balancing performance, etc.
[0004] However, the ant colony algorithm requires a lot of computing resources and communication time for iteration and search process. In the case of a large number of nodes and tasks, the computational complexity of the algorithm may increase significantly, which makes it impossible to meet the coordination and balance between the computational overhead and communication time of the nodes, resulting in an increase in the overall overhead of task processing. Summary of the invention
[0005] The embodiments of the present application provide a task scheduling method, apparatus, device, storage medium and product, aiming to reduce the computing overhead in the task processing process and improve communication efficiency.
[0006] The present application embodiment provides a task scheduling method, the task scheduling method comprising:
[0007] Determine a current task dependency matrix, a cost matrix, and a task allocation matrix, wherein the task dependency matrix represents the execution order and dependency relationship between the subtasks to be executed at present;
[0008] Determining the final completion cost of each of the subtasks according to the task dependency matrix, the cost matrix and the task allocation matrix;
[0009] Determine a target node allocation scheme according to the final completion cost of each of the subtasks, wherein the target node allocation scheme is used to allocate the subtask with the current execution order priority to the node with the lowest final completion cost;
[0010] Each subtask is dispatched to a corresponding node for processing based on the target node allocation scheme.
[0011] Optionally, determining a cost matrix includes:
[0012] Obtaining task information of each of the current subtasks;
[0013] According to the task information, a data allocation matrix, a computing overhead matrix, a data migration overhead matrix, a result delivery overhead matrix and a queuing overhead matrix are constructed;
[0014] The cost matrix is obtained according to the data allocation matrix, the computational overhead matrix, the data migration overhead matrix, the result delivery overhead matrix and the queuing overhead matrix.
[0015] Optionally, the step of constructing a data allocation matrix, a computing cost matrix, a data migration cost matrix, a result delivery cost matrix and a queuing cost matrix according to the task information includes:
[0016] According to the task information, the storage location of the data of each subtask in the node, the computing cost of each subtask in the node, the data migration cost between nodes, the current queuing cost of each node, the input data volume of each subtask and the output data volume of each subtask are obtained;
[0017] The data allocation matrix is constructed according to the storage location of the data of each subtask in the node, the computational cost matrix is constructed according to the computational cost of each subtask in the node, the data migration cost matrix is constructed according to the data migration cost between the nodes and the input data volume of each subtask, the result delivery cost matrix is constructed according to the data migration cost between the nodes and the output data volume of each subtask, and the queuing cost matrix is constructed according to the queuing cost of each current node.
[0018] Optionally, the step of determining the final completion cost of each of the subtasks according to the task dependency matrix, the cost matrix and the task allocation matrix includes:
[0019] According to the task allocation matrix, the queuing cost matrix, the calculation cost matrix and the result delivery cost matrix, the total cost of each subtask when it is locally executed is obtained;
[0020] According to the data migration cost matrix, the queuing cost matrix, the calculation cost matrix and the result delivery cost matrix, the total cost of each subtask when it belongs to the migration execution is obtained;
[0021] Obtaining the total cost of each of the subtasks according to the total cost of each of the subtasks when being locally executed and the total cost of each of the subtasks when being migrated and executed;
[0022] The final completion cost of each of the subtasks is obtained according to the total cost of each of the subtasks and the task dependency matrix.
[0023] Optionally, obtaining the total overhead of each subtask when it is locally executed according to the task allocation matrix, the queuing overhead matrix, the calculation overhead matrix and the result delivery overhead matrix includes:
[0024] Obtaining a local queuing time according to the task allocation matrix and the queuing overhead matrix, obtaining a local computing time according to the task allocation matrix and the computing overhead matrix, and obtaining a local delivery time according to the task allocation matrix and the result delivery overhead matrix;
[0025] According to the local queuing time, the local calculation time and the local delivery time, the total overhead of each subtask when it is executed locally is obtained;
[0026] The total cost of each subtask when being executed under migration is obtained according to the data migration cost matrix, the queuing cost matrix, the calculation cost matrix and the result delivery cost matrix, including:
[0027] Determine the migration transmission overhead according to the data migration overhead matrix, obtain the queuing overhead according to the queuing overhead matrix, obtain the post-migration processing time according to the calculation overhead matrix, and obtain the result delivery overhead according to the result delivery overhead matrix;
[0028] The total cost of each of the subtasks when being executed in migration is obtained according to the maximum cost of the migration transmission cost and the queuing cost, the post-migration processing time and the result delivery cost.
[0029] Optionally, determining the current task dependency matrix includes:
[0030] Get the current network architecture mode;
[0031] If the network architecture mode is a synchronous gradient network architecture mode, the task dependency matrix is constructed according to the execution order and dependency relationship between each subtask, wherein each row of the task dependency matrix represents the time required for subtask calculation, which is sorted from fast to slow, and the last row of the task dependency matrix represents that the calculation time of the node corresponding to the subtask is the longest.
[0032] Optionally, determining the task allocation matrix includes:
[0033] Traverse each row in the task dependency matrix to obtain a list of dependent nodes for each node;
[0034] For each dependent node in the dependent node list, each dependent node is added to a directed graph, wherein the connection relationship between the node and the dependent node serves as an edge of the directed graph;
[0035] Determining an execution order of each subtask based on the directed graph;
[0036] According to the execution order of each subtask, the node with the lowest computational cost of each subtask is found from the current nodes to obtain the task allocation matrix.
[0037] In addition, to achieve the above purpose, the present application also provides a task scheduling device, including:
[0038] A matrix determination module, used to determine the current task dependency matrix, determine the cost matrix and determine the task allocation matrix, wherein the task dependency matrix represents the execution order and dependency relationship between the subtasks to be executed at present;
[0039] An overhead determination module, used to determine the final completion overhead of each of the subtasks according to the task dependency matrix, the cost matrix and the task allocation matrix;
[0040] A target node allocation scheme determination module is used to determine a target node allocation scheme according to the final completion cost of each of the subtasks, wherein the target node allocation scheme is used to allocate the subtask with the current execution order priority to the node with the lowest final completion cost;
[0041] The scheduling module is used to schedule each subtask to a corresponding node for processing based on the target node allocation scheme.
[0042] In addition, to achieve the above-mentioned purpose, the present application also provides a task scheduling device including: a memory, a processor, and a task scheduling program stored in the memory and executable on the processor, wherein the task scheduling program implements the steps of the above-mentioned task scheduling method when executed by the processor.
[0043] In addition, to achieve the above-mentioned purpose, the present application also provides a computer-readable storage medium on which a task scheduling program is stored, and when the task scheduling program is executed by a processor, the steps of the above-mentioned task scheduling method are implemented.
[0044] In addition, to achieve the above-mentioned purpose, the present application also provides a computer program product, which includes a task scheduling program, and when the task scheduling program is executed by a processor, the steps of the task scheduling method described above are implemented.
[0045] A technical solution of a task scheduling method, device, equipment, storage medium and product provided in the embodiments of the present application. The present application determines the final completion cost of each subtask based on the current task dependency matrix, cost matrix and task allocation matrix, and determines the target node allocation plan of the subtask based on the final completion cost of each subtask. The present application can allocate the subtask with a higher current execution order to the node with the lowest current node cost, that is, allocate the subtask to the node with the minimum completion time, and can realize task scheduling processing in a shorter time, reduce the computational overhead in the task processing process, and improve communication efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] Figure 1 A schematic diagram of the structure of the hardware operating environment involved in the embodiment of the present application;
[0047] Figure 2 This is a flow chart of an embodiment of a task scheduling method of the present application;
[0048] Figure 3 This is a functional module diagram of the task scheduling device of this application.
[0049] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. The above-mentioned drawings are only an embodiment diagram, not the entire invention. DETAILED DESCRIPTION
[0050] It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0051] Reference Figure 1 , Figure 1 This is a schematic diagram of the structure of the hardware operating environment of the task scheduling device involved in the embodiment of the present application.
[0052] like Figure 1As shown, the task scheduling device may include: a processor 1001, such as a CPU, a memory 1005, a user interface 1003, a network interface 1004, and a communication bus 1002. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen, an input unit such as a keyboard, and the user interface 1003 may optionally include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory, or a stable memory, such as a disk memory. The memory 1005 may optionally be a storage device independent of the aforementioned processor 1001.
[0053] Those skilled in the art will understand that Figure 1 The task scheduling device structure shown in the figure does not constitute a limitation on the task scheduling device, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.
[0054] like Figure 1 As shown, the memory 1005 as a storage medium may include an operating system, a network communication module, a user interface module and a task scheduler. The operating system is a program that manages and controls the hardware and software resources of the task scheduling device, the task scheduler and the operation of other software or programs.
[0055] exist Figure 1 In the task scheduling device shown, the user interface 1003 is mainly used to connect to the terminal and communicate data with the terminal; the network interface 1004 is mainly used for the background server and communicates data with the background server; the processor 1001 can be used to call the task scheduling program stored in the memory 1005.
[0056] In this embodiment, the task scheduling device includes: a memory 1005, a processor 1001, and a task scheduling program stored in the memory and executable on the processor, wherein:
[0057] When the processor 1001 calls the task scheduling program stored in the memory 1005, the following operations are performed:
[0058] Determine a current task dependency matrix, a cost matrix, and a task allocation matrix, wherein the task dependency matrix represents the execution order and dependency relationship between the subtasks to be executed at present;
[0059] Determining the final completion cost of each of the subtasks according to the task dependency matrix, the cost matrix and the task allocation matrix;
[0060] Determine a target node allocation scheme according to the final completion cost of each of the subtasks, wherein the target node allocation scheme is used to allocate the subtask with the current execution order priority to the node with the lowest final completion cost;
[0061] Each subtask is dispatched to a corresponding node for processing based on the target node allocation scheme.
[0062] The embodiment of the present application provides a task scheduling method. The task scheduling method of the present application is applied to a distributed heterogeneous communication network. In a distributed heterogeneous communication network, the calculation of communication tasks between different nodes involves multiple aspects, including the selection of communication protocols, the mode of data transmission, the division and allocation of tasks, etc. Different nodes may support different communication protocols. Therefore, when calculating communication tasks, one or more communication protocols need to be selected to ensure that data can be correctly transmitted between nodes. This may require consideration of factors such as the hardware and software capabilities of the nodes, network bandwidth, and delay. In a distributed heterogeneous communication network, the mode of data transmission may be point-to-point communication, broadcast communication, multicast communication, or cluster communication. Which mode is selected depends on the specific requirements of the communication task and the status of the network. For example, if data needs to be synchronized to all nodes, then broadcast communication may be a good choice; if data only needs to be sent to a specific node, then multicast communication or point-to-point communication may be more appropriate. In addition, in a distributed heterogeneous communication network, the communication task can be divided into multiple subtasks, and these subtasks can be assigned to different nodes for processing. This can be achieved by pipeline processing or data slicing. Pipeline processing is to divide the task into multiple stages, each stage is processed by a different node, while data sharding is to divide a large-scale data set into multiple small pieces and distribute them to different nodes for parallel processing. This can effectively utilize network resources and improve the overall performance of the system.
[0063] In order to enable the distributed heterogeneous communication network of the present application to meet the task processing requirements of different scenarios, a distributed heterogeneous communication network capable of undertaking different types of tasks is constructed. Assuming that each task will arrive at the node system at a different time point and require the allocation of computing resources for it, the task can be decomposed into m subtasks, and the subtasks have different execution orders. Assuming a total of n nodes, each node has the data required for different subtasks and provides different computing resources. Each subtask is pre-sent to the node where the required data is located for processing. If the task is migrated to other nodes, the corresponding data needs to be migrated to the new node.
[0064] For example, assume that data parallelism is used to process tasks. The distributed heterogeneous communication network system corresponding to the task uses n nodes and a parameter server. Each node initially loads a part of the training data locally and is responsible for calculating the gradient of the model parameters corresponding to this part of the data. After completing a round of gradient calculation, the node sends the calculated gradient to the parameter server. The parameter server is responsible for maintaining and updating the global model parameters. When the parameter server receives the gradient update of all nodes, it will synchronously update the model parameters and then broadcast the latest model parameters to all nodes. After receiving the latest model parameters, the node will use this parameter and local data for the next round of gradient calculation. In the context of this task, each round of calculation tasks can be regarded as a task. The task can be divided into n subtasks according to n nodes. The completion process of each subtask includes gradient calculation, uploading gradient to the parameter server, waiting for the parameter server to summarize the total gradient, and pulling new gradients for the next round of calculation.
[0065] Different network architecture modes have different processing methods for tasks. The network architecture modes include synchronous gradient network architecture mode or asynchronous gradient network architecture mode. When the parameter server of the synchronous gradient network architecture mode updates the gradient of each round, each subtask needs to wait until the slowest subtask uploads the gradient and waits for the parameter server to update before pulling the new gradient. This method ensures that all nodes are in the same state, but the overall training speed may be limited by the slowest node. When the parameter server of the asynchronous gradient network architecture mode updates the gradient of each round, each node can independently perform gradient calculation and parameter update without waiting for other nodes. This means that each node can update parameters at its own speed, thereby improving the overall training speed. However, due to the asynchronous parameter updates between nodes, the model convergence performance may be reduced, requiring additional tuning.
[0066] In order to reduce the computing time of each round, this application can migrate different data to different nodes. Migration to other nodes for calculation requires the required data to be migrated together. Define local execution as the subtask and the required resources on the same node, and migrate execution as the node currently learned by the subtask is inconsistent with the node of the last calculation. By modeling the cost of task completion, the total cost of different node allocation schemes for subtasks is calculated and compared to obtain the node scheduling scheme for the task.
[0067] Reference Figure 2 , Figure 2 This is a flow chart of an embodiment of the task scheduling method of the present application. In this embodiment, the task scheduling method includes the following steps:
[0068] Step S110, determining the current task dependency matrix, determining the cost matrix and determining the task allocation matrix, wherein the task dependency matrix represents the execution order and dependency relationship between the subtasks to be executed currently.
[0069] In this embodiment, each task to be processed will arrive at the node system at a different time point to require the allocation of computing resources for it, and the task to be processed can be decomposed into multiple subtasks of different types.
[0070] In this embodiment, the task dependency matrix represents the execution order and dependency relationship between each subtask. The task dependency matrix is usually a two-dimensional array (or matrix), in which rows and columns represent tasks, and the elements in the matrix represent the dependency relationship between tasks. These elements can be numerical values (such as dependency, weight, etc.) or Boolean values (such as dependency / non-dependency). For example, if task A depends on task B, then in the task dependency matrix, at the intersection of the row corresponding to task B and the column corresponding to task A, there will be a value representing this dependency relationship.
[0071] Optionally, the corresponding dependencies in different network architecture modes are different; in the synchronous gradient network architecture mode, each subtask needs to wait until the slowest subtask uploads the gradient and waits for the parameter server to update before pulling the new gradient; in the asynchronous gradient network architecture mode, there is no dependency between the subtasks in the rounds that do not require synchronous gradients, and each subtask does not need to pull gradients from the parameter server in each round of calculation. The matrix mathematical expression is used to represent the subtask dependency between each network architecture, which can provide an optimization solution for any network architecture mode. For different network architecture modes, due to the different corresponding task dependency matrices, their specific optimization formulas will also be different. Under a certain compatibility, the optimization path structure can also be given for different network architecture modes.
[0072] In this embodiment, the cost matrix is a matrix for representing the overhead required to execute each task on different nodes or resources. The cost matrix is usually a two-dimensional array, in which rows represent subtasks and columns represent nodes or resources that can be used to execute subtasks. Each element in the matrix represents the overhead of executing the corresponding task on the corresponding node, and these overheads include computing overhead, data migration overhead, result delivery overhead, and queuing overhead, etc. The cost matrix includes matrices of different overheads, namely, a computing overhead matrix, a data migration overhead matrix, a result delivery overhead matrix, and a queuing overhead matrix, etc.
[0073] In this embodiment, the task allocation matrix is used to represent the nodes where each subtask is located. The task allocation matrix is usually a two-dimensional array (or matrix), in which rows represent subtasks and columns represent resources. The elements in the matrix represent the allocation relationship between tasks and resources. These elements can be Boolean values (such as allocated / unassigned) or other types of identifiers or data (such as the number of allocated resources, the priority of the allocation, etc.).
[0074] Step S120, determining the final completion cost of each of the subtasks according to the task dependency matrix, the cost matrix and the task allocation matrix.
[0075] Optionally, the final completion cost of each subtask is different depending on whether the subtask belongs to local execution or migration execution; the total cost of each subtask when it belongs to local execution and the total cost of each subtask when it belongs to migration execution can be determined based on the current task dependency matrix, the cost matrix and the task allocation matrix; and then the final completion cost of each subtask is calculated based on the total cost of each subtask when it belongs to local execution and the total cost of each subtask when it belongs to migration execution.
[0076] Optionally, considering the impact of the execution order and dependencies of each subtask on the overhead, in the process of determining the final completion overhead of each subtask, it is necessary to consider the impact of the task dependency matrix on the final completion overhead of each subtask, so as to improve the accuracy of the final completion overhead of each subtask.
[0077] Step S130, determining a target node allocation scheme according to the final completion cost of each of the subtasks, wherein the target node allocation scheme is used to allocate the subtask with the current execution order priority to the node with the lowest final completion cost.
[0078] Optionally, the target node allocation scheme can allocate subtasks with a relatively high execution order to the node with the lowest current computational cost to ensure that the total task completion time can be minimized. This helps ensure that tasks can be executed smoothly according to dependencies while minimizing the overall completion cost.
[0079] Step S140: scheduling each subtask to a corresponding node for processing based on the target node allocation scheme.
[0080] This embodiment is based on the above technical solution. This application determines the final completion cost of each subtask based on the current task dependency matrix, cost matrix and task allocation matrix, and determines the target node allocation plan for the subtask based on the final completion cost of each subtask. It can allocate the subtask with a higher current execution order to the node with the lowest current node cost, that is, assign the subtask to the node with the minimum completion time, and realize task scheduling in a shorter time, thereby reducing the computational overhead in the task processing process and improving communication efficiency.
[0081] Based on the above embodiment, in one embodiment, in step S110, determining the cost matrix includes:
[0082] Step S111, obtaining task information of each of the current subtasks.
[0083] Optionally, the task information includes the storage location of each subtask data in the node, the computing overhead of each subtask in the node, the data migration overhead between nodes, the current queuing overhead of each node, the input data volume of each subtask and the output data volume of each subtask.
[0084] Optionally, the task information may also include: storage nodes for data required for each subtask, link bandwidth between nodes, etc.
[0085] Step S112: constructing a data allocation matrix, a computing overhead matrix, a data migration overhead matrix, a result delivery overhead matrix and a queuing overhead matrix according to the task information.
[0086] Step S113, obtaining the cost matrix according to the data allocation matrix, the computational overhead matrix, the data migration overhead matrix, the result delivery overhead matrix and the queuing overhead matrix.
[0087] Optionally, different matrices may be constructed according to different task information.
[0088] Optionally, the data allocation matrix is constructed according to the storage location of the data of each subtask in the node, the computational overhead matrix is constructed according to the computational overhead of each subtask in the node, the data migration overhead matrix is constructed according to the data migration overhead between the nodes and the input data volume of each subtask, the result delivery overhead matrix is constructed according to the data migration overhead between the nodes and the output data volume of each subtask, and the queuing overhead matrix is constructed according to the queuing overhead of each current node. Each overhead matrix will be introduced in detail below:
[0089] Data allocation matrix: used to indicate the storage location of each subtask’s data in the node. The values of each element in the data allocation matrix include 0 and 1. When node j has the data of subtask i, the value is 1, otherwise the value is 0.
[0090] Computational cost matrix: used to represent the time cost of each subtask on the node.
[0091] Data migration cost matrix: used to represent the cost of migrating the input data of a subtask to other nodes.
[0092] Result delivery overhead matrix: used to represent the overhead of delivering the output data of subtask i to the node where the next subtask is executed.
[0093] Queuing cost matrix: used to represent the cost incurred by a node due to queuing delay when it is waiting to process tasks or data.
[0094] Optionally, the above-mentioned various types of cost matrices are collectively referred to as cost matrices.
[0095] According to the above technical solution, this embodiment constructs different types of overhead matrices to consider all overheads required in the task processing process, thereby achieving accurate evaluation of all overheads required in the task processing process.
[0096] Based on the above embodiment, in one embodiment, step S120 includes:
[0097] Step S121, obtaining the total overhead of each of the subtasks when they are locally executed according to the task allocation matrix, the queuing overhead matrix, the calculation overhead matrix and the result delivery overhead matrix.
[0098] Optionally, the subtask needs to go through node queuing, calculation, and delivery cost after the calculation is completed when it is executed locally. Therefore, the local queuing time can be obtained according to the task allocation matrix and the queuing cost matrix, the local calculation time can be obtained according to the task allocation matrix and the calculation cost matrix, and the local delivery time can be obtained according to the task allocation matrix and the result delivery cost matrix. According to the local queuing time, the local calculation time, and the local delivery time, the total cost of each subtask when it is locally executed is obtained.
[0099] Specifically, the local queuing time is obtained by multiplying the task allocation matrix and the queuing overhead matrix, the local computing time is obtained by multiplying the task allocation matrix and the computing overhead matrix, and the local delivery time is obtained by multiplying the task allocation matrix and the result delivery overhead matrix; the local queuing time, local computing time and local delivery time are added together to obtain the total overhead of each subtask when it is executed locally. The specific calculation formula is:
[0100] .
[0101] in, It indicates the total cost of the local execution of the i-th subtask. represents the queueing cost matrix, represents the computational cost matrix, Indicates the result delivery overhead matrix, represents the task assignment matrix.
[0102] Step S122, obtaining the total cost of each of the subtasks when they are executed under migration according to the data migration cost matrix, the queuing cost matrix, the calculation cost matrix and the result delivery cost matrix.
[0103] Optionally, when a subtask is to be executed under migration, the required data needs to be migrated to the execution node, and migration and queuing are performed simultaneously. Therefore, the migration transmission overhead can be determined according to the data migration overhead matrix, the queuing overhead can be obtained according to the queuing overhead matrix, the post-migration processing time can be obtained according to the calculation overhead matrix, and the result delivery overhead can be obtained according to the result delivery overhead matrix; the total overhead of each subtask when it is executed under migration can be obtained according to the maximum overhead of the migration transmission overhead and the queuing overhead, the post-migration processing time and the result delivery overhead.
[0104] Specifically, obtain a completion time matrix, which represents the final completion time of each subtask. Determine the first product of the completion time matrix and the data migration overhead matrix as the first overhead, and determine the second product of the completion time matrix and the queuing overhead matrix as the second overhead, and then determine the maximum overhead of the first overhead and the second overhead. Next, obtain the post-migration processing time according to the product between the completion time matrix and the computing overhead matrix; obtain the result delivery overhead according to the product between the completion time matrix and the result delivery overhead matrix. Finally, according to the sum of the maximum overhead, the post-migration processing time and the result delivery overhead, obtain the total overhead of each subtask when it belongs to the migration execution. The specific calculation formula is:
[0105] .
[0106] in, Indicates the total cost of the migration execution of the i-th subtask. represents the queueing cost matrix, represents the computational cost matrix, Indicates the result delivery overhead matrix, represents the data migration cost matrix, Represents the completion time matrix.
[0107] During the task processing, the node queue overhead will also change continuously. This application allows the node overhead change to be expressed as the node queue overhead matrix after each subtask is completed. Will be updated, the update formula is as follows:
[0108] .
[0109] in, is the total cost vector of m subtasks.
[0110] Step S123, obtaining the total overhead of each of the subtasks according to the total overhead of each of the subtasks when being locally executed and the total overhead of each of the subtasks when being migrated and executed.
[0111] Optionally, the total overhead is different depending on whether the subtask belongs to local execution or migration execution, and a first product of the first coefficient and the total overhead when each subtask belongs to local execution can be determined, and a second product of the second coefficient and the total overhead when the subtask belongs to migration execution can be determined, and the total overhead of each subtask is obtained according to the sum of the first product and the second product. The sum of the first coefficient and the second coefficient is 1.
[0112] Specifically, the total cost varies depending on whether the subtask is executed locally or migrated. The total cost of each subtask is calculated using the following formula:
[0113] .
[0114] in, Indicates the total cost of the subtask when it is executed locally. Indicates the total cost of the subtask when it is executed by migration. When it is equal to 1, it means that the subtask is executed locally. A value equal to 0 indicates that the subtask belongs to migration execution. The calculation of is as follows:
[0115] .
[0116] The value is 1 if the data storage node and the migration node are the same, and 0 if they are not. The value includes 1 and 0. When subtask i is executed at node j, The value is 1, otherwise the value is 0.
[0117] Step S124, obtaining the final completion cost of each of the subtasks according to the total cost of each of the subtasks and the task dependency matrix.
[0118] Optionally, for each subtask, the product of the total cost of each subtask and the task dependency matrix is determined to obtain the final completion cost of each subtask. The final completion cost of each subtask in this application is expressed as:
[0119] .
[0120] According to the above technical solution, this embodiment takes into account both the computational overhead and the communication overhead required for distributed training, thus avoiding single consideration to a certain extent, meeting communication requirements, and reducing computational overhead.
[0121] Based on the above embodiment, in one embodiment, in step S110, determining the current task dependency matrix includes:
[0122] Step S211, obtaining the current network architecture mode.
[0123] Step S212, if the network architecture mode is a synchronous gradient network architecture mode, construct the task dependency matrix according to the execution order and dependency relationship between each subtask, wherein each row of the task dependency matrix represents the time required for subtask calculation, sorted in order from fast to slow, and the last row of the task dependency matrix represents that the calculation time of the node corresponding to the subtask is the longest.
[0124] Optionally, when the network architecture mode is a synchronous gradient network architecture mode, first define the task dependency matrix Dep to represent the execution order and dependency relationship between subtasks. When updating each round of gradients in the network architecture mode of the parameter server using synchronous gradients, each subtask needs to wait until the slowest subtask uploads the gradient and waits for the parameter server to update before pulling the new gradient. Therefore, the relationship between this type of subtasks can be expressed as a serial execution order.
[0125] In the task dependency matrix Dep, each row of the matrix represents a subtask. For the i-th subtask, if the i-1-th subtask needs to be completed before the i-th subtask can be executed, [i-1, i] = 1, otherwise it is 0. According to the characteristics of each subtask of the parameter server of the synchronized gradient, it is assumed that the calculation time required for the subtask represented by each row is sorted from fast to slow, and the node corresponding to the subtask represented by the last row has the longest calculation time. Therefore, in this network architecture mode, the last row of the task dependency matrix Dep is all 1, indicating that the subtask has the highest degree of dependence on other subtasks.
[0126] In other embodiments, taking the network architecture mode of a parameter server using asynchronous gradient as an example, since each subtask does not need to pull gradients from the parameter server in each round of calculation, there is no dependency between the subtasks in the rounds that do not require synchronized gradients.
[0127] According to the above technical solution, this embodiment uses matrixed mathematical expressions to represent the sub-task dependencies between network architectures, so it can provide an optimization solution for any network architecture mode. Since different network architecture modes have different corresponding task dependency matrices, their specific optimization formulas will also be different. Under a certain compatibility, it can also provide an optimization path structure for different network architecture modes.
[0128] Based on the above embodiment, in one embodiment, in step S110, determining the task allocation matrix includes:
[0129] Step S311, traverse each row in the task dependency matrix to obtain a list of dependent nodes of each node.
[0130] Step S312: for each dependent node in the dependent node list, add each dependent node to a directed graph, wherein the connection relationship between the node and the dependent node serves as an edge of the directed graph.
[0131] Step S313: determining the execution order of each subtask based on the directed graph.
[0132] Step S314, according to the execution order of each subtask, find the node with the lowest computational cost of each subtask from the current nodes to obtain the task allocation matrix.
[0133] The purpose of this application is to convert the computing resource information and communication information involved in the task into a cost matrix and a task dependency matrix, so as to determine the scheduling strategy of the subtasks, so as to achieve the purpose of optimizing the total cost of the training task. The process of optimizing the total cost is a process of trying to minimize the above expression. The most important way to optimize the cost is to change the allocation matrix by migrating the subtasks to other nodes, and determine which node the subtasks are assigned to can reduce the final completion cost of the task. The scheduling strategy of the subtask is the task allocation matrix defined above.
[0134] In order to speed up the solution, this application designs the algorithm for solving the task allocation matrix as an online algorithm, and allocates nodes to the subtasks decomposed from the task in the order in which the tasks arrive. Each time, only the current node and link status and task status are considered for task allocation. This implementation can avoid the global optimal problem caused by multi-task concurrency, reduce the solution domain, improve the solution efficiency while minimizing the impact on the solution accuracy.
[0135] Taking the online algorithm as an example, at this time, the total cost of each subtask at each node can be determined. When the node where the subtask is located belongs to local learning, the total cost is the sum of local queuing cost, local computing cost, and delivery cost; when it belongs to transfer learning, the total cost is the sum of migration transmission cost, post-migration computing cost, and delivery cost. When a subtask is assigned to a node, the computational cost of the subtask can be used as a factor to be included in the calculation of the node's queuing cost. In this way, when assigning a new task, the computational cost of the task and the queuing cost of the node can be comprehensively considered to make a more reasonable allocation decision. This approach helps to more accurately evaluate the load of the node and avoid excessive task allocation that causes the node to be overloaded, thereby affecting the performance and stability of the entire system. Therefore, when performing task scheduling and resource allocation in a distributed system, it is necessary to comprehensively consider the computational cost of the subtask and the queuing cost of the node to achieve efficient execution of tasks and reasonable use of resources.
[0136] This application designs an idea based on a greedy algorithm, which selects the local optimal solution in each subtask assignment, and then continues to select the local optimal solution based on the previous solution. The core idea of this algorithm is to assign the subtasks with a relatively high execution order to the node with the lowest current computing cost to ensure that the total task completion time can be minimized. The solution algorithm is as follows:
[0137] Step 1: First, create a directed graph by topologically sorting the dependency matrix of the subtasks: Create an empty directed graph object, traverse each row of the dependency matrix, and for each row, find the list of dependent nodes of the current node. For each dependent node, add them to the directed graph and create a directed edge from the current node to the dependent node. And record the in-degree of each node (indicating how many nodes depend on it).
[0138] Create a queue to represent the order of subtask allocation. First, add subtasks with zero in-degree to the queue, reduce the in-degree of the neighbor nodes of these subtasks by one, and add the neighbor nodes if the in-degree is reduced to 0. Repeat the above process to add subtasks to the queue in the order of execution.
[0139] Define the subtask allocation vector based on this queue:
[0140] .
[0141] in, Represents the number of the allocated node, which is an integer ranging from 1 to n.
[0142] Define the subtask completion time vector:
[0143] .
[0144] in, Indicates the final completion time of the subtask.
[0145] The initialization cost matrix represents the total time required to calculate subtask i on node j:
[0146] .
[0147] .
[0148] Initialize the completion time of each subtask to 0 and the subtask allocation vector to 0:
[0149] .
[0150] .
[0151] Step 2: For each subtask i, find the node with the shortest computation time (i.e., the lowest computational overhead) for subtask i among all nodes according to the execution order, and assign subtask i to this node. Add the computation time of subtask i of this node to the sum of the computation time of the tasks required before executing i to get the completion time of subtask i:
[0152] .
[0153] For subtasks , subtask It is a subtask of the previous step.
[0154] Update the task allocation vector and assign subtask i to the node with the minimum computing time :
[0155] .
[0156] in, satisfy , i.e. node It is the node with the lowest computational cost for subtask i.
[0157] For nodes that have been assigned tasks, update the queue time of the node:
[0158] .
[0159] Start assigning the next subtask and repeat step 2 until all nodes are assigned subtasks.
[0160] This application ensures that the subtasks with an earlier execution order are assigned first through the above-mentioned solution ideas, thereby reducing the total time for task completion as a whole.
[0161] According to the above technical solution, this embodiment designs an online algorithm to address the drawback of the existing partial task scheduling strategy that the calculation time is long and affects the immediacy of the task. In this algorithm, the tasks are decomposed one by one according to the arrival order, and the subtasks are assigned to the node with the minimum completion time. Each time a task is assigned, only the current node and link status and the task status are considered, and the optimal allocation result is pursued as much as possible. In this way, a "good enough" solution can be obtained in a relatively short time, and the accuracy of the calculation can be guaranteed as much as possible while ensuring the calculation efficiency, so as to achieve the purpose of optimizing the cost. At the same time, the solution process of this scheme also has good adaptability to the changes in the initial conditions and parameters of the problem.
[0162] The embodiments of the present application provide embodiments of a task scheduling method. It should be noted that although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in an order different from that shown here.
[0163] like Figure 3 As shown, the present application provides a task scheduling device, comprising:
[0164] The matrix determination module 10 is used to determine the current task dependency matrix, the cost matrix and the task allocation matrix, wherein the task dependency matrix represents the execution order and dependency relationship between the subtasks to be executed currently.
[0165] The cost determination module 20 is used to determine the final completion cost of each of the subtasks according to the task dependency matrix, the cost matrix and the task allocation matrix.
[0166] The target node allocation scheme determination module 30 is used to determine the target node allocation scheme according to the final completion cost of each of the subtasks, wherein the target node allocation scheme is used to allocate the subtask with the current execution order priority to the node with the lowest final completion cost.
[0167] The scheduling module 40 is used to schedule each subtask to a corresponding node for processing based on the target node allocation scheme.
[0168] The specific implementation of the task scheduling device of the present application is basically the same as the various embodiments of the above-mentioned task scheduling method, and will not be repeated here.
[0169] In addition, an embodiment of the present application further proposes a storage medium, on which a task scheduling program is stored. When the task scheduling program is executed by a processor, the steps of the task scheduling method described above are implemented.
[0170] In addition, an embodiment of the present application further provides a computer program product, including a task scheduling program, which implements the steps of the task scheduling method described above when executed by a processor.
[0171] The specific implementation methods of the computer program product of the present application are basically the same as the above-mentioned embodiments of the task scheduling method, and will not be repeated here.
[0172] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or system including the element.
[0173] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0174] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, TV, or network device, etc.) to execute the methods described in each embodiment of the present application.
[0175] The above are only preferred embodiments of the present application, and are not intended to limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A task scheduling method, characterized in that: The task scheduling method comprises: Get the task information of each current subtask; According to the task information, the storage location of the data of each subtask in the node, the computing cost of each subtask in the node, the data migration cost between nodes, the current queuing cost of each node, the input data volume of each subtask and the output data volume of each subtask are obtained; A data allocation matrix is constructed according to the storage location of the data of each subtask at the node, a computing overhead matrix is constructed according to the computing overhead of each subtask at the node, a data migration overhead matrix is constructed according to the data migration overhead between the nodes and the input data volume of each subtask, a result delivery overhead matrix is constructed according to the data migration overhead between the nodes and the output data volume of each subtask, and a queuing overhead matrix is constructed according to the queuing overhead of each current node; Obtaining a cost matrix according to the data allocation matrix, the computational overhead matrix, the data migration overhead matrix, the result delivery overhead matrix, and the queuing overhead matrix; Determine a current task dependency matrix and a task allocation matrix, wherein the task dependency matrix represents the execution order and dependency relationship between the subtasks to be executed currently; Determining the final completion cost of each of the subtasks according to the task dependency matrix, the cost matrix and the task allocation matrix; Determine a target node allocation scheme according to the final completion cost of each of the subtasks, wherein the target node allocation scheme is used to allocate the subtask with the current execution order priority to the node with the lowest final completion cost; Each subtask is dispatched to a corresponding node for processing based on the target node allocation scheme.
2. The task scheduling method according to claim 1, characterized in that: The step of determining the final completion cost of each of the subtasks according to the task dependency matrix, the cost matrix and the task allocation matrix comprises: According to the task allocation matrix, the queuing cost matrix, the calculation cost matrix and the result delivery cost matrix, the total cost of each subtask when it is locally executed is obtained; According to the data migration cost matrix, the queuing cost matrix, the calculation cost matrix and the result delivery cost matrix, the total cost of each subtask when it belongs to migration execution is obtained; Obtaining the total cost of each of the subtasks according to the total cost of each of the subtasks when being locally executed and the total cost of each of the subtasks when being migrated and executed; The final completion cost of each of the subtasks is obtained according to the total cost of each of the subtasks and the task dependency matrix.
3. The task scheduling method according to claim 2, characterized in that: The total cost of each subtask when being executed locally is obtained according to the task allocation matrix, the queuing cost matrix, the calculation cost matrix and the result delivery cost matrix, comprising: Obtaining a local queuing time according to the task allocation matrix and the queuing overhead matrix, obtaining a local computing time according to the task allocation matrix and the computing overhead matrix, and obtaining a local delivery time according to the task allocation matrix and the result delivery overhead matrix; According to the local queuing time, the local calculation time and the local delivery time, the total overhead of each subtask when it is executed locally is obtained; The total cost of each subtask when being executed under migration is obtained according to the data migration cost matrix, the queuing cost matrix, the calculation cost matrix and the result delivery cost matrix, including: Determine the migration transmission overhead according to the data migration overhead matrix, obtain the queuing overhead according to the queuing overhead matrix, obtain the post-migration processing time according to the calculation overhead matrix, and obtain the result delivery overhead according to the result delivery overhead matrix; The total cost of each of the subtasks when being executed in migration is obtained according to the maximum cost of the migration transmission cost and the queuing cost, the post-migration processing time and the result delivery cost.
4. The task scheduling method according to claim 1, characterized in that: Determining the current task dependency matrix includes: Get the current network architecture mode; If the network architecture mode is a synchronous gradient network architecture mode, the task dependency matrix is constructed according to the execution order and dependency relationship between each subtask, wherein each row of the task dependency matrix represents the time required for subtask calculation, which is sorted from fast to slow, and the last row of the task dependency matrix represents that the calculation time of the node corresponding to the subtask is the longest.
5. The task scheduling method according to claim 1, characterized in that: Determining the task allocation matrix comprises: Traverse each row in the task dependency matrix to obtain a list of dependent nodes for each node; For each dependent node in the dependent node list, each dependent node is added to a directed graph, wherein the connection relationship between the node and the dependent node serves as an edge of the directed graph; Determining an execution order of each subtask based on the directed graph; According to the execution order of each subtask, the node with the lowest computational cost of each subtask is found from the current nodes to obtain the task allocation matrix.
6. A task scheduling device, characterized in that: The task scheduling device comprises: A matrix determination module is used to obtain the task information of each current subtask; according to the task information, obtain the storage location of the data of each subtask in the node, the computing cost of each subtask in the node, the data migration cost between the nodes, the current queuing cost of each node, the input data volume of each subtask and the output data volume of each subtask; construct a data allocation matrix according to the storage location of the data of each subtask in the node, construct a computing cost matrix according to the computing cost of each subtask in the node, construct a data migration cost matrix according to the data migration cost between the nodes and the input data volume of each subtask, construct a result delivery cost matrix according to the data migration cost between the nodes and the output data volume of each subtask, and construct a queuing cost matrix according to the current queuing cost of each node; obtain a cost matrix according to the data allocation matrix, the computing cost matrix, the data migration cost matrix, the result delivery cost matrix and the queuing cost matrix; determine the current task dependency matrix and determine the task allocation matrix, wherein the task dependency matrix represents the execution order and dependency relationship between the current subtasks to be executed; An overhead determination module, used to determine the final completion overhead of each of the subtasks according to the task dependency matrix, the cost matrix and the task allocation matrix; A target node allocation scheme determination module is used to determine a target node allocation scheme according to the final completion cost of each of the subtasks, wherein the target node allocation scheme is used to allocate the subtask with the current execution order priority to the node with the lowest final completion cost; The scheduling module is used to schedule each subtask to a corresponding node for processing based on the target node allocation scheme.
7. A task scheduling device, characterized in that: The task scheduling device comprises: a memory, a processor, and a task scheduling program stored in the memory and running on the processor. When the task scheduling program is executed by the processor, the steps of the task scheduling method according to any one of claims 1 to 5 are implemented.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a task scheduling program, and when the task scheduling program is executed by a processor, the steps of the task scheduling method described in any one of claims 1 to 5 are implemented.
9. A computer program product, characterized in that The computer program product comprises a task scheduling program, and when the task scheduling program is executed by a processor, the steps of the task scheduling method according to any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
DAG task scheduling method and device, equipment and storage medium
CN114756358A
Path planning and task allocation method and device, service equipment and storage medium
CN115268434A
