DPU task scheduling method and DPU task scheduling system
Through the introduction of DPU task scheduling methods and systems, the problem of excessive expectations for DPU data processing capabilities in the prior art is solved, load balancing between the CPU and DPU is achieved, and the overall performance and stability of the system are improved.
Patent Information
- Application Number
- CN202411646981.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-18
- Publication Date
- 2025-03-07
AI Technical Summary
The prior art expects too high the data processing capability of DPUs, resulting in a decline in overall system performance after offloading tasks from the CPU to the DPU.
Through a DPU task scheduling method and system, the priority of the task package is calculated based on the calculation amount of the task, the deadline and whether there is special hardware on the DPU side, and the task package is stored in the scheduling queue corresponding to its priority, and the task package is transferred to the CPU side or the DPU side in sequence to realize load balancing between the CPU and DPU.
It effectively improves the efficiency and reliability of DPU task scheduling, improves the problem of offloading complex DPU tasks, realizes load balancing between CPU and DPU, and ensures high performance and stability of the system.
Smart Images

Figure CN119576494A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of DPU task scheduling, and in particular to a DPU task scheduling method and a DPU task scheduling system. Background Art
[0002] DPU (Data Processing Unit) is a programmable processor designed specifically for handling large amounts of data workloads in data centers. The main purpose of DPU is to offload specific types of tasks from the CPU, especially those related to data transmission, network communication, storage management, and security, thereby freeing up CPU resources to focus on the execution of applications. DPU is usually connected to the corresponding host via a PCIe interface to form a complete data processing system. However, the existing usage of DPU often has too high expectations for its data processing capabilities, and blindly offloading tasks from the CPU to the DPU leads to a decrease in the overall performance of the system. Summary of the invention
[0003] The purpose of the present invention is to overcome the above-mentioned defects or problems existing in the background technology and to provide a DPU task scheduling method and a DPU task scheduling system, which can improve the overall performance of the system by effectively scheduling tasks.
[0004] To achieve the above object, the present invention adopts the following technical solutions:
[0005] Technical Solution 1: A DPU task scheduling method, which is used to schedule tasks to the CPU side or the DPU side, comprising: generating a task package based on the task information to be processed; calculating the priority of the task package based on the computational amount and deadline of the task package and whether there is dedicated hardware for the task package on the DPU side; storing the task package in a scheduling queue at a position corresponding to its priority according to the priority of the task package, and delivering the task package to the CPU side or the DPU side in sequence; and updating the scheduling queue according to the execution result of the received task package on the CPU side or the DPU side.
[0006] Technical solution 2 based on technical solution 1: When calculating the priority of the task package, the following formula is used: P=a*Cal+b*Tim+c*Hav; wherein P is the priority of the task package, Cal is the computing amount of the task package, Tim is the deadline of the task package, Hav is 0 or 1, and a, b, c are preset weighting coefficients; the task package records the computing amount information, deadline information and task type information related to itself; when calculating the priority of the task package, based on the task type information of the task package, it is determined whether there is dedicated hardware corresponding to the task type information on the DPU side, and if so, the value of Hav is set to 1, and if not, the value of Hav is set to 0.
[0007] Technical solution three based on technical solution one: in the scheduling queue, task packets are placed continuously from left to right according to priority from large to small, and task packets are transmitted from the left end of the scheduling queue to the DPU side, and from the right end of the scheduling queue to the CPU side.
[0008] Technical solution four based on technical solution three: the scheduling queue is divided into a first unit and a second unit, wherein the first unit is located on the left side of the scheduling queue and the second unit is located on the right side of the scheduling queue; when a new task package is stored in the scheduling queue, according to the number of task packages in the first unit and the second unit, the task packages in the scheduling queue are moved to units with fewer numbers to free up storage space for new task packages.
[0009] Technical solution five based on technical solution four: the lengths of the first unit and the second unit are adjusted according to the processing efficiency of the task packets on the DPU side and the CPU side. In the first unit or the second unit, if the number of task packets in any unit is 0 and the number of task packets in the other unit is greater than 0, the length of the unit with the number of task packets greater than 0 is reduced by 1, and the length of the unit with the number of task packets 0 is increased by 1.
[0010] Technical solution six based on technical solution five: each time after adjusting the length of the first unit and the second unit, the new task package is stored in the scheduling queue and when the task package in the scheduling queue is moved according to the number of task packages in the first unit and the second unit, the number of task packages in the unit with increased length is increased by 1, and the number of task packages in the unit with reduced length is reduced by 1, and the calculated values are compared to determine the moving direction of the task package in the scheduling queue.
[0011] Technical Solution 7 based on Technical Solution 3: When the difference between the deadline of any task package and the current time is less than a preset time threshold, if the task package is located in the first unit, the position of the task package is adjusted to the leftmost side of the scheduling queue, and the positions of other task packages originally located on the left side of the task package are moved one position to the right; if the task package is located in the second unit, the position of the task package is adjusted to the rightmost side of the scheduling queue, and the positions of other task packages originally located on the right side of the task package are moved one position to the left.
[0012] Technical Solution 8 based on Technical Solution 1: When the DPU side or the CPU side is in a full load state, suspend the transmission of task packets from the scheduling queue to the DPU side or the CPU side; the full load state means that the computing resource consumption of the DPU side or the CPU side is greater than a preset full load threshold.
[0013] Technical solution nine based on technical solution eight: When the DPU side or the CPU side is in a fully loaded state, if the difference between the deadline time of any task package and the current time is less than a preset time threshold, the task package will be transmitted to the DPU side or the CPU side.
[0014] In addition, the present invention also provides technical solution ten: a DPU task scheduling system, comprising: a task generation module, which is used to generate a task package according to the task information to be processed; the task package records the calculation amount information, deadline information and task type information related to itself; a priority calculation module, which receives the task package generated by the task generation module, and calculates the priority of the task package according to the calculation amount, deadline and whether there is dedicated hardware for the task package on the DPU side; the task type information of the task package is used to determine whether there is dedicated hardware for the task package on the DPU side; a queue storage module, which is used to store the task package in a position corresponding to its priority in the scheduling queue according to the priority of the task package, and transmit the task package to the CPU side or the DPU side in sequence; a queue update module, which is used to update the scheduling queue according to the execution result of the received task package on the CPU side or the DPU side.
[0015] It can be seen from the above description of the present invention that, compared with the prior art, the present invention has the following beneficial effects:
[0016] The present invention provides a DPU task scheduling method and a DPU task scheduling system. The method and the system can effectively improve the efficiency and reliability of DPU task scheduling, improve the problem of DPU complex task offloading, achieve load balancing between CPU and DPU, and ensure the high performance and stability of the system.
[0017] Among them, by comprehensively considering the task's computational workload, deadline, and whether the DPU side has dedicated hardware, tasks can be allocated more reasonably and the overall efficiency of the system can be improved. The priority calculation of the task not only considers the inherent attributes of the task, but also combines the current state of the system to ensure the flexibility and real-time performance of task scheduling. In addition, through priority sorting and task allocation, load balancing between the CPU and DPU is achieved to avoid system performance degradation caused by overload on one side.
[0018] Secondly, by introducing weighted coefficients, the priority calculation formula can flexibly adjust the impact of the amount of calculation, deadline, and the existence of dedicated hardware on the priority, making the priority calculation more accurate. By judging whether there is dedicated hardware on the DPU side and adjusting the priority, tasks suitable for DPU processing are scheduled first, making full use of the hardware acceleration capabilities of the DPU, and further improving the efficiency of task execution.
[0019] In the task scheduling process, high-priority tasks are scheduled first to ensure that important tasks are processed in a timely manner, improving the response speed and reliability of the system. By delivering tasks to the DPU and CPU from both ends of the scheduling queue, load balancing is achieved to avoid overloading of one side. At the same time, the storage location of the task package is dynamically adjusted according to the number of task packages to ensure the flexibility and scalability of the scheduling queue, further improving the effect of load balancing.
[0020] In order to adapt to the current system status, the unit length of the scheduling queue is dynamically adjusted according to the processing efficiency of the DPU and CPU, making the scheduling queue more flexible. By ensuring that the unit with 0 task packages can receive new task packages in time, resource waste is avoided. The fine control of the number of task packages ensures that the movement direction and number of task packages are more reasonable, and the balance of the number of tasks in the scheduling queue is continuously maintained, further optimizing the load balancing effect.
[0021] For urgent tasks approaching the deadline, the system can quickly adjust their positions to ensure that these tasks are processed first, improving the real-time and reliability of the system. By quickly adjusting the positions of task packages, the system can quickly respond to the needs of urgent tasks and ensure the timely completion of key tasks.
[0022] When the DPU or CPU is fully loaded, the system will suspend the delivery of task packages to prevent overload and ensure the stability and reliability of the system. This strategy avoids ineffective task scheduling, reduces resource waste, and improves system resource utilization. Even when fully loaded, the system can prioritize urgent tasks to ensure the timely completion of critical tasks, improving the system's response capability and robustness. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0024] Figure 1 A flowchart of a DPU task scheduling method provided by an embodiment of the present invention;
[0025] Figure 2 Schematic diagram of the scheduling queue in the DPU task scheduling method provided in the embodiment of the present invention Figure 1 ;
[0026] Figure 3 Schematic diagram of the scheduling queue in the DPU task scheduling method provided in the embodiment of the present invention Figure 2 ;
[0027] Figure 4 Schematic diagram of the scheduling queue in the DPU task scheduling method provided in the embodiment of the present invention Figure 3 ;
[0028] Figure 5 Schematic diagram of the scheduling queue in the DPU task scheduling method provided in the embodiment of the present invention Figure 4 ;
[0029] Figure 6 A module diagram of a DPU task scheduling system provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0030] The technical solutions in the embodiments of the present invention will be described clearly and completely below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are preferred embodiments of the present invention and should not be regarded as excluding other embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0031] In the claims, description and the above-mentioned drawings of the present invention, unless otherwise clearly defined, the use of terms such as "first", "second" or "third" etc. are for distinguishing different objects rather than for describing a specific order.
[0032] In the claims, specification and the above-mentioned drawings of the present invention, unless otherwise explicitly defined, directional words, such as the terms "center", "lateral", "longitudinal", "horizontal", "vertical", "top", "bottom", "inside", "outside", "up", "down", "front", "back", "left", "right", "clockwise", "counterclockwise", etc., indicating directions or positional relationships are based on the directions and positional relationships shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific direction or be constructed and operated in a specific direction, and therefore cannot be understood as limiting the specific protection scope of the present invention.
[0033] In the claims, specification and the above drawings of the present invention, unless otherwise clearly defined, if the term "fixed connection" or "fixed connection" is used, it should be understood in a broad sense, that is, any connection method without a displacement relationship and relative rotation relationship between the two, that is to say, including non-detachable fixed connection, detachable fixed connection, integrated connection and fixed connection through other devices or elements.
[0034] In the claims, description and drawings of the present invention, if the terms "include", "have" and their variations are used, they are intended to mean "including but not limited to".
[0035] Example 1
[0036] Embodiment 1 of the present invention provides a DPU task scheduling method, which is used to schedule tasks to the CPU side or the DPU side. The DPU task scheduling method can be run in a host having a CPU, and the host also includes at least one DPU. When the host runs a task, the scheduling method can be used to select whether to assign the task to the CPU side for processing or to assign the task to the DPU side for processing. The execution of the scheduling method can be implemented by the CPU. The CPU side is a part set in the CPU for processing tasks, which has the ability to process tasks.
[0037] On both the CPU side and the DPU side, execution libraries for executing related tasks are designed. The execution library on the CPU side may include a software library, that is, the processing capability of related tasks is obtained through software code. The execution library on the DPU side may include a software library and a hardware library. The hardware library is designed on the DPU side by hardware circuits when designing the DPU to facilitate the execution of related tasks. When executing tasks, the corresponding hardware library can be directly called to improve the efficiency of task execution. In the execution library, processing functions corresponding to tasks can be encapsulated. These processing functions can show a unified interface to the outside world. When executing on the CPU side or the DPU side, the corresponding processing function can be selected according to the relevant information of the task, and the results can be output through processes such as receiving data, parsing data, and calculating to complete the processing and execution of the task.
[0038] In the prior art, the DPU, due to its efficient data processing capability, enables the host to offload some tasks to the DPU for processing, thereby enhancing the overall data processing efficiency of the system and saving host resources. However, blindly offloading tasks to the DPU will lead to a decrease in overall performance. To this end, an embodiment of the present invention provides a DPU task scheduling method, which can effectively schedule tasks and improve the overall performance of the system.
[0039] Reference Figure 1 The DPU task scheduling method provided in this embodiment mainly includes the following steps:
[0040] S100: Generate a task package according to the task information to be processed;
[0041] S200: Calculate the priority of the task package according to the computational workload and deadline of the task package and whether there is dedicated hardware for the task package on the DPU side;
[0042] S300: According to the priority of the task packet, the task packet is stored in a position corresponding to the priority in the scheduling queue, and the task packet is transmitted to the CPU side or the DPU side in sequence;
[0043] S400: updating the scheduling queue according to the execution result of the received task packet by the CPU side or the DPU side.
[0044] The above steps are described in detail below.
[0045] In the DPU task scheduling method provided in this embodiment, it is first necessary to generate a task package based on the task information to be processed. The task package is used to inform the CPU side or the DPU side what task to execute, how to execute the task, and how to output the task result. Specifically, the task package may include the following relevant information: task code, task package length, task package generation time and deadline, data required for task package execution and corresponding address, the total amount of data executed by the task package, that is, the calculation amount of the task package, and the output method of the task package execution result.
[0046] Among them, the task code is a pre-set value. In the execution library on the CPU side and the DPU side, the processing function corresponding to each task type is provided with a unique task code. At the same time, when the task package is encapsulated and generated, the task package will also be assigned a corresponding task code, so that after the task package is scheduled and allocated to the CPU side or the DPU side, the CPU side or the DPU side can determine which processing function is used for processing according to the task code. It should be noted that if a new task type needs to be added, in addition to adding the corresponding processing function on both the CPU side and the DPU side, the corresponding task code also needs to be added in the step of generating the task package so that the CPU side and the DPU side can correctly process the corresponding task package.
[0047] After the task package is generated, the priority of the task package needs to be calculated to determine the storage location and delivery direction of the task package. Specifically, when calculating the priority of the task package, the following formula is used: P = a*Cal+b*Tim+c*Hav; where P is the priority of the task package, Cal is the computational amount of the task package, Tim is the deadline of the task package, Hav is 0 or 1, and a, b, c are preset weighting coefficients; the task package records the computational amount information, deadline information and task type information related to itself; when calculating the priority of the task package, based on the task type information of the task package, it is determined whether there is dedicated hardware corresponding to the task type information on the DPU side, and if it exists, the value of Hav is set to 1, and if it does not exist, the value of Hav is set to 0.
[0048] Among them, the attributes related to the calculation of the priority of the task package are: the calculation amount of the task package, the deadline, and whether there is dedicated hardware for the task type of the task package on the DPU side. The dedicated hardware here means that a hardware circuit for processing related tasks is designed on the DPU side. The hardware circuit is represented in the execution library by a processing function, and the processing function can be called for processing when the corresponding task is received. Among them, the calculation amount and deadline of the task package are corresponding numerical values, and whether there is dedicated hardware for the task type of the task package on the DPU side is a Boolean value, that is, if there is dedicated hardware for the task type of the task package, its value is 1, and if there is no dedicated hardware for the task type of the task package, its value is 0. In the actual processing process, it can be judged whether there is corresponding dedicated hardware on the DPU side according to the task code of the task package. For example, a set of task codes with dedicated hardware can be pre-determined. When judging, the task code of the task package can be compared with the set. If the task code is the same as an element in the set, it is considered that there is corresponding dedicated hardware on the DPU side.
[0049] After the above formula is used for calculation, the corresponding priority can be obtained. It is easy to see that the higher the priority, the more suitable it is for transmission to the DPU side for execution. In the above formula, the values of a, b, and c can be predetermined based on relevant experiments, and all three are positive numbers. After obtaining the priority of the task package, it is necessary to assign the priority value to the task package, that is, to add relevant attributes and attribute values to the task package so that the task package can be stored according to the priority of the task package.
[0050] The dispatch queue is used to store task packages. Figure 2, which is an example of a scheduling queue. It can be seen that the scheduling queue extends from left to right, and is provided with a plurality of storage locations arranged continuously and used to store task packages. The task packages can be stored in these storage locations and transported to the CPU side or the DPU side in order. Wherein, in the scheduling queue, the task packages are placed continuously from left to right according to the priority from large to small, and the task packages are transported from the left end of the scheduling queue to the DPU side, and from the right end of the scheduling queue to the CPU side. That is to say, in the process of storing the task package in the scheduling queue, the value of the priority of the current task package will be compared with the value of the priority of the task package in the scheduling queue. For example, the value of the priority of the current task package is i, and there are two adjacent task packages in the scheduling queue. The value of the priority of the task package on the right side of the two task packages is less than i, and the value of the priority of the task package on the left side is greater than i, then the current task package will be inserted between the two task packages, so that in the final scheduling queue, the task packages are still arranged continuously from left to right according to the priority from large to small. Afterwards, since the priority of the task package on the left is always greater than the priority of the task package on the right, the task package on the left is more suitable for processing by the DPU. Therefore, the scheduling queue transmits the task package from the left end to the DPU side and transmits the task package from the right end to the CPU side.
[0051] However, when a new task package is inserted into the above scheduling queue, there is a problem of whether the task package originally stored in the scheduling queue moves to the left or right. Figure 3 In this embodiment, the scheduling queue is also divided into a first unit and a second unit, wherein the first unit is located on the left side of the scheduling queue and the second unit is located on the right side of the scheduling queue; when a new task package is stored in the scheduling queue, the task packages in the scheduling queue are moved to the unit with fewer numbers according to the number of task packages in the first unit and the second unit to free up storage space for the new task package.
[0052] Take the case where the number of the first unit and the second unit in the scheduling queue is the same as an example. Figure 3, originally three task packages were stored in the scheduling queue, with priority values of 5, 2, and 3, respectively. There were two task packages in the first unit and one task package in the second unit. At this time, a new task package with a priority value of 4 needs to be stored in the scheduling queue. According to the rule of arranging task packages from large to small and from left to right, the new task package needs to be stored between the two task packages with priority values of 5 and 2. It is easy to see that there are fewer task packages in the second unit, so after inserting the new task package, the task package with a priority value of 5 remains in its original position, while the task packages with priority values of 2 and 1 are moved one unit to the right. By dynamically adjusting the scheduling queue, the flexibility of the scheduling queue in storing and transmitting task packages is improved.
[0053] In the case of using the above-mentioned scheduling queue, there will be a new problem, that is, the processing efficiency of the task packets on the CPU side and the DPU side is inconsistent. Generally speaking, although the DPU side has more targeted dedicated hardware, the CPU side has higher computing performance, so the tasks on the CPU side are usually executed faster, that is, the task packets of the second unit in the scheduling queue will be cleared faster. At this time, there may be no task packets in the second unit, while there are still a large number of task packets in the first unit. In this case, more task packets should be sent to the CPU side to improve the overall performance of the system. However, since the first unit and the second unit are pre-divided, there will always be a storage location in the second unit, resulting in the task packets in the first unit can only be sent to the DPU side.
[0054] To this end, the lengths of the first unit and the second unit are adjusted according to the processing efficiency of the task packets on the DPU side and the CPU side. In the first unit or the second unit, when the number of task packets in any unit is 0 and the number of task packets in the other unit is greater than 0, the length of the unit with the number of task packets greater than 0 is reduced by 1, and the length of the unit with the number of task packets 0 is increased by 1.
[0055] Specifically, refer to Figure 4, in the original dispatch queue, the number of storage locations of the first unit and the second unit is consistent, at this time, the number of task packages in the first unit is 2, and the number of task packages in the second unit is 0. When this situation occurs, the number of storage locations of the first unit and the second unit is adjusted, the number of storage locations of the second unit is increased, and the number of storage locations of the first unit is reduced at the same time, so that the original two task packages in the first unit are assigned to the second unit. Of course, in other cases, for example, the number of task packages in the first unit is 0, and the number of task packages in the second unit is greater than 0, when this situation occurs, the number of storage locations of the first unit is increased, and the number of storage locations of the second unit is reduced at the same time. Wherein, the adjustment of the number of storage locations of the first unit and the second unit is carried out when the number of one task package in the two is greater than 0 and the other is equal to 0 each time. By dynamically adjusting the number of storage locations of the first unit and the second unit in the dispatch queue, it is ensured that the unit with the number of task packages of 0 can receive new task packages in time, avoiding waste of resources.
[0056] Correspondingly, each time after adjusting the length of the first unit and the second unit, the new task package is stored in the scheduling queue and when the task package in the scheduling queue is moved according to the number of task packages in the first unit and the second unit, the number of task packages in the unit whose length has increased is increased by 1, and the number of task packages in the unit whose length has decreased is reduced by 1, and the calculated values are compared to determine the moving direction of the task package in the scheduling queue.
[0057] Specifically, when the number of storage locations in the first unit and the second unit is the same, the calculation of the moving direction of the task packet is based on the actual number of task packets in the first unit or the second unit; when the number of storage locations in the first unit and the second unit is inconsistent, for example, the number of storage locations in the first unit is 1 less than the number of storage locations in the second unit, when calculating the moving direction of the task packet, it is not possible to simply compare the actual number of task packets in the first unit and the second unit, but it is necessary to subtract 1 from the actual number of task packets in the first unit and add 1 to the actual number of task packets in the second unit, and use the values after subtraction and addition as the comparison basis, and move the task packet in the corresponding direction according to which value is larger. By adjusting the calculation method of the moving direction of the task packet, the influence of the adjustment of the number of storage locations in the first unit and the second unit in the scheduling queue on the calculation of the moving direction of the task packet is avoided, and it is ensured that when a new task packet is inserted, the original task packet in the scheduling queue can move in the correct direction.
[0058] In addition, the task package stored in the scheduling queue also stores the deadline information of the task. If the task is not executed before the deadline, the task will fail. Figure 5When the difference between the deadline of any task package and the current time is less than the preset time threshold, if the task package is located in the first unit, the position of the task package is adjusted to the leftmost side of the scheduling queue, and the positions of other task packages originally located on the left side of the task package are moved one position to the right; if the task package is located in the second unit, the position of the task package is adjusted to the rightmost side of the scheduling queue, and the positions of other task packages originally located on the right side of the task package are moved one position to the left.
[0059] The time threshold can be adjusted according to the actual situation, for example, according to the task type or the computing resources of the DPU and CPU. By setting the queue-jumping execution mechanism for task packages, it is possible to avoid the situation where the task packages that are about to expire are queued in the scheduling queue and cause execution failure.
[0060] Furthermore, when the DPU side or the CPU side is in a full load state, the transmission of task packets from the scheduling queue to the DPU side or the CPU side is suspended; the full load state is that the computing resource consumption of the DPU side or the CPU side is greater than the preset full load threshold. By suspending the transmission of task packets to the DPU side or the CPU side, it is possible to avoid crowding of task packets on the CPU side or the DPU side, thereby improving the overall performance of the system. The full load threshold here can be set according to actual conditions, for example, set to 70%, that is, when the computing resource consumption of the DPU side or the CPU side is greater than 70%, the transmission of task packets from the scheduling queue to the DPU side or the CPU side is suspended.
[0061] But at the same time, in order to ensure that the corresponding task package can be executed before the deadline, when the DPU side or the CPU side is in a fully loaded state, if the difference between the deadline and the current time of any task package is less than the preset time threshold, the task package is transmitted to the DPU side or the CPU side. In other words, the task package can be directly transmitted to the DPU side or the CPU side so that these task packages can be executed. Therefore, even if the CPU side and the DPU side are in a fully loaded state, they are not fully loaded in the true sense, and at least computing resources need to be reserved for processing the task packages whose deadlines are about to arrive.
[0062] Finally, the scheduling queue is updated according to the execution result of the received task package on the CPU side or the DPU side. The update here refers to deleting or retaining the task package from the scheduling queue. There are different situations here. For example, when the execution result of the task package is completed, the task package can be deleted from the scheduling queue to free up the corresponding storage location; and if the execution result of the task package is failed, the task package can be retained in the scheduling queue to re-transmit the task package to the CPU side or the DPU side for execution.
[0063] Further, as described above, after the priority value is encapsulated into the task packet, the task packet stored in the scheduling queue may include the following fields to inform the DPU or CPU how to execute the task:
[0064] Section 1: Task coding. In the system, there are only N fixed types of tasks, such as erasure coding task coding = 1, hash calculation task coding = 2...
[0065] Paragraph 2: Mission package length.
[0066] Section 3: The specific priority value of the task package; this section is used for queue sorting.
[0067] Section 4: The task package generation time and deadline, used for task package management and monitoring.
[0068] Paragraph 5: How many copies of data are needed for the task package to execute and the address type of each copy of the data (determine whether the input data needs to be read from local memory (including host memory, DPU memory), read from local SSD, read remotely using RDMA, read remotely using TCP, etc.).
[0069] Section 6: Corresponding to the number of copies of the data in Section 5 and the address type of the data, lists the storage address of each copy of the read data (for example, TCP needs to provide specific IP address, port number, remote data storage location and other information) and its stored data length.
[0070] Section 7: Total amount of executed data; used to determine the specific amount of data calculation.
[0071] Paragraph 8: After the task is completed, how many copies of the output data will there be and the storage address type.
[0072] Section 9: Corresponding to the number of data copies and address type of the stored data in Section 8, lists the storage address of each output data copy.
[0073] Paragraph 10: Data length for a specific task. (Since each task may require additional parameters, each specific task packet will have specific data at the end. How the internal data is placed is related to the task packet data parsing of the library function.)
[0074] Paragraph 11: Give specific data for a specific task.
[0075] At the same time, at least one software agent is running on both the CPU side and the DPU side. The software agent is mainly used to implement the following functions:
[0076] (1) Responsible for receiving task packages from the scheduling queue and extracting the corresponding processing function from the execution library according to the task code contained in the task package.
[0077] (2) According to the task packet address information, read the corresponding input data from the host memory or host SSD to the processing function.
[0078] (3) According to the task packet address information, call the communication-related functions and read the input data from the remote end to the processing function.
[0079] (4) According to the task packet address information, the output data of the processing function is stored in the host memory or host SSD.
[0080] (5) According to the task packet address information, call the communication-related functions and store the output data to the remote end.
[0081] (6) After the task is completed, a short response packet is sent to the CPU side. This response packet is different from the return data after the task packet is executed. It arrives at a certain address in the host memory. Its specific structure is as follows:
[0082] Section 1: Identity information of the mission package.
[0083] Section 2: Generation time and deadline of the task package.
[0084] Paragraph 3: Execution success or failure.
[0085] The CPU will periodically check the memory segment to determine the task execution status and update the scheduling queue.
[0086] If performance permits, the above task scheduling method can be executed in parallel, and the same number of software agents can be run in parallel on the CPU side and the DPU side to improve the overall performance of the system.
[0087] In addition, when the software agent on the DPU side reads and writes local memory or local SSD data, it needs to determine the transmission form between the DPU and the local data, compared with the software agent on the CPU side. Generally speaking, there are two main forms of data communication for offloading tasks to the DPU side:
[0088] (1) Host memory interacts with DPU.
[0089] (2) PCIe-side devices interact with the DPU.
[0090] When the task data communication form is the first one, if the DPU has DMA function, the DPU's DMA is used to transfer data between the host memory and the DPU to avoid excessive intervention of the host CPU. If there is no DMA, the host CPU is used normally for data exchange.
[0091] When the task data communication form is the second one, if the DPU, host and PCIe terminal all support PCIe P2P technology, P2P technology is used for data transmission to avoid host CPU and memory intervention. If not, the host CPU is used normally for data interaction. In addition, in some specific scenarios, such as SSD and Alveo FPGA P2P data interaction, when the transmission data block size exceeds 128MB, due to the optimized processing mechanism of the operating system, the host CPU has a higher data interaction efficiency than P2P technology. Therefore, if there are higher requirements for data transmission performance, the corresponding transmission standard can be set in the DPU side software agent during system initialization, that is, even if the task already requires P2P technology for transmission, it will still not be enabled due to the large size of the transmission data block.
[0092] By selecting the transmission form between DPU and local data in the DPU-side software agent, the delay caused by local data transmission can be reduced and the overall host resources can be saved.
[0093] Preferably, in order to increase the working efficiency of the CPU side and the DPU side, the CPU side and the DPU side are allowed to execute tasks in parallel. For the CPU side, if there are spare computing resources, and for the DPU side, if there are corresponding spare dedicated hardware or computing resources, tasks can be executed in parallel.
[0094] Taking the DPU side as an example, the software agent on the DPU side receives an erasure coding task, and the DPU uses internal dedicated hardware to calculate the erasure coding task; then, the software agent on the DPU side receives another erasure coding task. Since the erasure computing acceleration hardware still has additional resources, the hardware is used to continue to calculate the new task. At this time, the erasure hardware has no extra resources; then, the software agent on the DPU side receives another hash computing task. Since the erasure hardware does not conflict with the hash hardware, the DPU lets the hash hardware perform the hash computing task; then, the software agent on the DPU side receives another erasure coding task. Since the erasure hardware computing resources are full, but there are software computing resources, the software library on the DPU side can perform a new erasure coding task. At this time, the DPU side also has no computing resources. At this time, the software agent on the DPU side finds that the next new task is still erasure coding. Since the software and hardware resources related to erasure computing are full, the software agent on the DPU side suspends receiving new tasks, and the scheduler queue is in a blocked state until the DPU side has new computing resources.
[0095] Embodiment 1 of the present invention provides a DPU task scheduling method, which can effectively improve the efficiency and reliability of DPU task scheduling, improve the problem of unloading complex tasks of DPU, realize load balancing between CPU and DPU, and ensure the high performance and stability of the system. Among them, by comprehensively considering the calculation amount, deadline and whether the DPU side has dedicated hardware of the task, the task can be more reasonably allocated to improve the overall efficiency of the system. The priority calculation of the task not only considers the inherent attributes of the task, but also combines the current state of the system to ensure the flexibility and real-time performance of task scheduling. In addition, through priority sorting and task allocation, load balancing between CPU and DPU is achieved to avoid the degradation of system performance caused by overload of one party. Secondly, the priority calculation formula can flexibly adjust the influence of the calculation amount, deadline and the existence of dedicated hardware on the priority by introducing weighting coefficients, so that the priority calculation is more accurate. By judging whether there is dedicated hardware on the DPU side and adjusting the priority, the tasks suitable for DPU processing are preferentially scheduled, and the hardware acceleration capability of DPU is fully utilized to further improve the efficiency of task execution. In the task scheduling process, tasks with high priority are preferentially scheduled to ensure that important tasks are processed in time, thereby improving the response speed and reliability of the system. By delivering tasks to the DPU and CPU from both ends of the scheduling queue, load balancing is achieved to avoid overloading on one side. At the same time, the storage location of the task package is dynamically adjusted according to the number of task packages to ensure the flexibility and scalability of the scheduling queue, further improving the effect of load balancing. In order to adapt to the current system state, the unit length of the scheduling queue is dynamically adjusted according to the processing efficiency of the DPU and CPU, making the scheduling queue more flexible. By ensuring that the unit with 0 task packages can receive new task packages in time, resource waste is avoided. The fine control of the number of task packages ensures that the moving direction and number of task packages are more reasonable, and the balance of the number of tasks in the scheduling queue is continuously maintained, further optimizing the load balancing effect. For urgent tasks approaching the deadline, the system can quickly adjust their positions to ensure that these tasks are processed first, improving the real-time and reliability of the system. By quickly adjusting the position of the task package, the system can quickly respond to the needs of urgent tasks and ensure the timely completion of key tasks. When the DPU or CPU is fully loaded, the system will suspend the delivery of task packages to prevent overload and ensure the stability and reliability of the system. This strategy avoids invalid task scheduling, reduces resource waste, and improves system resource utilization. Even when fully loaded, the system can prioritize emergency tasks and ensure timely completion of critical tasks, thus improving the system's response capability and robustness.
[0096] Example 2
[0097] Embodiment 2 of the present invention provides a DPU task scheduling system, which is used to schedule tasks to the CPU side or the DPU side.
[0098] Reference Figure 6 , the scheduling system includes:
[0099] A task generation module, which is used to generate a task package according to the task information to be processed; the task package records the calculation amount information, deadline information and task type information related to the task itself;
[0100] A priority calculation module receives the task package generated by the task generation module, and calculates the priority of the task package according to the computational amount of the task package, the deadline, and whether there is dedicated hardware for the task package on the DPU side; the task type information of the task package is used to determine whether there is dedicated hardware for the task package on the DPU side;
[0101] A queue storage module is used to store the task packets in a position corresponding to the priority of the scheduling queue according to the priority of the task packets, and transmit the task packets to the CPU side or the DPU side in sequence;
[0102] The queue update module is used to update the scheduling queue according to the execution result of the received task packet by the CPU side or the DPU side.
[0103] The description of the above-mentioned task generation module, priority calculation module, queue storage module and queue update module can refer to Example 1, and will not be repeated here. Among them, the task generation module can receive the task information sent by the CPU side and generate a task package; the priority calculation module can receive the task package, and after calculating the priority, assign the priority attribute and value to the task package; the queue storage module is used to determine the storage location of the task package in the scheduling queue according to the priority value, and can transmit the task package to the CPU side or the DPU side; the queue update module can receive the execution result of the task package executed on the CPU side or the DPU side, and update the scheduling queue according to the execution result.
[0104] Among them, the task generation module, priority calculation module, queue storage module and queue update module can all be computer programs that can be run in the processor. By running the corresponding computer programs, the scheduling and allocation of tasks can be realized, the efficiency and reliability of DPU task scheduling can be improved, the problem of DPU complex task offloading can be improved, and load balancing between CPU and DPU can be achieved, ensuring the high performance and stability of the system.
[0105] The description of the above specification and embodiments is used to explain the protection scope of the present invention, but does not constitute a limitation on the protection scope of the present invention. Through the enlightenment of the present invention or the above embodiments, ordinary technicians in this field can obtain modifications, equivalent replacements or other improvements to the embodiments of the present invention or one of the technical features of a unit through logical analysis, reasoning or limited experiments, which should be included in the protection scope of the present invention.
Claims
1. A DPU task scheduling method, which is used to schedule tasks to the CPU side or the DPU side, characterized in that: include: Generate a task package based on the task information to be processed; Calculate the priority of the task package based on the computational effort of the task package, the deadline, and whether there is dedicated hardware for the task package on the DPU side; According to the priority of the task package, the task package is stored in the position corresponding to its priority in the scheduling queue, and the task package is transmitted to the CPU side or the DPU side in sequence; The scheduling queue is updated according to the execution result of the received task packet by the CPU side or the DPU side.
2. A DPU task scheduling method as claimed in claim 1, characterized in that: When calculating the priority of the task package, the following formula is used: P = a*Cal+b*Tim+c*Hav; wherein P is the priority of the task package, Cal is the computational load of the task package, Tim is the deadline of the task package, Hav is 0 or 1, and a, b, and c are preset weighting coefficients; The task package records the computational information, deadline information and task type information related to itself; when calculating the priority of the task package, based on the task type information of the task package, it is determined whether there is dedicated hardware corresponding to the task type information on the DPU side, and if so, the value of Hav is set to 1, and if not, the value of Hav is set to 0.
3. A DPU task scheduling method as claimed in claim 1, characterized in that In the scheduling queue, task packets are placed continuously from left to right according to priority from large to small, and task packets are transmitted from the left end of the scheduling queue to the DPU side, and from the right end of the scheduling queue to the CPU side.
4. A DPU task scheduling method as claimed in claim 3, characterized in that: The scheduling queue is divided into a first unit and a second unit, wherein the first unit is located on the left side of the scheduling queue and the second unit is located on the right side of the scheduling queue; when a new task package is stored in the scheduling queue, the task packages in the scheduling queue are moved to the unit with fewer numbers according to the number of task packages in the first unit and the second unit to free up storage space for the new task package.
5. A DPU task scheduling method as claimed in claim 4, characterized in that: The lengths of the first unit and the second unit are adjusted according to the processing efficiency of the task packets on the DPU side and the CPU side. In the first unit or the second unit, when the number of task packets in any unit is 0 and the number of task packets in the other unit is greater than 0, the length of the unit with the number of task packets greater than 0 is reduced by 1, and the length of the unit with the number of task packets 0 is increased by 1.
6. A DPU task scheduling method as claimed in claim 5, characterized in that: After each adjustment of the length of the first unit and the second unit, the new task packet is stored in the scheduling queue and when the task packets in the scheduling queue are moved according to the number of task packets in the first unit and the second unit, the number of task packets in the unit whose length has increased is increased by 1, and the number of task packets in the unit whose length has decreased is reduced by 1, and the calculated values are compared to determine the moving direction of the task packets in the scheduling queue.
7. A DPU task scheduling method as claimed in claim 3, characterized in that When the difference between the deadline of any task package and the current time is less than the preset time threshold, if the task package is located in the first unit, the position of the task package is adjusted to the leftmost side of the scheduling queue, and the positions of other task packages originally located on the left side of the task package are moved one position to the right; If the task packet is located in the second unit, the position of the task packet is adjusted to the rightmost side of the scheduling queue, and the positions of other task packets originally located on the right side of the task packet are moved one position to the left.
8. A DPU task scheduling method as claimed in claim 1, characterized in that: When the DPU side or the CPU side is in a full load state, the transmission of task packets from the scheduling queue to the DPU side or the CPU side is suspended; the full load state means that the computing resource consumption of the DPU side or the CPU side is greater than a preset full load threshold.
9. A DPU task scheduling method as claimed in claim 8, characterized in that: When the DPU side or the CPU side is in a fully loaded state, if the difference between the deadline time of any task packet and the current time is less than a preset time threshold, the task packet is transmitted to the DPU side or the CPU side.
10. A DPU task scheduling system, characterized in that: include: A task generation module, which is used to generate a task package according to the task information to be processed; the task package records the calculation amount information, deadline information and task type information related to the task itself; A priority calculation module receives the task package generated by the task generation module, and calculates the priority of the task package according to the computational amount of the task package, the deadline, and whether there is dedicated hardware for the task package on the DPU side; the task type information of the task package is used to determine whether there is dedicated hardware for the task package on the DPU side; A queue storage module is used to store the task packets in a position corresponding to the priority of the scheduling queue according to the priority of the task packets, and transmit the task packets to the CPU side or the DPU side in sequence; The queue update module is used to update the scheduling queue according to the execution result of the received task packet by the CPU side or the DPU side.
Citation Information
Patent Citations
Multi-core parallel scheduling method based on CPU + GPU heterogeneous processing platform
CN113553103A
Matrix acceleration calculation method based on GPU
CN114675966A
Dynamic load balancing for real-time deep learning analysis operations
CN114981779A
Task allocation method and device, electronic equipment and computer program
CN118796441A
Task scheduling method and apparatus, and kubernetes scheduler
WO2024021489A1