A method and system for a single system to support multiple GPUs simultaneously
By dynamically allocating graph computing tasks to multiple GPU units in a single system, the problem of single GPU resource constraints is solved, and efficient utilization of computing resources and an increase in computing speed are achieved.
Patent Information
- Application Number
- CN202311804157.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-26
- Publication Date
- 2024-09-03
- Estimated Expiration
- 2043-12-26
AI Technical Summary
When a single GPU unit processes graph computing tasks, computing resources are prone to be tight, resulting in slow computing speed.
Using a method and system that supports multiple GPUs in a single system at the same time, by obtaining the operating information and scheduling information of multiple GPU units, the computing tasks are dynamically allocated to the most suitable GPU unit for processing, ensuring efficient utilization of computing resources. Specific steps include obtaining the running information of multiple GPU units, receiving the tasks to be calculated and scheduling information, selecting the GPU unit that meets the computing requirements or the optimal GPU unit for task distribution, and using the first-in-first-out queue to manage tasks in the GPU unit.
It effectively overcomes the problem of single GPU resource shortage, improves the computing rate of the entire machine, and ensures efficient execution of computing tasks.
Smart Images

Figure CN117952815B
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of computer technology, and in particular relates to a method and system for a single system to support multiple GPUs working simultaneously. Background Art
[0002] Graphics processing unit (GPU), also known as display core, visual processor, display chip, is specialized in performing image and graphics related calculations on personal computers, workstations, game consoles and other mobile devices.
[0003] Currently, some single-system machines only use one GPU unit. However, as the demand for graph computing increases, machines with a single GPU unit can no longer meet most graph computing needs. Computing resources are often tight, resulting in slow computing speeds. Summary of the invention
[0004] In view of the defects in the prior art, the present invention provides a method and system for a single system to support multiple GPUs at the same time, which overcomes the defect of tight computing resources of a single GPU resource and improves the computing speed of the entire machine.
[0005] In a first aspect, a method for a single system to support multiple GPUs at the same time is run on a single system machine; the method comprises:
[0006] Obtaining operation information of multiple GPU units; GPU units are deployed in the cloud and / or locally;
[0007] Receive tasks to be calculated and scheduling information;
[0008] Get the corresponding GPU unit according to the scheduling information;
[0009] If the obtained GPU unit meets the computing requirements of the task to be calculated, the task to be calculated is distributed to the GPU unit for processing;
[0010] If the obtained GPU unit cannot meet the computing requirements of the task to be calculated, the optimal GPU unit is obtained according to the operating information of each GPU unit, and the task to be calculated is distributed to the optimal GPU unit for processing.
[0011] Furthermore, the operation information includes the free memory size of the GPU unit, the memory usage ratio, the number of computing tasks being processed, and the processing waiting time;
[0012] The scheduling information includes the GPU unit ID associated with the task to be calculated.
[0013] Further, judging whether the GPU unit meets the computing requirements of the task to be calculated specifically includes:
[0014] Parse the task to be calculated to obtain the task body and task information; the task information includes the memory and time required to process the task body;
[0015] When the memory usage ratio of the GPU unit is less than the maximum memory usage, and the free memory size is greater than the memory required by the main body of the task, it is determined that the GPU unit meets the computing requirements of the task to be calculated;
[0016] When the memory occupancy ratio of the GPU unit is greater than the maximum memory occupancy, the processing waiting time of the GPU unit is greater than the waiting time threshold, the number of computing tasks being processed is greater than the task execution threshold, or the memory occupancy ratio of the GPU unit is less than the maximum memory occupancy but the free memory size is less than the memory required for processing the task body, it is judged that the GPU unit does not meet the computing requirements of the task to be calculated.
[0017] Furthermore, a first-in-first-out queue is provided in the GPU unit; the computing tasks being processed by the GPU unit are arranged in the first-in-first-out queue in sequence according to the order of receipt; and the length of the first-in-first-out queue is defined as the number of computing tasks being processed.
[0018] Furthermore, after distributing the computing task to the GPU unit for processing, the method further includes:
[0019] The time required for the computing task to process the task body is accumulated in the processing waiting time of the GPU unit;
[0020] When a computing task is processed in the GPU unit, the time required for processing the main body of the computing task is subtracted from the processing waiting time of the GPU unit.
[0021] In the second aspect, a system that supports multiple GPUs simultaneously is deployed on a single system machine; the system includes:
[0022] Acquisition unit: used to obtain the operation information of multiple GPU units; GPU units are deployed in the cloud and / or locally; receive tasks to be calculated and scheduling information;
[0023] Scheduling unit: used to obtain the corresponding GPU unit according to the scheduling information; if the obtained GPU unit meets the computing requirements of the task to be calculated, the task to be calculated will be distributed to the GPU unit for processing; if the obtained GPU unit cannot meet the computing requirements of the task to be calculated, the optimal GPU unit is obtained according to the operating information of each GPU unit, and the task to be calculated will be distributed to the optimal GPU unit for processing.
[0024] Furthermore, the operation information includes the free memory size of the GPU unit, the memory usage ratio, the number of computing tasks being processed, and the processing waiting time;
[0025] The scheduling information includes the GPU unit ID associated with the task to be calculated.
[0026] Furthermore, the scheduling unit is specifically used for:
[0027] Parse the task to be calculated to obtain the task body and task information; the task information includes the memory and time required to process the task body;
[0028] When the memory usage ratio of the GPU unit is less than the maximum memory usage, and the free memory size is greater than the memory required by the main body of the task, it is determined that the GPU unit meets the computing requirements of the task to be calculated;
[0029] When the memory occupancy ratio of the GPU unit is greater than the maximum memory occupancy, the processing waiting time of the GPU unit is greater than the waiting time threshold, the number of computing tasks being processed is greater than the task execution threshold, or the memory occupancy ratio of the GPU unit is less than the maximum memory occupancy but the free memory size is less than the memory required for processing the task body, it is judged that the GPU unit does not meet the computing requirements of the task to be calculated.
[0030] Furthermore, a first-in-first-out queue is provided in the GPU unit; the computing tasks being processed by the GPU unit are arranged in the first-in-first-out queue in sequence according to the order of receipt; and the length of the first-in-first-out queue is defined as the number of computing tasks being processed.
[0031] Furthermore, the scheduling unit is also used for:
[0032] After the computing task is distributed to the GPU unit for processing, the time required for the computing task to process the task body is accumulated in the processing waiting time of the GPU unit;
[0033] When a computing task is processed in the GPU unit, the time required for processing the main body of the computing task is subtracted from the processing waiting time of the GPU unit.
[0034] It can be seen from the above technical solutions that the method and system for a single system to support multiple GPUs at the same time provided by the present invention supports simultaneous calculation of multiple GPU units, overcoming the defect of tight computing resources of a single GPU resource. When allocating GPU units to computing tasks, the GPU unit specified by the computing task is given priority. If the specified GPU unit cannot meet the computing requirements, the computing task is promptly allocated to other GPU units, thereby improving the computing rate of the entire machine. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] In order to more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the following is a brief introduction to the drawings required for the specific embodiments or the description of the prior art. In all the drawings, similar elements or parts are generally identified by similar reference numerals. In the drawings, the elements or parts are not necessarily drawn according to the actual scale.
[0036] Figure 1 A flowchart of a method for a single system to simultaneously support multiple GPUs is provided in an embodiment.
[0037] Figure 2 A module block diagram of a system in which a single system supports multiple GPUs simultaneously provided by an embodiment. DETAILED DESCRIPTION
[0038] The embodiments of the technical solution of the present invention will be described in detail below in conjunction with the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solution of the present invention, and are therefore only used as examples, and the protection scope of the present invention cannot be limited thereto. It should be noted that, unless otherwise specified, the technical terms or scientific terms used in this application should be the common meanings understood by those skilled in the art to which the present invention belongs.
[0039] It should be understood that when used in this specification and the appended claims, the terms "include" and "comprises" indicate the presence of described features, integers, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or combinations thereof.
[0040] It should also be understood that the terms used in this specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. As used in the specification of the present invention and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.
[0041] As used in this specification and the appended claims, the term "if" may be interpreted as "when" or "upon" or "in response to determining" or "in response to detecting," depending on the context. Similarly, the phrases "if it is determined" or "if [described condition or event] is detected" may be interpreted as meaning "upon determination" or "in response to determining" or "upon detection of [described condition or event]" or "in response to detecting [described condition or event]," depending on the context.
[0042] Example:
[0043] A method for supporting multiple GPUs on a single system. Run on a single system machine. See Figure 1 , methods include:
[0044] S1: Obtaining operation information of multiple GPU units; GPU units are deployed in the cloud and / or locally;
[0045] S2: Receive the tasks to be calculated and the scheduling information;
[0046] S3: Obtain the corresponding GPU unit according to the scheduling information;
[0047] S4: If the obtained GPU unit meets the computing requirements of the task to be calculated, the task to be calculated is distributed to the GPU unit for processing;
[0048] S5: If the obtained GPU unit cannot meet the computing requirements of the task to be calculated, the optimal GPU unit is obtained according to the operation information of each GPU unit, and the task to be calculated is distributed to the optimal GPU unit for processing.
[0049] In this embodiment, the method is run on a single system machine. The GPU unit can be deployed in the cloud or locally, so that in addition to using the locally deployed GPU unit, the method can also directly use a third-party GPU unit deployed in the cloud, reducing the difficulty of local deployment. The method supports multiple GPU resources, overcoming the defect of single GPU resources having tight computing resources.
[0050] In this embodiment, the method receives scheduling information while receiving the task to be calculated, wherein the scheduling information can identify the GPU unit to which the task to be calculated is preferentially assigned. In this way, the method can obtain the corresponding GPU unit according to the scheduling information. For example, the method receives the task A to be calculated and the scheduling information A at the same time, and the scheduling information A contains the ID of the GPU unit A. In this way, the method can preferentially assign the task A to be calculated to the GPU unit A for processing according to the scheduling information A. If the GPU unit A meets the computing requirements of the task A to be calculated, the task A to be calculated is distributed to the GPU unit A for processing. If the GPU unit A cannot meet the computing requirements of the task A to be calculated, it is necessary to obtain the optimal GPU unit according to the operating information of each GPU unit, and distribute the task to be calculated to the optimal GPU unit for processing. In this way, when the GPU unit specified by the computing task cannot meet the computing requirements, it is necessary to promptly assign the computing task to other GPU units for processing, thereby improving the computing rate of the entire machine.
[0051] This method supports simultaneous computing of multiple GPU units, overcoming the shortcoming of single GPU resources that computing resources are tight. When allocating GPU units to computing tasks, the GPU unit specified by the computing task is given priority. If the specified GPU unit cannot meet the computing requirements, the computing task is promptly allocated to other GPU units, thereby improving the computing rate of the entire machine.
[0052] Further, in some embodiments, the operation information includes the free memory size of the GPU unit, the memory occupancy ratio, the number of computing tasks being processed, and the processing waiting time;
[0053] The scheduling information includes the GPU unit ID associated with the task to be calculated.
[0054] In this embodiment, the free memory size is the unused memory size in the GPU unit, the memory occupancy ratio is the ratio of used memory, the number of computing tasks being processed indicates how many tasks the GPU unit is processing, and the processing waiting time indicates the time required for the GPU unit to process all tasks in the queue.
[0055] Further, in some embodiments, determining whether the GPU unit meets the computing requirements of the task to be calculated specifically includes:
[0056] Parse the task to be calculated to obtain the task body and task information; the task information includes the memory and time required to process the task body;
[0057] When the memory usage ratio of the GPU unit is less than the maximum memory usage, and the free memory size is greater than the memory required by the main body of the task, it is determined that the GPU unit meets the computing requirements of the task to be calculated;
[0058] When the memory occupancy ratio of the GPU unit is greater than the maximum memory occupancy, the processing waiting time of the GPU unit is greater than the waiting time threshold, the number of computing tasks being processed is greater than the task execution threshold, or the memory occupancy ratio of the GPU unit is less than the maximum memory occupancy but the free memory size is less than the memory required for processing the task body, it is judged that the GPU unit does not meet the computing requirements of the task to be calculated.
[0059] In this embodiment, after receiving the task to be calculated, the method parses the task to be calculated to obtain the task body and task information, wherein the task body is the main task content, and the task information includes the memory and time required to process the task body.
[0060] This method determines that the GPU unit meets the computational requirements of the task to be calculated when it detects that the memory occupancy ratio of the GPU unit is less than the maximum memory occupancy and the free memory size is greater than the memory required to process the main body of the task. For example, assuming that the maximum memory occupancy is 70%, when the memory occupancy ratio of GPU unit A is 40%, the memory occupancy ratio is less than the maximum memory occupancy, indicating that the memory usage in GPU unit A is good and can continue to receive new computing tasks. When the GPU unit simultaneously meets the following two conditions: 1) the memory occupancy ratio is less than the maximum memory occupancy; 2) the free memory size is greater than the memory required to process the main body of the task, it means that the memory usage in GPU unit A is good and the free memory size can complete the computing requirements of the main body of the task. At this time, it is considered that the GPU unit meets the computing requirements of the task to be calculated.
[0061] When the method detects the following situations, it is considered that the GPU unit does not meet the computing requirements of the task to be calculated: 1) The memory occupancy ratio of the GPU unit is greater than the maximum memory occupancy; for example, the memory occupancy ratio of GPU unit A is 80%, which is greater than the maximum memory occupancy of 70%. At this time, it means that the memory load of GPU unit A is too large and it is not suitable to continue to receive new computing tasks. 2) The processing waiting time of the GPU unit is greater than the waiting time threshold; for example, the waiting time threshold is 1 minute, if the processing waiting time of the GPU unit is 2 minutes, it is greater than the waiting time threshold of 1 minute. At this time, if GPU unit A continues to receive new computing tasks, then the new computing tasks will wait for a long time, and it is not suitable to continue to receive new computing tasks. 3) The number of computing tasks being processed is greater than the execution task threshold; for example, the execution task threshold is 5, if the number of computing tasks being processed by GPU unit A is 6, it is greater than the execution task threshold of 5. At this time, if GPU unit A is processing too many computing tasks, it is not suitable to continue to receive new computing tasks. 4) The memory usage ratio of the GPU unit is less than the maximum memory usage, but the free memory size is less than the memory required to process the main task; if the memory usage in GPU unit A is good, but the free memory size is less than the memory required to process the main task, it is not suitable to continue to receive new computing tasks.
[0062] Furthermore, in some embodiments, a first-in-first-out queue is provided in the GPU unit; computing tasks being processed by the GPU unit are arranged in the first-in-first-out queue in the order of receipt; and the length of the first-in-first-out queue is defined as the number of computing tasks being processed.
[0063] In this embodiment, the method may provide a first-in-first-out queue in the GPU unit for storing the computing tasks being processed, and the computing tasks that enter the first-in-first-out queue first are executed first, and the computing tasks that enter the first-in-first-out queue later are executed later. The length of the first-in-first-out queue is the number of computing tasks being processed.
[0064] Furthermore, in some embodiments, after distributing the computing task to the GPU unit for processing, the method further includes:
[0065] The time required for the computing task to process the task body is accumulated in the processing waiting time of the GPU unit;
[0066] When a computing task is processed in the GPU unit, the time required for processing the main body of the computing task is subtracted from the processing waiting time of the GPU unit.
[0067] In this embodiment, when the GPU unit receives a new computing task, the processing waiting time is accumulated, and when the GPU unit completes processing a computing task, the processing waiting time is reduced. For example, the processing waiting time of GPU unit A is 1 minute. When computing task A is assigned to GPU unit A, the time required for computing task A to process the main task is 10 seconds, then 10 seconds are accumulated to the processing waiting time of GPU unit A, and the processing waiting time of GPU unit A is 70 seconds. If GPU unit A completes processing of computing task B, and the time required for computing task B to process the main task is 20 seconds, then 20 seconds are subtracted from the processing waiting time of GPU unit A, and the processing waiting time of GPU unit A is 50 seconds.
[0068] A system 11 in which a single system supports multiple GPUs at the same time is deployed on a single system machine 1; the system includes:
[0069] The acquisition unit 111 is used to obtain the operation information of multiple GPU units; the GPU units are deployed in the cloud and / or locally; receive the tasks to be calculated and the scheduling information; wherein the GPU units deployed in the cloud Figure 2 In the figure, it is represented as 13, and the GPU unit deployed locally is Figure 2 It is represented as 12 in Chinese.
[0070] Scheduling unit 112: used to obtain the corresponding GPU unit according to the scheduling information; if the obtained GPU unit meets the computing requirements of the task to be calculated, the task to be calculated is distributed to the GPU unit for processing; if the obtained GPU unit cannot meet the computing requirements of the task to be calculated, the optimal GPU unit is obtained according to the operating information of each GPU unit, and the task to be calculated is distributed to the optimal GPU unit for processing.
[0071] Further, in some embodiments, the operation information includes the free memory size of the GPU unit, the memory occupancy ratio, the number of computing tasks being processed, and the processing waiting time;
[0072] The scheduling information includes the GPU unit ID associated with the task to be calculated.
[0073] Furthermore, in some embodiments, the scheduling unit 112 is specifically configured to:
[0074] Parse the task to be calculated to obtain the task body and task information; the task information includes the memory and time required to process the task body;
[0075] When the memory usage ratio of the GPU unit is less than the maximum memory usage, and the free memory size is greater than the memory required by the main body of the task, it is determined that the GPU unit meets the computing requirements of the task to be calculated;
[0076] When the memory occupancy ratio of the GPU unit is greater than the maximum memory occupancy, the processing waiting time of the GPU unit is greater than the waiting time threshold, the number of computing tasks being processed is greater than the task execution threshold, or the memory occupancy ratio of the GPU unit is less than the maximum memory occupancy but the free memory size is less than the memory required for processing the task body, it is judged that the GPU unit does not meet the computing requirements of the task to be calculated.
[0077] Furthermore, in some embodiments, a first-in-first-out queue is provided in the GPU unit; computing tasks being processed by the GPU unit are arranged in the first-in-first-out queue in the order of receipt; and the length of the first-in-first-out queue is defined as the number of computing tasks being processed.
[0078] Furthermore, in some embodiments, the scheduling unit 112 is further configured to:
[0079] After the computing task is distributed to the GPU unit for processing, the time required for the computing task to process the task body is accumulated in the processing waiting time of the GPU unit;
[0080] When a computing task is processed in the GPU unit, the time required for processing the main body of the computing task is subtracted from the processing waiting time of the GPU unit.
[0081] The system provided in the embodiment of the present invention is briefly described. For matters not mentioned in the embodiment part, reference may be made to the corresponding contents in the aforementioned embodiment.
[0082] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein by equivalents. These modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present invention, and they should all be included in the scope of the claims and specification of the present invention.
Claims
1. A method for a single system to support multiple GPUs simultaneously, characterized in that: Running on a single-system machine; the method comprises: Obtaining operation information of multiple GPU units; the GPU units are deployed in the cloud and / or locally; Receive tasks to be calculated and scheduling information; Acquire a corresponding GPU unit according to the scheduling information; If the obtained GPU unit meets the computing requirements of the task to be calculated, the task to be calculated is distributed to the GPU unit for processing; If the obtained GPU unit cannot meet the computing requirements of the task to be calculated, the optimal GPU unit is obtained according to the operation information of each GPU unit, and the task to be calculated is distributed to the optimal GPU unit for processing; The operation information includes the free memory size of the GPU unit, the memory occupancy ratio, the number of computing tasks being processed, and the processing waiting time; The scheduling information includes a GPU unit ID associated with the task to be calculated; Determining whether the GPU unit meets the computing requirements of the task to be calculated specifically includes: Parsing the task to be calculated to obtain a task body and task information; the task information includes memory and time required to process the task body; When the memory occupancy ratio of the GPU unit is less than the maximum memory occupancy, and the free memory size is greater than the memory required to process the task body, it is determined that the GPU unit meets the computing requirements of the task to be calculated; When the memory occupancy ratio of the GPU unit is greater than the maximum memory occupancy, the processing waiting time of the GPU unit is greater than the waiting time threshold, the number of computing tasks being processed is greater than the task execution threshold, or the memory occupancy ratio of the GPU unit is less than the maximum memory occupancy but the free memory size is less than the memory required to process the task body, it is judged that the GPU unit does not meet the computing requirements of the task to be calculated.
2. The method for supporting multiple GPUs in a single system according to claim 1, characterized in that: The GPU unit is provided with a first-in-first-out queue; the computing tasks being processed by the GPU unit are arranged in the first-in-first-out queue in sequence according to the order of receipt; and the length of the first-in-first-out queue is defined as the number of computing tasks being processed.
3. The method for supporting multiple GPUs in a single system according to claim 1, characterized in that: After distributing the computing task to the GPU unit for processing, the method further includes: Accumulating the time required for the computing task to process the task body in the processing waiting time of the GPU unit; When a computing task is processed in the GPU unit, the time required for processing the main body of the computing task is subtracted from the processing waiting time of the GPU unit.
4. A system that supports multiple GPUs simultaneously, characterized in that: Deployed on a single-system machine; the system includes: Acquisition unit: used to obtain the operation information of multiple GPU units; the GPU units are deployed in the cloud and / or locally; receive the tasks to be calculated and the scheduling information; Scheduling unit: used to obtain the corresponding GPU unit according to the scheduling information; if the obtained GPU unit meets the computing requirements of the task to be calculated, distribute the task to be calculated to the GPU unit for processing; if the obtained GPU unit cannot meet the computing requirements of the task to be calculated, obtain the optimal GPU unit according to the operation information of each GPU unit, and distribute the task to be calculated to the optimal GPU unit for processing; The operation information includes the free memory size of the GPU unit, the memory occupancy ratio, the number of computing tasks being processed, and the processing waiting time; The scheduling information includes a GPU unit ID associated with the task to be calculated; The scheduling unit is specifically used for: Parsing the task to be calculated to obtain a task body and task information; the task information includes memory and time required to process the task body; When the memory occupancy ratio of the GPU unit is less than the maximum memory occupancy, and the free memory size is greater than the memory required to process the task body, it is determined that the GPU unit meets the computing requirements of the task to be calculated; When the memory occupancy ratio of the GPU unit is greater than the maximum memory occupancy, the processing waiting time of the GPU unit is greater than the waiting time threshold, the number of computing tasks being processed is greater than the task execution threshold, or the memory occupancy ratio of the GPU unit is less than the maximum memory occupancy but the free memory size is less than the memory required to process the task body, it is judged that the GPU unit does not meet the computing requirements of the task to be calculated.
5. The system according to claim 4, wherein a single system supports multiple GPUs at the same time, The GPU unit is provided with a first-in-first-out queue; the computing tasks being processed by the GPU unit are arranged in the first-in-first-out queue in sequence according to the order of receipt; and the length of the first-in-first-out queue is defined as the number of computing tasks being processed.
6. The system according to claim 4, wherein a single system supports multiple GPUs at the same time, The scheduling unit is also used for: After the computing task is distributed to the GPU unit for processing, the time required for the computing task to process the task body is accumulated in the processing waiting time of the GPU unit; When a computing task is processed in the GPU unit, the time required for processing the main body of the computing task is subtracted from the processing waiting time of the GPU unit.
