A CPU / GPU cooperative online scheduling method and system based on lyapunov optimization
By using a Lyapunov optimization-based method, the online scheduling problem of CPU/GPU heterogeneous computing systems is transformed into time-slot scheduling. By constructing workloads and virtual queues, collaborative scheduling between CPU/GPU devices is achieved, solving the problems of load balancing and energy consumption optimization in online task environments and improving resource utilization.
Patent Information
- Application Number
- CN202611408181.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-11
- Publication Date
- 2026-11-06
- Estimated Expiration
- 2046-09-11
AI Technical Summary
In CPU/GPU heterogeneous computing systems, existing scheduling methods struggle to achieve load balancing and energy optimization when future task information is unknown, resulting in low resource utilization. Furthermore, traditional methods are not well-suited for online task environments.
By employing a Lyapunov optimization-based approach, the online scheduling optimization model is transformed into a time-slot-by-time scheduling problem. By constructing workload queues and virtual queues, and establishing energy consumption and load balancing constraints, the goal is to minimize the long-term average unfinished workload of the system, thereby achieving collaborative online scheduling between CPU/GPU devices.
Under the constraints of energy consumption and load balancing, the resource utilization of the CPU/GPU heterogeneous computing system is improved, the long-term average unfinished workload of the system is reduced, and the real-time solution requirements of online scheduling are met.
Smart Images

