Resource allocation method and device, electronic equipment and storage medium

By judging the computing power requirements of the task to be executed and the current distribution of computing power, the resources are extracted and distributed resources in accordance with the priority order, and the problem of low resource allocation accuracy in the existing technology has been solved, and the use of high -efficiency resources during the expansion of the computing power has been realized. Essence

CN119376909APending Publication Date: 2025-01-28SHENZHEN INTELLIFUSION TECHNOLOGIES CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411148312.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-20
Publication Date
2025-01-28

AI Technical Summary

Technical Problem

When the existing resource allocation method performs video analysis tasks in a limited computing environment, it has low accuracy and cannot effectively judge the computing power expansion period or meet the computing power requirements during the algorithm expansion period.

Method used

By obtaining the computing power requirements of the task to be executed and the current distribution of computing power, determine whether to enter the computing power expansion period, and extract the target execution tasks in accordance with the priority of the task to provide resource allocation to meet the computing power requirements of the target task first.

Benefits of technology

It improves the accuracy of resource allocation, can prioritize the computing power needs of target execution tasks during the expansion of the computing power, and improve the efficiency of resource utilization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119376909A_ABST
    Figure CN119376909A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a resource allocation method, and the method comprises the steps: obtaining the current allocable computing power and a to-be-executed task, and enabling the to-be-executed task to comprise a corresponding priority and a computing power demand; when the current distributable computing power does not meet the computing power requirements of all the to-be-executed tasks, extracting a target execution task from all the to-be-executed tasks according to the sequence of the priorities; and carrying out resource allocation on the target execution task based on the current allocatable computing power. Whether the current distributable computing power meets the computing power requirement or not is judged according to the computing power requirement of the task to be executed and the current distributable computing power, if not, it is indicated that the task enters the computing power expansion period, and then the target execution task is extracted according to the priority sequence, so that the computing power requirement of the target execution task can be preferentially met in the computing power expansion period, and the task execution efficiency is improved. And thus, the resource allocation accuracy is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of resource management, and in particular to a resource allocation method, device, electronic equipment and storage medium. Background Art

[0002] At present, algorithm platform applications are becoming more and more frequent. Based on limited computing power, more video analysis tasks need to be performed. The traditional resource allocation method is to allocate resources by video channels. However, the accuracy of resource allocation based on video channels alone is still low. It is usually impossible to determine whether a computing power expansion period has occurred, and it is also impossible to meet a large number of computing power usage scenarios such as algorithm expansion periods. Therefore, how to provide a method to improve the accuracy of resource allocation has become an urgent problem to be solved. Summary of the invention

[0003] The embodiment of the present invention provides a resource allocation method, which aims to solve the problem of low accuracy of existing resource allocation methods. Through the computing power requirements of the task to be executed and the current allocable computing power, it is judged whether the current allocable computing power meets the computing power requirements. If not, it indicates that the computing power expansion period has begun, and then the target execution task is extracted in the order of priority, so that during the computing power expansion period, the computing power requirements of the target execution task can be met first, thereby improving the accuracy of resource allocation.

[0004] In a first aspect, an embodiment of the present invention provides a resource allocation method, the method comprising the following steps:

[0005] Obtaining currently allocable computing power and pending tasks, wherein the pending tasks include corresponding priorities and computing power requirements;

[0006] When the currently allocable computing power does not meet the computing power requirements of all tasks to be executed, extracting a target execution task from all the tasks to be executed in the order of priority;

[0007] Based on the currently allocatable computing power, resources are allocated for the target execution task.

[0008] Optionally, extracting the target execution task from all the tasks to be executed in the order of the priorities includes:

[0009] Based on the computing power requirements of all the tasks to be executed and the priorities, a computing power threshold is set;

[0010] In the order of the priorities, a target execution task is extracted from all the tasks to be executed based on the computing power threshold.

[0011] Optionally, the tasks to be executed include a first priority task and a second priority task, the priority of the first priority task is higher than the priority of the second priority task, and extracting the target execution task from all the tasks to be executed based on the computing power threshold in the order of the priorities includes:

[0012] When the currently allocable computing power is greater than the computing power threshold, determining a second executable task from all the second priority tasks in the order of priority, and determining the target execution task based on the first priority task and the second executable task, wherein the priority of the first priority task is higher than that of the second priority task;

[0013] When the currently allocatable computing power is less than the computing power threshold, a first executable task is determined from all the first-priority tasks in the order of priority, and the target execution task is determined based on the first executable task.

[0014] Optionally, the priority is determined according to a task priority and an algorithm priority, and determining the first executable task from all the first-priority tasks in order of the priorities includes:

[0015] Taking the task priority as the main priority and the algorithm priority as the secondary priority, sorting each of the first priority tasks to obtain a first task sorting table;

[0016] According to the ranking of each first-priority task in the first task sorting table, the first-priority task whose computing power requirement meets the currently allocatable computing power is extracted as the first executable task.

[0017] Optionally, the priority is determined according to the task priority and the algorithm priority, and determining the second executable task from all the second priority tasks in the order of the priorities includes:

[0018] Determine the current remaining allocatable computing power based on the computing power requirements of all the first-priority tasks and the currently allocatable computing power;

[0019] Taking the task priority as the main priority and the algorithm priority as the secondary priority, sorting each of the second priority tasks to obtain a second task sorting table;

[0020] According to the ranking of each second-priority task in the second task sorting table, the second-priority task whose computing power requirement satisfies the currently remaining allocatable computing power is extracted as the second executable task.

[0021] Optionally, allocating resources for the target execution task based on the currently allocable computing power includes:

[0022] Obtaining the task attributes of each of the target execution tasks and the computing power data corresponding to the currently allocable computing power;

