Algorithm scheduling method and device and storage medium

By subdividing the time period into sub-time periods and determining task allocation based on the basic and optimization objectives, the problem of low equipment resource utilization in existing technologies is solved, and more efficient algorithm task execution is achieved.

CN121166293AActive Publication Date: 2025-12-19BEIJING BIG DATA CENT
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202511129357.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-12
Publication Date
2025-12-19
Estimated Expiration
2045-08-12

AI Technical Summary

Technical Problem

Existing algorithm scheduling methods fail to provide more detailed planning for different algorithm tasks that electronic devices can execute simultaneously while occupying the same equipment resources, resulting in low equipment resource utilization.

Method used

By dividing the preset time period into multiple sub-time periods, the algorithm task allocation within each sub-time period is determined based on the basic objective and optimization objective, forming an optimal algorithm scheduling scheme to rationally plan the execution time of each algorithm task on the target device.

Benefits of technology

This improves the utilization rate of the target device's resources, enabling it to execute as many algorithm tasks as possible simultaneously within the constraints of available resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121166293A_ABST
    Figure CN121166293A_ABST
Patent Text Reader

Abstract

The invention provides an algorithm scheduling method and device and a storage medium, and the algorithm scheduling method comprises the steps: carrying out the subdivision of a time period in which a target device can actually execute an algorithm task, and planning the specific execution time of each algorithm task on the target device more carefully and reasonably; according to the invention, the target device can execute more algorithm tasks at the same time as much as possible under the condition that the available device resources are limited to the target resources, so that the device resource utilization rate of the target device is effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of data processing, in particular to an algorithm scheduling method, device and storage medium. BACKGROUND

[0002] In a video analysis scenario, different algorithm tasks are executed based on different video analysis requirements, so in order to meet different video analysis requirements, the electronic device often needs to execute multiple different algorithm tasks; for example, multiple target detection tasks for different target objects or different target events in video data.

[0003] At present, when the electronic device needs to execute multiple different algorithm tasks, the existing algorithm scheduling method is usually to sort multiple algorithm tasks according to the order of the task execution time corresponding to each algorithm task, and then call the device resources (including software resources and hardware resources) in the electronic device to execute the multiple algorithm tasks in turn according to the sorting result. However, since the above-mentioned existing algorithm scheduling method only relies on the order of the task execution time corresponding to different algorithm tasks to schedule multiple algorithm tasks, it lacks more detailed planning of different algorithm tasks that can be executed by the electronic device at the same time under the condition of occupying the same device resources, so that the electronic device has the defect of low device resource utilization rate when scheduling algorithms according to the above-mentioned existing algorithm scheduling method. SUMMARY

[0004] Therefore, the present application provides an algorithm scheduling method, device and storage medium to solve the above technical problems.

[0005] In a first aspect, an algorithm scheduling method is provided, which comprises:

[0006] determining, from a task execution plan associated with a target device, an algorithm task that needs to be executed by the target device within a preset time period and a task execution condition corresponding to each algorithm task; wherein the task execution condition comprises a task execution time and a task execution duration corresponding to the algorithm task;

[0007] splitting the preset time period into multiple sub-time periods with a unit time length according to the preset unit time length;

[0008] According to the preset basic target and optimization target, an algorithm task allocated to be executed in each of the sub time periods is determined as an optimal algorithm scheduling scheme corresponding to the task execution plan; the basic target refers to that a sub time period allocated to each of the algorithm tasks matches a task execution condition corresponding to each of the algorithm tasks and device resources occupied by algorithm tasks executed in a same sub time period do not exceed a target resource, the optimization target refers to that overall device resources occupied by algorithm tasks executed in a same sub time period are close to the target resource, and the target resource represents available device resources pre-configured for the task execution plan from device resources of the target device;

[0009] On the target device, algorithm scheduling is performed on each of the algorithm tasks according to the optimal algorithm scheduling scheme.

[0010] In a second aspect, an embodiment of the present application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements steps of the algorithm scheduling method when executing the computer program.

[0011] In a third aspect, an embodiment of the present application provides a computer readable storage medium, and the computer readable storage medium stores a computer program, and the computer program implements steps of the algorithm scheduling method when being executed by a processor.

[0012] In a fourth aspect, an embodiment of the present application provides a computer program product, and the computer program product implements steps of the algorithm scheduling method when being executed by a processor.

[0013] Embodiments of the present application provide the technical scheme, which can include the following beneficial effects:

[0014] The algorithm scheduling method provided in the embodiments of the present application determines algorithm tasks that a target device needs to execute within a preset time period and a task execution condition corresponding to each algorithm task from a task execution plan associated with the target device; splits the preset time period into a plurality of sub-time periods according to a preset unit time length, and the time length of one sub-time period is equal to the unit time length; determines an algorithm task to be executed in each sub-time period according to a pre-set basic target and an optimization target, as an optimal algorithm scheduling scheme corresponding to the task execution plan; and performs algorithm scheduling on each algorithm task according to the optimal algorithm scheduling scheme on the target device. In this way, the embodiments of the present application plan the specific execution time of each algorithm task on the target device more carefully and reasonably by subdividing the time period in which the target device can actually execute algorithm tasks, so that the target device can execute as many algorithm tasks as possible at the same time under the condition that the available device resources are limited to target resources, thereby effectively improving the device resource utilization of the target device. BRIEF DESCRIPTION OF DRAWINGS

[0015] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following will briefly introduce the drawings needed to be used in the embodiments. It should be understood that the following drawings only show some of the embodiments of the present application, and therefore should not be considered as a limitation to the scope. For those skilled in the art, other related drawings can also be obtained without creative labor on the basis of these drawings.

[0016] Figure 1 A flowchart of an algorithm scheduling method provided by the embodiments of the present application is shown;

[0017] Figure 2 A flowchart of a resource quantification method provided by the embodiments of the present application is shown;

[0018] Figure 3 A flowchart of a method for sequentially determining sub-time periods to which different algorithm tasks are respectively allocated is shown;

[0019] Figure 4 A structural diagram of an electronic device 400 provided by the embodiments of the present application is shown. DETAILED DESCRIPTION

