Detailed Description
Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
Example 1
The scheme provided by the embodiment of the application can be applied to any system with audio and video computing power dynamic adjustment capability, such as a processing system with audio and video processing capability and the like. Fig. 1 is a schematic diagram of an application scenario of an audio/video computing power dynamic adjustment scheme provided in an embodiment of the present application, and the scenario shown in fig. 1 is only one example of the principles of the technical scheme of the present application.
With the development of video acquisition technology, monitoring means based on the video acquisition technology have been widely used. Particularly, with the improvement of video acquisition capability, a video or an image with high resolution can be acquired at a video acquisition terminal to perform more various and complex processing on a video processing server, and particularly, as the high-resolution video or the image acquired at the video acquisition terminal can have more details and retain more original information, more complex processing algorithms can be performed at the video processing terminal based on the high-resolution video or the image to better meet various demands of users. Particularly for high resolution video or images containing large amounts of information, users want to be able to apply more algorithms with different targeted uses to perform collaborative processing, but such complex processing often involves multiple computational demands that also put higher demands on the computational power at the video processing end. However, the video processing schemes in the prior art can only support a single algorithm to perform processing, and thus cannot meet the requirement of users for complex processing results of multiple algorithms.
For example, a scene of a real-time video stream acquired by the video acquisition device 1 is shown in a scene as shown in fig. 1. As shown in fig. 1, the video capture device 1 may be a multi-path video capture device, for example, it may be a video capture device to which 3 cameras are connected, and 3 video streams captured in real time by the 3 cameras may be decoded by a GPU (graphics processing unit) of the video capture device 1 to generate image frames, so that image recognition processing such as face recognition may be performed by using the computing resources shown in fig. 1.
In the prior art, due to the improvement of the video capturing capability, the video capturing apparatus 1 outputs a large number of image frames per second for processing using the computing resources. The number of image frames thus output by the video capture device 1 in a unit time per second, for example, is also referred to as the frame rate, and the higher the frame rate, the more corresponding computing resources are required. Accordingly, in the prior art, a corresponding computing resource allocation scheme is generally set in advance according to a computing task to be processed, such as an identification task for processing a video frame image or a video frame decoding or encoding task, and then processing is performed with such a fixed computing resource allocation scheme. However, in the actual task processing process, not only the task type may change, but also the complexity of the task itself may also change at any time, so in the prior art, computing resources are pre-allocated according to the type of computing task, and in the actual execution of the computing task, the task can only be executed by the computing resources pre-allocated in this way, so that the task cannot be executed when the type or the complexity of the computing task is changed. For example, a video frame processed by an identification task that processes an image of a surveillance video frame typically requires more computing resources during the day because of the more information contained in the image, but less computing resources are required because of the less information contained in the image during the night because of the rarity of people. In this case, if the computing resources required for ensuring the daytime processing are considered when the computing resources are configured in advance for such computing tasks, more computing resources are likely to be left idle at night processing, whereas if only the computing resources required for ensuring the night processing are considered, the pre-allocated computing resources face a problem of insufficient processing capacity at the time of processing the image frames of the daytime.
For this reason, the embodiment of the present application proposes a dynamic adjustment scheme for computing power, where, for example, in the video frame processing scenario shown in fig. 1, a portion of computing resources is divided into a plurality of resource pools in advance, and each resource pool may include the same number of computing resources, so as to have a preset computing power. In particular, in the embodiment of the present application, unlike the prior art, the plurality of resource pools divided from a portion of the computing resources in the embodiment of the present application may be a resource pool of minimum computational effort created according to a predetermined task, for example, in the computing scenario shown in fig. 1 where video frame images are processed, the resource pool may be created with the computational effort required to process night images as the minimum computational effort, or the resource pool may also be created with the lowest consumption computational effort in the historical computational effort statistics of processing video frames as the minimum computational effort, or the resource pool may be created with the computational effort required to process the default frame rate of a preset algorithm of video frame images as the minimum computational effort. In particular, in the embodiment of the present application, the creation manner of the resource pool is not limited thereto, but the resource pool may be created with various suitable calculation force criteria as the minimum calculation force according to the actual use requirements.
After creating a plurality of resource pools with a preset computing power, it is possible to start receiving computing tasks and to assign the received tasks to the created resource pools in a preset order to perform processing. For example, in the scenario shown in fig. 1, after decoding the received 3-way video stream using the GPU, the video capture device 1 generates a plurality of image frames that can be processed as a plurality of computing tasks in the embodiments of the present application assigned to a pre-created resource pool. For example, in the computing scenario shown in fig. 1, the GPU of the video capture device 1 generates 3 computing tasks from the decoded image frames and sequentially allocates to resource pools 1-3 of computing resources for processing. For example, among the 3 computing tasks shown in fig. 1, 5 objects are included in the image frame related to the first computing task, 10 objects are included in the image frame related to the second computing task, and 1 object is included in the image frame related to the third computing task, so that, after the 3 computing tasks are allocated to the resource pools 1 to 3, the execution states of the three resource pools can be acquired, and thus the pressure of the resource pools 1 to 3 to execute the computing tasks allocated thereto can be known from the acquired execution states, for example, the frame rate of the computing task corresponding to the computing power processing of each resource pool, that is, the number of frames processed per second can be known. For example, in the case of the computing tasks described above, resource pool 1 can process 50 frames per second in the first computing task, resource pool 2 can process only 10 frames per second in the second computing task, and resource pool 3 can process 100 frames per second in the third computing task. Thus, it can be determined that the computational power of the resource pool 2 is insufficient to handle the computational tasks assigned thereto. In this case, a part of the remaining computing resources, i.e. those resources not yet divided into resource pools, may be further divided into a part and allocated to the resource pool 2, so as to increase the computing power of the resource pool 2, for example, so that it is capable of processing 50 frames in the second computing task per second, thus only a part of the computing power needs to be increased for the resource pool 2 to realize the computing task of the video capture device 1, without also increasing the computing power of the resource pools 1 and 3 simultaneously, so that compared with the prior art that the computing power of the increased resource pool 2 is used to execute the first and third computing tasks in order to ensure the smooth implementation of the second computing task, especially in the case that the current computing resources are limited and the computing tasks are complex and variable, the embodiment of the present application realizes the effect that the execution efficiency of the computing task is ensured as much as possible with the limited resources, and also can timely adjust the resources by monitoring the execution states of the respective computing tasks in the respective resource pools, which also realizes the effective utilization of the resources.
Therefore, according to the audio and video computing power dynamic adjustment scheme, different processing tasks are respectively processed by using a plurality of resource pools which are created in advance according to computing resources, the resource pools with insufficient computing power are determined according to the execution state of the processing tasks executed by the resource pools which are allocated with the processing tasks, so that the residual resources of the current computing resources are allocated to the resource pools with insufficient computing power to improve the computing power of the resource pools, therefore, fewer computing resources can be allocated to each processing task first, and when the computing power of the allocated computing resources is insufficient to execute the tasks, the reserved computing resources are timely used to increase the computing power of the resource pools with insufficient computing power, so that the initial basic resource allocation of the limited computing resources to the computing tasks is realized, and the execution state is monitored to carry out resource adjustment, thereby ensuring the execution efficiency of the computing tasks and the effective utilization of the computing resources.
The foregoing embodiments are illustrative of the technical principles and exemplary application frameworks of the embodiments of the present application, and the detailed description of specific technical solutions of the embodiments of the present application will be further described below by means of a plurality of embodiments.
Example two
Fig. 2 is a flowchart of an embodiment of an audio/video computing power dynamic adjustment method provided in the present application, where the execution subject of the method may be various terminals or server devices with audio/video processing capabilities, or may be devices or chips integrated on these devices. As shown in fig. 2, the audio/video computing power dynamic adjustment method comprises the following steps:
S201, a plurality of resource pools are created according to a first part of the current computing resources.
In the embodiment of the present application, a plurality of resource pools may be created according to a part of the computing resources in step S201. For example, in the scenario shown in fig. 1, the current computing resource may include 100 CPUs, 100 GPUs, and 500G memory spaces, and 80 CPUs, 80 GPUs, and 400G memory spaces thereof may be used to create 10 resource pools, where each resource pool has, for example, 8 CPUs, 8 GPUs, and 40G memory spaces as preset computing power, and the remaining 20 CPUs, 20 GPUs, and 100G memory spaces may be used as spare computing resources.
S202, receiving a plurality of processing tasks and respectively distributing the received processing tasks to different resource pools in a plurality of resource pools according to a preset sequence for execution.
After the resource pool is created instep 201, processing tasks may be received in step S202. For example, in a scene as shown in fig. 1, the video capture device 1 may capture real-time video by its 3-way cameras, and the 3-way video streams captured by the 3-way cameras in real-time may be decoded by a GPU (graphics processing unit) of the video capture device 1 to generate image frames, so that a plurality of image frames thus generated may be received as a plurality of calculation tasks to be allocated to a resource pool created in advance for processing in step S202. For example, in the computing scenario shown in fig. 1, the GPU of the video capture device 1 generates 3 computing tasks from the decoded image frames and sequentially allocates to resource pools 1-3 of computing resources for processing.
S203, the execution state of the resource pool allocated with the processing task is acquired.
After the processing task is allocated to the resource pool created in step S201 in step S202, since the resource pool created in step S201 is generally the resource pool of the minimum computing power created according to the predetermined task, for example, in the computing scene of processing the video frame image shown in fig. 1, the resource pool may be created with the computing power required for processing the night image as the minimum computing power, or the resource pool may also be created with the lowest consumption computing power in the historical computing power statistics of processing the video frame as the minimum computing power, or the resource pool may be created with the computing power required for processing the default frame rate of the preset algorithm of the video frame image as the minimum computing power. Thus, there is a likelihood that such a pre-created resource pool may not have a computational power that matches the assigned computational task.
For example, among the 3 computing tasks shown in fig. 1, 5 objects are included in the image frame related to the first computing task, 10 objects are included in the image frame related to the second computing task, and 1 object is included in the image frame related to the third computing task, so that after the 3 computing tasks are allocated to the resource pools 1 to 3, the execution states of the three resource pools can be acquired in step S203 so as to determine whether the allocated computing tasks are matched according to the execution states.
S204, determining a resource pool which is insufficient in computing power for executing the allocated processing task in the plurality of resource pools as a first resource pool according to the execution state of the resource pool.
In the embodiment of the present application, after the execution state of each resource pool to execute the processing task is acquired in step S203, the pressure of the resource pool 1-3 to execute the processing task allocated thereto may be known in step S204 according to the execution state acquired in step S203, for example, the frame rate of the computing task corresponding to the computing power processing of each resource pool, that is, the number of frames processed per second may be known.
For example, in the case of the computing tasks described above, resource pool 1 can process 50 frames per second in the first computing task, resource pool 2 can process only 10 frames per second in the second computing task, and resource pool 3 can process 100 frames per second in the third computing task. Thus, it may be determined at step S204 that the computational power of resource pool 2 is insufficient to process the computational tasks assigned thereto. In addition, in the embodiment of the present application, it may also be determined in step S204 that the computing power of the resource pool 3 is excessive in performing the third computing task allocated thereto.
S205, allocating at least a portion of the second portion of the current computing resources to the first resource pool.
After it is determined in step S204 that a certain resource pool is insufficient to perform the processing task allocated thereto, that is, it is determined which resource pools are the first resource pools from among the resource pools allocated in step S202. For example, in the scenario shown in fig. 1, it may be determined in step S204 that resource pool 2 is the first resource pool. Therefore, in this case, a part of the computing resources remaining in the computing resources, that is, the second part that is not divided into the resource pools, may be further divided into a part to be allocated to the resource pool 2 in step S205, so as to increase the computing power of the resource pool 2, for example, so that it is capable of processing 50 frames in the second computing task per second, so that only a part of the computing power needs to be increased for the resource pool 2 to realize the computing task that is qualified for the video capture device 1, without also increasing the computing power of the resource pools 1 and 3 at the same time, so that compared with the prior art that the first and third computing tasks are performed by using, for example, the computing power of the increased resource pool 2 in order to ensure the smooth implementation of the second computing task, the computing resources are greatly saved, especially in the case that the current computing resources are limited and the computing tasks are complex and variable, the embodiment of the present application realizes the effect that the execution efficiency of the computing tasks is ensured as much as possible with the limited resources, and the resource adjustment is also capable of timely implementing the resource adjustment by monitoring the execution states of the respective computing tasks in each resource pool.
Therefore, according to the audio and video computing power dynamic adjustment method, different processing tasks are respectively processed through the plurality of resource pools which are created in advance according to the computing resources, the resource pools with insufficient computing power are determined according to the execution states of the processing tasks executed by the resource pools which are allocated with the processing tasks, so that the residual resources of the current computing resources are allocated to the resource pools with insufficient computing power to improve the computing power of the resource pools, therefore, fewer computing resources can be allocated to each processing task first, and when the computing power of the allocated computing resources is insufficient to execute the tasks, the reserved computing resources are timely used to increase the computing power of the resource pools with insufficient computing power, so that initial basic resource allocation of the limited computing resources to the plurality of computing tasks is realized, and resource adjustment is performed by monitoring the execution states, and the execution efficiency of the computing tasks and the effective utilization of the computing resources are ensured.
Example III
Fig. 3 is a flowchart of another embodiment of an audio/video computing power dynamic adjustment method provided in the present application, where the execution subject of the method may be various terminals or server devices with audio/video processing capabilities, or may be devices or chips integrated on these devices. As shown in fig. 3, the audio-video computing power dynamic adjustment method comprises the following steps:
S301, acquiring the type of the processing task.
In the embodiment of the present application, the type of task to be processed according to the audio/video computing power adjustment method of the present application may be acquired in step S301. For example, in the example shown in fig. 1, it may be determined that a task to be processed is a video processing task according to the video capture apparatus 1, or that a task to be processed is a video processing task according to device information transmitted by the video capture apparatus 1.
S302, a plurality of resource pools are created according to a first part of the current computing resources.
In the embodiment of the present application, a plurality of resource pools may be created according to a part of the computing resources in step S302, and each resource pool may have a preset computing power. For example, in the scenario shown in fig. 1, the current computing resource may include 100 CPUs, 100 GPUs, and 500G memory spaces, and 80 CPUs, 80 GPUs, and 400G memory spaces thereof may be used to create 10 resource pools, where each resource pool has, for example, 8 CPUs, 8 GPUs, and 40G memory spaces as preset computing power, and the remaining 20 CPUs, 20 GPUs, and 100G memory spaces may be used as spare computing resources. Furthermore, in the embodiment of the present application, the preset calculation force may be determined according to the type of the processing task. For example, in the scene shown in fig. 1, it may be determined that a task to be processed is a video processing task according to the video capture apparatus 1 or a video frame it decodes output, thereby setting the computational power of the resource pool to 8 CPUs, 8 GPUs, and 40G.
S303, receiving a plurality of processing tasks and respectively distributing the received processing tasks to different resource pools in a plurality of resource pools according to a preset sequence for execution.
After the resource pool is created instep 302, processing tasks may be received in step S303. For example, in a scene as shown in fig. 1, the video capture device 1 may capture real-time video by its 3-way cameras, and the 3-way video streams captured by the 3-way cameras in real-time may be decoded by a GPU (graphics processing unit) of the video capture device 1 to generate image frames, so that a plurality of image frames thus generated may be received as a plurality of calculation tasks to be allocated to a resource pool created in advance for processing in step S303. For example, in the computing scenario shown in fig. 1, the GPU of the video capture device 1 generates 3 computing tasks from the decoded image frames and sequentially allocates to resource pools 1-3 of computing resources for processing.
S304, the execution state of the resource pool allocated with the processing task is obtained.
After the processing task is assigned to the resource pool created in step S302 in step S303, since the resource pool created in step S302 is the resource pool of the minimum computing power created according to the task type determined in step S301, for example, in the computing scenario of processing video frame images shown in fig. 1, the resource pool may be created with the computing power required for processing night images as the minimum computing power, or the resource pool may also be created with the lowest consumption computing power in the historical computing power statistics of processing video frames as the minimum computing power, or the resource pool may be created with the computing power required for processing the default frame rate of the preset algorithm of video frame images as the minimum computing power. Thus, there is a likelihood that such a pre-created resource pool may not have a computational power that matches the assigned computational task.
For example, among the 3 computing tasks shown in fig. 1, 5 objects are included in the image frame related to the first computing task, 10 objects are included in the image frame related to the second computing task, and 1 object is included in the image frame related to the third computing task, so that after the 3 computing tasks are allocated to the resource pools 1 to 3, the execution states of the three resource pools may be acquired in step S304 so as to determine whether the allocated computing tasks are matched according to the execution states. Specifically, in the embodiment of the present application, the execution state acquired in step S304 may include at least: number of processes, time to perform processing tasks, computational resources occupied, and real-time processing frame rate
S305, determining a resource pool which is insufficient in computing power for executing the allocated processing task in a plurality of resource pools as a first resource pool according to the execution state of the resource pool.
In the embodiment of the present application, after the execution state of each resource pool to execute the processing task is acquired in step S304, the pressure of executing the processing task allocated to the resource pool 1-3 may be known in step S305 according to the execution state acquired in step S304, for example, the frame rate of the computing task corresponding to the computing power processing of each resource pool, that is, the number of frames processed per second may be known. Knowing the pressure of each resource pool to execute the processing task, it can further determine which resource pools are first resource pools with insufficient computing power according to the comparison result of the execution state and the preset threshold value. For example, when at least one of the execution states of the resource pool exceeds a second preset threshold, it may be determined that the computational power of the resource pool is insufficient to execute the allocated processing task.
For example, in the case of the above-described calculation tasks, the processing frame rate of the resource pool is obtained as the execution state in step S304, for example, resource pool 1 can process 50 frames per second in the first calculation task, resource pool 2 can process only 10 frames per second in the second calculation task, and resource pool 3 can process 100 frames per second in the third calculation task. Accordingly, it may be determined in step S305 that the computational power of the resource pool 2 is insufficient to process the computational task allocated thereto, i.e., the resource pool 2 is determined as the first resource pool, based on the processing frame rate of the resource pool and a preset threshold, e.g., 40 frames per second.
In addition, in the embodiment of the present application, it may also be determined in step S305 that the computing power of the resource pool 3 is excessive in performing the third computing task allocated thereto according to the comparison result that the processing frame rate of the resource pool 3 exceeds the 80 frame threshold, and further, the computing power of the other unallocated resource pools may be adjusted.
S306, at least one part of the second part of the current computing resources is allocated to the first resource pool.
After it is determined in step S305 that a certain resource pool is insufficient to perform the processing task allocated thereto, that is, it is determined which resource pools are the first resource pools from among the resource pools allocated in step S303. For example, in the scenario shown in fig. 1, it may be determined in step S305 that resource pool 2 is the first resource pool. In this case, therefore, a portion may be further divided from the second portion remaining in the computing resources, i.e., not yet divided into resource pools, to be allocated to the resource pool 2 in step S306 to increase the computational power of the resource pool 2. In the embodiment of the present application, the ratio of the amount of computing resources of the remaining second portion to the amount of computing resources of the current computing resources used in step S302 is not less than the first preset threshold. For example, the first preset threshold may be set to 20%, and of course, in the embodiment of the present application, the first preset threshold may also be set to other ratios according to the actual requirements of use.
For example, a part of the second portion may be divided into the resource pool 2, so that the computing power of the resource pool 2 is improved to be capable of processing 50 frames in the second computing task per second, so that the computing task of the video capture device 1 can be realized by only adding a part of computing power to the resource pool 2, without increasing the computing power of the resource pools 1 and 3 at the same time, so that compared with the prior art that the first computing task and the third computing task are executed by using the computing power of the resource pool 2 after being increased for ensuring the smooth implementation of the second computing task, the computing resource is greatly saved, especially in the case that the current computing resource is limited and the computing task is complex and changeable, the embodiment of the present application achieves the effect of ensuring the execution efficiency of the computing task with the limited resource as much as possible, and also can timely perform resource adjustment by monitoring the execution state of each computing task in each resource pool, which also achieves the effective utilization of the resource.
S307, when the first resource pool does not exist in the preset time period according to the execution state of the resource pool, or when the ratio of the calculated resource quantity of the second part to the calculated resource quantity of the current calculated resource in the preset time period is larger than a third preset threshold value, the preset calculation power of the resource pool is reduced.
Further, if the first resource pool is not obtained in step S305, that is, it is determined that the calculation power of each resource pool is sufficient to perform the respective processing task according to the execution state of the processing task performed by the resource pool, it is explained that the calculation resources of the currently allocated resource pool can match the demands of the processing task, the determination operation of step S305 may be continuously performed for a predetermined period of time, and if it is determined that the first resource pool has not occurred for a period of time, the preset calculation power determined in step S301 may be reduced in step S307, and/or the calculation power with the resource pool to which the processing task has not been allocated may be reduced.
Furthermore, when the ratio of the remaining undivided second portion to the current computing resources used in step S302 is greater than the third preset threshold, i.e., there is not much need to divide the resource pools that require additional division of the increased computing power within the predetermined period of time, this also means that the preset computing power determined in step S302 for each resource pool may be large, and thus the preset computing power determined in step S301 may be similarly reduced, and/or the computing power thereof to the resource pool to which the processing task has not been allocated may be reduced.
Therefore, according to the audio and video computing power dynamic adjustment method, different processing tasks are respectively processed through the plurality of resource pools which are created in advance according to the computing resources, the resource pools with insufficient computing power are determined according to the execution states of the processing tasks executed by the resource pools which are allocated with the processing tasks, so that the residual resources of the current computing resources are allocated to the resource pools with insufficient computing power to improve the computing power of the resource pools, therefore, fewer computing resources can be allocated to each processing task first, and when the computing power of the allocated computing resources is insufficient to execute the tasks, the reserved computing resources are timely used to increase the computing power of the resource pools with insufficient computing power, so that initial basic resource allocation of the limited computing resources to the plurality of computing tasks is realized, and resource adjustment is performed by monitoring the execution states, and the execution efficiency of the computing tasks and the effective utilization of the computing resources are ensured.
Example IV
Fig. 4 is a schematic structural diagram of an embodiment of an audio/video computing power dynamic adjustment device provided in the present application, which may be used to perform the method steps shown in fig. 2 and 3. As shown in fig. 4, the audio-video computing power dynamic adjusting device may include: acreation module 41, afirst allocation module 42, anacquisition module 43, adetermination module 44 and asecond allocation module 45.
Thecreation module 41 may be configured to create a plurality of resource pools from a first portion of the current computing resources.
In an embodiment of the present application, thecreation module 41 may create a plurality of resource pools according to a portion of the computing resources, and each resource pool may have a preset computing power. For example, in the scenario shown in fig. 1, the current computing resource may include 100 CPUs, 100 GPUs, and 500G memory spaces, and 80 CPUs, 80 GPUs, and 400G memory spaces thereof may be used to create 10 resource pools, where each resource pool has, for example, 8 CPUs, 8 GPUs, and 40G memory spaces as preset computing power, and the remaining 20 CPUs, 20 GPUs, and 100G memory spaces may be used as spare computing resources. Furthermore, in the embodiment of the present application, the preset calculation force may be determined according to the type of the processing task. In the embodiment of the application, the type of the task to be processed according to the audio/video computing power adjusting method of the application can be acquired first. For example, in the example shown in fig. 1, it may be determined that a task to be processed is a video processing task according to the video capture apparatus 1, or that a task to be processed is a video processing task according to device information transmitted by the video capture apparatus 1. Thereafter, thecreation module 41 may determine that the task to be processed is a video processing task from the video capture apparatus 1 or the video frame it decodes output, thereby setting the computational power of the resource pool to 8 CPUs, 8 GPUs, and 40G.
Thefirst allocation module 42 may be configured to receive the plurality of processing tasks and allocate the received plurality of processing tasks to different resource pools of the plurality of resource pools in a predetermined order for execution.
After thecreation module 41 creates the resource pool, thefirst allocation module 42 may receive processing tasks. For example, in a scene as shown in fig. 1, the video capture device 1 may capture real-time video by its 3-way cameras, and the 3-way video streams captured by the 3-way cameras in real-time may be decoded by a GPU (graphics processing unit) of the video capture device 1 to generate image frames, so that the thus generated plurality of image frames may be received by thefirst allocation module 42 as a plurality of calculation tasks to be allocated to a pre-created resource pool for processing. For example, in the computing scenario shown in fig. 1, the GPU of the video capture device 1 generates 3 computing tasks from the decoded image frames and is sequentially allocated to resource pools 1-3 of computing resources for processing by thefirst allocation module 42.
Theacquisition module 43 may be configured to acquire an execution state of a resource pool to which a processing task has been allocated.
After thefirst allocation module 42 allocates the processing task to the resource pool created by thecreation module 41, since the resource pool created by thecreation module 41 is the resource pool of the minimum computing power created according to the task type, for example, in the computing scene of processing the video frame image shown in fig. 1, the resource pool may be created with the computing power required for processing the night image as the minimum computing power, or the resource pool may also be created with the lowest consumed computing power in the historical computing power statistics of processing the video frame as the minimum computing power, or the resource pool may be created with the computing power required for processing the default frame rate of the preset algorithm of the video frame image as the minimum computing power. Thus, there is a likelihood that such a pre-created resource pool may not have a computational power that matches the assigned computational task.
For example, among the 3 computing tasks shown in fig. 1, 5 objects are included in the image frame related to the first computing task, 10 objects are included in the image frame related to the second computing task, and 1 object is included in the image frame related to the third computing task, so that after the 3 computing tasks are allocated to the resource pools 1 to 3, the obtainingmodule 43 may obtain the execution states of the three resource pools so as to determine whether to match the allocated computing tasks according to the execution states. Specifically, in the embodiment of the present application, the execution state acquired by the acquiringmodule 43 may at least include: number of processes, time to perform processing tasks, computational resources occupied, and real-time processing frame rate
The determiningmodule 44 may be configured to determine, as the first resource pool, a resource pool of the plurality of resource pools that is computationally insufficient to perform the allocated processing task based on an execution state of the resource pool.
In the embodiment of the present application, after the acquiringmodule 43 acquires the execution state of each resource pool for executing the processing task, the determiningmodule 44 may learn the pressure of the resource pools 1-3 for executing the processing task allocated thereto according to the execution state acquired by the acquiringmodule 43, for example, may learn the frame rate of the computing task corresponding to the computing power processing of each resource pool, that is, the number of frames processed per second. Knowing the pressure of each resource pool to execute the processing task, it can further determine which resource pools are first resource pools with insufficient computing power according to the comparison result of the execution state and the preset threshold value. For example, when at least one of the execution states of the resource pool exceeds a second preset threshold, it may be determined that the computational power of the resource pool is insufficient to execute the allocated processing task.
For example, in the case of the above-described calculation tasks, the processing frame rate of the resource pool is obtained as the execution state at theacquisition module 43, for example, the resource pool 1 can process 50 frames per second in the first calculation task, the resource pool 2 can process only 10 frames per second in the second calculation task, and the resource pool 3 can process 100 frames per second in the third calculation task. Thus, thedetermination module 44 may determine that the computational power of the resource pool 2 is insufficient to process the computational tasks allocated thereto, i.e., determine the resource pool 2 as the first resource pool, based on the processing frame rate of the resource pool and a preset threshold, e.g., 40 frames per second.
In addition, in the embodiment of the present application, the determiningmodule 44 may also determine, according to the comparison result that the processing frame rate of the resource pool 3 exceeds the 80 frame threshold, that the computing power of the resource pool 3 is excessive in performing the third computing task allocated thereto, and may further adjust the computing power of other unallocated resource pools.
Thesecond allocation module 45 may be configured to allocate at least a portion of the second portion of the current computing resources to the first pool of resources.
After thedetermination module 44 determines that a certain resource pool is insufficient to perform the processing task allocated thereto, i.e. which resource pool is the first resource pool from the resource pools allocated by thefirst allocation module 42. For example, in the scenario shown in fig. 1, thedetermination module 44 may determine that the resource pool 2 is the first resource pool. Thus, in this case, thesecond allocation module 45 may further divide a portion from the second portion of the computing resources remaining, i.e., not yet divided into resource pools, for allocation to the resource pool 2 to increase the computational power of the resource pool 2. In the embodiment of the present application, the ratio of the amount of computing resources of the remaining second portion to the amount of computing resources of the current computing resources used by thecreation module 41 is not less than the first preset threshold. For example, the first preset threshold may be set to 20%, and of course, in the embodiment of the present application, the first preset threshold may also be set to other ratios according to the actual requirements of use.
For example, a part of the second portion may be divided into the resource pool 2, so that the computing power of the resource pool 2 is improved to be capable of processing 50 frames in the second computing task per second, so that the computing task of the video capture device 1 can be realized by only adding a part of computing power to the resource pool 2, without increasing the computing power of the resource pools 1 and 3 at the same time, so that compared with the prior art that the first computing task and the third computing task are executed by using the computing power of the resource pool 2 after being increased for ensuring the smooth implementation of the second computing task, the computing resource is greatly saved, especially in the case that the current computing resource is limited and the computing task is complex and changeable, the embodiment of the present application achieves the effect of ensuring the execution efficiency of the computing task with the limited resource as much as possible, and also can timely perform resource adjustment by monitoring the execution state of each computing task in each resource pool, which also achieves the effective utilization of the resource.
Further, thesecond allocation module 45 may reduce the preset computing power of the resource pool when it is determined that the first resource pool does not exist for a predetermined period of time according to the execution state of the resource pool, or when a ratio of the amount of computing resources of the second portion to the amount of computing resources of the current computing resources for the predetermined period of time is greater than a third preset threshold.
Further, if the determiningmodule 44 does not obtain the first resource pool, that is, determines that the computing power of each resource pool is sufficient to perform the respective processing task according to the execution state of the processing task performed by the resource pool, it is explained that the computing resources of the currently allocated resource pool can match the requirements of the processing task, the determining operation of step S305 may be continuously performed for a predetermined period of time, and if it is determined that the first resource pool has not occurred for a period of time, the second allocatingmodule 45 may reduce the preset computing power determined by the creatingmodule 41 and/or may reduce the computing power thereof with the resource pool to which the processing task has not been allocated.
Furthermore, when the ratio of the remaining undivided second portion to the current computing resources used by thecreation module 41 is greater than the third preset threshold for a predetermined time, i.e. there is not much need to divide the resource pool for which additional division of the added computing power is required for the predetermined time period, this also means that the preset computing power determined by thecreation module 41 for each resource pool may be large, and thus the preset computing power determined by the creation module may be similarly reduced and/or the computing power thereof with the resource pool for which no processing task has been allocated may be reduced.
Therefore, the audio and video computing power dynamic adjusting device of the embodiment of the invention respectively processes different processing tasks by using a plurality of resource pools which are created in advance according to computing resources, determines the resource pool with insufficient computing power according to the execution state of the processing tasks executed by the resource pools which are allocated with the processing tasks, and allocates the residual resources of the current computing resources to the resource pool with insufficient computing power to improve the computing power of the resource pool.
Example five
The above describes the internal functions and structure of an audio video computing power dynamic adjustment device that may be implemented as an electronic device. Fig. 5 is a schematic structural diagram of an embodiment of an electronic device provided in the present application. As shown in fig. 5, the electronic device includes amemory 51 and aprocessor 52.
Amemory 51 for storing a program. In addition to the programs described above, thememory 51 may also be configured to store other various data to support operations on the electronic device. Examples of such data include instructions for any application or method operating on the electronic device, contact data, phonebook data, messages, pictures, videos, and the like.
Thememory 51 may be implemented by any type of volatile or non-volatile memory device or combination thereof, such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disk.
Theprocessor 52 is not limited to a Central Processing Unit (CPU), but may be a Graphics Processor (GPU), a Field Programmable Gate Array (FPGA), an embedded neural Network Processor (NPU), or an Artificial Intelligence (AI) chip. And aprocessor 52 coupled to thememory 51 for executing a program stored in thememory 51, the program executing the audio/video calculation dynamic adjustment method according to the second and third embodiments.
Further, as shown in fig. 5, the electronic device may further include:communication component 53,power component 54,audio component 55,display 56, and other components. Only some of the components are schematically shown in fig. 5, which does not mean that the electronic device only comprises the components shown in fig. 5.
Thecommunication component 53 is configured to facilitate communication between the electronic device and other devices, either wired or wireless. The electronic device may access a wireless network based on a communication standard, such as WiFi, 3G, 4G, or 5G, or a combination thereof. In one exemplary embodiment, thecommunication component 53 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, thecommunication component 53 further includes a Near Field Communication (NFC) module to facilitate short range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, ultra Wideband (UWB) technology, bluetooth (BT) technology, and other technologies.
Apower supply assembly 54 provides power to the various components of the electronic device. Thepower supply components 54 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for electronic devices.
Theaudio component 55 is configured to output and/or input audio signals. For example, theaudio component 55 includes a Microphone (MIC) configured to receive external audio signals when the electronic device is in an operational mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signal may be further stored in thememory 51 or transmitted via thecommunication component 53. In some embodiments, theaudio assembly 55 further comprises a speaker for outputting audio signals.
Thedisplay 56 includes a screen, which may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from a user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensor may sense not only the boundary of a touch or slide action, but also the duration and pressure associated with the touch or slide operation.
Those of ordinary skill in the art will appreciate that: all or part of the steps for implementing the method embodiments described above may be performed by hardware associated with program instructions. The foregoing program may be stored in a computer readable storage medium. The program, when executed, performs steps including the method embodiments described above; and the aforementioned storage medium includes: various media that can store program code, such as ROM, RAM, magnetic or optical disks.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present invention, and not for limiting the same; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some or all of the technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit of the invention.