[0023] Based on the task attributes and the priority, classify each of the target execution tasks to obtain a classification result of the target execution task;

[0024] Based on the classification result and the computing power data, resources are allocated for the target execution task.

[0025] Optionally, after allocating resources for the target execution task based on the currently allocable computing power, the method further includes:

[0026] Determine a non-target execution task based on all the tasks to be executed and the target execution task;

[0027] After the target execution task is completed, resources are allocated to the non-target execution task based on the priority of the non-target execution task.

[0028] In a second aspect, an embodiment of the present invention further provides a resource allocation device, the resource allocation device comprising:

[0029] A first acquisition module is used to acquire currently allocable computing power and pending tasks, wherein the pending tasks include corresponding priorities and computing power requirements;

[0030] A first extraction module is used to extract a target execution task from all the tasks to be executed according to the order of priority when the currently allocatable computing power does not meet the computing power requirements of all the tasks to be executed;

[0031] The first allocation module is used to allocate resources for the target execution task based on the current allocatable computing power.

[0032] In a third aspect, an embodiment of the present invention provides an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps in the resource allocation method provided in the embodiment of the present invention when executing the computer program.

[0033] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps in the resource allocation method provided in the embodiment of the invention are implemented.

[0034] In an embodiment of the present invention, the currently allocable computing power and tasks to be executed are obtained, and the tasks to be executed include corresponding priorities and computing power requirements; when the currently allocable computing power does not meet the computing power requirements of all tasks to be executed, the target execution task is extracted from all the tasks to be executed in the order of the priorities; and resources are allocated for the target execution task based on the currently allocable computing power. Through the computing power requirements of the tasks to be executed and the currently allocable computing power, it is determined whether the currently allocable computing power meets the computing power requirements. If it does not meet the requirements, it indicates that the computing power expansion period has begun, and then the target execution task is extracted in the order of priority, so that during the computing power expansion period, the computing power requirements of the target execution task can be met first, thereby improving the accuracy of resource allocation. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0036] Figure 1 is a flow chart of a resource allocation method provided by an embodiment of the present invention;

[0037] Figure 2 is a flow chart of a second resource allocation method provided by an embodiment of the present invention;

[0038] Figure 3 is a flow chart of a third resource allocation method provided by an embodiment of the present invention;

[0039] Figure 4 is a structural schematic diagram of a resource allocation device provided in an embodiment of the present invention;

[0040] Figure 5 It is a structural schematic diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0041] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0042] like Figure 1 As shown, Figure 1 is a flow chart of a resource allocation method provided by an embodiment of the present invention, including:

[0043] 101. Get the currently allocable computing power and tasks to be executed.

[0044] In an embodiment of the present invention, the above-mentioned tasks to be executed include corresponding priorities and computing power requirements, the above-mentioned resources may be computing power resources, the above-mentioned computing power resources may be used to execute algorithm tasks, and the above-mentioned algorithm tasks may be any algorithm tasks, for example, video analysis tasks, image recognition tasks, text error correction tasks, text expansion tasks, etc. The above-mentioned resource allocation method may be applied to a resource management platform, and the above-mentioned resource management platform may be constructed by a server or a server cluster, and the above-mentioned server or server cluster may be any electronic device having functions such as resource management, resource allocation, data storage, data transmission, and data analysis.

[0045] The resource management platform may be deployed with an algorithm container, which may be a software environment for encapsulating and running algorithms. A standardized way may be provided to deploy, run, and manage algorithms so that they have consistent behavior and performance in different computing environments. For example, it may be Docker, Kubernetes, Singularity, etc.

[0046] The resource management platform can obtain the allocable computing power by counting the idle computing power of the algorithm container. The data transmission function of the task to be executed can be used to obtain the data. For example, when the algorithm task created by the user is a video analysis task, the data transmission function can be used to obtain the video sequence transmitted from the camera and the analysis algorithm corresponding to the video sequence. When the algorithm task is a text expansion task, the data transmission function can be used to obtain the text data uploaded by the user and the corresponding text expansion algorithm.

[0047] Each task to be executed includes a corresponding priority and computing power requirement. The above priority can be set by the user type and / or algorithm type of the task created. It is understandable that the importance of a task to be executed with a high priority is higher than that of a task to be executed with a low priority. The above computing power requirement can be the computing power resources required to execute the above task to be executed, such as CPU resources, GPU resources, memory resources, etc.

[0048] 102. When the currently allocable computing power does not meet the computing power requirements of all tasks to be executed, the target execution task is extracted from all tasks to be executed in order of priority.

[0049] In the embodiment of the present invention, the tasks to be executed can be extracted one by one in order of priority from high to low as executable tasks, and the extraction is stopped when the total computing power requirement of all executable tasks is equal to or about to exceed the above-mentioned current allocable computing power. The extracted executable tasks are used as target execution tasks.

[0050] Specifically, a priority ranking table corresponding to the tasks to be executed can be established based on the order of priority, and the tasks to be executed can be extracted one by one according to the ranking of each task to be executed in the priority ranking table. The extracted tasks to be executed are added to the target execution task set as executable tasks. When the total computing power demand of the executable tasks in the target execution task set is equal to or about to exceed the above-mentioned current allocable computing power, the extraction is stopped, and the executable tasks in the target execution task set are used as target execution tasks. At the same time, the tasks to be executed that are not extracted in the above-mentioned priority ranking table are determined as non-target execution tasks.

[0051] It can be understood that the standard for the above-mentioned total computing power being about to be higher than the above-mentioned currently allocatable computing power can be that when the total computing power requirement is greater than the computing power requirement of the next task to be executed in the above-mentioned priority sorting table, it means that it is about to be higher than the above-mentioned currently allocatable computing power.