[0020] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. It should be understood that the accompanying drawings in this application are for illustrative and descriptive purposes only and are not intended to limit the scope of protection of this application. Furthermore, it should be understood that the schematic drawings are not drawn to scale. The flowcharts used in this application illustrate operations implemented according to some embodiments of this application. It should be understood that the operations in the flowcharts may not be implemented in sequence, and steps without logical contextual relationships may be reversed or implemented simultaneously. In addition, those skilled in the art, guided by the content of this application, may add one or more other operations to the flowcharts, or remove one or more operations from the flowcharts.

[0021] Furthermore, the described embodiments are merely some, not all, of the embodiments of this application. The components of the embodiments of this application described and illustrated herein can typically be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely to illustrate selected embodiments of the application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.

[0022] It should be noted that the term "comprising" will be used in the embodiments of this application to indicate the presence of the features declared thereafter, but does not exclude the addition of other features.

[0023] One embodiment of the algorithm scheduling method in this application can run in an electronic device, which may be a terminal device or a server. The specific device type of the electronic device is not limited in this application.

[0024] To facilitate understanding of the embodiments of this application, a detailed description of an algorithm scheduling method, device, and storage medium provided in the embodiments of this application is provided below.

[0025] Reference Figure 1 As shown, Figure 1 The diagram illustrates a flowchart of an algorithm scheduling method provided in an embodiment of this application, wherein the algorithm scheduling method includes steps S101-S104; specifically:

[0026] S101, determine the algorithm tasks that the target device needs to execute within a preset time period and the corresponding task execution conditions for each algorithm task from the task execution plan associated with the target device.

[0027] Here, the target device can be an electronic device running the algorithm scheduling method provided by the embodiments of the present application, or a hardware device with data processing capability in the electronic device; when the target device is the hardware device, the specific device type of the target device can be determined according to the algorithm task included in the task execution plan, and the specific device type of the target device is not limited in the embodiments of the present application.

[0028] For example, if the algorithm task included in the task execution plan is an algorithm task related to video analysis or image processing, the target device can be a hardware device such as a graphics card or GPU (Graphics Processing Unit) related to image data processing in the electronic device; if the algorithm task included in the task execution plan is an algorithm task involving complex logical judgment or high randomness memory access, the target device can be a hardware device such as a CPU (Central Processing Unit) in the electronic device.

[0029] Here, the task execution plan represents an algorithm task execution plan configured by the user for the target device; at least the algorithm task (which can be one or multiple) that the target device needs to execute within a preset time period and the specific task execution condition corresponding to each algorithm task are included in the task execution plan, so that the electronic device can subsequently determine the specific algorithm scheduling scheme for each algorithm task according to the specific task execution condition corresponding to each algorithm task.

[0030] Specifically, for each algorithm task, the task execution condition corresponding to the algorithm task includes the executable time interval corresponding to the algorithm task and the task execution duration of the algorithm task within the executable time interval; the executable time interval is used to represent a time range within the preset time period during which the algorithm task can be selected for execution, and the task execution duration is used to represent the specific time length of the target device executing the algorithm task within the executable time interval.

[0031] For example, if the algorithm task a is "detecting whether the garbage can in the video data is in the abnormal state of falling down", and the corresponding task execution condition of the algorithm task a in the task execution plan is "detecting for 1 hour in the time period of 8:00-19:00 every day", it can be determined that the executable time interval of the algorithm task a is "8:00-18:00" (equivalent to that the target device can execute the algorithm task a for 1 hour between 8:00-18:00), and the task execution duration of the algorithm task a in the above executable time interval is "1 hour" (equivalent to that the total duration of the algorithm task a executed by the target device in the above executable time interval needs to reach 1 hour).

[0032] It should be noted that the algorithm scheduling method provided by the embodiments of the present application is applicable to various data processing scenarios. For example, in the image data processing scenario of video analysis, all algorithm tasks in the above task execution plan can be: a plurality of different video analysis tasks performed on video data shot in the same video shooting scene (such as the same construction site) (for example, the algorithm task can be a safety helmet detection task of detecting whether the construction personnel in the video data shot in the construction scene wear safety helmets, and the algorithm task can also be a dangerous goods detection task of detecting whether there are flammable and explosive goods in the video data shot in the construction scene, etc.). All algorithm tasks in the above task execution plan can also be: video analysis tasks respectively performed on a plurality of video data from different shooting scenes (for example, the algorithm task can be a street lamp detection task of detecting whether the street lamp in the video data shot in the road scene A is damaged, and the algorithm task can also be a street lamp detection task of detecting whether the street lamp in the video data shot in the road scene B is damaged, etc.). The specific task content and the specific number of algorithm tasks included in the above task execution plan are not limited by the embodiments of the present application, and the user can flexibly adjust them according to the actual application scenario.

[0033] In S102, the preset time period is divided into a plurality of sub-time periods according to a preset unit time length, and the time length of one sub-time period is equal to one unit time length.

[0034] Here, in the preset time period, there can be overlaps between the executable time intervals corresponding to different algorithm tasks, for example, algorithm task a is "detect whether a garbage can in the video data is in an abnormal state of falling down", algorithm task b is "detect whether a street lamp in the video data is in a damaged state", if the task execution condition corresponding to algorithm task a in the task execution plan is "detect for 1 hour in the time period of 8:00-19:00 every day", and the task execution condition corresponding to algorithm task b in the task execution plan is "detect for 1 hour in any one of the time periods of 8:00-10:00 or 22:00-00:00 every day", it can be determined that the executable time interval corresponding to algorithm task a is "8:00-18:00", and the executable time interval corresponding to algorithm task b is "8:00-9:00 or 22:00-23:00", at this time, the executable time intervals corresponding to algorithm task a and algorithm task b can overlap for 1 hour of "8:00-9:00".