Figure CN122903209B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of parallel computing technology, and in particular relates to a CPU / GPU collaborative online scheduling method and system based on Lyapunov optimization. Background Technology
[0002] With the continuous growth of data volume and the increasing demands for computing power, single-type computing devices can no longer meet the performance requirements of complex application scenarios. In recent years, heterogeneous computing systems composed of CPUs and GPUs have been widely used in scientific computing, machine learning, data analysis, and high-performance computing. CPUs have flexible control capabilities and strong serial processing capabilities, while GPUs can efficiently handle highly parallel computing tasks through massively parallel computing units. Therefore, in CPU / GPU heterogeneous computing systems, rational task scheduling, which appropriately distributes different types of computing tasks between the CPU and GPU, is of great significance for improving the overall system performance.
[0003] In practical applications, tasks typically arrive at the system continuously, requiring the system to make scheduling decisions in real time without knowing future task information. This type of problem is known as the online scheduling problem. Traditional static scheduling methods usually require obtaining complete task information in advance, making them unsuitable for online task environments. Furthermore, there are significant differences between CPUs and GPUs in terms of computing power, energy consumption characteristics, and task adaptability. An inappropriate scheduling strategy can easily lead to problems such as unbalanced device load, increased system energy consumption, and reduced resource utilization.
[0004] Existing research often focuses on optimizing system throughput or task completion time, while neglecting to consider system energy consumption and load balancing between CPUs and GPUs. Furthermore, achieving long-term performance optimization in online scheduling scenarios without relying on future task information remains a challenging research problem.
[0005] Therefore, this paper proposes a CPU / GPU collaborative online scheduling method and system based on Lyapunov optimization, which is of great significance for improving the scheduling efficiency and resource utilization of CPU / GPU heterogeneous computing systems. Summary of the Invention
[0006] To address the problems existing in the prior art, this invention proposes a CPU / GPU collaborative online scheduling method and system based on Lyapunov optimization. This method solves the problem that in CPU / GPU heterogeneous computing systems, due to the randomness of task arrival and unpredictable factors such as changes in system operating status over time, it is difficult to formulate task allocation strategies in real time under energy consumption constraints and CPU / GPU load balancing constraints. This enables collaborative online scheduling between CPU and GPU devices, improves system resource utilization, and reduces the long-term average unfinished workload of the system.
[0007] The technical solution of the present invention is as follows: A CPU / GPU collaborative online scheduling method based on Lyapunov optimization is applied to a CPU / GPU collaborative computing system. The method includes: The runtime of the CPU / GPU collaborative computing system is discretized into multiple time slots. At the beginning of each time slot, the set of tasks arriving at the system is obtained, and a set of CPU devices containing multiple CPU devices and a set of GPU devices containing multiple GPU devices are defined. A CPU device workload queue is constructed for each CPU device in the CPU device set, and a GPU device workload queue is constructed for each GPU device in the GPU device set. Each workload queue is used to represent the computational workload that the corresponding device has not yet completed at the beginning of the current time slot. Based on the workload queue, calculate the unfinished workload of the CPU / GPU collaborative computing system, the system energy consumption in the current time slot, and the overall load imbalance measurement; Based on the system energy consumption and the load imbalance metric, energy consumption constraints and load balancing constraints are established, and an online scheduling optimization model is constructed with the objective function of minimizing the long-term average unfinished workload of the system. The long-term optimization problem described by the online scheduling optimization model is transformed into a real-time scheduling problem within each time slot using the Lyapunov optimization method. The task allocation strategy for each time slot is calculated, and tasks are assigned to CPU or GPU devices for execution, thereby completing CPU / GPU collaborative online scheduling.
[0008] Furthermore, the runtime of the CPU / GPU collaborative computing system is divided into segments of equal length. Time slot, time slot index satisfy: ; in each time slot The initial set of tasks arriving at the CPU / GPU co-computing system is: ;in, Indicates time slot The number of tasks arriving within the specified timeframe.
[0009] Furthermore, the CPU device set and the GPU device set are respectively defined as follows: and ;in, The number of CPU devices. The number of GPU devices; In the time slot Inside, the mission Assigned to CPU device Indicator variables Defined as: ; in, ; In the time slot Inside, the mission Assigned to GPU device Indicator variables Defined as: ; in, ; Each task can only be assigned to one computing device within a time slot, therefore satisfying: .
[0010] Furthermore, for each CPU device in the CPU device set Constructing time slots Workload queue For each GPU device in the GPU device set Constructing time slots Workload queue The queue update relationship is as follows: ; ; in, Indicates time slot Tasks in The computational scale; Indicates time slot CPU devices Equivalent service capacity; Indicates time slot GPU devices The equivalent service capacity.
[0011] Furthermore, CPU / GPU collaborative computing systems in time slots Initial unfinished work for: ; CPU / GPU collaborative computing system in time slots Internal system energy consumption Represented as: ; in, Indicates CPU device The unit of work workload energy consumption coefficient, Indicates GPU device The unit of work workload energy consumption coefficient; Overall load imbalance measurement of CPU / GPU collaborative computing system Represented as: ,in, This represents the average load on the CPU device. ; This indicates the average load on the GPU device. .
[0012] Furthermore, the long-term optimization problem described by the online scheduling optimization model... Represented as: ; ; ; ; ; in, This represents the total number of time slots in the system operation. Represents the mathematical expectation. This represents the system's long-term average energy consumption budget. This represents the long-term average load imbalance budget of the system.
[0013] Furthermore, the real-time scheduling problem within each time slot, transformed by the Lyapunov optimization method, is a time-slot-wise deterministic optimization problem P3, denoted as: ; ; ; in, A positive zero tradeoff parameter used to balance the workload queue and the virtual queue; Indicates the system in time slots The update relationship of the virtual queue state variables corresponding to energy consumption constraints is as follows: ; Indicates the system in time slots The update relationship of the virtual queue state variables corresponding to load balancing constraints is as follows: The initial state of the virtual queue satisfies , .
[0014] Furthermore, the specific method for calculating the task allocation strategy for each time slot, assigning tasks to CPU devices or GPU devices for execution, thereby completing CPU / GPU collaborative online scheduling, includes: A queue-weighted CPU / GPU collaborative online scheduling algorithm is used to solve the time-slot deterministic optimization problem. In each time slot, the tasks in the task set are allocated to devices according to the system state, thereby obtaining the online scheduling decision between CPU devices and GPU devices. Input parameters include time slots task set Time slot Tasks in Computational scale CPU device set GPU device collection CPU devices In the time slot Workload queue GPU devices In the time slot Workload queue Time slot Energy-constrained virtual queue Time slot Load balancing constraint virtual queue Trade-off parameters CPU devices Energy consumption coefficient per unit of work GPU devices Energy consumption coefficient per unit of work Equivalent service capacity of CPU devices in the current time slot And the equivalent service capability of the GPU device in the current time slot. ; Step 1) Initialize task allocation decision variables, setting them for all tasks and all devices. and ; Step 2) Divide the time slot task set Scale based on task Sort from largest to smallest; Step 3) Perform steps 4 through 6 sequentially for each task; Step 4) Set up CPU devices With GPU device collection The computation task for each candidate device is assigned to the objective function increment corresponding to that device; Step 5) Compare the increments corresponding to each candidate device and determine the computing device that minimizes the increment as the execution device for the task; Step 6) Assign decision variables based on the determined execution device update task. or and the computational scale of the current task Add to the workload queue for the corresponding device; Step 7) After completing the device allocation for all tasks in the current time slot, based on the task allocation results of the current time slot and the workload queues of each device after task allocation and before deducting the equivalent service capacity of the devices, calculate the system energy consumption and overall load imbalance metric in the current time slot, and update the energy consumption constraint virtual queue and the load balancing constraint virtual queue according to the update relationship of the virtual queue state variables; then, according to the queue update relationship of the workload queues, deduct the equivalent service capacity of the corresponding device in the current time slot from the workload queue of each device to obtain the workload queue of the next time slot. Step 8) Output the device allocation decisions for all tasks. , obtain time slot The results of CPU / GPU collaborative online scheduling.
[0015] A CPU / GPU collaborative online scheduling system based on Lyapunov optimization includes a set acquisition module, a workload queue construction module, a computation module, a modeling module, and a task scheduling module; The set acquisition module is used to discretize the running time of the CPU / GPU collaborative computing system into multiple time slots, acquire the set of tasks arriving at the system at the beginning of each time slot, and define a set of CPU devices containing multiple CPU devices and a set of GPU devices containing multiple GPU devices. The workload queue construction module is used to construct a CPU device workload queue for each CPU device in the CPU device set and a GPU device workload queue for each GPU device in the GPU device set. Each workload queue is used to represent the computation workload that the corresponding device has not yet completed at the beginning of the current time slot. The computing module is used to calculate the unfinished workload of the CPU / GPU collaborative computing system, the system energy consumption in the current time slot, and the overall load imbalance measurement based on the workload queue. The modeling module is used to establish energy consumption constraints and load balancing constraints based on the system energy consumption and the load imbalance metric, and to construct an online scheduling optimization model with the objective function of minimizing the long-term average unfinished workload of the system. The task scheduling module is used to transform the long-term optimization problem described by the online scheduling optimization model into a real-time scheduling problem within each time slot through the Lyapunov optimization method, and calculate the task allocation strategy for each time slot to allocate tasks to CPU devices or GPU devices for execution, thereby completing CPU / GPU collaborative online scheduling.
[0016] Time complexity analysis of the scheduling algorithm for solving the time-slot-by-time deterministic optimization problem P3: Let time slots be... The number of missions arriving within the time limit is The number of CPU devices is The number of GPU devices is At the beginning of each time slot, the task set is first... Scale based on task Sort from largest to smallest; the time complexity of this process is O(n log n). After sorting, the objective function increment for each task is calculated sequentially across all CPU and GPU devices, and the device with the smallest increment is selected for allocation. For any task, it is necessary to iterate through all CPU and GPU devices; therefore, the time complexity of calculating the candidate allocation increment for a task is O(log n). For time slots The time complexity of all tasks being completed and the equipment allocation is [missing information]. Therefore, the overall time complexity for making scheduling decisions within each time slot is: .
[0017] For the original scheduling optimization problem P1, the long-term average unfinished workload obtained by the method of this invention is comparable to the optimal... The difference between -only strategies does not exceed That is, the system performance meets Its convergence properties.
[0018] To analyze the stability of the system queue, a system state vector is introduced: ; Define the Lyapunov function as: ; This function is used to characterize the overall size of the system's virtual queue state.
[0019] Define the drift function as: ; To optimize system performance while ensuring queue stability, a drift penalty function is introduced: .
[0020] Update relationship of virtual queue with energy consumption constraints And the update relationship of virtual queues under load balancing constraints. and combined We can obtain: ; ; Adding the two equations above together, and combining them with the definitions of the Lyapunov function and the drift function, we get: ; For both sides of the above equation under a given system state Under the given conditions, taking the expected value yields: ; Due to the system's energy consumption in each time slot With load imbalance measurement All are bounded random variables, therefore there exist constants that are independent of the scheduling decision. , so that: ; Substituting, we get: ; Add a penalty term to both sides of the above equation. We can obtain: ; That is, the drift plus penalty function has a definite upper bound.
[0021] Define the optimal -only policy, denoted as This strategy satisfies the long-term time-average constraint in the original scheduling optimization model P1, and the decision within each time slot depends only on the exogenous random information of the current time slot, not on the queue state. Let the optimal... The long-term average unfinished work for the -only strategy is: ; Because the time-slot scheduling strategy adopted in this invention is based on a given system state Under the condition of minimizing the right side of the upper bound of the drift plus penalty function, the optimal w-only strategy is thus achieved. In the time slot Substituting the generated random quantity into the right side of the above inequality, we get: ; If the system satisfies the strict feasibility condition, then there exists a constant. , making optimal -only policy satisfies: ; ; Substituting the above relationship into the previous inequality, we get: ; Ignore the non-positive terms on the right side and to Summing yields: ; make Then we have: ; As can be seen from the above analysis, the difference between the long-term average unfinished workload obtained by the method of this invention and the optimal w-only strategy does not exceed [a certain percentage]. Therefore, the system performance meets the requirements. The convergence properties. When When the value is large, the long-term average unfinished workload obtained by the method of this invention is closer to the optimal value, but the corresponding queue length will increase, and the system convergence speed will decrease; when When the value is small, the system queue length is short, but the performance gap with the optimal value is relatively large. Therefore, the parameter can be flexibly selected according to the different requirements of the system for performance and queue stability. The value of allows the method of the present invention to achieve reasonable collaborative scheduling between CPU devices and GPU devices in CPU / GPU heterogeneous computing systems with dynamically arriving tasks, under the conditions of satisfying long-term average energy consumption constraints and long-term average load balancing constraints, thereby improving system resource utilization and reducing the long-term average unfinished workload of the system.
[0022] Compared with the prior art, the present invention has the following beneficial effects: This invention transforms the long-term optimization problem described by the online scheduling optimization model into a slot-by-slot scheduling problem, and solves it using a queue-weighted CPU / GPU collaborative online scheduling algorithm. This algorithm dynamically determines the task allocation strategy between CPU and GPU devices based on the system state. While satisfying the system's long-term average energy consumption constraints and load balancing constraints, it reduces the system's long-term average unfinished workload and improves the resource utilization of the CPU / GPU heterogeneous computing system. Furthermore, the employed scheduling algorithm is a multinomial-time algorithm, which meets the real-time solution requirements in online scheduling scenarios. Attached Figure Description
[0023] Figure 1 This is a schematic diagram of the process flow for a CPU / GPU collaborative online scheduling method based on Lyapunov optimization. Detailed Implementation
[0024] The present invention will be further illustrated below with reference to the accompanying drawings and specific embodiments. It should be understood that these embodiments are for illustrative purposes only and are not intended to limit the scope of the invention. After reading this invention, any modifications of the invention in various equivalent forms by those skilled in the art will fall within the scope defined by the appended claims.
[0025] Example 1: This invention discloses a CPU / GPU collaborative online scheduling method based on Lyapunov optimization, applicable to CPU / GPU collaborative computing systems, such as... Figure 1 As shown, the method includes: The runtime of the CPU / GPU collaborative computing system is discretized into multiple time slots of equal length. At the beginning of each time slot, the set of tasks arriving at the system is obtained, and a set of CPU devices containing multiple CPU devices and a set of GPU devices containing multiple GPU devices are defined. Furthermore, the runtime of the CPU / GPU collaborative computing system is divided into segments of equal length. Equal-length time slots, time slot index satisfy: ; in each time slot The initial set of tasks arriving at the CPU / GPU co-computing system is: ;in, Indicates time slot The number of tasks arriving within the specified timeframe.
[0026] Furthermore, the CPU device set and the GPU device set are defined as follows: and ;in, The number of CPU devices. The number of GPU devices; for any task Its computational scale is denoted as ,and .
[0027] Based on the task set, CPU device set, and GPU device set, a CPU device workload queue is constructed for each CPU device in the CPU device set, and a GPU device workload queue is constructed for each GPU device in the GPU device set. Each workload queue is used to represent the computation workload that the corresponding device has not yet completed at the beginning of the current time slot. Furthermore, in time slots Inside, the mission Assigned to CPU device Indicator variables Defined as: ; in, ; In the time slot Inside, the mission Assigned to GPU device Indicator variables Defined as: ; in, It should be noted that the subscript... Used to identify CPU devices in a set of CPU devices, subscript Used to identify GPU devices in a set of GPU devices; even if the index... With subscript They have the same numerical value, but they also represent different types of computing devices.
[0028] Each task can only be assigned to one computing device within a time slot, therefore satisfying: .
[0029] Furthermore, for each CPU device in the CPU device set Constructing time slots Workload queue For each GPU device in the GPU device set Constructing time slots Workload queue The queue update relationship is as follows: ; ; in, Indicates time slot CPU devices Equivalent service capacity; Indicates time slot GPU devices The equivalent service capacity.
[0030] The workload queue is used to calculate the unfinished workload of the CPU / GPU collaborative computing system, the system energy consumption in the current time slot, and the overall load imbalance measurement. Furthermore, CPU / GPU collaborative computing systems in time slots Initial unfinished work for: ; CPU / GPU collaborative computing system in time slots Internal system energy consumption Represented as: ; in, Indicates CPU device The unit of work workload energy consumption coefficient, Indicates GPU device The unit of work workload energy consumption coefficient; Overall load imbalance measurement of CPU / GPU collaborative computing system Represented as: ,in, This represents the average load on the CPU device. ; This indicates the average load on the GPU device. .
[0031] Based on system energy consumption and load imbalance metrics, energy consumption constraints and load balancing constraints are established, and an online scheduling optimization model is constructed with the objective function of minimizing the long-term average unfinished workload of the system. Furthermore, the long-term optimization problem described by the online scheduling optimization model Represented as: ; This formula represents the energy consumption constraint. This formula represents the load balancing constraint. This formula represents the task uniqueness constraint. This expression represents the integer constraint of the task. in, This represents the total number of time slots in the system operation. Represents the mathematical expectation. This represents the system's long-term average energy consumption budget. This represents the long-term average load imbalance budget of the system.
[0032] The long-term optimization problem described by the online scheduling optimization model is transformed into a real-time scheduling problem within each time slot using the Lyapunov optimization method. The task allocation strategy for each time slot is calculated, and tasks are assigned to CPU or GPU devices for execution, thereby completing CPU / GPU collaborative online scheduling.
[0033] Furthermore, the real-time scheduling problem within each time slot is transformed using the Lyapunov optimization method, as follows: To address the system's long-term average energy consumption constraints and CPU / GPU load balancing constraints, virtual queue state variables corresponding to the energy consumption constraints are constructed respectively. Virtual queue state variables corresponding to load balancing constraints Their update relationships are represented as follows: ; ; The initial state of the virtual queue satisfies , ; Furthermore, the system is defined in time slots. The state vector is: ; Introducing Lyapunov functions and drift function , is represented as: ; ; Furthermore, the original scheduling optimization model is transformed into a time-slot-by-time optimization problem in the form of drift plus penalty. Its optimization objective is expressed as: ; ; ; in, It is a positive-zero tradeoff parameter used to balance the workload queue and the virtual queue. Furthermore, by performing an upper bound analysis on the drift-penalty objective function, we can obtain: ; in, Let be a constant independent of the scheduling decision. Since the right-hand side of the above inequality is an upper bound of the objective function for problem P2, and Since the constant term is constant, minimizing the upper bound after removing the constant term further transforms problem P2 into the final time-slot-by-time deterministic optimization problem. : ; ; .
[0034] Furthermore, the specific methods for calculating the task allocation strategy for each time slot and assigning tasks to CPU or GPU devices for execution, thereby completing CPU / GPU collaborative online scheduling, include: A queue-weighted CPU / GPU collaborative online scheduling algorithm is used to solve the time-slot deterministic optimization problem. In each time slot, the tasks in the task set are allocated to devices according to the system state, thereby obtaining the online scheduling decision between CPU devices and GPU devices. Input parameters include time slots task set Time slot Tasks in Computational scale CPU device set GPU device collection CPU devices In the time slot Workload queue GPU devices In the time slot Workload queue Time slot Energy-constrained virtual queue Time slot Load balancing constraint virtual queue Trade-off parameters CPU devices Energy consumption coefficient per unit of work GPU devices Energy consumption coefficient per unit of work Equivalent service capacity of CPU devices in the current time slot And the equivalent service capability of the GPU device in the current time slot. .
[0035] Step 1) Initialize task allocation decision variables, setting them for all tasks and all devices. and ; Step 2) Divide the time slot task set Scale based on task Sort from largest to smallest; Step 3) Perform steps 4 through 6 sequentially for each task; Step 4) Set up CPU devices With GPU device collection For each candidate device, the computation task is assigned to the objective function increment corresponding to that device; among which, the task is assigned to the CPU device. The increment is expressed as: ; in, Indicates in time slot Task Assigned to candidate CPU devices Post-load imbalance metric relative to the initial overall load imbalance metric at the start of the current time slot The change in; Tasks are assigned to GPU devices The increment is expressed as: ; in, Indicates in time slot Task Assigned to candidate GPU devices Post-load imbalance metric relative to the initial overall load imbalance metric at the start of the current time slot The change in; Step 5) Compare the increments corresponding to each candidate device and determine the computing device that minimizes the increment as the execution device for the task; Step 6) Assign decision variables based on the determined execution device update task. or and the computational scale of the current task Add to the workload queue for the corresponding device; Step 7) After completing the device allocation for all tasks in the current time slot, based on the task allocation results of the current time slot and the workload queues of each device after task allocation and before deducting the equivalent service capacity of the devices, calculate the system energy consumption and overall load imbalance metric in the current time slot, and update the energy consumption constraint virtual queue and the load balancing constraint virtual queue according to the update relationship of the virtual queue state variables; then, according to the queue update relationship of the workload queues, deduct the equivalent service capacity of the corresponding device in the current time slot from the workload queue of each device to obtain the workload queue of the next time slot. ; ; ; ; Step 8) Output the device allocation decisions for all tasks. , obtain time slot The results of CPU / GPU collaborative online scheduling.
[0036] Example 2: The present invention provides a CPU / GPU collaborative online scheduling system based on Lyapunov optimization, comprising a set acquisition module, a workload queue construction module, a computation module, a modeling module, and a task scheduling module; The set acquisition module is used to discretize the runtime of the CPU / GPU collaborative computing system into multiple time slots, acquire the set of tasks arriving at the system at the beginning of each time slot, and define a set of CPU devices containing multiple CPU devices and a set of GPU devices containing multiple GPU devices. The workload queue construction module is used to build a CPU device workload queue for each CPU device in the CPU device set and a GPU device workload queue for each GPU device in the GPU device set. Each workload queue is used to represent the computation workload that the corresponding device has not yet completed at the beginning of the current time slot. The computing module is used to calculate the unfinished workload of the CPU / GPU collaborative computing system, the system energy consumption in the current time slot, and the overall load imbalance measurement based on the workload queue. The modeling module is used to establish energy consumption constraints and load balancing constraints based on system energy consumption and load imbalance metrics, and to build an online scheduling optimization model with the objective function of minimizing the long-term average unfinished workload of the system. The task scheduling module is used to transform the long-term optimization problem described by the online scheduling optimization model into a real-time scheduling problem within each time slot through the Lyapunov optimization method, and calculate the task allocation strategy for each time slot to allocate tasks to CPU devices or GPU devices for execution, thereby completing CPU / GPU collaborative online scheduling.
[0037] Example 3: To further illustrate the specific implementation process of the method of the present invention, this example provides a numerical example under a single time slot.
[0038] Assume the system is in time slot The set of internal arrival tasks is: ; The task computational scales are as follows: ; The CPU device set is as follows: ; The GPU device set is as follows: ; The energy consumption coefficient per unit of CPU computational workload is: ; The energy consumption coefficient per unit computational workload of a GPU device is: ; For ease of numerical illustration in this example, the workload queues of the four computing devices are numbered consecutively. The workload queues for CPU device 1 and CPU device 2 are denoted as follows: and The workload queues for GPU device 1 and GPU device 2 are respectively denoted as... and Time slot Initially, the workload queue statuses for each device were as follows: ; in, , These represent the workload queues for CPU device 1 and CPU device 2, respectively. , These represent the workload queues for GPU device 1 and GPU device 2, respectively.
[0039] The states of the energy-constrained virtual queue and the load-balancing-constrained virtual queue are as follows: ; Trade-off parameters ; The system's long-term average energy consumption budget and long-term average load imbalance budget are as follows: ; In the time slot Initially, the average CPU load was: ; The average load on GPU devices is: ; Therefore, the CPU / GPU load imbalance metric at the start of the current time slot is: ; For ease of explanation, the task Assigned to CPU device The increment of the objective function at time is denoted as ,Task Assigned to GPU devices The increment of the objective function at time is denoted as The increments of the load imbalance term are denoted as follows: ; ; here, and This indicates that the task is assigned based on the workload queue state before the current task is assigned. Assume the load imbalance metric obtained after allocation to the corresponding devices. Therefore, the increment of the objective function is expressed as follows: ; ; Step 1: Initialize task assignment decision variables. For all tasks and all devices, initialize the task assignment decision variables as follows: ; ; Step 2: Sort by task computation size. Sort the tasks from largest to smallest. Therefore, the task execution order is as follows: .
[0040] Step 3: Perform steps 4 through 6 sequentially for each task; Perform the following operations on Task 1: For Task 1, there are .
[0041] If task 1 is assigned to CPU device 1, then assume that the queues of each device after assignment are as follows: ,then ; ; ;therefore ; If task 1 is assigned to CPU device 2, then assume that the queues of each device after assignment are as follows: ,then ; ; therefore ; If task 1 is assigned to GPU device 1, then assume that the queues for each device after assignment are as follows: ,then ; ; ; therefore ; If task 1 is assigned to GPU device 2, then assume that the queues for each device after assignment are as follows: ,then ; ; therefore ; The comparison shows that the smallest increment corresponds to GPU device 2. Therefore, task 1 is assigned to GPU device 2. ; And update the corresponding device workload queue to ; At this point, the queue state becomes ; Perform the following operations on Task 2: For task 2, there are .
[0042] The objective function increment is then calculated based on the updated workload queue status. If task 2 is assigned to CPU device 1, then it is assumed that the queues on each device are as follows after assignment. ,then ; ; ; therefore ; If task 2 is assigned to CPU device 2, then assume that the queues of each device after assignment are as follows: ,then ; ; therefore ; If task 2 is assigned to GPU device 1, then assume that the queues for each device after assignment are as follows: ,then ; ; ; therefore ; If task 2 is assigned to GPU device 2, then assume that the queues for each device after assignment are as follows: ,then ; ; therefore ; The comparison shows that the smallest increment corresponds to CPU device 1. Therefore, task 2 is assigned to CPU device 1. ; And update the corresponding device workload queue as follows: ; At this point, the final workload queue state is: ; Step 7: Calculate system energy consumption and load imbalance metrics based on the current time slot task allocation results. Based on the final allocation results of all tasks within the current time slot, the system energy consumption is: ; The average CPU load is: ; The average load on GPU devices is: ; Therefore, the CPU / GPU load imbalance metric for the current time slot is: Step 8: Update the virtual queue and output the scheduling result. Based on the virtual queue update formula: ; ; Substitution ; get ; Therefore, in time slots Within the task, the equipment allocation decision is as follows: ; ; That is, Task 1 is assigned to GPU device 2, and Task 2 is assigned to CPU device 1.
[0043] This embodiment demonstrates that, given the workload queue state, virtual queue state, and system parameters, the method of the present invention can complete the time-slot scheduling by sequentially performing incremental calculation, device selection, and queue update for each task. After all tasks are allocated, the system energy consumption and load imbalance metric are calculated uniformly, and the virtual queue is updated, thereby obtaining a complete single-time-slot CPU / GPU collaborative online scheduling result.
[0044] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in the present invention should be included within the scope of protection of the present invention.
Claims
1. A CPU / GPU collaborative online scheduling method based on Lyapunov optimization, applied to a CPU / GPU collaborative computing system, characterized in that, The method includes: The runtime of the CPU / GPU collaborative computing system is discretized into multiple time slots. At the beginning of each time slot, the set of tasks arriving at the system is obtained, and a set of CPU devices containing multiple CPU devices and a set of GPU devices containing multiple GPU devices are defined. A CPU device workload queue is constructed for each CPU device in the CPU device set, and a GPU device workload queue is constructed for each GPU device in the GPU device set. Each workload queue is used to represent the computational workload that the corresponding device has not yet completed at the beginning of the current time slot. Based on the workload queue, calculate the unfinished workload of the CPU / GPU collaborative computing system, the system energy consumption in the current time slot, and the overall load imbalance measurement; Based on the system energy consumption and the load imbalance metric, energy consumption constraints and load balancing constraints are established, and an online scheduling optimization model is constructed with the objective function of minimizing the long-term average unfinished workload of the system. The long-term optimization problem described by the online scheduling optimization model is transformed into a real-time scheduling problem within each time slot using the Lyapunov optimization method. The task allocation strategy for each time slot is calculated, and tasks are assigned to CPU or GPU devices for execution, thereby completing CPU / GPU collaborative online scheduling.
2. The CPU / GPU cooperative online scheduling method based on Lyapunov optimization according to claim 1, characterized in that, The runtime of the CPU / GPU collaborative computing system is divided into segments of equal length. Time slot, time slot index satisfy: ; in each time slot The initial set of tasks arriving at the CPU / GPU co-computing system is: ;in, Indicates time slot The number of tasks arriving within the specified timeframe.
3. The CPU / GPU cooperative online scheduling method based on Lyapunov optimization according to claim 2, characterized in that, The CPU device set and the GPU device set are defined as follows: and ;in, The number of CPU devices. The number of GPU devices; In the time slot Inside, the mission Assigned to CPU device Indicator variables Defined as: ; in, ; In the time slot Inside, the mission Assigned to GPU device Indicator variables Defined as: ; in, ; Each task can only be assigned to one computing device within a time slot, therefore satisfying: 。 4. The CPU / GPU cooperative online scheduling method based on Lyapunov optimization according to claim 3, characterized in that, For each CPU device in the CPU device set Constructing time slots Workload queue For each GPU device in the GPU device set Constructing time slots Workload queue The queue update relationship is as follows: ; ; in, Indicates time slot Tasks in The computational scale; Indicates time slot CPU devices Equivalent service capacity; Indicates time slot GPU devices The equivalent service capacity.
5. The CPU / GPU cooperative online scheduling method based on Lyapunov optimization according to claim 4, characterized in that, CPU / GPU collaborative computing system in time slots Initial unfinished work for: ; CPU / GPU collaborative computing system in time slots Internal system energy consumption Represented as: ; in, Indicates CPU device The unit of work workload energy consumption coefficient, Indicates GPU device The unit of work workload energy consumption coefficient; Overall load imbalance measurement of CPU / GPU collaborative computing system Represented as: ,in, This represents the average load on the CPU device. ; This indicates the average load on the GPU device. .
6. The CPU / GPU cooperative online scheduling method based on Lyapunov optimization according to claim 5, characterized in that, The long-term optimization problem described by the online scheduling optimization model Represented as: ; ; ; ; ; in, This represents the total number of time slots in the system operation. Represents the mathematical expectation. This represents the system's long-term average energy consumption budget. This represents the long-term average load imbalance budget of the system.
7. The CPU / GPU cooperative online scheduling method based on Lyapunov optimization according to claim 6, characterized in that, The real-time scheduling problem within each time slot, transformed by the Lyapunov optimization method, is a time-slot-wise deterministic optimization problem P3, denoted as: ; ; ; in, A positive zero tradeoff parameter used to balance the workload queue and the virtual queue; Indicates the system in time slots The update relationship of the virtual queue state variables corresponding to energy consumption constraints is as follows: ; Indicates the system in time slots The update relationship of the virtual queue state variables corresponding to load balancing constraints is as follows: The initial state of the virtual queue satisfies , .
8. The CPU / GPU cooperative online scheduling method based on Lyapunov optimization according to claim 7, characterized in that, The specific method for calculating the task allocation strategy for each time slot, assigning tasks to CPU devices or GPU devices for execution, thereby completing CPU / GPU collaborative online scheduling, includes: A queue-weighted CPU / GPU collaborative online scheduling algorithm is used to solve the time-slot deterministic optimization problem. In each time slot, the tasks in the task set are allocated to devices according to the system state, thereby obtaining the online scheduling decision between CPU devices and GPU devices. Input parameters include time slots task set Time slot Tasks in Computational scale CPU device set GPU device collection CPU devices In the time slot Workload queue GPU devices In the time slot Workload queue Time slot Energy-constrained virtual queue Time slot Load balancing constraint virtual queue Trade-off parameters CPU devices Energy consumption coefficient per unit of work GPU devices Energy consumption coefficient per unit of work Equivalent service capacity of CPU devices in the current time slot And the equivalent service capability of the GPU device in the current time slot. ; Step 1) Initialize task allocation decision variables, setting them for all tasks and all devices. and ; Step 2) Divide the time slot task set Scale based on task Sort from largest to smallest; Step 3) Perform steps 4 through 6 sequentially for each task; Step 4) Set up CPU devices With GPU device collection The computation task for each candidate device is assigned to the objective function increment corresponding to that device; Step 5) Compare the increments corresponding to each candidate device and determine the computing device that minimizes the increment as the execution device for the task; Step 6) Assign decision variables based on the determined execution device update task. or and the computational scale of the current task Add to the workload queue for the corresponding device; Step 7) After completing the device allocation for all tasks in the current time slot, based on the task allocation results of the current time slot and the workload queues of each device after task allocation and before deducting the equivalent service capacity of the devices, calculate the system energy consumption and overall load imbalance metric in the current time slot, and update the energy consumption constraint virtual queue and the load balancing constraint virtual queue according to the update relationship of the virtual queue state variables; then, according to the queue update relationship of the workload queues, deduct the equivalent service capacity of the corresponding device in the current time slot from the workload queue of each device to obtain the workload queue of the next time slot. Step 8) Output the device allocation decisions for all tasks. , obtain time slot The results of CPU / GPU collaborative online scheduling.
9. A CPU / GPU collaborative online scheduling system based on Lyapunov optimization, characterized in that, It includes a collection acquisition module, a workload queue construction module, a calculation module, a modeling module, and a task scheduling module; The set acquisition module is used to discretize the running time of the CPU / GPU collaborative computing system into multiple time slots, acquire the set of tasks arriving at the system at the beginning of each time slot, and define a set of CPU devices containing multiple CPU devices and a set of GPU devices containing multiple GPU devices. The workload queue construction module is used to construct a CPU device workload queue for each CPU device in the CPU device set and a GPU device workload queue for each GPU device in the GPU device set. Each workload queue is used to represent the computation workload that the corresponding device has not yet completed at the beginning of the current time slot. The computing module is used to calculate the unfinished workload of the CPU / GPU collaborative computing system, the system energy consumption in the current time slot, and the overall load imbalance measurement based on the workload queue. The modeling module is used to establish energy consumption constraints and load balancing constraints based on the system energy consumption and the load imbalance metric, and to construct an online scheduling optimization model with the objective function of minimizing the long-term average unfinished workload of the system. The task scheduling module is used to transform the long-term optimization problem described by the online scheduling optimization model into a real-time scheduling problem within each time slot through the Lyapunov optimization method, and calculate the task allocation strategy for each time slot to allocate tasks to CPU devices or GPU devices for execution, thereby completing CPU / GPU collaborative online scheduling.
Citation Information
Patent Citations
Intelligent computing task scheduling method based on heterogeneous computing power
CN120653403A
Virtual computing power center low-carbon economic dispatching method based on Lyapunov optimization
CN122264394A