[0052] 103. Based on the currently allocable computing power, allocate resources for the target execution task.

[0053] In an embodiment of the present invention, since the above-mentioned currently allocatable computing power meets the total computing power requirement of the above-mentioned target execution task, at least one corresponding algorithm container can be determined based on the current allocatable computing power, and when the execution time of the target execution task is reached, the target execution task can be allocated to the corresponding algorithm container to execute the above-mentioned target execution task.

[0054] After the above-mentioned target execution tasks are completed, the computing power expansion period ends. At this time, it may enter the computing power saturation period or the computing power idle period. The above-mentioned computing power saturation period can be understood as the computing power requirements of all tasks to be executed in the current time period are equal to the allocatable computing power in the current time period. The above-mentioned computing power idle period can be understood as the computing power requirements of all tasks to be executed in the current time period are less than the allocatable computing power in the current time period. The above-mentioned computing power expansion period can be understood as the computing power requirements of all tasks to be executed in the current time period are greater than the allocatable computing power in the current time period.

[0055] Therefore, after the computing power expansion period ends, if the computing power saturation period is entered, the above non-target execution tasks are retained until the computing power idle period is entered, and the above non-target execution tasks are determined as the tasks to be executed in the above computing power idle period. Alternatively, after the computing power expansion period ends, if the computing power idle period is entered, the above non-target execution tasks can be directly determined as the tasks to be executed in the above computing power idle period.

[0056] In an embodiment of the present invention, the currently allocable computing power and tasks to be executed are obtained, and the tasks to be executed include corresponding priorities and computing power requirements; when the currently allocable computing power does not meet the computing power requirements of all tasks to be executed, the target execution task is extracted from all the tasks to be executed in the order of the priorities; and resources are allocated for the target execution task based on the currently allocable computing power. Through the computing power requirements of the tasks to be executed and the currently allocable computing power, it is determined whether the currently allocable computing power meets the computing power requirements. If it does not meet the requirements, it indicates that the computing power expansion period has begun, and then the target execution task is extracted in the order of priority, so that during the computing power expansion period, the computing power requirements of the target execution task can be met first, thereby improving the accuracy of resource allocation.

[0057] It is understandable that in the specific implementation of this application, data related to tasks to be executed, task attributes, computing power data, etc., when the embodiments in this application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of relevant data and the construction, training and use of related models need to comply with relevant laws, regulations and standards of relevant countries and regions.

[0058] It should be noted that the resource allocation method provided in the embodiment of the present invention can be applied to devices such as computers and servers that can perform resource allocation.

[0059] Optionally, in the step of extracting the target execution task from all tasks to be executed in order of priority, a computing power threshold can also be set based on the computing power requirements and priorities of all tasks to be executed; and in order of priority, the target execution task is extracted from all tasks to be executed based on the computing power threshold.

[0060] In an embodiment of the present invention, the above-mentioned priorities may include high priority, medium priority and low priority, wherein the priority of the first priority task is high priority, and the priority of the second priority task is medium priority or low priority. The above-mentioned priorities can be set according to the above-mentioned user type and the above-mentioned algorithm type. Specifically, the task priority can be set according to the above-mentioned user type, the algorithm priority can be set according to the above-mentioned algorithm type, and the priority of the above-mentioned task to be executed can be set according to the above-mentioned task priority and the above-mentioned algorithm priority.

[0061] For example, the above user types may include types with high real-time requirements and types with low real-time requirements. For example, users such as the Emergency Bureau are users with relatively high real-time requirements, or users such as the Political and Digital Bureau and the Street Management Office who collect and count data are users with low real-time requirements. When the user type of the above task to be executed is a user such as the Emergency Bureau, the corresponding task priority may be a high task priority, and when the user type of the above task to be executed is a user such as the Political and Digital Bureau and the Street Management Office, the corresponding task priority may be a medium task priority or a low task priority.

[0062] The above algorithm types may include algorithm types that need to be perceived in advance, detection algorithms, and statistical algorithms. For example, the above algorithm types that need to be perceived in advance may be flood-prone point detection algorithms and fight recognition algorithms, the above detection algorithms may be non-motor vehicle helmet wearing detection algorithms, and the above statistical algorithms may be red light running statistical algorithms, etc. When the above algorithm type is a flood-prone point detection algorithm or a fight recognition algorithm, the algorithm priority of the above task to be executed is a high algorithm priority, when the above algorithm type is a non-motor vehicle helmet wearing detection algorithm, the algorithm priority of the above task to be executed is a medium algorithm priority, and when the above algorithm type is a red light running statistical algorithm, the algorithm priority of the above task to be executed is a low algorithm priority. After obtaining the above algorithm priority and task priority, the priority of the above task to be executed can be determined according to the higher one of the above algorithm priority and task priority. The above priorities include high-priority tasks to be executed (i.e., first priority tasks), medium-priority tasks to be executed, and low-priority tasks to be executed (i.e., second priority tasks).

[0063] The computing power requirements of each first-priority task can be added together to obtain the above computing power threshold. The current allocatable computing power is compared with the above computing power threshold. If the current allocatable computing power is greater than the computing power threshold, it means that the current allocatable computing power can meet the computing power requirements of all first-priority tasks. At this time, some second-priority tasks can be directly extracted from the second-priority tasks, and the total computing power requirements of some second-priority tasks and all first-priority tasks can be calculated until the total computing power requirement is greater than the current allocatable computing power. The last second-priority task added for calculation is eliminated, and the remaining tasks to be executed that have not been eliminated can be determined as target execution tasks.