[0035] Based on this, for the purpose of avoiding the above-mentioned overlap as much as possible and making the resource usage of the device resources on the target device more balanced, before determining the algorithm scheduling scheme, the embodiments of the present application can first subdivide the preset time period according to a preset unit time length, and split the preset time period into a plurality of sub-time periods with a period length of the unit time length, at this time, each sub-time period after subdivision can be used as a minimum execution unit corresponding to an algorithm task (that is, the unit time length can represent the minimum continuous execution time when executing an algorithm task on the target device), thereby facilitating the target device to execute each algorithm task more flexibly (equivalent to the task execution mode of the algorithm task on the target device is no longer limited to only executing the task execution duration in a single continuous manner, but can be executed in multiple times in a single continuous manner of unit time length, as long as the cumulative execution duration can reach the task execution duration).

[0036] It should be noted that the specific value of the unit time length can be flexibly adjusted according to actual needs, for example, taking the preset time period of 1 day as an example, when the unit time length is 1 hour, the preset time period can be split into 24 sub-time periods according to the unit time length; when the unit time length is 2 hours, the preset time period can be split into 12 sub-time periods according to the unit time length; the specific value of the unit time length is not limited in the embodiments of the present application.

[0037] S103, according to the pre-set basic target and optimization target, determine the algorithm task allocated for execution in each sub-time period as the optimal algorithm scheduling scheme corresponding to the task execution plan.

[0038] Here, the basic target means that the sub-time period allocated to each algorithm task matches the task execution condition corresponding to each algorithm task, and the device resources occupied by the algorithm tasks executed in the same sub-time period do not exceed the target resources; and the optimization target means that the overall device resources occupied by the algorithm tasks executed in the same sub-time period are close to the target resources.

[0039] Here, according to the related description of the foregoing step S101, for each algorithm task, the task execution condition corresponding to the algorithm task includes the two parts of the executable time interval and the task execution duration, and at this time, the “each algorithm task is allocated to a sub-time period that matches the task execution condition corresponding to each algorithm task” in the basic target means that the specific time corresponding to the sub-time period allocated to an algorithm task should be located in the executable time interval corresponding to the algorithm task, and the overall time length corresponding to all sub-time periods allocated to an algorithm task should reach the task execution duration corresponding to the algorithm task.

[0040] For example, if the preset time period is 1 day and the unit time length is 2 hours, then according to the unit time length, the preset time period of 1 day can be divided into the following 12 sub-time periods: “0:00-2:00”, “2:00-4:00”, “4:00-6:00”, “6:00-8:00”, “8:00-10:00”, “10:00-12:00”, “12:00-14:00”, “14:00-16:00”, “16:00-18:00”, “18:00-20:00”, “20:00-22:00”, “22:00-00:00”; wherein, if the executable time interval corresponding to the algorithm task x is “0:00-10:00”, and the task execution duration corresponding to the algorithm task x is 2 hours, then the sub-time periods that match the task execution condition corresponding to the algorithm task x can be determined as “0:00-2:00”, “2:00-4:00”, “4:00-6:00”, “6:00-8:00”, “8:00-10:00”.

[0041] Here, the target resources represent the available device resources pre-configured for the task execution plan from the device resources of the target device; wherein, the device resources of the target device include but are not limited to: software resources and hardware resources; for example, if the target device is a graphics card, then the device resources of the graphics card can include but are not limited to: video memory resources and computing power resources.

[0042] Here, for each of the algorithm tasks, the algorithm task is executed in a target algorithm service on the target device; wherein the target algorithm service represents an algorithm service corresponding to the algorithm task; that is, each algorithm task corresponds to an algorithm service (the algorithm task is equivalent to a software service, that is, each algorithm task corresponds to a software service capable of executing the algorithm task, running a software service on the target device can execute one or more algorithm tasks corresponding to the software service in the running software service), and the target device needs to execute one or more algorithm tasks corresponding to the algorithm service in the currently running algorithm service on the basis of running the algorithm service; for example, taking the algorithm task belonging to the target detection task as an example, the algorithm service corresponding to the algorithm task can be a target detection model (equivalent to the target device needing to load the target detection model when executing the target detection task, and then executing the target detection task through the target detection model).

[0043] It should be noted that the running of the algorithm service also needs to occupy the device resources of the target device (even if no algorithm task is executed in an algorithm service, the target device needs to occupy related device resources when loading the algorithm service), based on this, when judging whether the device resources occupied by the algorithm tasks executed in a sub-time period exceed the target resources, the device resources occupied by the algorithm tasks and the algorithm services corresponding to the algorithm tasks need to be considered comprehensively.

[0044] Specifically, taking the algorithm tasks executed in a sub-time period as algorithm task a, algorithm task b and algorithm task c, if the algorithm task a and the algorithm task c correspond to the same algorithm service z (for example, the safety hat detection task and the dangerous goods detection task can be executed through the target detection model), and the algorithm task b corresponds to another algorithm service y, at this time, as an optional embodiment, the sum of the device resources occupied by the target device in executing the algorithm task a, the algorithm task b and the algorithm task c can be calculated, and when the calculated sum of the device resources is less than or equal to the target resources, it is determined that the device resources occupied by the algorithm tasks executed by the target device in the sub-time period do not exceed the target resources.

[0045] In addition, since the device resources occupied by the target device for executing the algorithm task a and the algorithm task c depend on the device resources occupied by the target device for running the algorithm service z, and the device resources occupied by the target device for executing the algorithm task b depend on the device resources occupied by the target device for running the algorithm service y, as another optional embodiment, it can also be determined whether the sum of the device resources occupied by the target device for executing the algorithm task a and the algorithm task c exceeds the device resources occupied by the target device for running the algorithm service z, if not, it can be determined whether the device resources occupied by the target device for executing the algorithm task b exceeds the device resources occupied by the target device for running the algorithm service y, if not, it only needs to be determined that the sum of the device resources occupied by the target device for running the algorithm service z and the algorithm service y does not exceed the target resources, that is, the device resources occupied by the algorithm tasks executed by the target device in the sub-time period does not exceed the target resources.

[0046] Similarly, for the above optimization target, the overall device resources occupied by the algorithm tasks executed in a sub-time period can also be determined according to the above two optional embodiments, and the repeated parts will not be described here.

[0047] S104, on the target device, according to the optimal algorithm scheduling scheme, algorithm scheduling is performed on each algorithm task.

