A task scheduling system based on virtual GPU
By deploying a second scheduler in each virtual GPU, two-level scheduling from hardware GPU to virtual GPU and virtual GPU to tasks is realized, which solves the problem of low concurrent execution efficiency of tasks in multi-virtual GPU scenarios and improves concurrent task execution. efficiency and resource utilization.
Patent Information
- Application Number
- CN202410507807.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-25
- Publication Date
- 2024-09-27
- Estimated Expiration
- 2044-04-25
AI Technical Summary
In a multi-virtual GPU scenario, the existing technology cannot guarantee the low concurrent execution efficiency of multiple tasks in the virtual GPU, resulting in low concurrent execution efficiency of tasks.
A second scheduler is deployed in each virtual GPU to achieve concurrent execution of multiple tasks through secondary scheduling from hardware GPU to virtual GPU and virtual GPU to tasks.
It improves the concurrent execution efficiency of tasks of each virtual GPU in a multi-virtual GPU scenario and improves resource utilization.
Smart Images

Figure CN118193224B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of chip technology, and in particular to a task scheduling system based on a virtual GPU. Background Art
[0002] In the scenario of applying multiple virtual GPUs, the hardware GPU usually performs switching scheduling of multiple virtual GPUs through a scheduler. Usually, in order to ensure the fairness and immediacy of scheduling, the scheduling duration of each virtual GPU is consistent. Therefore, through the hardware GPU scheduler, multiple virtual GPUs can be time-division multiplexed through scheduling, so that the tasks of multiple virtual GPUs are executed concurrently on a macro level.
[0003] However, since there are multiple computing tasks in a single virtual GPU, the above scheduling scheme cannot guarantee that multiple tasks in the virtual GPU are also executed concurrently, which leads to low efficiency of concurrent execution of tasks in actual applications. Therefore, how to improve the efficiency of concurrent execution of tasks of each virtual GPU in a multi-virtual GPU scenario has become an urgent problem to be solved. Summary of the invention
[0004] In view of the above technical problems, the technical solution adopted by the present invention is:
[0005] A task scheduling system based on virtual GPU, the system comprising: a hardware GPU, a virtual GPU set V = {v1, v2, ..., v m , …, v M}, wherein the hardware GPU includes a main driver HD and a first scheduler HS, v m is the mth virtual GPU, v m Including slave drive GD m and the second scheduler GS m .
[0006] The first scheduler HS is used to switch and schedule M virtual GPUs by calling the HD interface;
[0007] The second scheduler GS m Used to call GD m Interface switching scheduling v m tasks in
[0008] The hardware GPU schedules v m When m The number of executable tasks is p m .
[0009] Compared with the prior art, the present invention has obvious beneficial effects. By means of the above technical solution, the task scheduling system based on virtual GPU provided by the present invention can achieve considerable technical advancement and practicality, and has wide industrial utilization value, and has at least the following beneficial effects:
[0010] The present invention provides a task scheduling system based on a virtual GPU, the system comprising: a hardware GPU, a virtual GPU set V = {v1, v2, ..., v m , …, v M}, wherein the hardware GPU includes a main driver HD and a first scheduler HS, v m is the mth virtual GPU, v m Including slave drive GD m and the second scheduler GS m The first scheduler HS is used to switch and schedule M virtual GPUs by calling the HD interface, and the second scheduler GS m Used to call GD m Interface switching scheduling v m The hardware GPU schedules tasks in a single v m When m The number of executable tasks is p m .
[0011] It can be seen that by deploying a second scheduler in each virtual GPU, the second scheduler can switch and schedule multiple tasks in the virtual GPU, thereby realizing two-level scheduling from hardware GPU to virtual GPU and from virtual GPU to task, thereby improving the concurrent execution efficiency of tasks of each virtual GPU. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] In order to more clearly illustrate the technical solutions in 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 only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0013] Figure 1 A schematic diagram of the architecture of a task scheduling system based on a virtual GPU provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0014] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0015] This embodiment provides a task scheduling system based on a virtual GPU. Figure 1 , is a schematic diagram of the architecture of a task scheduling system based on a virtual GPU provided by an embodiment of the present invention, the system comprising: a hardware GPU, a virtual GPU set V = {v1, v2, ..., v m , …, v M}, wherein the hardware GPU includes a main driver HD and a first scheduler HS, v m is the mth virtual GPU, v m Including slave drive GD m and the second scheduler GS m .
[0016] The first scheduler HS is used to implement switching and scheduling of M virtual GPUs by calling an interface of the HD.
[0017] The second scheduler GS m Used to call GD m Interface switching scheduling v m in the tasks.
[0018] The hardware GPU schedules v m When m The number of executable tasks is p m .
[0019] Among them, the hardware GPU can refer to the physical GPU deployed on the server, and the virtual GPU can be deployed in the virtual machine to enable multiple virtual GPUs to share the same physical GPU, thereby improving the utilization of GPU computing resources and enabling flexible remote response to business needs.
[0020] Master drive HD and slave drive GD m Both can provide interfaces including context switching, suspend, and resume functions to support time-division multiplexing of multiple virtual GPUs. m Scheduling slave drive GD m When the interface of the main drive HD is called indirectly.
[0021] Specifically, by adopting the time-division multiplexing method, when the hardware GPU schedules one virtual GPU at a time, the virtual GPU can use all computing resources of the hardware GPU, and from a macro perspective, the task scheduling and execution of multiple virtual GPUs are concurrent. Similarly, this embodiment configures a second scheduler for each virtual GPU, so that when the hardware GPU schedules one virtual GPU at a time, the scheduling and execution of multiple tasks in the virtual GPU are also concurrent, thereby improving resource utilization, that is, improving the efficiency of concurrent task execution of each virtual GPU.
[0022] When the hardware GPU schedules a virtual GPU at a time, there is a corresponding scheduling duration. m When called by the hardware GPU, the execution time of each task within the scheduling duration can be determined by v m Slave drive GD m Interface configuration, in this embodiment, v m The number of tasks that can be executed by the hardware GPU in a single call is denoted as p m .
[0023] Optionally, the system further comprises a processor and a memory storing a computer program, and when the computer program is executed by the processor, the following steps are implemented:
[0024] S101, initializing a first scheduling value i=1.
[0025] S102, the hardware GPU schedules v j , j = i mod M.
[0026] S103, initialize v j The second scheduling value k j =1.
[0027] S104, by v j By GS m Schedule the kth task from its internal task queue j Tasks to k j +p j -1 task, update i=i+1, k j =k j +p j , where p j v for a single dispatch j The number of executable tasks.
[0028] S105, returning to execute steps S102 to S104 until i=I, where I is a preset value.
[0029] Among them, multiple virtual GPUs can be cyclically scheduled through HS to ensure scheduling fairness, and in the virtual GPU, tasks in the task queue are scheduled sequentially.
[0030] Optionally, the hardware GPU single scheduling v m The corresponding scheduling duration is q.
[0031] In order to ensure fairness and immediacy of virtual GPU scheduling, the scheduling duration of a single scheduling of any virtual GPU by the hardware GPU is q. Usually, q can be set within the range of 1ms-10ms, for example, 5ms.
[0032] Optionally, the hardware GPU schedules v j include:
[0033] According to i and q, a first time period is determined.
[0034] The hardware GPU schedules v according to the first time period through HS j .
[0035] The first time period may refer to the scheduling v j The corresponding time period, in the first time period, is determined by v j Use the computing resources of the hardware GPU.
[0036] Optionally, the first time period is [(i-1)*q, i*q].
[0037] Among them, in this embodiment, the default starting time of scheduling the first virtual GPU is 0, and the first time period can be expressed as [(i-1)*q, i*q]. For example, when i=1, the v1 virtual GPU is scheduled, and the corresponding first time period is [0,q]; when i=1, the v2 virtual GPU is scheduled, and the corresponding first time period is [q,2q]; and so on. The first time periods of each virtual GPU do not overlap.
[0038] Optionally, the v j By GS m Schedule the kth task from its internal task queue j Tasks to k j +p j -1 mission includes:
[0039] According to i, q, p j and r j , determine the second time period.
[0040] By v j Follow the second time period through GS mSchedule the kth task from its internal task queue j +r j tasks, r j is [0, p j -1] range.
[0041] The second time period may refer to the scheduling v j k j +r j The time period corresponding to each task.
[0042] Optionally, the second time period is [(i-1)*q+(q / p j )*r j , (i-1)*q+(q / p j )*(r j +1)].
[0043] Among them, the scheduling duration corresponding to each task is (q / p j ), then the kth j +r j The second time period corresponding to each task can be expressed as [(i-1)*q+(q / p j )*r j , (i-1)*q+(q / p j )*(r j +1)].
[0044] Optionally, GS m Same as HS architecture.
[0045] In order to reduce the complexity of architecture deployment, GS m The GS uses the same architecture as the HS. m The deployment environment of GS is different from that of HS, so the functions they play are different. m It is used for task scheduling, and HS is used for virtual GPU scheduling.
[0046] This embodiment deploys a second scheduler in each virtual GPU so that the second scheduler can switch and schedule multiple tasks in the virtual GPU, thereby realizing two-level scheduling from hardware GPU to virtual GPU and from virtual GPU to task, thereby improving the concurrent execution efficiency of tasks of each virtual GPU in multi-virtual GPU scenarios.
[0047] Although some specific embodiments of the present invention have been described in detail by way of example, it will be appreciated by those skilled in the art that the above examples are for illustration only and are not intended to limit the scope of the present invention. It will also be appreciated by those skilled in the art that various modifications may be made to the embodiments without departing from the scope and spirit of the present invention. The scope of the present invention is defined by the appended claims.
Claims
1. A task scheduling system based on a virtual GPU, characterized in that: The system includes: a hardware GPU, a virtual GPU set V={v1, v2, ..., v m , …, v M }, a processor and a memory storing a computer program, wherein the hardware GPU comprises a main driver HD and a first scheduler HS, v m is the mth virtual GPU, v m Including slave drive GD m and the second scheduler GS m ; The first scheduler HS is used to switch and schedule M virtual GPUs by calling the HD interface; The second scheduler GS m Used to call GD m Interface switching scheduling v m tasks in The hardware GPU schedules v m When m The number of executable tasks is p m , the hardware GPU single scheduling v m The corresponding scheduling duration is q; When the computer program is executed by the processor, the following steps are implemented: S101, initializing the first scheduling value i=1; S102, the hardware GPU schedules v j , j = i mod M, wherein the hardware GPU is scheduled by HS v j ,include: Determine a first time period according to i and q, wherein the first time period is [(i-1)×q, i×q]; The hardware GPU schedules v according to the first time period through HS j ; S103, initialize v j The second scheduling value k j =1; S104, by v j By GS m Schedule the kth task from its internal task queue j Tasks to k j +p j -1 task, update i=i+1, k j =k j +p j , where p j v for a single dispatch j The number of executable tasks, as given by v j By GS m Schedule the kth task from its internal task queue j Tasks to k j +p j - 1 mission, including: According to i, q, p j and r j , determine a second time period; By v j Follow the second time period through GS m Schedule the kth task from its internal task queue j +r j tasks, r j is [0, p j -1], the second time period is [(i-1)×q+(q / p j )×r j , (i-1)×q+(q / p j )×(r j +1)]; S105, return to execute steps S102 to S104 until i=I, where I is a preset value.
2. The task scheduling system based on virtual GPU according to claim 1, characterized in that: GS m Same as HS architecture.