[0064] If the current allocatable computing power is less than the computing power threshold, it means that the current allocatable computing power cannot meet the computing power requirements of all first-priority tasks. At this time, some first-priority tasks can be extracted from all tasks to be executed in order of priority, and the total computing power requirements of some first-priority tasks can be calculated. When the total computing power requirement is greater than the current allocatable computing power, the last first-priority task added for calculation will be eliminated, and the remaining first-priority tasks that have not been eliminated can be determined as target execution tasks.

[0065] Optionally, in the step of extracting the target execution task based on the computing power threshold from all tasks to be executed in order of priority, when the currently allocatable computing power is greater than the computing power threshold, the second executable task can be determined from all second priority tasks in order of priority, and the target execution task can be determined based on the first priority task and the second executable task, with the priority of the first priority task being higher than that of the second priority task; when the currently allocatable computing power is less than the computing power threshold, the first executable task can be determined from all first priority tasks in order of priority, and the target execution task can be determined based on the first executable task.

[0066] In the embodiment of the present invention, the priority of the first priority task is higher than that of the second priority task, and the tasks to be executed include the first priority task (i.e., the high priority task to be executed) and the second priority task (i.e., the medium priority or low priority task to be executed). The computing power threshold is set according to the computing power requirements of all high priority tasks to be executed.

[0067] Therefore, when the allocatable computing power is greater than the computing power threshold, it means that all first-priority tasks and some second-priority tasks (i.e., second executable tasks) can be satisfied. At this time, some second-priority tasks can be extracted from the second-priority tasks according to the corresponding algorithm priority and task priority, and some second-priority tasks and all first-priority tasks can be determined as target execution tasks.

[0068] Alternatively, when the allocatable computing power is less than the above computing power threshold, it means that only some of the first priority tasks (i.e., the first executable tasks) can be satisfied. At this time, some of the first priority tasks can be extracted from the first priority tasks according to the corresponding algorithm priority and task priority, and some of the first priority tasks can be determined as target execution tasks.

[0069] It can be understood that, through the above computing power threshold, it is possible to avoid repeated calculation of the computing power requirements of the first priority task when the allocatable computing power is greater than the computing power threshold, thereby improving the efficiency of resource allocation.

[0070] Optionally, in the step of determining the first executable task among all first priority tasks in order of priority, each first priority task can be sorted with task priority as the main priority and algorithm priority as the secondary priority to obtain a first task sorting table; according to the ranking of each first priority task in the first task sorting table, the first priority task whose computing power requirement meets the currently allocable computing power is extracted as the first executable task.

[0071] In an embodiment of the present invention, the priority is determined according to the task priority and the algorithm priority. Specifically, the above-mentioned priority can be determined by the higher one of the task priority and the algorithm priority. For example, when the task priority of the above-mentioned task to be executed is a high task priority and the algorithm priority is a medium algorithm priority, then the priority of the above-mentioned task to be executed is a high priority; or when the task priority is a medium task priority and the algorithm priority is a high algorithm priority, then the priority of the above-mentioned task to be executed is also a high priority.

[0072] When the currently allocatable computing power is less than the computing power threshold, it means that only the computing power requirements of some first-priority tasks can be met. However, since the priorities of the first-priority tasks are the same (that is, they are all high-priority tasks to be executed), the first-priority tasks can be sorted with the task priority as the main priority and the algorithm priority as the secondary priority to obtain a first task sorting table.

[0073] For example, if the first priority tasks include A0, A1 and A2, where A0 is a high task priority and a high algorithm priority, A1 is a high task priority and a medium algorithm priority, and A2 is a medium task priority and a high algorithm priority. In the first task ranking table, A0 ranks higher than A1, and A1 ranks higher than A2.

[0074] It should be noted that, from the above examples, it can be seen that among the algorithm priority or task priority of the first priority task, there must be a high task priority or a high algorithm priority.

[0075] After obtaining the first task ranking table, the first priority task whose computing power requirement meets the currently allocable computing power can be extracted as the first executable task according to the ranking in the first task ranking table. That is, according to the above ranking, the first priority task whose total computing power requirement (i.e., the computing power requirement of all first executable tasks added together) is not greater than the currently allocable computing power is extracted.

[0076] Optionally, in the step of determining the second executable task among all second priority tasks in order of priority, the current remaining allocatable computing power can also be determined based on the computing power requirements of all first priority tasks and the currently allocatable computing power; each second priority task is sorted with the task priority as the main priority and the algorithm priority as the secondary priority to obtain a second task sorting table; according to the ranking of each second priority task in the second task sorting table, the second priority task whose computing power requirement meets the currently remaining allocatable computing power is extracted as the second executable task.

[0077] In an embodiment of the present invention, when the allocatable computing power is greater than the computing power threshold, it means that all first-priority tasks and some second-priority tasks can be satisfied. However, since the priorities of the second-priority tasks are the same (that is, they are all medium-priority tasks to be executed), the task priority can be used as the main priority and the algorithm priority can be used as the secondary priority to sort the second-priority tasks and obtain a second task sorting table.

[0078] For example, if the first priority tasks include A3, A4, A5 and A6, where A3 is a medium task priority and a medium algorithm priority, A4 is a medium task priority and a low algorithm priority, A5 is a low task priority and a medium algorithm priority, and A6 is a low task priority and a low algorithm priority. In the above second task ranking table, A3 ranks higher than A4, A4 ranks higher than A5, and A5 ranks higher than A6.

[0079] It should be noted that, from the above examples, it can be seen that there is no high task priority or high algorithm priority in the algorithm priority or task priority of the second priority task.

[0080] At the same time, the computing power requirements of each first-priority task can be added together to obtain the total computing power requirements corresponding to the first-priority tasks, and the total computing power requirements can be subtracted from the current allocatable computing power to obtain the current remaining allocatable computing power.