[0048] Here, according to the specific implementation of the foregoing steps S101-S103, since the specific algorithm tasks allocated for execution in each sub-time period are determined in the optimal scheduling scheme, and the algorithm service corresponding to each algorithm task is also known information, after the optimal scheduling scheme is determined, the electronic device only needs to perform algorithm scheduling on the algorithm tasks in the task execution plan on the target device according to the optimal scheduling scheme, so as to successfully complete the above task execution plan under the condition of meeting the above basic target and the above optimization target, at this time, the completion of the task execution plan meets the above optimization target (i.e., the overall device resources occupied by the algorithm tasks executed in the same sub-time period is close to the target resources), so that the target device can execute more algorithm tasks at the same time as far as possible under the condition that the available device resources are limited to the target resources, thereby effectively improving the device resource utilization of the target device.

[0049] For example, if the optimal algorithm scheduling scheme is that algorithm task a and algorithm task c are executed in the sub-time period "0:00-2:00" and algorithm task b is executed in the sub-time period "12:00-14:00", and algorithm task a and algorithm task c correspond to the same algorithm service z and algorithm task b corresponds to another algorithm service y, then the corresponding algorithm scheduling result of the task execution plan on the target device is that the target device runs the algorithm service z in the sub-time period "0:00-2:00" and executes algorithm task a and algorithm task c in the algorithm service z, and the target device runs the algorithm service y in the sub-time period "12:00-14:00" and executes algorithm task b in the algorithm service y; at this time, since the specific running time of each algorithm service and the specific execution time of each algorithm task can be accurately regulated on the target device, the device resource utilization of the target device is effectively improved.

[0050] The steps in the algorithm scheduling method provided by the embodiments of the present application are described below.

[0051] Here, according to the above description of step S103, when determining whether the algorithm tasks executed in the same sub-time period meet the above basic target or the above optimization target, the specific device resources occupied by the target device for executing each algorithm task and the specific device resources occupied by the target device for executing each algorithm service need to be determined; at this time, as an optional embodiment, the target resource, the device resources occupied by the target device for executing each algorithm task, and the device resources occupied by the target device for executing each algorithm service can be quantified by a resource quantification method, so that the quantification results of the digital representation are beneficial to more simply and quickly determining the specific device resources occupied by the target device for executing each algorithm service and each algorithm task.

[0052] Based on this, Figure 2 A flowchart of a resource quantification method provided by an embodiment of the present application is shown in FIG. 2. Figure 2 Before step S103, the method includes steps S201-S203, specifically:

[0053] S201, quantifying the target resource to obtain a digital representation of the resource quantification result of the target resource.

[0054] Here, when quantifying the target resource, the preset resource occupation value can be directly used as the digital representation of the resource quantification result of the target resource.

[0055] Exemplarily, it is assumed that the preset resource occupation value is 100, and the resource quantization result of the target resource is determined as 100. The specific value of the resource occupation value can be flexibly adjusted according to actual setting requirements, and the specific value of the resource occupation value is not limited in the embodiments of the present application.

[0056] In S202, the resource quantization result is divided according to the maximum service quantity of the target algorithm service that can be simultaneously run under the target resource, as a first resource occupation result.

[0057] Here, the first resource occupation result is used to represent the device resource occupied by the target device for executing each target algorithm service.

[0058] Exemplarily, it is assumed that the target algorithm service is a safety helmet detection algorithm service (for example, a target detection model for executing a safety helmet detection task) corresponding to an algorithm task "safety helmet detection task", and the target device is a graphics card on an electronic device. If the graphics card can simultaneously run at most 5 safety helmet detection algorithm services under the condition of occupying 100 device resources (i.e., the resource quantization result of the target resource is 100), it can be determined that the device resource occupied by the graphics card (i.e., the target device) for executing one safety helmet detection algorithm service is 20 (i.e., the first resource occupation result is 20).

[0059] In S203, the first resource occupation result is divided according to the maximum task quantity of the algorithm task that can be simultaneously executed in the same target algorithm service, as a second resource occupation result.

[0060] Here, the second resource occupation result is used to represent the device resource occupied by the target device for executing the algorithm task.

[0061] Exemplarily, it is assumed that the example in the above step S202 is still used, and if at most 5 algorithm tasks "safety helmet detection task" can be simultaneously executed in one safety helmet detection algorithm service, based on the device resource occupied by the target device for executing one safety helmet detection algorithm service being 20, it can be calculated that the device resource occupied by the graphics card (i.e., the target device) for executing one algorithm task "safety helmet detection task" is 20 ÷ 5 = 4 (i.e., the second resource occupation result is 4).

[0062] For the specific implementation of step S103, considering that the task execution plan can include multiple different algorithm tasks, and the multiple different algorithm tasks can correspond to multiple different algorithm services respectively, therefore, as an optional embodiment, in the process of determining the optimal algorithm scheduling scheme, the processing order between different algorithm services and the processing order between multiple algorithm tasks corresponding to one algorithm service can also be determined according to a certain priority order, so as to compared with the random processing mode without sorting, it is beneficial to reduce the phenomenon of frequently modifying the algorithm scheduling scheme due to not meeting the basic target or the optimization target, thereby effectively improving the efficiency of formulating the optimal algorithm scheduling scheme.

[0063] Based on this, Figure 3 A flowchart of a method for sequentially determining sub-time periods to which different algorithm tasks are respectively allocated is shown, as shown in Figure 3 When step S103 is executed, the method includes steps S301-S302, specifically:

[0064] S301, the multiple algorithm services are sorted according to the order from high to low of the resource occupation results, and under the condition of meeting the basic target and the optimization target, the sub-time periods to which the algorithm tasks corresponding to each algorithm service are allocated are sequentially determined according to the sorting results.

[0065] Here, the resource occupation result is determined according to the device resources occupied by the target device for executing each algorithm service, and the multiple algorithm services are determined according to the algorithm service corresponding to each algorithm task contained in the task execution plan; wherein the specific calculation method of the resource occupation result can refer to the calculation method of the first resource occupation result in the foregoing step S202, and the repeated part will not be described here.

