Task execution method, system and device, storage medium and program product
By analyzing resource requirements parameters and calculating the scoring cycle points during task execution, fine-grained resource allocation and task priority management are realized, and the problems of low resource utilization and low task execution efficiency caused by inflexible resource allocation in the existing technology are solved, thereby improving system stability and task execution efficiency.
Patent Information
- Application Number
- CN202510774816.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-11
- Publication Date
- 2025-07-11
- Estimated Expiration
- 2045-06-11
AI Technical Summary
In the prior art, resource management methods cannot dynamically adjust resource allocation according to task requirements, resulting in inefficient resource utilization and inefficient task execution.
By analyzing the tasks to be executed, determining the resource requirement parameters and task quota, setting the scoring cycle for points calculation, and dividing resources according to time slices to retrieve them, realizing fine-grained resource allocation and task priority management.
It improves resource utilization, avoids the phenomenon of stuckness caused by resource seizure between tasks, and improves system stability and task execution efficiency.
Smart Images

Figure CN120295798A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer application technologies, and particularly to a task execution method, system, device, storage medium, and program product. Background Art
[0002] Model training tasks, graphics rendering tasks, etc. require a large amount of computing resources. Currently, the commonly used resource management methods are mainly divided into two categories: one is static allocation, that is, resources are fixedly allocated to specific tasks; the other is simple dynamic scheduling.
[0003] However, both of the above two resource management methods have their respective disadvantages. First, the static allocation method lacks flexibility and cannot dynamically adjust resource allocation according to task requirements. Second, simple dynamic scheduling only makes coarse-grained calls to resources, making it difficult to achieve efficient resource utilization, resulting in low task execution efficiency. Summary of the Invention
[0004] This application provides a task execution method, system, device, readable storage medium, and program product to at least solve the problems in the related technologies that resource allocation cannot be dynamically adjusted according to task requirements, it is difficult to achieve efficient resource utilization, and task execution efficiency is low.
[0005] This application provides a task execution method, including: Parsing the received task to be executed to obtain resource requirement parameters; Determining the task quota corresponding to the task to be executed according to the resource requirement parameters; Obtaining a preset scoring period, and calculating points for the task to be executed according to the scoring period and the task quota; Retrieving resources divided by time slices from the resource pool according to the task quota and the calculated integral result; where each time slice is a time slice obtained by dividing the scoring period according to a preset time interval; Executing the task to be executed by using the retrieved resources.
[0006] This application also provides a task execution system, including: A user terminal for sending a task to be executed to the hybrid task scheduler; The hybrid task scheduler for parsing the task to be executed to obtain resource requirement parameters; determining the task quota corresponding to the task to be executed according to the resource requirement parameters; obtaining a preset scoring period, and calculating points for the task to be executed according to the scoring period and the task quota; sending a resource retrieval request to the dynamic heterogeneous computing power resource pool according to the task quota and the calculated integral result; executing the task to be executed by using the retrieved resources; The dynamic heterogeneous computing power resource pool is used to return the resources segmented by time slices to the hybrid task scheduler according to the resource retrieval request; wherein, each time slice is a time slice obtained by dividing the scoring period according to a preset time interval.
[0007] The present application also provides an electronic device, including: a memory for storing a computer program; a processor for implementing the steps of any one of the above task execution methods when executing the computer program.
[0008] The present application also provides a non-volatile computer-readable storage medium, in which a computer program is stored, and wherein the computer program implements the steps of any one of the above task execution methods when executed by a processor.
[0009] The present application also provides a computer program product, including a computer program, and the computer program implements the steps of any one of the above task execution methods when executed by a processor.
[0010] Through the present application, since the resource requirement parameters are obtained by parsing the to-be-executed task, the task quota corresponding to the to-be-executed task is determined according to the resource requirement parameters, the scoring period of the task is preset, the to-be-executed task is subjected to integral calculation according to the scoring period and the task quota, the resources in the resource pool are segmented by time slices, and the resources segmented by time slices are retrieved from the resource pool according to the task quota and the calculated integral result, and then the retrieved resources are used to execute the to-be-executed task. Through the task quota, the resources within each time slice are allocated to different to-be-executed tasks, enabling the resources to support multiple tasks within a single time slice, realizing fine-grained division of the resources, reducing the resource idle time, and significantly improving the resource utilization rate. And through the task integral calculation, the control of the task resource occupation is realized, avoiding the occupation of too many resources by a single task, avoiding the stuck phenomenon caused by resource contention between tasks, and improving the system stability. Therefore, the technical problems of being unable to dynamically adjust resource allocation according to task requirements, being difficult to achieve efficient resource utilization, and low task execution efficiency can be solved, and the technical effects of being able to dynamically adjust resource allocation according to task requirements, achieving efficient utilization of resources, and improving task execution efficiency are achieved. Description of the Drawings
[0011] In order to more clearly illustrate the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0012] Figure 1 It is the implementation flowchart of a task execution method provided by an embodiment of the present application; Figure 2 It is a flowchart of another task execution method provided by an embodiment of this application; Figure 3 It is a timing diagram of application programming interface request hijacking during a task execution provided by an embodiment of this application; Figure 4 It is a structural block diagram of a task execution device provided by an embodiment of this application; Figure 5 It is an architecture diagram of a task execution system provided by an embodiment of this application. Specific embodiments
[0013] Next, the technical solutions in the embodiments of this application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of this application. Obviously, the described embodiments are only a part of the embodiments of this application, rather than all the embodiments. Based on the embodiments in this application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of this application.
[0014] It should be noted that in the description of this application, the terms "include", "comprise" or any other variant thereof are intended to cover a non-exclusive inclusion, such that a process, method, article or device including a series of elements not only includes those elements but also includes other elements not expressly listed, or further includes elements inherent to such process, method, article or device. The terms "first", "second", etc. in this application are used to distinguish similar objects and not to describe a specific order or sequence.
[0015] To enable those skilled in the art of this technology to better understand the solution of this application, the following further detailed description of this application will be made in conjunction with the accompanying drawings and specific embodiments.
[0016] In combination with the specific application environment architecture or specific hardware architecture on which the execution of the task execution method depends, the specific application environment architecture or specific hardware architecture will be described herein.
[0017] The embodiments of this application provide a task execution method, and the method will be described in detail in combination with the execution process of the task execution method.
[0018] See Figure 1 , Figure 1 It is a flowchart of an embodiment of a task execution method provided by an embodiment of this application, and the method may include the following steps.
[0019] S101: Analyze the received task to be executed to obtain resource requirement parameters.
[0020] When there is a task to be executed at the client side, send the task to be executed to the server side, and the task to be executed includes resource requirement parameters. The server side receives the task to be executed and parses the received task to obtain the resource requirement parameters.
[0021] The resource requirement parameters may include the required computing power and video memory size, and the computing power may include a Graphics Processing Unit (GPU).
[0022] S102: Determine the task quota corresponding to the task to be executed according to the resource requirement parameters.
[0023] Preset the correspondence between the resource requirement parameters and the task quota, such as setting the correspondence between the resource requirement parameter range and the task quota. After parsing the resource requirement parameters, determine the task quota corresponding to the task to be executed according to the resource requirement parameters.
[0024] The task quota is the time length occupied by the task execution within a time slice.
[0025] S103: Obtain the preset scoring period and perform integral calculation on the task to be executed according to the scoring period and the task quota.
[0026] After determining the task quota corresponding to the task to be executed according to the resource requirement parameters, obtain the preset scoring period and perform integral calculation on the task to be executed according to the scoring period and the task quota. For example, the task integral upper limit corresponding to the task to be executed within a scoring period can be obtained by multiplying the scoring period and the task quota.
[0027] S104: Retrieve the resources divided by time slices from the resource pool according to the task quota and the calculated integral result.
[0028] Among them, each time slice is a time slice obtained by dividing the scoring period according to a preset time interval.
[0029] Preset the scoring period for the task and divide the scoring period into multiple time slices according to the preset time interval. After performing integral calculation on the task to be executed to obtain the integral result, retrieve the resources divided by time slices from the resource pool according to the task quota and the calculated integral result. For example, the resource usage of the task to be executed within each scoring period can be controlled by integral deduction. When the remaining integral after scoring deduction within the current scoring period is not enough to continue executing the task to be executed in the subsequent time slices, control the task to be executed to stop executing within the current scoring period.
[0030] It should be noted that the scoring period can be set and adjusted according to the actual situation, and the embodiments of the present application do not limit this, for example, it can be set to 60 seconds.
[0031] It should also be noted that the length of the time slice can also be set and adjusted according to the actual situation. This application embodiment does not limit it, and it can be set to any time length that can divide the scoring period evenly. For example, when the scoring period is 60 seconds, the time slice length can be set to 1.5 seconds, and then a scoring period can be divided into 40 time slices.
[0032] S105: Execute the task to be executed by using the retrieved resources.
[0033] After retrieving the resources divided by time slices from the resource pool according to the task quota and the calculated integral result, execute the task to be executed by using the retrieved resources. By dividing the corresponding time length of resources from each time slice according to the task quota corresponding to the task to be executed to execute the task to be executed, and using the resources of the remaining time length in the time slice to execute other tasks, effective cutting of resources is achieved, and the resource utilization rate is significantly improved.
[0034] Through this application, since the resource requirement parameters are obtained by parsing the task to be executed, the task quota corresponding to the task to be executed is determined according to the resource requirement parameters, the scoring period of the task is set in advance, the task to be executed is integrated and calculated according to the scoring period and the task quota, the resources in the resource pool are divided by time slices, the resources divided by time slices are retrieved from the resource pool according to the task quota and the calculated integral result, and then the task to be executed is executed by using the retrieved resources. Through the task quota, the resources within each time slice are divided among different tasks to be executed, enabling the resources to support multiple tasks within a single time slice, achieving fine-grained division of resources, reducing resource idle time, and significantly improving the resource utilization rate. And through the task integral calculation, the control of task resource occupation is realized, avoiding the occupation of too many resources by a single task and the stuck phenomenon caused by resource contention between tasks, and improving the system stability. Therefore, the technical problems of being unable to dynamically adjust resource allocation according to task requirements, difficult to achieve efficient resource utilization, and low task execution efficiency can be solved, and the technical effects of being able to dynamically adjust resource allocation according to task requirements, achieving efficient utilization of resources, and improving task execution efficiency can be achieved.
[0035] See Figure 2 , Figure 2 is the flowchart of the implementation of another task execution method provided by the embodiment of this application. This method may include the following steps.
[0036] S201: Parse the received task to be executed to obtain resource requirement parameters and task priority parameters.
[0037] After the server receives a task to be executed, the task to be executed may include resource requirement parameters and task priority parameters. By parsing the received task to be executed, the resource requirement parameters and task priority parameters are obtained.
[0038] S202: Determine the task quota corresponding to the task to be executed according to the resource requirement parameters.
[0039] S203: Obtain a preset scoring period, and calculate the score of the task to be executed according to the scoring period and the task quota.
[0040] S204: Retrieve the resources divided by time slices from the resource pool according to the task quota and the calculated score result.
[0041] Among them, each time slice is a time slice obtained by dividing the scoring period according to a preset time interval.
[0042] S205: Send the task to be executed to the task execution queue according to the task priority parameter.
[0043] After parsing the task priority parameter, the task to be executed is sent to the task execution queue according to the task priority parameter. For example, it can be set that high-priority tasks enter the task execution queue first, tasks with the same priority enter the task execution queue in the order of the tasks generated first, and low-priority tasks enter the task execution queue later, so as to ensure that high-priority tasks obtain resources first.
[0044] In a specific embodiment of the present application, step S205 may include the following steps: Step 1: Obtain the remaining task score of the task to be executed; Step 2: Determine the task score status of the task to be executed according to the remaining task score and the task quota; Step 3: When the task score status is that the task score is sufficient, send the task to be executed to the task execution queue according to the task priority parameter.
[0045] For the convenience of description, the above three steps can be combined for description.
[0046] Before sending a task to be executed to the task execution queue, obtain the remaining task points of the task to be executed, and determine the task point status of the task to be executed based on the remaining task points and the task quota. For example, perform a multiplication operation on the task quota and the time slice, and determine whether the remaining task points are greater than the calculated product result. When it is determined that the remaining task points are greater than the calculated product result, determine that the task point status is sufficient task points, and send the task to be executed to the task execution queue according to the task priority parameter. By judging whether the task to be executed can be sent to the task execution queue based on the task point status of the task to be executed, only sending the tasks to be executed with sufficient task points to the task execution queue ensures the executability of each task to be executed in the task execution queue and further improves the task execution efficiency.
[0047] S206: Obtain the task to be executed from the task execution queue.
[0048] After sending the task to be executed to the task execution queue according to the task priority parameter, obtain the task to be executed from the task execution queue.
[0049] S207: Execute the task to be executed using the currently retrieved resources in the current time slice.
[0050] After retrieving the resources divided by time slice from the resource pool, execute the task to be executed using the currently retrieved resources in the current time slice.
[0051] S208: Obtain the resource utilization rate corresponding to the current time slice.
[0052] After executing the task to be executed using the currently retrieved resources in the current time slice, obtain the resource utilization rate corresponding to the current time slice.
[0053] S209: Determine whether the resource utilization rate is saturated. If so, do not process; if not, execute step S210.
[0054] After obtaining the resource utilization rate corresponding to the current time slice, determine whether the resource utilization rate is saturated. If so, it means that the system resources in the current time slice have been well utilized and no processing is required. If not, it means that there are still idle resources in the current time slice, and execute step S210.
[0055] S210: Increase the task quota in the next time slice.
[0056] After the resource utilization rate is not saturated, it means that there are still idle resources in the current time slice, and increase the task quota in the next time slice. By increasing the task quota when the resource utilization rate is not saturated, the utilization rate of resources in each time slice within the scoring period is improved, and thus the overall system resource utilization rate is improved.
[0057] S211: Calculate the upper limit of task points according to the task quota determined based on the resource requirement parameters.
[0058] After the task quota is increased, calculate the upper limit of task points according to the task quota determined based on the resource requirement parameters. For example, by multiplying the scoring period and the task quota, obtain the upper limit of task points for the task to be executed within a scoring period.
[0059] S212: When it is determined that the task points of the task to be executed are insufficient within the current scoring period according to the upper limit of task points, control the task to be executed to stop execution within the current scoring period.
[0060] After calculating the upper limit of task points according to the task quota determined based on the resource requirement parameters, when it is determined that the task points of the task to be executed are insufficient within the current scoring period according to the upper limit of task points, control the task to be executed to stop execution within the current scoring period. By increasing the task quota when the resource utilization rate is not saturated and controlling the resource occupancy of the task to be executed within a scoring period through the upper limit of task points after the increase, it avoids a single task from occupying too many resources and the deadlock phenomenon caused by resource preemption between tasks, improving system stability.
[0061] And it can also trigger a recovery mechanism when the task is interrupted and support breakpoint resumption and frame recalculation.
[0062] In a specific embodiment of the present application, the method may further include the following steps: Step 1: Obtain the preset upper limit of the queue length; Step 2: When the length of the task execution queue reaches the upper limit of the queue length, control the newly generated task to be executed to pause accessing the task execution queue.
[0063] For the convenience of description, the above two steps can be combined for description.
[0064] Preset the upper limit of the queue length of the task execution queue, obtain the preset upper limit of the queue length, and when the length of the task execution queue reaches the upper limit of the queue length, control the newly generated task to be executed to pause accessing the task execution queue. By setting the upper limit of the queue length, it avoids the task from overusing the resource calculation time and ensures the stability of time slice scheduling.
[0065] It should be noted that the upper limit of the queue length can be set and adjusted according to the actual situation, and the embodiments of the present application do not make limitations in this regard. For example, it can be set to 90% of the total queue length.
[0066] In a specific embodiment of the present application, the method may further include the following steps: Reset the task points of the tasks to be executed according to the task quota in the scoring cycle.
[0067] It is also possible to set the task points of the tasks to be executed to be reset according to the task quota in the scoring cycle. For example, it can be set that the points of all tasks will be reset to the product of their respective task quotas and 60 seconds every 60 seconds, thus avoiding the excessive use of resources caused by the stretching of time slices and allowing tasks with smaller task quotas to run periodically.
[0068] It is also possible to set the task points corresponding to each task to be cleared after the execution of each task to be executed.
[0069] In a specific embodiment of the present application, the method may further include the following steps: Step 1: Obtain the system resource tension; Step 2: When it is determined that the resources are tense according to the system resource tension, perform time slice reduction; Step 3: When it is determined that the resources are idle according to the system resource tension, perform time slice increase and increase the task execution queue threshold.
[0070] For ease of description, the above three steps can be combined for explanation.
[0071] During the task execution process, obtain the system resource tension. When it is determined that the resources are tense according to the system resource tension, perform time slice reduction. When it is determined that the resources are idle according to the system resource tension, perform time slice increase and increase the task execution queue threshold. By adjusting the time slice and the task execution queue according to the system resource tension, when the resources are tense, the time slice is reduced, thus accelerating the scheduling frequency and achieving fine-grained control of resource allocation. When the resources are idle, the time slice is extended and the queue threshold is relaxed, improving the task throughput.
[0072] The generation of resource tension situations can include three events: (1) queue overload (which can be understood as task backlog); (2) GPU resource fluctuation > 15% (such as sudden computing power demand); (3) GPU average utilization rate > 80% (resource tension); among them, the GPU resource fluctuation can be the standard deviation of the GPU utilization rate statistically within 5 time slice cycles.
[0073] Resource idleness can include that there are no such events in the current time slice and there were no such events in the previous time slice.
[0074] It should be noted that the increase and decrease ratios of the time slice and the task execution queue threshold can be set and adjusted according to the actual situation, and the embodiments of the present application do not limit this. For example, a time slice scaling coefficient can be set. When the time slice scaling coefficient L = 1.2, it is used for time slice extension. When the time slice scaling coefficient S = 0.8, it is used for time slice shortening.
[0075] In a specific embodiment of the present application, after the time slice is increased and the task execution queue threshold is increased, the method may further include the following steps: When the system resource tension is normal within two consecutive time slices, the time slice is decreased and the task execution queue threshold is decreased.
[0076] After the time slice is increased and the task execution queue threshold is increased, continue to monitor the system resource tension. When the system resource tension is normal within two consecutive time slices, the time slice is decreased and the task execution queue threshold is decreased, so as to achieve parameter correction.
[0077] In a specific embodiment of the present application, using the retrieved resources to execute the task to be executed may include the following steps: Step 1: Use the currently retrieved resources to execute the task to be executed in the current time slice; Step 2: Obtain the actual occupied time corresponding to the task to be executed in the current time slice; Step 3: Calculate the quota time corresponding to the task to be executed according to the task quota and the time slice length; Step 4: When it is determined that the actual occupied time is greater than the quota time, calculate the difference between the actual occupied time and the quota time to obtain the current task overuse time corresponding to the current time slice; Step 5: When it is determined that there is a task overuse time in a preset number of consecutive nearest neighbor time slices corresponding to the current time slice, obtain the task overuse time corresponding to each nearest neighbor time slice; Step 6: Calculate the average value of the current task overuse time and the task overuse time corresponding to each nearest neighbor time slice to obtain the average overuse time; Step 7: Calculate the difference between the quota time and the average overuse time to obtain the time difference; Step 8: Determine the time difference as the new quota time corresponding to the task to be executed in the next time slice.
[0078] For the convenience of description, the above eight steps can be combined for description.
[0079] After retrieving the time-slice segmented resources from the resource pool according to the task quota and the calculated integral results, since the resource occupancy during the actual execution of the task may fluctuate relative to the resources corresponding to the allocated task quota, the to-be-executed task is executed using the currently retrieved resources in the current time slice, the actual occupancy time corresponding to the to-be-executed task in the current time slice is obtained, and the quota time corresponding to the to-be-executed task is calculated according to the task quota and the time slice length. The actual occupancy time is compared with the quota time in terms of magnitude. When it is determined that the actual occupancy time is greater than the quota time, the difference between the actual occupancy time and the quota time is calculated to obtain the current task overuse time corresponding to the current time slice. When it is determined that there is task overuse time in each of the preset number of consecutive nearest neighbor time slices corresponding to the current time slice, the task overuse time corresponding to each nearest neighbor time slice is obtained, and the average overuse time is calculated by taking the average of the current task overuse time and the task overuse time corresponding to each nearest neighbor time slice. The difference between the quota time and the average overuse time is calculated to obtain a time difference, and the time difference is determined as the new quota time corresponding to the to-be-executed task in the next time slice. By subtracting the average overuse time from the task quota, it is ensured that the total occupancy time corresponding to the to-be-executed task within the scoring period is less than the product of the scoring period and the task quota, avoiding the excessive occupancy of resources by the to-be-executed task.
[0080] In a specific embodiment of the present application, the method may further include the following steps: Step 1: During the process of executing the to-be-executed task using the retrieved resources, monitor whether there is video memory overuse. If not, no processing is performed. If so, proceed to Step 2; Step 2: Intercept the video memory allocation operation corresponding to the to-be-executed task and return an error code.
[0081] For ease of description, the above two steps can be combined for explanation.
[0082] During the process of executing the to-be-executed task using the retrieved resources, monitor whether there is video memory overuse. If not, it indicates that there is no illegal operation of the video memory, and no processing is performed. If so, there is an illegal operation of the video memory. Intercept the video memory allocation operation corresponding to the to-be-executed task and return an error code. By intercepting the video memory allocation operation corresponding to the to-be-executed task and returning an error code, multi-task video memory isolation is achieved.
[0083] The computing power utilization rate, video memory occupancy rate, and operating status data of each GPU node can be collected in real time through the resource monitoring module. When a fault (such as hardware or software anomalies) is detected, the recovery mechanism (such as restarting tasks or reallocating resources) is immediately initiated. The monitoring data is synchronously fed back to the scheduler for dynamically optimizing the resource allocation strategy. The task is executed on the allocated GPU and returns the calculation result after completion. If an error occurs during the execution process (such as video memory overflow or time slice scheduling failure), the system generates an error alarm and records detailed logs. Meanwhile, according to the preset policy, it attempts to restart the task and notify the user for intervention.
[0084] See Figure 3 , Figure 3 FIG. is a timing diagram of application programming interface request hijacking during the execution of a task provided by an embodiment of the present application. It should be noted that during the API call process, both AI model training and rendering are based on similar APIs. In video memory calls, APIs related to video memory allocation are used. During the computing power call process (the computing power call is mainly manifested as kernel submission), computing power submission APIs are used. Therefore, the APIs corresponding to the artificial intelligence model and rendering are the same. The operation flow of the module is as follows: (1) API interception and task scheduling: Hijack the user program's call to the Compute Unified Device Architecture (CUDA) API, and control the computing power task submission time within the time slice according to the resource pool policy (such as waiting or executing).
[0085] (2) Computing power and video memory monitoring: Real-time statistics on whether the usage of computing power and video memory exceeds the limit, intercept illegal operations and return error codes to ensure multi-task video memory isolation.
[0086] By intercepting the API, the AI framework and rendering software can be connected to the resource pool without modifying the code, significantly reducing the operation and maintenance costs.
[0087] In a specific embodiment of the present application, parsing the received task to be executed to obtain resource requirement parameters may include the following steps: Step 1: Parse the received task to be executed to obtain the task type to which the task to be executed belongs; Step 2: Determine the resource requirement parameters according to the task type.
[0088] For ease of description, the above two steps can be combined for description.
[0089] The tasks to be executed include task types, which can include model training, graphics rendering, etc. After the server receives the tasks to be executed, it parses the received tasks to be executed to obtain the task types to which the tasks to be executed belong. For example, the task types can be identified through a task classifier, and resource requirement parameters such as computing power and video memory requirements can be determined according to the task types. And the determined resource requirement parameters can be passed to the resource scheduler as the basis for resource allocation. By implementing the task type obtained through parsing, the rapid determination of resource requirement parameters is realized.
[0090] After obtaining the task types, multiple resource schedulers allocate physical GPU computing cards from the GPU computing power node pool based on the task types. If the current resources are insufficient, the system triggers an expansion mechanism to automatically add new GPUs to ensure the continuous execution of the task queue. The scheduler also supports fine-grained allocation, that is, the computing power of a single GPU is divided into time slices for multi-task reuse, and this function supports oversubscription of GPUs.
[0091] Through the description of the above implementation manners, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by means of software plus a necessary general hardware platform. Of course, it can also be implemented by hardware, but in many cases, the former is a better implementation manner.
[0092] The embodiments of the present application also provide a task execution device.
[0093] See Figure 4 , Figure 4 which is a structural block diagram of a task execution device provided by an embodiment of the present application. The device may include: A task parsing module 41, configured to parse the received tasks to be executed to obtain resource requirement parameters; A task quota determination module 42, configured to determine the task quota corresponding to the tasks to be executed according to the resource requirement parameters; An integral calculation module 43, configured to obtain a preset scoring period and calculate the integral of the tasks to be executed according to the scoring period and the task quota; A resource retrieval module 44, configured to retrieve resources divided into time slices from the resource pool according to the task quota and the calculated integral result; wherein each time slice is a time slice obtained by dividing the scoring period according to a preset time interval; A task execution module 45, configured to execute the tasks to be executed by using the retrieved resources.
[0094] With this application, since resource requirement parameters are obtained by parsing the task to be executed, task quotas corresponding to the task to be executed are determined according to the resource requirement parameters, the scoring period of the task is set in advance, the task to be executed is scored according to the scoring period and the task quota, the resources in the resource pool are divided by time slices, and the resources divided by time slices are retrieved from the resource pool according to the task quota and the calculated integral result, and then the retrieved resources are used to execute the task to be executed. Through the task quota, the resources within each time slice are allocated to different tasks to be executed, enabling the resources to support multiple tasks within a single time slice, achieving a fine-grained division of the resources, reducing the resource idle time, and significantly improving the resource utilization rate. And through the task integral calculation, the control of the task resource occupation is realized, avoiding the occupation of too many resources by a single task and the stuck phenomenon caused by resource contention between tasks, and improving the system stability. Therefore, the technical problems of being unable to dynamically adjust resource allocation according to task requirements, difficult to achieve efficient resource utilization, and low task execution efficiency can be solved, and the technical effects of being able to dynamically adjust resource allocation according to task requirements, achieving efficient resource utilization, and improving task execution efficiency are achieved.
[0095] In a specific embodiment of the present application, the task parsing module 41 is specifically a module that parses the received task to be executed to obtain resource requirement parameters and task priority parameters; The task execution module 45 may include: A task sending sub-module, configured to send the task to be executed to the task execution queue according to the task priority parameters; A task obtaining sub-module, configured to obtain the task to be executed from the task execution queue; A first task execution sub-module, configured to execute the task to be executed by using the retrieved resources.
[0096] In a specific embodiment of the present application, the task sending sub-module may include: A remaining task integral obtaining unit, configured to obtain the remaining task integral of the task to be executed; A task integral status determining unit, configured to determine the task integral status of the task to be executed according to the remaining task integral and the task quota; A task sending unit, configured to send the task to be executed to the task execution queue according to the task priority parameters when the task integral status is that the task integral is sufficient.
[0097] In a specific embodiment of the present application, the device may further include: A queue length upper limit obtaining module, configured to obtain a preset queue length upper limit; A task access control module, which is used to control the newly generated tasks to be executed to pause accessing the task execution queue when the length of the task execution queue reaches the upper limit of the queue length.
[0098] In a specific embodiment of the present application, the device may further include: A task score reset module, which is used to reset the task scores of the tasks to be executed according to the task quota in accordance with the scoring period.
[0099] In a specific embodiment of the present application, the task execution module 45 may include: A second task execution sub-module, which is used to execute the tasks to be executed by using the currently retrieved resources in the current time slice; A resource utilization rate acquisition sub-module, which is used to acquire the resource utilization rate corresponding to the current time slice; A judgment sub-module, which is used to judge whether the resource utilization rate is saturated; A task quota increase sub-module, which is used to increase the task quota in the next time slice when it is determined that the resource utilization rate is not saturated.
[0100] In a specific embodiment of the present application, the device may further include: A task score upper limit calculation module, which is used to calculate the task score upper limit according to the task quota determined according to the resource demand parameters after increasing the task quota in the next time slice; A task execution stop control module, which is used to control the tasks to be executed to stop execution in the current scoring period when the task scores are insufficient according to the task score upper limit in the current scoring period.
[0101] In a specific embodiment of the present application, the device may further include: A system resource tension acquisition module, which is used to acquire the system resource tension; A time slice reduction module, which is used to reduce the time slice when it is determined that the resources are tense according to the system resource tension; A time slice and queue threshold increase module, which is used to increase the time slice and increase the task execution queue threshold when it is determined that the resources are idle according to the system resource tension.
[0102] In a specific embodiment of the present application, the device may further include: A time slice and queue threshold reduction module, which is used to reduce the time slice and reduce the task execution queue threshold when the system resource tension is normal in two consecutive time slices after increasing the time slice and increasing the task execution queue threshold.
[0103] In a specific embodiment of the present application, the task execution module 45 may include: The third task execution sub-module is used to execute the to-be-executed task using the currently retrieved resources in the current time slice; The actual occupation time acquisition sub-module is used to acquire the actual occupation time corresponding to the to-be-executed task in the current time slice; The quota time calculation sub-module is used to calculate the quota time corresponding to the to-be-executed task according to the task quota and the time slice length; The current task overuse time acquisition sub-module is used to calculate the difference between the actual occupation time and the quota time when it is determined that the actual occupation time is greater than the quota time, so as to obtain the current task overuse time corresponding to the current time slice; The task overuse time acquisition sub-module is used to acquire the task overuse time corresponding to each nearest neighbor time slice when it is determined that there is task overuse time in a preset number of consecutive nearest neighbor time slices corresponding to the current time slice; The average overuse time acquisition sub-module is used to calculate the average value of the current task overuse time and the task overuse time corresponding to each nearest neighbor time slice respectively, so as to obtain the average overuse time; The time difference acquisition sub-module is used to calculate the difference between the quota time and the average overuse time, so as to obtain the time difference; The quota time determination sub-module is used to determine the time difference as the new quota time corresponding to the to-be-executed task in the next time slice.
[0104] In a specific embodiment of the present application, the device may further include: The video memory overuse monitoring module is used to monitor whether there is video memory overuse during the process of executing the to-be-executed task using the retrieved resources; The error code return module is used to intercept the video memory allocation operation corresponding to the to-be-executed task and return an error code when it is determined that there is video memory overuse.
[0105] In a specific embodiment of the present application, the task parsing module 41 may include: The task type acquisition sub-module is used to parse the received to-be-executed task to obtain the task type to which the to-be-executed task belongs; The resource requirement parameter determination sub-module is used to determine the resource requirement parameters according to the task type.
[0106] For the description of the features in the corresponding embodiment of the task execution device, reference may be made to the relevant description of the corresponding embodiment of the task execution method, which will not be elaborated here one by one.
[0107] An embodiment of the present application further provides a task execution system.
[0108] See Figure 5 , Figure 5This is an architecture diagram of a task execution system provided by an embodiment of the present application. The task execution system involves five modules: a dynamic heterogeneous computing power resource pool, a hybrid task scheduler, an Application Programming Interface (API) hijacking module, a monitoring and error handling module, and a user side, where: The user side is used to send a task to be executed to the hybrid task scheduler. The hybrid task scheduler is used to parse the task to be executed to obtain resource requirement parameters; determine the task quota corresponding to the task to be executed according to the resource requirement parameters; obtain a preset scoring period, and calculate the score of the task to be executed according to the scoring period and the task quota; send a resource retrieval request to the dynamic heterogeneous computing power resource pool according to the task quota and the calculated score result; and execute the task to be executed by using the retrieved resources. The dynamic heterogeneous computing power resource pool is used to return the resources divided by time slices to the hybrid task scheduler according to the resource retrieval request; wherein, each time slice is a time slice obtained by dividing the scoring period according to a preset time interval.
[0109] In this application, by parsing the task to be executed to obtain resource requirement parameters, determining the task quota corresponding to the task to be executed according to the resource requirement parameters, presetting the scoring period of the task, calculating the score of the task to be executed according to the scoring period and the task quota, dividing the resources in the resource pool by time slices, retrieving the resources divided by time slices from the resource pool according to the task quota and the calculated score result, and then executing the task to be executed by using the retrieved resources. Through the task quota, the resources in each time slice are allocated to different tasks to be executed, so that the resources can support multiple tasks within a single time slice, realizing fine-grained division of the resources, reducing the resource idle time, and significantly improving the resource utilization rate. And through the task score calculation, the control of the task resource occupation is realized, avoiding the occupation of too many resources by a single task, avoiding the stuck phenomenon caused by resource preemption between tasks, and improving the system stability. Therefore, the technical problems of being unable to dynamically adjust the resource allocation according to the task requirements, being difficult to achieve efficient resource utilization, and low task execution efficiency can be solved, and the technical effects of being able to dynamically adjust the resource allocation according to the task requirements, realizing efficient utilization of the resources, and improving the task execution efficiency can be achieved.
[0110] In a specific embodiment of the present application, the hybrid task scheduler is specifically used to parse the received task to be executed to obtain resource requirement parameters and task priority parameters; send the task to be executed to the task execution queue according to the task priority parameters; obtain the task to be executed from the task execution queue; and execute the task to be executed by using the retrieved resources.
[0111] In a specific embodiment of the present application, the hybrid task scheduler is specifically configured to obtain the remaining task points of the task to be executed; determine the task point status of the task to be executed according to the remaining task points and the task quota; when the task point status is that the task points are sufficient, send the task to be executed to the task execution queue according to the task priority parameter.
[0112] In a specific embodiment of the present application, the hybrid task scheduler is further configured to obtain a preset upper limit of the queue length; when the length of the task execution queue reaches the upper limit of the queue length, control the newly generated task to be executed to pause accessing the task execution queue.
[0113] In a specific embodiment of the present application, the hybrid task scheduler is further configured to reset the task points of the task to be executed according to the task quota according to the scoring period.
[0114] In a specific embodiment of the present application, the hybrid task scheduler is specifically configured to execute the task to be executed using the currently retrieved resources in the current time slice; obtain the resource utilization rate corresponding to the current time slice; determine whether the resource utilization rate is saturated; if not, increase the task quota in the next time slice.
[0115] In a specific embodiment of the present application, the hybrid task scheduler is further configured to, after increasing the task quota in the next time slice, calculate the upper limit of the task points according to the task quota determined according to the resource demand parameter; when the task to be executed determines that the task points are insufficient according to the upper limit of the task points in the current scoring period, control the task to be executed to stop execution in the current scoring period.
[0116] In a specific embodiment of the present application, the hybrid task scheduler is further configured to obtain the system resource tension; when it is determined that the resources are tense according to the system resource tension, perform a time slice reduction; when it is determined that the resources are idle according to the system resource tension, perform a time slice increase and increase the threshold of the task execution queue.
[0117] In a specific embodiment of the present application, the hybrid task scheduler is further configured to, after performing a time slice increase and increasing the threshold of the task execution queue, when the system resource tension is normal in two consecutive time slices, perform a time slice reduction and reduce the threshold of the task execution queue.
[0118] In a specific embodiment of the present application, the hybrid task scheduler is specifically configured to execute the task to be executed by using the currently retrieved resources in the current time slice; obtain the actual occupation time corresponding to the task to be executed in the current time slice; calculate the quota time corresponding to the task to be executed according to the task quota and the time slice length; when it is determined that the actual occupation time is greater than the quota time, calculate the difference between the actual occupation time and the quota time to obtain the current task overuse time corresponding to the current time slice; when it is determined that there is task overuse time in a preset number of consecutive nearest neighbor time slices corresponding to the current time slice, obtain the task overuse time corresponding to each nearest neighbor time slice; calculate the average overuse time by calculating the average of the current task overuse time and the task overuse time corresponding to each nearest neighbor time slice; calculate the difference between the quota time and the average overuse time to obtain the time difference; and determine the time difference as the new quota time corresponding to the task to be executed in the next time slice.
[0119] In a specific embodiment of the present application, the system may further include: The application programming interface hijacking module is used to monitor whether there is video memory overuse during the process of executing the task to be executed by using the retrieved resources; if so, intercept the video memory allocation operation corresponding to the task to be executed and return an error code to the monitoring and error handling module. The monitoring and error handling module is used to output the task running log and resource occupation record according to the error code.
[0120] In a specific embodiment of the present application, the hybrid task scheduler is specifically configured to parse the received task to be executed to obtain the task type to which the task to be executed belongs; and determine the resource requirement parameters according to the task type.
[0121] Each module is introduced as follows.
[0122] Dynamic heterogeneous computing power resource pool: This module divides the computing power of a single GPU into multiple logical units according to time slices, and supports the parallel use of artificial intelligence (AI) training and rendering tasks. The video memory resources are dynamically allocated and recycled according to task requirements to achieve cross-task video memory reuse. It provides a standardized computing power supply for the upper-level scheduling. The heterogeneous computing power resource pool has an automatic recovery mechanism, and this resource pool can automatically recover computing tasks through configuration details.
[0123] Hybrid task scheduler: This module is responsible for scheduling the resource allocation and execution order of multiple types of tasks, and this module is the core of the system. Based on task characteristics (artificial intelligence training or rendering), users can independently select or actively set different scheduling strategies. It adopts a time-sharing multiplexing and preemptive scheduling mechanism to ensure the quick trigger of high-priority tasks and avoid idle computing power.
[0124] Application Programming Interface Hijacking Module: By hijacking the call requests of application programming interfaces, it redirects the task's dependence on the physical GPU to the virtualized resource pool. Its core functions include: parsing application programming interface instructions such as kernel submission or video memory allocation of tasks, and dynamically allocating virtual computing power and video memory. It achieves resource access isolation through API interception to ensure the stable operation of the multi-task parallel process.
[0125] Monitoring and Error Handling Module: This module provides resource and task status monitoring and implements fault tolerance management. It collects indicators such as GPU utilization rate, video memory occupancy rate, and task error reports in real time, and outputs task operation logs and resource occupancy records. It is also responsible for identifying task deadlocks or video memory leaks, and triggering task restart or killing tasks. The monitoring and error handling module is responsible for recording hardware information and logs in the heterogeneous acceleration system; after recording, it writes the data to the hard disk for archiving through redis. The monitoring and error handling module is also responsible for recording errors and exceptions. When problems occur in the hybrid task scheduler, dynamic heterogeneous computing power resource pool, and application programming interface hijacking module, the monitoring and error handling module is responsible for recording the error text and error code number.
[0126] User Side: This module provides users with a unified task access and task log interface. It supports defining task types, resource requirements, and dependencies through JS key-value pair data (JavaScript Object Notation, JSON). During the task execution process, it provides real-time feedback on resource occupancy, progress, and exceptions, allowing users to dynamically adjust parameters or terminate tasks when there are no tasks. Finally, it forms a complete process from task submission, resource allocation to execution result return, realizing an efficient scheduling process of mutual feedback between the front-end user and the back-end server. The user side is responsible for sending the user's task requests to the server side, and returning the monitoring information such as computing power and video memory, and log information such as error reports returned by the server side to the user. The user side also has the function of real-time drawing of visual reports, allowing users to monitor the running status of tasks in real time.
[0127] For the description of the features in the embodiments corresponding to the task execution system, reference can be made to the relevant descriptions in the embodiments corresponding to the task execution method, which will not be elaborated here one by one.
[0128] An embodiment of the present application also provides an electronic device, including a memory and a processor. The memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the embodiments of the above task execution method.
[0129] An embodiment of the present application also provides a non-volatile computer-readable storage medium, which stores a computer program. The computer program is configured to execute the steps in any one of the embodiments of the above task execution method when running.
[0130] In an exemplary embodiment, the above non-volatile computer-readable storage medium may include, but is not limited to: various media that can store computer programs such as USB flash drives, read-only memory (ROM for short), random access memory (RAM for short), external hard drives, magnetic disks, or optical discs.
[0131] The embodiments of the present application also provide a computer program product. The above computer program product includes a computer program, and when the computer program is executed by a processor, it implements the steps in any of the above-described task execution method embodiments.
[0132] The embodiments of the present application also provide another computer program product, including a non-volatile computer-readable storage medium. The non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, it implements the steps in any of the above-described task execution method embodiments.
[0133] Those skilled in the art can further realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of the two. To clearly illustrate the interchangeability of hardware and software, the components and steps of each example have been generally described according to functions in the above description. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Skilled professionals can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present application.
[0134] The above has introduced in detail a task execution method, system, device, storage medium, and program product provided by the present application. Specific examples are used in this article to elaborate on the principles and implementation manners of the present application. The description of the above embodiments is only used to help understand the method and its core idea of the present application. It should be noted that for those of ordinary skill in the art in the technical field, without departing from the principle of the present application, several improvements and modifications can still be made to the present application, and these improvements and modifications also fall within the protection scope of the present application.
Claims
1. A task execution method, characterized in that, Including: Parsing the received task to be executed to obtain resource requirement parameters; Determining the task quota corresponding to the task to be executed according to the resource requirement parameters; Obtaining a preset scoring period, and calculating the score of the task to be executed according to the scoring period and the task quota; Retrieving resources segmented by time slices from the resource pool according to the task quota and the calculated score result; where each time slice is a time slice obtained by dividing the scoring period according to a preset time interval; Executing the task to be executed by using the retrieved resources.
2. The task execution method according to claim 1, wherein Parsing the received task to be executed to obtain resource requirement parameters, including: Parsing the received task to be executed to obtain the resource requirement parameters and task priority parameters; Correspondingly, executing the task to be executed by using the retrieved resources, including: Sending the task to be executed to the task execution queue according to the task priority parameters; Obtaining the task to be executed from the task execution queue; Executing the task to be executed by using the retrieved resources.
3. The task execution method according to claim 2, characterized in that Sending the task to be executed to the task execution queue according to the task priority parameters, including: Obtaining the remaining task score of the task to be executed; Determining the task score status of the task to be executed according to the remaining task score and the task quota; When the task score status is that the task score is sufficient, sending the task to be executed to the task execution queue according to the task priority parameters.
4. The task execution method according to claim 2, wherein Further including: Obtaining a preset queue length upper limit; When the length of the task execution queue reaches the queue length upper limit, controlling the newly generated task to be executed to pause accessing the task execution queue.
5. The task execution method according to claim 1, characterized in that, Further including: Resetting the task score of the task to be executed according to the task quota according to the scoring period.
6. The task execution method according to claim 1, characterized in that, Executing the task to be executed by using the retrieved resources, including: Executing the task to be executed by using the currently retrieved resources in the current time slice; Obtaining the resource utilization rate corresponding to the current time slice; Judging whether the resource utilization rate is saturated; If not, increasing the task quota in the next time slice.
7. The task execution method according to claim 6, characterized in that, After increasing the task quota in the next time slice, further including: Calculating the upper limit of the task score according to the task quota determined according to the resource requirement parameters; When the task to be executed determines that the task score is insufficient according to the upper limit of the task score in the current scoring period, controlling the task to be executed to stop executing in the current scoring period.
8. The task execution method according to claim 1, wherein Further including: Obtaining the system resource tension; When it is determined that the resources are tense according to the system resource tension, performing a time slice reduction; When it is determined that the resources are idle according to the system resource tension, performing a time slice increase and increasing the threshold of the task execution queue.
9. The task execution method according to claim 8, wherein After performing a time slice increase and increasing the threshold of the task execution queue, further including: When the system resource tension is normal in two consecutive time slices, performing a time slice reduction and reducing the threshold of the task execution queue.
10. The task execution method according to claim 1, characterized in that Executing the task to be executed by using the retrieved resources, including: Executing the task to be executed by using the currently retrieved resources in the current time slice; Obtain the actual occupied time corresponding to the to-be-executed task in the current time slice; Calculate the quota time corresponding to the to-be-executed task according to the task quota and the time slice length; When it is determined that the actual occupied time is greater than the quota time, calculate the difference between the actual occupied time and the quota time to obtain the current task overuse time corresponding to the current time slice; When it is determined that there is task overuse time in a preset number of consecutive nearest neighbor time slices corresponding to the current time slice, obtain the task overuse time corresponding to each nearest neighbor time slice; Calculate the average overuse time by calculating the average of the current task overuse time and the task overuse time corresponding to each nearest neighbor time slice; Calculate the difference between the quota time and the average overuse time to obtain a time difference; Determine the time difference as the new quota time corresponding to the to-be-executed task in the next time slice.
11. The task execution method according to claim 1, wherein Further includes: During the process of executing the to-be-executed task by using the retrieved resources, monitor whether there is video memory overuse; If so, intercept the video memory allocation operation corresponding to the to-be-executed task and return an error code.
12. The task execution method according to claim 1, wherein Parse the received to-be-executed task to obtain resource requirement parameters, including: Parse the received to-be-executed task to obtain the task type to which the to-be-executed task belongs; Determine the resource requirement parameters according to the task type.
13. A task execution system, characterized in that, Includes: A user terminal for sending a to-be-executed task to the hybrid task scheduler; The hybrid task scheduler for parsing the to-be-executed task to obtain resource requirement parameters; Determine the task quota corresponding to the to-be-executed task according to the resource requirement parameters; Obtain a preset scoring period and calculate the score of the to-be-executed task according to the scoring period and the task quota; Send a resource retrieval request to the dynamic heterogeneous computing power resource pool according to the task quota and the calculated score result; Execute the to-be-executed task by using the retrieved resources; The dynamic heterogeneous computing power resource pool for returning the resources divided by time slices to the hybrid task scheduler according to the resource retrieval request; wherein each time slice is a time slice obtained by dividing the scoring period at a preset time interval.
14. The task execution system according to claim 13, wherein The hybrid task scheduler is specifically used for parsing the received to-be-executed task to obtain the resource requirement parameters and task priority parameters; sending the to-be-executed task to the task execution queue according to the task priority parameters; obtaining the to-be-executed task from the task execution queue; and executing the to-be-executed task by using the retrieved resources.
15. The task execution system according to claim 14, wherein The hybrid task scheduler is specifically used for obtaining the remaining task score of the to-be-executed task; determining the task score status of the to-be-executed task according to the remaining task score and the task quota; and when the task score status is that the task score is sufficient, sending the to-be-executed task to the task execution queue according to the task priority parameters.
16. The task execution system according to claim 13, characterized in that, The hybrid task scheduler is specifically configured to execute the to-be-executed task using the currently retrieved resources in the current time slice; obtain the actual occupied time corresponding to the to-be-executed task in the current time slice; calculate the quota time corresponding to the to-be-executed task according to the task quota and the time slice length; when it is determined that the actual occupied time is greater than the quota time, calculate the difference between the actual occupied time and the quota time to obtain the current task overuse time corresponding to the current time slice; when it is determined that there is task overuse time in a preset number of consecutive nearest neighbor time slices corresponding to the current time slice, obtain the task overuse time corresponding to each nearest neighbor time slice; calculate the average overuse time by calculating the average of the current task overuse time and the task overuse time corresponding to each nearest neighbor time slice; calculate the difference between the quota time and the average overuse time to obtain the time difference; and determine the time difference as the new quota time corresponding to the to-be-executed task in the next time slice.
17. The task execution system according to claim 13, characterized in that, It further includes: An application programming interface hijacking module, configured to monitor whether there is video memory overuse during the execution of the to-be-executed task using the retrieved resources; If so, intercept the video memory allocation operation corresponding to the to-be-executed task and return an error code to the monitoring and error handling module; The monitoring and error handling module is configured to output a task running log and a resource occupancy record according to the error code.
18. An electronic device, characterized in that, It includes: A memory, configured to store a computer program; A processor, configured to implement the steps of the task execution method according to any one of claims 1 to 12 when executing the computer program.
19. A non-volatile computer-readable storage medium, characterized in that, A computer program is stored in the non-volatile computer-readable storage medium, wherein the computer program implements the steps of the task execution method according to any one of claims 1 to 12 when being executed by a processor.
20. A computer program product comprising a computer program, characterized in that, The computer program implements the steps of the task execution method according to any one of claims 1 to 12 when being executed by a processor.
Citation Information
Patent Citations
Dynamic scheduling method and terminal based on resource application
CN117032974A
Resource dynamic allocation method and device, electronic equipment and storage medium
CN118331709A
GPU task queue management method, system and device
CN119003149A
Resource processing method and device, computer equipment and storage medium
CN119179567A
Task scheduling detection method and device, electronic equipment and storage medium
CN119201382A