[0081] After obtaining the second task ranking table, the second priority tasks whose computing power requirements meet the current remaining allocatable computing power can be extracted as the second executable tasks according to the ranking in the second task ranking table. That is, according to the above ranking, the second priority tasks whose total computing power requirements (i.e., the computing power requirements of all second executable tasks added together) are not greater than the current remaining allocatable computing power are extracted.

[0082] Optionally, in the step of allocating resources for the target execution task based on the currently allocable computing power, the task attributes of each target execution task and the computing power data corresponding to the currently allocable computing power can also be obtained; based on the task attributes and priority, each target execution task is classified and processed to obtain the classification result of the target execution task; based on the classification result and the computing power data, resources are allocated to the target execution task.

[0083] In an embodiment of the present invention, the target execution task may be a video analysis task. When the target execution task is a video analysis task, the corresponding task attributes may include a unique camera identifier and pixel attributes. The computing power data may be the remaining decoding capability of the algorithm container and the decoding parameters that can be supported. The currently allocable computing power may be obtained by adding the remaining decoding capabilities of at least one algorithm container. The camera identifier may be understood as a unique identifier for each camera, the pixel attribute may be the number of pixels, that is, the number of pixels in a frame of image, and the decoding parameter may be understood as the number of pixels that can be decoded.

[0084] In the above target execution tasks, the target execution tasks with the same camera unique identifier are determined, and according to the remaining decoding capacity of the algorithm container in the above computing power data, the target execution tasks with the same camera unique identifier are matched and classified into the corresponding algorithm container. If there are target execution tasks with the same pixel attributes in the above target execution tasks with the same camera unique identifier, the target execution tasks with the same pixel attributes can be placed in the same execution batch and executed at the same time. Alternatively, when there are no target execution tasks with the same camera unique identifier, the pixel attributes of the target execution tasks can be matched and added to the algorithm container of the corresponding decoding parameters.

[0085] For example, in the case of the same device (i.e., camera unique identification), the target execution tasks can share the decoding capability.

[0086] Among them, there is only one algorithm container, and the remaining decoding capacity in the computing power data is 50. The above target execution tasks include task T1 and task T2, where the number of cameras in task T1 is 80 (including 50 cameras in T2), and the number of cameras in task T2 is 50.

[0087] Before optimization (i.e., before using the resource allocation method provided by the embodiment of the present invention)

[0088] The execution time of T1 includes immediate execution, the status of the major task includes running, and the status of the subtask includes 50 running;

[0089] The execution time of T1 includes waiting for execution, and the status of the big task includes waiting for execution, and the status of the subtask includes 30 waiting for execution;

[0090] The execution time of T2 includes immediate execution, the status of the major task includes immediate execution, and the status of the subtask includes >20 items in progress, 20-50;

[0091] The execution time of T2 includes waiting for execution, the status of the major task includes waiting for execution, and the status of the subtask includes <30 waiting for execution, 0-30;

[0092] In an extreme case, 30 different devices are sent out first and only 20 shared decoding devices are left, so there are a total of 60 tasks waiting to be executed.

[0093] After optimization (i.e., after using the resource allocation method provided by the embodiment of the present invention)

[0094] The execution time of T1 includes immediate execution, the status of the major task includes running, and the status of the subtask includes 50 running;

[0095] The execution time of T1 includes waiting for execution, the status of the main task includes waiting for execution, and the status of the subtask includes 30 waiting for execution;

[0096] The execution time of T2 includes immediate execution, the main task status includes running, and the subtask status includes 50 running.

[0097] It should be noted that the above execution time can be the time required for the overall execution of a batch of target execution tasks, the above large task status can be the overall task status of a batch of target execution tasks, and the above subtask status can be the status of each target execution task in a batch of target execution tasks. It can be seen that when there are target execution tasks with the same priority, the same camera unique identifier, and the same pixel attribute, dividing them into the same batch for computing resource calculation can maximize the use of computing power.

[0098] For example, in the case of different devices (ie, different camera unique identifiers), the performance of the same decoding stream (ie, decoding parameters) is better than that of fluctuating decoding streams (ie, decoding parameters).

[0099] The computing power data includes algorithm container 1, which supports 40-way analysis (i.e., remaining decoding capacity) at 2 million pixel attributes (i.e., decoding parameters), and algorithm container 2, which supports 10-way analysis (i.e., remaining decoding capacity) at 8 million pixel attributes (i.e., decoding parameters). It should be noted that the presence of 2 million and 8 million interlaced in the algorithm container (i.e., switching of different decoding parameters) will lead to unstable decoding performance.

[0100] The target execution tasks include Task T1 and Task T2. The number of cameras for Task T1 is 80 (some with 2 million pixels (i.e., pixel attributes) and some with 8 million pixels (i.e., pixel attributes)).

[0101] The number of cameras for task T2 is 50 (some with 2 million pixels (i.e., pixel attributes) and some with 8 million pixels (i.e., pixel attributes))

[0102] Before optimization (i.e., before using the resource allocation method provided by the embodiment of the present invention)

[0103] Algorithm container 1 uses both types of pixels, and the computing power usage is unstable;

[0104] Algorithm container 2 uses both types of pixels, and the computing power usage is unstable;

[0105] After optimization (i.e., after using the resource allocation method provided by the embodiment of the present invention)

[0106] Algorithm container 1 only uses 200W and is stable at 40 channels;

[0107] Algorithm container 2, both pixels are used, <the number of algorithm analysis paths for two pixels alone.

[0108] Optionally, after the step of allocating resources for the target execution task based on the currently allocatable computing power, non-target execution tasks can also be determined based on all tasks to be executed and the target execution tasks; after the target execution task is completed, resources are allocated to the non-target execution tasks based on their priorities.