[0066] For example, if the resource quantification result of the target resource is 100, and the resource occupation results of the algorithm services A, B and C are 40, 20 and 60 respectively, according to the calculation method of the first resource occupation result in the step S202, the algorithm services A, B and C can be ranked in descending order of the resource occupation results, and the algorithm services A, B and C can be determined as the algorithm services with the highest, second highest and lowest resource occupation results respectively. In this case, the algorithm tasks i-k corresponding to the algorithm service C with the highest resource occupation result can be allocated to the corresponding sub-time periods first, and then the algorithm tasks a-d corresponding to the algorithm service A with the second highest resource occupation result can be allocated to the corresponding sub-time periods, and finally the algorithm tasks e-h corresponding to the algorithm service B with the lowest resource occupation result can be allocated to the corresponding sub-time periods.

[0067] In the step S302, for each algorithm service, the multiple algorithm tasks corresponding to the algorithm service are sorted in descending order of the coverage results, and the sub-time periods allocated to the multiple algorithm tasks are determined in sequence according to the sorting results under the condition that the basic target and the optimization target are met.

[0068] Here, for each algorithm task, the coverage result corresponding to the algorithm task is determined according to the number of sub-time periods matched with the executable time interval corresponding to the algorithm task and the number of target time periods, wherein the number of target time periods is used to represent the number of unit time lengths covered by the task execution duration corresponding to the algorithm task.

[0069] For example, if the unit time length is 2 hours and the task execution duration of the algorithm task a is 8 hours, the number of target time periods corresponding to the algorithm task a can be determined as 4 (equivalent to 4 sub-time periods need to be allocated to the algorithm task a).

[0070] Here, taking the preset time period as 1 day, and splitting the preset time period into 12 sub-time periods according to the preset unit time length of 2 hours as an example, it is assumed that the task execution plan includes a total of 11 algorithm tasks a-k, wherein algorithm tasks a-d correspond to algorithm service A, algorithm tasks e-h correspond to algorithm service B, and algorithm tasks i-k correspond to algorithm service C, and the resource quantization result of the target resource is 100. As shown in Table 1 below, after the first resource occupation result (i.e., occupied device resources) corresponding to each algorithm service and the second resource occupation result (i.e., occupied device resources) corresponding to each algorithm task are calculated according to the method shown in steps S202-S203, for each algorithm task, the target time period quantity (i.e., the number of sub-time periods to be allocated) corresponding to the algorithm task can be calculated according to the task execution duration corresponding to the algorithm task. At this time, according to the executable time interval corresponding to each algorithm task, the sub-time periods matching the executable time interval corresponding to the algorithm task can also be marked from all sub-time periods using a target identifier (such as a √ identifier). Specifically:

[0071]

[0072] Table 1

[0073] As shown in Table 1, it can be known from the foregoing step S301 that when formulating the optimal algorithm scheduling scheme, the corresponding algorithm tasks i-k under the algorithm service C (i.e., the algorithm service with the highest resource occupation result, i.e., the algorithm service with the most occupied device resources in Table 1) can be preferentially allocated corresponding sub-time periods. When determining the respective processing orders of algorithm tasks i-k, taking algorithm task i as an example, based on the number of sub-time periods matching the executable time interval corresponding to algorithm task i being 8 (i.e., a total of 8 sub-time periods with √ identifiers in the column of algorithm task i in Table 1) and the target time period quantity (i.e., the number of sub-time periods to be allocated) corresponding to algorithm task i being 6, the coverage result corresponding to algorithm task i can be calculated as: 6÷8=75%. Similarly, the coverage result corresponding to algorithm task j can be calculated as: 10÷12=83%, and the coverage result corresponding to algorithm task k can be calculated as: 3÷6=50%. Thus, according to the order of coverage results from high to low, when allocating corresponding sub-time periods to the corresponding algorithm tasks i-k under the algorithm service C, the corresponding sub-time periods can be preferentially allocated to algorithm task j (i.e., the algorithm task with the highest coverage result), then to algorithm task i (i.e., the algorithm task with the second highest coverage result), and finally to algorithm task k (i.e., the algorithm task with the lowest coverage result).

[0074] Specifically, taking the allocation of the corresponding sub-time period to the algorithm task i-k under the algorithm service C as an example, as shown in Table 1, for each algorithm task, only the number of target time periods (i.e., the number of sub-time periods that the algorithm task needs to allocate in Table 1) needs to be selected from the sub-time periods matching the executable time interval corresponding to the algorithm task (i.e., the sub-time periods with a √ symbol in the column where the algorithm task is located in Table 1), and the total device resources occupied by the currently selected algorithm task i-k is ensured to be less than or equal to the target resource 100, which can meet the basic target.

[0075] As an optional embodiment, based on the content shown in Table 1, as shown in Table 2 below, for each sub-time period, the total device resources occupied by the algorithm tasks that can be allocated in the sub-time period is divided by the device resources occupied by the algorithm service (i.e., the algorithm service C) corresponding to these algorithm tasks, and the calculation result is taken as the resource utilization rate of the sub-time period. The higher the resource utilization rate is, the closer the overall device resources occupied by the algorithm tasks executed in the sub-time period to the target resource (i.e., the higher the resource utilization rate is, the more the optimization target is met, so the sub-time period can be preferentially allocated to the corresponding algorithm tasks that can be allocated in the sub-time period). Specifically:

[0076]

[0077] Table 2

[0078] As an example, as shown in Table 2, taking the sub-time period 0-2 as an example, the resource utilization rate corresponding to the sub-time period 0-2 is (12+30)÷60=70%, where (12+30) represents the total device resources occupied by the algorithm task i and the algorithm task j that can be allocated in the sub-time period 0-2, and 60 represents the device resources occupied by the algorithm service C corresponding to the algorithm task i and the algorithm task j. As for the calculation method of the resource utilization rate corresponding to other sub-time periods in Table 2, the specific calculation method of the resource utilization rate corresponding to the sub-time period 0-2 can be referred to, and the repeated parts will not be described here.

[0079] Specifically, taking the example of allocating a sub time period to algorithm task j, it can be known from Table 1 that 10 sub time periods need to be allocated to algorithm task j from the 12 sub time periods with the symbol √, wherein it can be known from Table 2 that, at this time, based on the currently calculated resource utilization, it can be determined that two sub time periods with a resource utilization of 100%, i.e., sub time period 6-8 and sub time period 16-18, are preferentially allocated to algorithm task j, and based on sub time period 6-8 and sub time period 16-18, the executable time intervals of algorithm task i and algorithm task k are also matched, so as to meet the optimization target (equivalent to as many algorithm tasks as possible running in the same sub time period), it can also be determined that sub time period 6-8 and sub time period 16-18 can be allocated to algorithm task i and algorithm task k at the same time.

[0080] On this basis, since algorithm task k only needs to be allocated one more sub time period to meet the task execution condition of algorithm task k, as an optional embodiment, one sub time period can also be preferentially allocated to algorithm task k from sub time period 8-10, sub time period 10-12, sub time period 12-14 and sub time period 14-16 with higher resource utilization (as shown in Table 2, since the resource utilizations corresponding to the four sub time periods are the same, i.e., 80%, one sub time period can be randomly selected as the sub time period allocated to algorithm task k), at this time, assuming that the sub time period allocated to algorithm task k is sub time period 8-10, based on the fact that algorithm task k has completed the allocation, algorithm task k can be removed from the algorithm tasks that can be allocated in the sub time periods not selected by algorithm task k, and the resource utilization corresponding to each sub time period is recalculated, so as to update Table 2 to obtain updated Table 3, specifically:

[0081]

[0082] Table 3

[0083] As shown in Table 3, after removing algorithm task k from the algorithm tasks that can be allocated in the sub-time period (i.e., "sub-time period 10:00-12:00", "sub-time period 12:00-14:00", and "sub-time period 14:00-16:00") that is not selected by algorithm task k, the resource utilization rates of "sub-time period 10:00-12:00", "sub-time period 12:00-14:00", and "sub-time period 14:00-16:00" that are respectively recalculated are updated from 80% (i.e., (30+18) ÷ 60 = 80%) in Table 2 to 50% (i.e., 30 ÷ 60 = 50%). At this time, based on the updated Table 3, algorithm task j and algorithm task i can be allocated sub-time periods in order from the remaining sub-time periods (i.e., the sub-time periods other than "sub-time period 6:00-8:00" and "sub-time period 16:00-18:00") according to the order from high to low of the resource utilization rates, until the number of sub-time periods allocated to algorithm task j reaches the corresponding target time period quantity (i.e., the number of sub-time periods to be allocated) 10, and the number of sub-time periods allocated to algorithm task i reaches the corresponding target time period quantity 6.

[0084] It should be noted that when allocating sub-time periods to algorithm task i or algorithm task j, for multiple sub-time periods with the same resource utilization rate (such as "sub-time period 0:00-2:00" and "sub-time period 2:00-4:00" in Table 3), one of the sub-time periods can be arbitrarily allocated to algorithm task i or algorithm task j;

[0085] Specifically, when allocating sub-time periods to the multiple algorithm tasks corresponding to algorithm service B and algorithm service A, the specific allocation manner can refer to the specific allocation manner of algorithm tasks i-k corresponding to algorithm service C in the foregoing example, and the repeated parts will not be described herein.

[0086] It should be noted that when allocating sub-time periods to the algorithm tasks a-d corresponding to algorithm task A, as shown in Table 1, an abnormal situation that the resource utilization rate of a sub-time period exceeds 100% (for example, the resource utilization rate of sub-time period 2:00-4:00 is (10+30+20+40) ÷ 40 = 250%) can occur. At this time, as an optional embodiment, the algorithm task allocated to the sub-time period can be determined preferentially; for example, for sub-time period 2:00-4:00, the algorithm task combination "algorithm task a and algorithm task b" with the highest resource utilization rate (which means that the overall device resources occupied by the algorithm tasks executed in the same sub-time period are closer to the device resources 40 occupied by algorithm service A) and not exceeding 100% can be determined as the algorithm task allocated to sub-time period 2:00-4:00 from the algorithm tasks a-d that can be allocated to sub-time period 2:00-4:00.

[0087] In the embodiments of the present application, as can be known from the above description of the plurality of examples about allocating sub-time periods for algorithm tasks, when the number of algorithm tasks and the number of algorithm services involved in the task execution plan is large, the allocation of sub-time periods often involves multiple processes, and due to the priority order (i.e., the above-mentioned related sorting of algorithm services and algorithm tasks in steps S301-S302), it may result in that when the sub-time periods are allocated to the algorithm tasks with low priority, the basic target cannot be met (equivalent to when the sub-time periods are allocated to the algorithm tasks with low priority, the overall device resources occupied by the algorithm tasks executed in the sub-time periods matching the task execution conditions of the algorithm tasks have exceeded the target resources, resulting in that the algorithm tasks cannot be allocated with sufficient sub-time periods).

[0088] At this time, the algorithm tasks that appear in the above-mentioned situation can be marked as blocked tasks; that is, when performing step S103, for any algorithm task, when it is detected that the number of sub-time periods allocated to the algorithm task under the condition of meeting the basic target and the optimization target is less than the number of target time periods (equivalent to the algorithm task cannot be scheduled in a manner matching the task execution conditions according to the currently determined optimal algorithm scheduling scheme), the electronic device can determine that the algorithm task belongs to a blocked task, and mark the algorithm task as a blocked task in the optimal algorithm scheduling scheme, so as to indicate that when the available device resources are limited to the target resources, the marked blocked task cannot be scheduled according to the currently determined optimal scheduling scheme.

[0089] Specifically, for the above-mentioned blocked tasks that are marked, as an optional embodiment, the electronic device can schedule the above-mentioned blocked tasks according to the method shown in steps a1-a2 as follows:

[0090] Step a1, in response to detecting the marked blocked task, determining the idle device resources other than the target resources from the device resources of the target device.