[0109] In the embodiment of the present invention, after the above-mentioned target execution task is executed, it indicates that the computing power expansion period is over. After the computing power expansion period ends, if the computing power saturation period is entered, the above-mentioned non-target execution task is retained until the computing power idle period is entered, and the above-mentioned non-target execution task is determined as the task to be executed in the above-mentioned computing power idle period. Alternatively, after the computing power expansion period ends, if the computing power idle period is entered, the above-mentioned non-target execution task can be directly determined as the task to be executed in the above-mentioned computing power idle period.

[0110] Specifically, during the above idle computing period, the idle computing power that can be allocated during the idle computing period can be obtained by subtracting the computing power requirements of all tasks to be executed from the corresponding allocate computing power during the idle computing period, and determining whether the allocate idle computing power can meet the computing power requirements of all non-target execution tasks. If it can, all non-target execution tasks are determined as tasks to be executed during the idle computing period. If it cannot be met, the non-target execution tasks whose computing power requirements meet the allocate idle computing power can be extracted according to the priority order of the non-target execution tasks as tasks to be executed during the idle computing period.

[0111] like Figure 3 As shown, the embodiment of the present invention also provides a flow chart of a second resource allocation method, including:

[0112] The first step is to execute the scheduled task;

[0113] The second step is to determine whether there is a period of computing power expansion after the scheduled task execution is started;

[0114] Step 3: If there is no computing power expansion period, the process ends without any processing;

[0115] The fourth step is to group tasks to be executed according to the currently available computing power, the task priority of each large task (i.e., task to be executed), and the algorithm priority, if there is a computing power expansion period. The above relationship map includes the task running time corresponding to each task to be executed, the dependency relationship between the large task status and the subtask status (or can be understood as a corresponding relationship, mapping relationship, etc.);

[0116] And based on the relationship map, total computing power (i.e., the allocatable computing power of the algorithm platform, or understood as the remaining allocatable computing power of all algorithm containers in the resource management platform), task priority, algorithm priority, computing power requirement (i.e., 50 cameras in Task 1, 50 cameras in Task 2, or 50 cameras in Task 3), and execution time, the resource allocation strategy is calculated (i.e., establishing a relationship map for the 50 video analysis tasks in Task 1, and executing them after 13:00 when they are idle).

[0117] For example, the above relationship graph can be specifically described by the following three situations:

[0118] Case 1: When the computing power of the algorithm platform is sufficient (that is, the currently allocable computing power is greater than the computing power required to meet all tasks to be executed), the dependency relationship is: the task running time is executed immediately, the status of all large tasks is running, and all associated subtasks are in the running state.

[0119] For example, the total computing power is 100, the number of cameras for task T1 is 50, and the number of cameras for task T2 is 30.

[0120] The dependencies established are as follows:

[0121] Task execution time Main task status Subtask status

[0122] T1 immediate execution is in progress 50 items are in progress;

[0123] T2 Immediate execution is in progress. 30 items are in progress.

[0124] Case 2: When the computing power of the algorithm platform is insufficient and is only sufficient to meet the needs of high-priority tasks or algorithms (that is, the currently allocatable computing power is greater than the computing power threshold, but cannot meet the computing power requirements of all tasks to be executed), the dependency relationship is: high-priority tasks are executed immediately at runtime, all large tasks are in the running state, and all associated subtasks are in the running state. For medium-priority tasks, depending on whether the number exceeds the threshold, the task runtime has two data, immediate execution and future execution. The task status is all running or partially running, and the associated subtasks are in the running state and partially running state.

[0125] For example, the total computing power is 100, the number of cameras for high-priority task T1 is 50, and the number of cameras for medium-priority task T2 is 80.

[0126] The dependencies established are as follows:

[0127] Task execution time, big task status, subtask status;

[0128] T1 immediate execution is in progress 50 items are in progress;

[0129] T2: Execute immediately, 50 items are in progress;

[0130] T2 Waiting for execution Waiting for execution 30 items waiting for execution.

[0131] Case 3: When the computing power of the algorithm platform is insufficient, and the computing power does not meet the needs of high-priority tasks or algorithm tasks (that is, the currently allocable computing power is less than the computing power threshold), the dependency relationship is that some high-priority algorithm tasks or algorithm task runtimes are executed immediately, and the status of all large tasks is "running", and some associated subtasks are in the running state. The high-priority subtasks that exceed the computing power will remind customers to issue computing power alarms to prevent the loss of important events.

[0132] For example, the total computing power is 100, the number of cameras for high-priority task T1 is 50, and the number of cameras for high-priority task T2 is 80.

[0133] The dependencies established are as follows:

[0134] Task execution time Main task status Subtask status

[0135] T1 immediate execution is in progress 50 items are in progress;

[0136] T2: Execute immediately, 50 items are in progress;

[0137] T2 Waiting for execution Waiting for execution The platform issues an alarm when 30 items are waiting for execution.

[0138] More specifically, the correspondence between the above dependency and the computing power threshold can be obtained as follows: Figure 3 The third resource allocation method shown in FIG. Figure 3 As shown, the first step is to calculate whether the computing power is sufficient (i.e., whether the currently allocable computing power meets the computing power requirements of all tasks to be executed);

[0139] In the second step, if the computing power is sufficient, the task running time of all tasks to be executed is immediately executed, the main task status is running, and the subtask status is all subtask status is running;

[0140] The third step is to check whether the computing power of the high-priority tasks to be executed is sufficient (i.e. whether the currently allocable computing power is greater than the computing power threshold);

[0141] Step 4: If the computing power to meet the high-priority tasks to be executed is sufficient, the execution time of the high-priority tasks is immediate execution, the status of the main task is running, and the status of the subtasks is that all subtasks are running. The execution time of the medium and low-priority tasks is partly immediate execution and partly waiting for execution, the status of the main task is partly running and partly waiting for execution, and the status of the subtasks is partly running and partly waiting for execution;