[0091] Here, as can be known from the above-mentioned related description of the target resources in step S103, in the embodiments of the present application, the target resources represent the available device resources pre-configured for the task execution plan from the device resources of the target device, that is, it is because the target resources are the available device resources pre-configured for the task execution plan before the optimal algorithm scheduling scheme is made, rather than the entire device resources of the target device, that the blocked tasks may inevitably occur when the optimal algorithm scheduling scheme is actually made subsequently.

[0092] At this time, the electronic device can, in response to detecting the marked blocking task, first determine remaining device resources other than the target resource from the device resources of the target device, and then determine, from the remaining device resources, a device resource in an idle state as the idle device resource.

[0093] Step a2, invoking the idle device resource to execute the blocking task on the target device.

[0094] Here, the electronic device can invoke the idle device resource as an additional device resource required by the target device to execute the blocking task according to the task execution plan, and since the idle device resource does not belong to the target resource, the use of the idle device resource to execute the blocking task will not affect the smooth execution of the optimal algorithm scheduling scheme based on the target resource.

[0095] Specifically, for the marked blocking task, as another optional embodiment, the electronic device can also perform algorithm scheduling on the blocking task according to the method shown in steps b1-b2 as follows:

[0096] Step b1, in response to detecting the marked blocking task, displaying target prompt information on the graphical user interface corresponding to the target device.

[0097] Here, as known from the foregoing description of the target device in step S101, since the target device can be the electronic device itself or a hardware device in the electronic device for executing the task execution plan, the graphical user interface corresponding to the target device is equivalent to the graphical user interface provided by the electronic device.

[0098] Specifically, the target prompt information represents prompt information about modifying the task execution condition corresponding to the blocking task. After viewing the target prompt information displayed on the graphical user interface, the user can select to modify the task execution condition corresponding to the blocking task to instruct the electronic device to re-determine the optimal algorithm scheduling scheme according to the modified task execution condition, so as to overcome the defect that the marked blocking task cannot be scheduled according to the previously determined optimal scheduling scheme.

[0099] It should be noted that the specific information content and display style of the target prompt information are not limited in the embodiments of the present application.

[0100] Step b2, in response to receiving the modified task execution condition corresponding to the blocking task, re-determining the optimal algorithm scheduling scheme corresponding to the task execution plan under the condition that the basic target and the optimization target are met.

[0101] Here, the electronic device can update the base target and the optimization target according to the modified task execution condition corresponding to the blocked task in response to receiving the modified task execution condition corresponding to the blocked task, and then determine the optimal algorithm scheduling scheme corresponding to the task execution plan in the same manner as the foregoing step S103 according to the updated base target and optimization target. The repeated parts are not described here again.

[0102] According to the algorithm scheduling method provided in the embodiments of the present application, the algorithm tasks that the target device needs to execute within a preset time period and the task execution conditions corresponding to each algorithm task are determined from a task execution plan associated with the target device; the preset time period is split into a plurality of sub-time periods, and the time length of one sub-time period is equal to the unit time length; the base target is that the sub-time period allocated to each algorithm task matches the task execution condition corresponding to each algorithm task and the device resources occupied by the algorithm tasks executed within the same sub-time period do not exceed the target resources, and the optimization target is that the overall device resources occupied by the algorithm tasks executed within the same sub-time period are close to the target resources; the algorithm tasks executed within each sub-time period are determined under the condition of meeting the base target and the optimization target, and the optimal algorithm scheduling scheme corresponding to the task execution plan is obtained; and the algorithm scheduling of each algorithm task is performed on the target device according to the optimal algorithm scheduling scheme, and the algorithm scheduling result corresponding to the task execution plan is obtained. In this way, the present application subdivides the time period in which the target device can actually execute algorithm tasks, more reasonably plans the specific execution time of each algorithm task on the target device, and enables the target device to execute as many algorithm tasks as possible at the same time under the condition that the available device resources are limited to the target resources, thereby effectively improving the device resource utilization rate of the target device.

[0103] Based on the same inventive concept, the present application also provides a computer program product corresponding to the above algorithm scheduling method, wherein the computer program product can implement the steps of any of the algorithm scheduling methods on the target device side when executed by a processor. Since the principle of solving problems by the computer program product in the embodiments of the present application is similar to the above algorithm scheduling method, the implementation of the computer program product can be referred to the implementation of the above algorithm scheduling method, and the repeated parts are not described here again.

[0104] Based on the same inventive concept, the present application also provides an electronic device corresponding to the above algorithm scheduling method. Since the principle of solving problems by the electronic device in the embodiments of the present application is similar to the above algorithm scheduling method, the implementation of the electronic device can be referred to the implementation of the above algorithm scheduling method, and the repeated parts are not described here again.

[0105] Figure 4 A structural schematic diagram of an electronic device 400 provided in the embodiment of the present application, comprising a processor 401, a memory 402 and a bus 403, the memory 402 stores machine readable instructions executable by the processor 401, when the electronic device runs an algorithm scheduling method as in the embodiment, the processor 401 and the memory 402 communicate through the bus 403, and the processor 401 executes the machine readable instructions, wherein the processor 401 executes the machine readable instructions to implement the algorithm scheduling method described above.

[0106] Specifically, the memory 402 and the processor 401 described above can be general memory and processor, which are not limited here, when the processor 401 runs the computer program stored in the memory 402, the algorithm scheduling method described above can be executed.

[0107] Corresponding to the algorithm scheduling method in the present application, the embodiment of the present application further provides a computer readable storage medium, the computer readable storage medium stores a computer program, and the computer program is executed by the processor to execute the steps of the algorithm scheduling method described above.

[0108] Specifically, the storage medium can be a general storage medium, such as a mobile disk, a hard disk, etc., and the computer program on the storage medium can be executed to execute the algorithm scheduling method described above.

[0109] In the embodiments provided in the present application, it should be understood that the disclosed system and method can be implemented in other ways. The system embodiments described above are only schematic. For example, the division of the units is only a logical function division, and there can be another division manner in actual implementation. For example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the units shown or discussed can be through some communication interface, and the indirect coupling or communication connection between the units can be electrical, mechanical or other forms.

[0110] The units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, that is, they can be located in one place, or can be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the embodiment.

[0111] In addition, each functional unit in the embodiments provided in the present application can be integrated in one processing unit, or each unit can exist physically, or two or more units can be integrated in one unit.