[0142] In the fifth step, if the computing power of the high-priority tasks to be executed is insufficient, the execution time of all tasks to be executed is immediately, the status of the main task is running, the status of the subtask is running, and an alarm can be sent at the same time.

[0143] like Figure 4 As shown, an embodiment of the present invention further provides a resource allocation device, including:

[0144] The first acquisition module 401 is used to acquire the currently allocable computing power and the tasks to be executed, wherein the tasks to be executed include the corresponding priorities and computing power requirements;

[0145] A first extraction module 402 is used to extract a target execution task from all the tasks to be executed according to the order of priority when the currently allocatable computing power does not meet the computing power requirements of all the tasks to be executed;

[0146] The first allocation module 403 is used to allocate resources for the target execution task based on the current allocatable computing power.

[0147] Optionally, the first extraction module 402 includes:

[0148] A first setting submodule, configured to set a computing power threshold based on the computing power requirements of all the tasks to be executed and the priorities;

[0149] The first extraction submodule is used to extract the target execution task from all the tasks to be executed based on the computing power threshold in the order of the priorities.

[0150] Optionally, the tasks to be executed include a first priority task and a second priority task, the priority of the first priority task is higher than the priority of the second priority task, and the first extraction submodule includes:

[0151] a first determining unit, configured to determine, when the currently allocatable computing power is greater than the computing power threshold, a second executable task from all the second priority tasks in the order of priority, and determine the target execution task based on the first priority task and the second executable task, wherein the priority of the first priority task is higher than that of the second priority task;

[0152] The second determining unit is used to determine a first executable task from all the first-priority tasks in the order of priority when the current allocatable computing power is less than the computing power threshold, and determine the target execution task based on the first executable task.

[0153] Optionally, the priority is determined according to the task priority and the algorithm priority, and the second determining unit includes:

[0154] A first sorting subunit is used to sort each of the first-priority tasks with the task priority as the main priority and the algorithm priority as the secondary priority to obtain a first task sorting table;

[0155] The first extraction subunit is configured to extract, according to the ranking of each first priority task in the first task sorting table, the first priority task whose computing power requirement satisfies the currently allocatable computing power as the first executable task.

[0156] Optionally, the priority is determined according to the task priority and the algorithm priority, and the first determining unit includes:

[0157] A first determining subunit, configured to determine a current remaining allocatable computing power based on the computing power requirements of all the first-priority tasks and the currently allocatable computing power;

[0158] A second sorting subunit is used to sort each second-priority task with the task priority as the main priority and the algorithm priority as the secondary priority to obtain a second task sorting table;

[0159] The second extraction subunit is used to extract the second priority tasks whose computing power requirements meet the currently remaining allocatable computing power as the second executable tasks according to the ranking of each second priority task in the second task sorting table.

[0160] Optionally, the first allocation module 403 includes:

[0161] A first acquisition submodule is used to acquire the task attributes of each target execution task and the computing power data corresponding to the currently allocable computing power;

[0162] A first classification submodule is used to classify each of the target execution tasks based on the task attributes and the priority to obtain a classification result of the target execution task;

[0163] The first allocation submodule is used to allocate resources for the target execution task based on the classification result and the computing power data.

[0164] Optionally, the resource allocation device further includes:

[0165] A first determining module, configured to determine a non-target execution task based on all the tasks to be executed and the target execution task;

[0166] The second allocation module is used to allocate resources to the non-target execution task based on the priority of the non-target execution task after the target execution task is completed.

[0167] like Figure 5 As shown, an embodiment of the present invention further provides an electronic device, characterized in that it includes a processor, and the processor can execute any one of the above resource allocation methods.

[0168] Specifically, it includes a processor 501 and a memory 502, and a computer program for executing the resource allocation method which is stored in the memory 502 and can be run on the processor 501, wherein:

[0169] The processor 501 runs the computer program of the resource allocation method stored in the memory 502 to perform the following steps:

[0170] Obtaining currently allocable computing power and pending tasks, wherein the pending tasks include corresponding priorities and computing power requirements;

[0171] When the currently allocable computing power does not meet the computing power requirements of all tasks to be executed, extracting a target execution task from all the tasks to be executed in the order of priority;

[0172] Based on the currently allocatable computing power, resources are allocated for the target execution task.

[0173] Optionally, the extracting of the target execution task from all the tasks to be executed in the order of the priorities performed by the processor 501 includes:

[0174] Based on the computing power requirements of all the tasks to be executed and the priorities, a computing power threshold is set;

[0175] In the order of the priorities, a target execution task is extracted from all the tasks to be executed based on the computing power threshold.

[0176] Optionally, the tasks to be executed include a first priority task and a second priority task, the priority of the first priority task is higher than the priority of the second priority task, and the processor 501 executes the steps of extracting a target execution task from all the tasks to be executed based on the computing power threshold in the order of the priorities, including:

[0177] When the currently allocable computing power is greater than the computing power threshold, determining a second executable task from all the second priority tasks in the order of priority, and determining the target execution task based on the first priority task and the second executable task, wherein the priority of the first priority task is higher than that of the second priority task;

[0178] When the currently allocatable computing power is less than the computing power threshold, a first executable task is determined from all the first-priority tasks in the order of priority, and the target execution task is determined based on the first executable task.

[0179] Optionally, the priority is determined according to the task priority and the algorithm priority, and the processor 501 performs the step of determining the first executable task from all the first priority tasks in the order of the priorities, including:

[0180] Taking the task priority as the main priority and the algorithm priority as the secondary priority, sorting each of the first priority tasks to obtain a first task sorting table;