[0112] If the functions are implemented in the form of software function units and sold or used as independent products, they can be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the present application essentially or the parts that contribute to the prior art or parts of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a number of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (Read-Only Memory, ROM), a random access memory (Random Access Memory, RAM), a magnetic disk or an optical disk, and various program code storage media.

[0113] It should be noted that similar reference numbers and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings. In addition, the terms "first", "second", "third" and the like are only used to distinguish the description and cannot be understood as indicating or implying relative importance.

[0114] Finally, it should be noted that the above-described embodiments are only specific implementations of the present application, which are used to illustrate the technical solutions of the present application, but not to limit them. Although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can modify or easily think of changes to the technical solutions described in the foregoing embodiments within the technical scope disclosed by the present application, or make equivalent replacements to some technical features. These modifications, changes or replacements do not cause the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present application. They should be covered within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.

Claims

1. An algorithm scheduling method, characterized by, The algorithm scheduling method comprises: determining, from a task execution plan associated with a target device, algorithm tasks that the target device needs to execute within a preset time period and a task execution condition corresponding to each algorithm task; wherein the task execution condition comprises an executable time interval corresponding to the algorithm task and a task execution duration of the algorithm task within the executable time interval; splitting the preset time period into a plurality of sub-time periods according to a preset unit time length, the time length of a sub-time period being equal to the unit time length; determining, according to a preset basic target and an optimization target, an algorithm task to be allocated for execution in each sub-time period as an optimal algorithm scheduling scheme corresponding to the task execution plan; wherein the basic target means that the sub-time period to which each algorithm task is allocated matches the task execution condition corresponding to each algorithm task and the device resources occupied by the algorithm tasks executed in the same sub-time period do not exceed a target resource, the optimization target means that the overall device resources occupied by the algorithm tasks executed in the same sub-time period are close to the target resource, and the target resource represents available device resources pre-configured for the task execution plan from device resources of the target device; performing algorithm scheduling on each algorithm task according to the optimal algorithm scheduling scheme on the target device.

2. The algorithm scheduling method of claim 1, wherein, For each algorithm task, a target algorithm service on the target device is executed; wherein the target algorithm service represents an algorithm service corresponding to the algorithm task.

3. The method of claim 2, wherein, For each algorithm task, the device resources occupied by the target device for executing the algorithm task are determined by the following method: quantizing the target resource to obtain a resource quantization result of the target resource in digital form; dividing the resource quantization result equally according to the maximum number of target algorithm services that can run simultaneously under the target resource as a first resource occupation result; wherein the first resource occupation result is used to represent the device resources occupied by the target device for executing each target algorithm service; dividing the first resource occupation result equally according to the maximum number of algorithm tasks that can be executed simultaneously in the same target algorithm service as a second resource occupation result; wherein the second resource occupation result is used to represent the device resources occupied by the target device for executing the algorithm task.

4. The method of claim 2, wherein, The determination of the algorithm task to be allocated for execution in each sub-time period according to the preset basic target and the optimization target comprises: sorting a plurality of algorithm services in descending order of resource occupation results, and under the condition of meeting the basic target and the optimization target, determining the sub-time period to which the corresponding algorithm task under each algorithm service is allocated according to the sorting result; wherein the resource occupation result is determined according to the device resources occupied by the target device for executing each algorithm service, and the plurality of algorithm services are determined according to the algorithm service corresponding to each algorithm task. For each of the algorithm services, the multiple algorithm tasks corresponding to the algorithm service are sorted in descending order of the coverage results, and under the condition of meeting the basic target and the optimization target, the multiple algorithm tasks are sequentially determined to be respectively assigned to sub-time periods according to the sorting results; wherein for each of the algorithm tasks, the coverage result corresponding to the algorithm task is determined according to the number of sub-time periods matched with the executable time interval corresponding to the algorithm task and the number of target time periods; the number of target time periods is used to represent the number of unit time lengths covered by the task execution duration corresponding to the algorithm task.

5. The method of claim 4, wherein, The algorithm scheduling method further comprises: For any of the algorithm tasks, when it is detected that the number of sub-time periods to which the algorithm task is assigned is less than the number of target time periods under the condition of meeting the basic target and the optimization target, the algorithm task is marked as a blocked task in the optimal algorithm scheduling scheme.

6. The method of claim 5, wherein, After the algorithm task is marked as a blocked task in the optimal algorithm scheduling scheme, the algorithm scheduling method further comprises: In response to detecting the marked blocked task, determining, from the device resources of the target device, an idle device resource other than the target resource; On the target device, invoking the idle device resource to execute the blocked task.

7. The method of claim 5, wherein, After the algorithm task is marked as a blocked task in the optimal algorithm scheduling scheme, the algorithm scheduling method further comprises: In response to detecting the marked blocked task, displaying target prompt information on the graphical user interface corresponding to the target device; wherein the target prompt information represents prompt information about modifying the task execution condition corresponding to the blocked task; In response to receiving the modified task execution condition corresponding to the blocked task, re-determining the optimal algorithm scheduling scheme corresponding to the task execution plan under the condition of meeting the basic target and the optimization target.

8. A computer program product, characterised in that, The computer program product, when executed by a processor, implements the steps of the algorithm scheduling method of any one of claims 1 to 7.

9. An electronic device, comprising: Comprise: A processor, a memory and a bus, the memory stores machine readable instructions executable by the processor, when the electronic device is running, the processor and the memory communicate through the bus, the machine readable instructions are executed by the processor to execute the steps of the algorithm scheduling method of any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a computer program, which is executed by a processor to execute the steps of the algorithm scheduling method of any one of claims 1 to 7.

Citation Information

Patent Citations

  • Task scheduling method and device based on distributed data collection

    CN111857983A

  • Task scheduling method and device, computer equipment and storage medium

    CN113821330A

  • Task scheduling method and device, equipment, storage medium and product

    CN116450306A

  • Method and device for judging execution frequency of timed task and electronic equipment

    CN117667355A

  • Task execution method and device, electronic equipment and storage medium

    CN118210610A