[0181] According to the ranking of each first-priority task in the first task sorting table, the first-priority task whose computing power requirement meets the currently allocatable computing power is extracted as the first executable task.

[0182] Optionally, the priority is determined according to the task priority and the algorithm priority, and the processor 501 performs the step of determining the second executable task from all the second priority tasks in the order of the priorities, including:

[0183] Determine the current remaining allocatable computing power based on the computing power requirements of all the first-priority tasks and the currently allocatable computing power;

[0184] Taking the task priority as the main priority and the algorithm priority as the secondary priority, sorting each of the second priority tasks to obtain a second task sorting table;

[0185] According to the ranking of each second-priority task in the second task sorting table, the second-priority task whose computing power requirement satisfies the currently remaining allocatable computing power is extracted as the second executable task.

[0186] Optionally, the allocating resources for the target execution task based on the currently allocable computing power performed by the processor 501 includes:

[0187] Obtaining the task attributes of each of the target execution tasks and the computing power data corresponding to the currently allocable computing power;

[0188] Based on the task attributes and the priority, classify each of the target execution tasks to obtain a classification result of the target execution task;

[0189] Based on the classification result and the computing power data, resources are allocated for the target execution task.

[0190] Optionally, after allocating resources for the target execution task based on the currently allocable computing power, the method executed by the processor 501 further includes:

[0191] Determine a non-target execution task based on all the tasks to be executed and the target execution task;

[0192] After the target execution task is completed, resources are allocated to the non-target execution task based on the priority of the non-target execution task.

[0193] An embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the computer program implements the various processes of the resource allocation method or the application-side resource allocation method provided in the embodiment of the present invention, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0194] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the above-mentioned computer program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the above-mentioned computer-readable storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.

[0195] The above disclosure is only the preferred embodiment of the present invention, which certainly cannot be used to limit the scope of the present invention. Therefore, equivalent changes made according to the claims of the present invention are still within the scope of the present invention.

Claims

1. A resource allocation method, characterized in that: The method comprises the following steps: Obtaining currently allocable computing power and pending tasks, wherein the pending tasks include corresponding priorities and computing power requirements; When the currently allocable computing power does not meet the computing power requirements of all tasks to be executed, extracting a target execution task from all the tasks to be executed in the order of priority; Based on the currently allocatable computing power, resources are allocated for the target execution task.

2. The resource allocation method according to claim 1, characterized in that: The step of extracting a target execution task from all the tasks to be executed in the order of the priorities includes: Based on the computing power requirements of all the tasks to be executed and the priorities, a computing power threshold is set; In the order of the priorities, a target execution task is extracted from all the tasks to be executed based on the computing power threshold.

3. The resource allocation method according to claim 2, characterized in that: The tasks to be executed include a first priority task and a second priority task, the priority of the first priority task is higher than the priority of the second priority task, and the target execution task is extracted from all the tasks to be executed based on the computing power threshold in the order of the priorities, including: When the currently allocable computing power is greater than the computing power threshold, determining a second executable task from all the second priority tasks in the order of priority, and determining the target execution task based on the first priority task and the second executable task, wherein the priority of the first priority task is higher than that of the second priority task; When the currently allocatable computing power is less than the computing power threshold, a first executable task is determined from all the first-priority tasks in the order of priority, and the target execution task is determined based on the first executable task.

4. The resource allocation method according to claim 3, characterized in that: The priority is determined according to the task priority and the algorithm priority, and the first executable task is determined from all the first priority tasks in the order of the priorities, including: Taking the task priority as the main priority and the algorithm priority as the secondary priority, sorting each of the first priority tasks to obtain a first task sorting table; According to the ranking of each first-priority task in the first task sorting table, the first-priority task whose computing power requirement meets the currently allocatable computing power is extracted as the first executable task.

5. The resource allocation method according to claim 3, characterized in that: The priority is determined according to the task priority and the algorithm priority, and the second executable task is determined from all the second priority tasks in the order of the priorities, including: Determine the current remaining allocatable computing power based on the computing power requirements of all the first-priority tasks and the currently allocatable computing power; Taking the task priority as the main priority and the algorithm priority as the secondary priority, sorting each of the second priority tasks to obtain a second task sorting table; According to the ranking of each second-priority task in the second task sorting table, the second-priority task whose computing power requirement satisfies the currently remaining allocatable computing power is extracted as the second executable task.

6. The resource allocation method according to claim 1, characterized in that: The allocating resources for the target execution task based on the currently allocable computing power includes: Obtaining the task attributes of each of the target execution tasks and the computing power data corresponding to the currently allocable computing power; Based on the task attributes and the priority, classify each of the target execution tasks to obtain a classification result of the target execution task; Based on the classification result and the computing power data, resources are allocated for the target execution task.

7. The resource allocation method according to claim 1, characterized in that: After allocating resources for the target execution task based on the currently allocable computing power, the method further includes: Determine a non-target execution task based on all the tasks to be executed and the target execution task; After the target execution task is completed, resources are allocated to the non-target execution task based on the priority of the non-target execution task.

8. A resource allocation device, characterized in that: The resource allocation device comprises: A first acquisition module is used to acquire currently allocable computing power and pending tasks, wherein the pending tasks include corresponding priorities and computing power requirements; A first extraction module is used to extract a target execution task from all the tasks to be executed according to the order of priority when the currently allocatable computing power does not meet the computing power requirements of all the tasks to be executed; The first allocation module is used to allocate resources for the target execution task based on the current allocatable computing power.

9. An electronic device, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps in the resource allocation method according to any one of claims 1 to 7 when executing the computer program.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in the resource allocation method according to any one of claims 1 to 7 are implemented.