Task allocation method and device, electronic equipment and storage medium
By rating the tasks to be allocated and selecting suitable processors for task allocation, the problem that existing GPU task scheduling schemes cannot meet different needs and conditions is solved, and more efficient task allocation and processing efficiency is achieved.
Patent Information
- Application Number
- CN202411456135.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-17
- Publication Date
- 2025-02-11
AI Technical Summary
The existing GPU task scheduling scheme uses polling or random calls to allocate tasks, which cannot meet tasks with different needs and GPUs with different conditions, resulting in poor processing efficiency and user experience.
A task allocation method is proposed. By determining a first score for the task to be assigned and determining a second score based on the status information of the processor, a suitable processor is selected as the target processor for task allocation.
This method can complete task allocation more flexibly and effectively, improving the efficiency and user experience of multitasking, especially in scenarios where more resources are required.
Smart Images

Figure CN119415232A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a task allocation method, device, electronic device and storage medium. Background Art
[0002] Since the emergence of GPU (graphics processing unit), due to its super computing power, GPU has played an important role in image and video processing, physics, biological science, chemistry, artificial intelligence and other fields that require high-performance computing. With the iteration of technology, in order to complete increasingly complex graphics and image processing tasks, general computing tasks and reduce computing time, it is often necessary to use multiple GPU cards or multiple GPU servers at the same time for multi-task processing and computing. Therefore, it is necessary to allocate and schedule tasks on multiple GPUs.
[0003] However, most of the current GPU task scheduling schemes allocate tasks through polling, random calls, etc. This method is not friendly to tasks with different requirements and GPUs with different conditions, and it is difficult to meet the task allocation requirements, which seriously affects the multi-task processing efficiency and user experience. Summary of the invention
[0004] In view of this, the present application proposes a task allocation method, device, electronic device and storage medium to solve or partially solve the above problems.
[0005] Based on the above objectives, in a first aspect, the present application provides a task allocation method, which is applied to a network including at least two processors, comprising:
[0006] In response to obtaining the task to be assigned, determining a first score of the task to be assigned;
[0007] Acquire status information of the at least two processors, and determine at least two second scores corresponding to the at least two processors according to the status information;
[0008] Screening the at least two second scores according to the first score, and using the ones that pass the screening as at least one third score;
[0009] In response to the at least one third score being less than the first threshold, selecting one of the processors corresponding to the at least one third score as the target processor according to a set requirement;
[0010] The task to be assigned is assigned to the target processor for processing.
[0011] In some exemplary embodiments, selecting one of the processors corresponding to the at least one third score as the target processor according to the set requirement includes:
[0012] A minimum value among the at least one third score is determined, and a processor corresponding to the minimum value is used as the target processor.
[0013] In some exemplary embodiments, after taking the at least one third score as passed the screening, the method further comprises:
[0014] In response to at least one fourth score being higher than the first threshold among the at least one third score, one of the processors corresponding to the at least one fourth score is selected as the target processor according to the set requirement.
[0015] In some exemplary embodiments, selecting one of the processors corresponding to the at least one fourth score as the target processor according to the set requirement includes:
[0016] A maximum value among the at least one fourth score is determined, and a processor corresponding to the maximum value is used as the target processor.
[0017] In some exemplary embodiments, after screening the at least two second scores according to the first score, the method further includes:
[0018] In response to the at least two second scores failing to pass the screening of the first score, the to-be-assigned task is added to a waiting list to delay processing of the to-be-assigned task.
[0019] In some exemplary embodiments, after adding the to-be-assigned task to a waiting list, the method further includes:
[0020] Return prompt information to the generating end of the task to be assigned.
[0021] In some exemplary embodiments, obtaining the status information of the at least two processors includes:
[0022] Actively obtain the status information of the at least two processors at set intervals;
[0023] or
[0024] The status information reported by the at least two processors is received at set intervals.
[0025] In some exemplary embodiments, determining the first score of the task to be assigned includes:
[0026] Determine the task type, resource size, encoding format, compression method and / or target requirements of the task to be assigned;
[0027] The task type, resource size, encoding format, compression method and / or target requirement are scored according to set rules, and the first score is obtained based on the scoring results.
[0028] In some exemplary embodiments, the status information includes at least one of a processor model, a memory percentage, and a processor temperature;
[0029] The determining, according to the state information, at least two second scores corresponding to the at least two processors comprises:
[0030] The processor model, memory usage and / or processor temperature of any processor are scored according to set rules, and a second score of the any processor is obtained based on the scoring result.
[0031] In some exemplary embodiments, the first score corresponds to the computing power required by the task to be assigned, and the at least two second scores correspond to the remaining computing power of the at least two processors.
[0032] Based on the same concept, in a second aspect, the present application further provides a task allocation device, which is applied to a network including at least two processors, comprising:
[0033] A first module is used for determining a first score of the task to be assigned in response to obtaining the task to be assigned;
[0034] A second module is configured to obtain status information of the at least two processors, and determine at least two second scores corresponding to the at least two processors according to the status information;
[0035] A third module is used to screen the at least two second scores according to the first score, and use the one that passes the screening as at least one third score;
[0036] A fourth module, configured to select, in response to the at least one third score being less than the first threshold, one of the processors corresponding to the at least one third score as a target processor according to a set requirement;
[0037] The fifth module is used to assign the task to be assigned to the target processor for processing.
[0038] Based on the same concept, in a third aspect, the present application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the method described in the first aspect above is implemented.
[0039] Based on the same concept, in a fourth aspect, the present application also provides a non-transitory computer-readable storage medium, wherein the non-transitory computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to implement the method described in the first aspect above.
[0040] As can be seen from the above, a task allocation method, device, electronic device and storage medium provided by the present application are applied to a network including at least two processors. The method determines the first score of the task to be allocated according to the set method when receiving the task to be allocated, and then determines the second score of each processor according to the status information of the processor in the current network, and then uses the first score to screen the second score to determine the processor that can process the task to be allocated, and the screened one is used as the third score. After that, these third scores are compared with the first threshold. If they are all less than the first threshold, it means that the processors corresponding to the third score are in a relatively crowded state, and then a processor that meets the needs of the scene can be selected from the processors corresponding to the third score according to the corresponding strategy, as the target processor to process the task to be allocated. In this way, in a scene where more resources need to be reserved, the processor corresponding to the minimum value in the third score can be selected as the target processor, so that more complete computing resources can be reserved, and task allocation can be completed more flexibly and effectively, thereby improving the processing efficiency and user experience of multiple tasks. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related technologies, the drawings required for use in the embodiments or the related technical descriptions are briefly introduced below. Obviously, the drawings described below are only embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0042] Figure 1 A flowchart of an exemplary method provided in an embodiment of the present application.
[0043] Figure 2 A structural diagram of the module structure corresponding to the exemplary method provided in the embodiments of the present application.
[0044] Figure 3 A flowchart of a specific process of task allocation in a specific scenario provided in an embodiment of the present application.
[0045] Figure 4 A flowchart of a more specific task allocation and execution process provided in an embodiment of the present application.
[0046] Figure 5 A schematic diagram of the structure of an exemplary device provided in an embodiment of the present application.
[0047] Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0048] In order to make the purpose, technical solutions and advantages of this specification more clear, this specification is further described in detail below in combination with specific embodiments and with reference to the accompanying drawings.
[0049] It should be noted that, unless otherwise defined, the technical terms or scientific terms used in the embodiments of the present application should be understood by people with ordinary skills in the field to which the present application belongs. The "first", "second" and similar words used in the embodiments of the present application do not represent any order, quantity or importance, but are only used to distinguish different components. "Including" or "comprising" and similar words mean that the elements, objects or method steps appearing before the word cover the elements, objects or method steps listed after the word and their equivalents, without excluding other elements, objects or method steps. "Connect" or "connected" and similar words are not limited to physical or mechanical connections, but can include electrical connections, whether direct or indirect. "Up", "down", "left", "right" and the like are only used to indicate relative positional relationships. When the absolute position of the described object changes, the relative positional relationship may also change accordingly.
[0050] As described in the background technology section, whether it is a GPU or a CPU (Central Processing Unit), they are all processing units with super computing power. With the iteration of technology and the increasing complexity of data processing, more processors are needed to process tasks in more and more scenarios. Processor servers have to handle tasks of different sizes and types, and these tasks have different requirements for processor servers. For example, there are different image processing, video processing, and corresponding parameters (processing resolution, video compression method, and the size of each GOP, etc.), and the memory and computing power of the processor occupied are also different, so task scheduling is required.
[0051] In some embodiments, processor node scheduling is generally based on the implementation of common load balancing, such as polling to schedule processor nodes or randomly calling processor nodes. This task scheduling and load balancing solution, on the one hand, cannot fully utilize processor resources. Moreover, because it is polling or random allocation, a task that may be issued may be assigned to a processor that already has a large load. The processor has no resources to allocate to process the task, which leads to task failure, but other processors may still be relatively idle. Therefore, the method of the above embodiment is difficult to meet the task allocation requirements, which seriously affects the processing efficiency of multi-tasks and user experience.
[0052] In combination with the above actual situation, the embodiment of the present application provides a task allocation method, which is applied to a network containing at least two processors. The method determines the first score of the task to be allocated according to the set method when receiving the task to be allocated, and then determines the second score of each processor according to the status information of the processor in the current network, and then uses the first score to screen the second score to determine the processor that can process the task to be allocated, and the screened one is used as the third score. After that, these third scores are compared with the first threshold. If they are all less than the first threshold, it means that the processors corresponding to the third score are in a relatively crowded state, and then a processor that meets the needs of the scene can be selected from the processors corresponding to the third score according to the corresponding strategy, as the target processor to process the task to be allocated. In this way, in the scenario where more resources need to be reserved, the processor corresponding to the minimum value in the third score can be selected as the target processor, so that more complete computing power resources can be reserved, and task allocation can be completed more flexibly and effectively, thereby improving the processing efficiency and user experience of multiple tasks.
[0053] Figure 1 A flow chart of an exemplary method provided in an embodiment of the present application is shown.
[0054] like Figure 1 As shown, the task allocation method proposed in the embodiment of the present application can be applied to a network including at least two processors, where the processor can be the aforementioned GPU or CPU, and multiple processors can form a network for processing complex tasks, and this exemplary method is used to schedule tasks, reasonably allocate tasks, make full use of each processor, and improve processing efficiency. The method can specifically include the following steps.
[0055] Step 102: in response to obtaining the task to be assigned, determining a first score of the task to be assigned.
[0056] In this step, the task to be assigned is a task that requires the processor to perform data processing, such as a 2D to 3D conversion task (image or video), a 3D reconstruction task, a font beautification task, and other data processing tasks that require a lot of repetitive work.
[0057] After obtaining a task to be assigned, it is necessary to score the task according to the set rules. The score here corresponds to the computing power. For a task, it can be determined intuitively through the score. The high or low score corresponds to the amount of computing power required for the task. The computing power here refers to the ability of a computer device or a computing / data center to process information, and is the ability of computer hardware and software to work together to perform certain computing requirements. In some embodiments, some attribute information of the task to be assigned can be determined and converted into corresponding scores. The specific conversion method here can be converted according to pre-set conversion rules.
[0058] In some embodiments, taking the task of converting 2D to 3D of a picture or video as an example, in order to generate a processor computing power cost scoring formula based on the type, duration, number of viewpoints of 2D to 3D conversion, and resolution of the picture and video, it is possible to consider how these factors affect the computing load of the processor. In a specific scenario, it is assumed that the influencing factors include: Picture / video type (T): Different types of media (such as static pictures, video processing, etc.) have different loads on the processor. Then a coefficient can be assigned to each type. Duration (D): The duration or number of frames of the video directly affects the total amount of data processed, so it is an important factor in scoring. If it is a picture here, the corresponding duration can be 1, that is, the number of frames is 1. 2D to 3D viewpoint number (V): When converting, the more viewpoints, the more complex the stereoscopic effect that needs to be calculated, and the greater the processor load. Resolution (R): The higher the resolution of the converted image or video, the larger the amount of data per frame, and the more resources required for processing. Based on the above factors, an exemplary first score generation formula can be established. Each of these factors affects the final score through an appropriate weight or coefficient. Here, these factors can be combined using multiplication or addition, etc., because they are independent of each other, and the growth of each factor will increase the overall computational load. Then the first score Score can be Score = T*D*nV*mR. Among them, T represents the type coefficient (for example, static picture = 1, ordinary video = 2, real-time video = 3, etc.); D represents the duration (some measure of seconds or frames); V represents the number of viewpoints; R represents the resolution (which can be the number of pixels, such as 1920*1080=2073600); n and m are indexes that adjust the impact of the number of viewpoints and resolution. These values need to be determined based on actual testing or experience. Usually, n and m will be greater than 1, because the increase in the number of viewpoints and resolution will increase the computational load nonlinearly. It should be noted that the values of T, n and m need to be adjusted according to the actual processor performance and specific application scenarios. At the same time, in specific scenarios, it is necessary to ensure that all input units (such as duration, resolution) remain consistent in the formula. When applying, one or more benchmarks can be further set to calibrate the scoring formula to ensure its accuracy and practicality. For real-time systems, it may be necessary to dynamically adjust the coefficients in the scoring formula according to the current load of the processor.
[0059] In a more specific scenario, suppose there is a video of the normal video type (T=2), a duration of 60 seconds (assuming 30 frames per second, the total number of frames is 1800), 2D to 3D viewpoints are 4, and the resolution is 1920*1080 (R=2073600). If n=1.5 and m=1.2 are assumed (these values need to be adjusted based on actual tests), the scoring formula is: Score=2*1800*(1.5*4)*(1.2*2073600). This score is the first score, which will give a rough estimate of the processor computing power overhead. Of course, the above is just a simplified example, and more complex models and more adjustments may be required in actual applications.
[0060] That is, in some embodiments, the determination of the first score of the task to be assigned includes: determining the task type, resource size, encoding format, compression method and / or target requirement of the task to be assigned; scoring the task type, resource size, encoding format, compression method and / or target requirement according to the set rules, and obtaining the first score based on the scoring result. Among them, the task type can correspond to the image / video type in the aforementioned embodiment; the resource size can correspond to the duration in the aforementioned embodiment; the target requirement can correspond to the number of viewpoints and resolution; then the encoding format is different encoding methods and the corresponding computing power requirements are also different, which can be converted into corresponding coefficients; the compression method is similar to the encoding format, and the compression or decompression computing power required by different compression methods is different, which can also be converted into corresponding coefficients. Afterwards, in a specific scenario, the above data can be converted into corresponding coefficients, and then the first score can be determined based on these coefficients, and the conversion rules can be specifically determined according to the specific scenario. Finally, for the first score, it can correspond to the computing power required for the task to be assigned.
[0061] Step 104: Acquire status information of the at least two processors, and determine at least two second scores corresponding to the at least two processors according to the status information.
[0062] In this step, it is necessary to obtain the status information of multiple processors in the network. Similar to the aforementioned tasks to be assigned, the status information here is also used to evaluate the current remaining computing power of the processor. It can also convert these status information into coefficients according to the set conversion method, and then determine the second score of the corresponding processor according to these coefficients.
[0063] In some embodiments, the timing of obtaining the status information may be to obtain it in real time after receiving a task to be processed; or it may be to obtain it repeatedly at intervals of set time, such as obtaining the status information of the processor in the network once every 10 seconds, etc. This can also be understood as the second score corresponding to any processor in the network within these 10 seconds is the same. Further, the status information may be obtained actively or passively (that is, actively reported by the processor). That is, in some embodiments, the obtaining of the status information of the at least two processors includes: actively obtaining the status information of the at least two processors at intervals of set time; or receiving the status information reported by the at least two processors at intervals of set time.
[0064] In some embodiments, similar to the aforementioned first score, for different processors, the current remaining computing power of a processor can be determined according to its specific model type, memory ratio, processor temperature and other factors, so as to form the second score corresponding to the processor. In a specific scenario, RTX3090 24G is now used as a reference graphics card for scoring, the GPU full load computing power is 100 points, and 50 points when it occupies 50%; 24G video memory is fully loaded with 100 points, and 12G is occupied. The temperature score gradient is divided into: 30℃-50℃ indicates good, 50℃-85℃ indicates busy, and above 85℃ indicates crowded. Then, an RTX4090 24G graphics card has a maximum score of 200 points for computing power and 100 points for video memory. Based on the results of dynamic scoring, when selecting a GPU server, GPU resources such as algorithms and video memory will be selected as much as possible without exceeding 70%. It can be seen from this scoring method that when the processor is more idle and the computing power is more remaining, the corresponding second score is higher; conversely, when the processor is more crowded and the remaining computing power is less, the corresponding second score is lower. Similar to the first score, the above coefficients can be set with corresponding adjustment indexes according to specific scenarios, and finally a second score of a processor is obtained by multiplication or addition, and the second score corresponds to the remaining computing power of the corresponding processor.
[0065] That is, in some embodiments, the state information includes at least one of a processor model, a memory percentage, and a processor temperature; the determining of at least two second scores corresponding to the at least two processors based on the state information includes: scoring the processor model, memory percentage, and / or processor temperature of any processor according to a set rule, and obtaining a second score of any processor based on the scoring result. Among them, the processor model corresponds to different processor types, and the basic computing power or maximum computing power of processors of different models is not the same. Therefore, different scoring coefficients can be set for processors of different models, for example, the corresponding score can be set according to its maximum computing power; then the memory percentage is the processor memory occupancy. The at least two second scores correspond to the remaining computing power of the at least two processors.
[0066] In addition, in some embodiments, there may be multiple processors in the network of the present application, and the status information of the processors obtained in this step does not necessarily correspond to all processors. According to different specific scenarios, the status information of some of the processors may be obtained, and the subsequent task allocation is only selected from these processors, and there is no specific limitation on this.
[0067] Step 106: Screen the at least two second scores according to the first score, and use the one that passes the screening as at least one third score.
[0068] In this step, it is necessary to determine the processor that can handle the task to be assigned. According to the above steps, the first score corresponding to the task and the second score corresponding to the processor can be obtained, and the first score corresponds to the computing power required for the task to be assigned, and the second score corresponds to the remaining computing power of the processor. Then, the size relationship between the first score and each second score can be compared. If the second score is greater than the first score, it means that the remaining computing power of the corresponding processor can meet the computing power required for the task to be assigned. Otherwise, even if a processor is selected to process the task to be assigned, the remaining computing power of the processor cannot execute the task to be assigned. In this way, the second score that passes the screening, that is, the second score that is higher than the first score, is used as the third score.
[0069] In some embodiments, for the screening process, if each second score is less than the first score, it means that the remaining computing power of the processors currently participating in the allocation cannot meet the requirements of the task to be assigned, and it cannot be processed at present. In order to avoid task failure, the task to be assigned can be added to the waiting list to delay processing. After the processor releases certain resources, it is re-evaluated, for example, the second score is recalculated, and then compared with the first score of the task in the waiting list, and the appropriate task to be assigned is assigned to the corresponding processor. The tasks in the waiting list can be sorted according to the entry time. When a second score is higher than the first score of the task in the multiple lists, the task is assigned according to the time sequence. Of course, in some embodiments, the assignment of tasks in the waiting list can also be performed by setting priorities. That is, in some embodiments, after the at least two second scores are screened according to the first score, the method also includes: in response to the at least two second scores failing to pass the screening of the first score, the task to be assigned is added to the waiting list to delay processing of the task to be assigned.
[0070] Furthermore, since the task to be assigned cannot be processed immediately, the task requester may need to wait for a long time to get the task result, and then a prompt message may be returned to the task requester to explain the current situation, or to inform the task requester that it needs to wait, etc. That is, in some embodiments, after adding the task to be assigned to the waiting list, the method further includes: returning a prompt message to the generator of the task to be assigned. The generator of the task to be assigned is the task requester.
[0071] Step 108 : In response to the at least one third score being less than the first threshold, selecting one of the processors corresponding to the at least one third score as a target processor according to a set requirement.
[0072] In this step, for the screened third scores, the corresponding processors can all process the tasks to be assigned, and then targeted allocation needs to be carried out according to the specific situation, so as to ensure the overall efficiency of the processor or processor network. A first threshold can be set here, and the threshold is used to judge whether the processor is busy / crowded. If a third score is less than the first threshold, it means that the computing power of the processor corresponding to the third score has been partially occupied and is in a relatively busy state. In this way, if all third scores are less than the first threshold, it means that the processors in the current network are in a relatively busy state. In this state, some targeted allocation strategies can be implemented, such as allocating the most idle processor first, or an allocation method that can retain the most processor resources. In this way, in different specific scenarios, one of the processors corresponding to at least one third score can be selected as the target processor according to different specific strategies.
[0073] In some embodiments, when at least one third score is less than the first threshold, it means that all processors corresponding to the third scores are in a busy state, and the remaining computing power of each processor may not be too much. In this way, if the tasks to be assigned are randomly assigned, it is a waste of processor resources. For example, assuming that the current third scores are 35, 50, and 60 corresponding to processors A, B, and C, and the first score of the task to be assigned is 30, if the task is assigned to processor B, processor B still has a score of 20, and the scores of the three processors eventually become 35, 20, and 65, two smaller scores and one larger score. If there is a task with a larger computing power, it can only be assigned to processor C, and only one task with a large computing power can be taken; and if targeted allocation is performed, the task is assigned to the smallest of the third scores, that is, processor A, then the scores of the three processors eventually become 5, 50, and 60, and there will be two processors that can handle larger tasks, and two tasks with larger computing power can be taken, thereby improving the computing power utilization of the processor in disguise and improving the overall efficiency. Furthermore, in some embodiments, the minimum value of at least one third score can be determined, and the processor corresponding to the minimum value is used as the target processor. That is, in some embodiments, selecting one of the processors corresponding to the at least one third score as the target processor according to the set requirements includes: determining a minimum value among the at least one third score, and selecting the processor corresponding to the minimum value as the target processor.
[0074] In other embodiments, for the comparison between the third score and the first threshold, the third score may also be greater than the first threshold. Here, the score in the third score that is higher than the first threshold is called the fourth score. If there is a fourth score, it means that the processors corresponding to these fourth scores in the network are in a relatively idle state, or in a state with more remaining computing power. Afterwards, for task allocation, similar to the scenario when the processor is relatively busy in the aforementioned embodiment, it can also be set in a targeted manner according to the requirements of the specific scenario, and one of the processors corresponding to these fourth scores is selected according to the corresponding rules as the target processor. That is, in some embodiments, after the at least one third score is selected through screening, the method also includes: in response to the existence of at least one fourth score higher than the first threshold in the at least one third score, one of the processors corresponding to the at least one fourth score is selected as the target processor according to the set requirements.
[0075] Furthermore, in some scenarios, for relatively idle processors, in order to balance the load as much as possible, the idlest processor can be selected as the target processor, that is, the processor corresponding to the maximum value in the fourth score is selected as the target processor, so as to perform load balancing. That is, in some embodiments, selecting one of the processors corresponding to the at least one fourth score as the target processor according to the set requirements includes: determining the maximum value in the at least one fourth score, and using the processor corresponding to the maximum value as the target processor.
[0076] Step 110: Allocate the task to be assigned to the target processor for processing.
[0077] In this step, after the target processor is selected, the task to be assigned can be assigned to the target processor for processing.
[0078] In a more specific scenario, the method of this embodiment can be presented in a module manner, such as Figure 2 As shown, it can specifically include a scheduling management module, a processor computing power scoring module, a task scoring module, a task allocation module, etc.
[0079] Among them, the scheduling management module is used to receive the real-time status of each processor server through heartbeat reporting (a method of reporting data at intervals of set time) to the scheduling management module. The scheduling management module will update the online status of each processor node in the processor network in real time (heartbeat timeout will be offline) and the running information status, realize the dynamic expansion and contraction of the GPU server node, and pass this information to the processor computing power scoring module for real-time scoring. After receiving the task to be assigned, the data related to the task score is transmitted to the task scoring module for scoring. After that, if the task assignment module determines the target processor of the task to be assigned, the task to be assigned can be assigned. When there are no available processor nodes (all offline or all busy), it can be responsible for delaying the task to be assigned (such as queuing, etc.), and give friendly prompts to the top-level caller (such as: insufficient processor resources, please wait patiently, etc.), when the available processor node appears again, the appropriate task will be arranged for the corresponding processor server to process the task.
[0080] The processor computing power scoring module is used to score the processor based on the data transmitted from the scheduling management module. Specifically, it can score the processor in multiple dimensions according to the processor server status (total memory size and usage rate, total video memory size and usage rate, processor model and processor usage rate, and processor temperature, etc.).
[0081] The task scoring module is used to score tasks based on the data transmitted from the scheduling management module. Specifically, it can estimate the required processor computing power, video memory and memory requirements based on the task type (video, picture, etc.), task resource size (duration and size), encoding format, compression method and processing result requirements (different resolutions), and finally derive the approximate service score requirement for the task.
[0082] The task allocation module is used to: ① when there are processor nodes with scores higher than the first threshold value in each dimension (for example, if the memory, video memory, CPU, and GPU usage are lower than 70%, and the temperature is normal, it is considered that the GPU server is in an uncongested state), assign tasks according to the principle of assigning tasks to those with higher scores (i.e., more idle). ② when all processor nodes have dimensions with scores lower than the first threshold value, it means that all processors have entered a congested state. At this time, assigning tasks to processors can follow the principle of reserving the most processor resources. The specific implementation principle is: among all processor nodes that meet the task call (i.e., the scores of each dimension can handle the task), select one of the processor nodes with the lowest score among these processor nodes to handle the task, so as to maximize the processor utilization. ③ when the scores of all processor nodes cannot meet the new task, a prompt message can be returned: "The server is busy, please wait patiently", and the task can be added to the waiting queue, and then processed when new processor resources are released (based on the processor heartbeat report information).
[0083] Afterwards, if Figure 3 As shown in the figure, the specific process of task allocation in a specific scenario. When a new task (task to be assigned) comes in, it is scored by the task scoring module. After that, it is determined whether there is a server node that can complete the task. If not, it enters the waiting queue or waiting list. After that, the processor heartbeat reports its own data and is scored by the processor computing power scoring module. When the score is sufficient, it is re-judged; if there is, the processor is allocated according to the principle of idle priority or retaining the maximum computing power when crowded, and finally the task is assigned to the selected appropriate processor node for task processing.
[0084] Afterwards, if Figure 4 As shown, it is a more specific process of task allocation and execution, specifically a 2D image conversion to 3D image task, and the processor for processing is GPU. Among them, the core business service is one end that executes the method of this embodiment, and is applied to a dynamic network pool containing at least two processors, in which each GPU processor reports the GPU status through a heartbeat (10s). When a new task is generated, it is given to the core business service through a web browser, and the core business service selects the most suitable GPU as the target GPU based on the task information, GPU information, etc. The task is sent to the target GPU, and after the GPU completes the task processing, it returns the processing result to the core business service, and the core business service returns the processing result to the web browser.
[0085] It can be seen from the above embodiments that the task allocation method provided by the embodiment of the present application is applied to a network including at least two processors. The method determines the first score of the task to be allocated according to the set method when receiving the task to be allocated, and then determines the second score of each processor according to the status information of the processor in the current network, and then uses the first score to screen the second score to determine the processor that can process the task to be allocated, and the screened one is used as the third score. After that, these third scores are compared with the first threshold. If they are all less than the first threshold, it means that the processors corresponding to the third score are in a relatively crowded state, and then a processor that meets the needs of the scene can be selected from the processors corresponding to the third score according to the corresponding strategy, as the target processor to process the task to be allocated. In this way, in the scene where more resources need to be reserved, the processor corresponding to the minimum value in the third score can be selected as the target processor, so that more complete computing resources can be reserved, and task allocation can be completed more flexibly and effectively, thereby improving the processing efficiency and user experience of multiple tasks.
[0086] It should be noted that the method of the embodiment of the present application can be performed by a single device, such as a computer or server. The method of the embodiment of the present application can also be applied to a distributed scenario and completed by multiple devices cooperating with each other. In the case of such a distributed scenario, one of the multiple devices can only perform one or more steps in the method of the embodiment of the present application, and the multiple devices will interact with each other to complete the described method.
[0087] It should be noted that the above describes specific embodiments of the present application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the above embodiments and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0088] Based on the same concept, corresponding to any of the above-mentioned embodiment methods, the present application also provides a task allocation device.
[0089] refer to Figure 5 , the task allocation device comprises:
[0090] The first module 510 is configured to determine a first score of the task to be assigned in response to obtaining the task to be assigned.
[0091] The second module 520 is configured to obtain status information of the at least two processors, and determine at least two second scores corresponding to the at least two processors according to the status information.
[0092] The third module 530 is used to filter the at least two second scores according to the first score, and use the second scores that pass the screening as at least one third score.
[0093] The fourth module 540 is configured to select, in response to the at least one third score being less than the first threshold, one of the processors corresponding to the at least one third score as a target processor according to a set requirement.
[0094] The fifth module 550 is used to assign the task to be assigned to the target processor for processing.
[0095] In some exemplary embodiments, the fourth module 540 is further configured to:
[0096] A minimum value among the at least one third score is determined, and a processor corresponding to the minimum value is used as the target processor.
[0097] In some exemplary embodiments, the third module 530 is further configured to:
[0098] In response to at least one fourth score being higher than the first threshold among the at least one third score, one of the processors corresponding to the at least one fourth score is selected as the target processor according to the set requirement.
[0099] In some exemplary embodiments, the third module 530 is further configured to:
[0100] A maximum value among the at least one fourth score is determined, and a processor corresponding to the maximum value is used as the target processor.
[0101] In some exemplary embodiments, the third module 530 is further configured to:
[0102] In response to the at least two second scores failing to pass the screening of the first score, the to-be-assigned task is added to a waiting list to delay processing of the to-be-assigned task.
[0103] In some exemplary embodiments, the third module 530 is further configured to:
[0104] Return prompt information to the generating end of the task to be assigned.
[0105] In some exemplary embodiments, the second module 520 is further configured to:
[0106] Actively obtain the status information of the at least two processors at set intervals;
[0107] or
[0108] The status information reported by the at least two processors is received at set intervals.
[0109] In some exemplary embodiments, the first module 510 is further configured to:
[0110] Determine the task type, resource size, encoding format, compression method and / or target requirements of the task to be assigned;
[0111] The task type, resource size, encoding format, compression method and / or target requirement are scored according to set rules, and the first score is obtained based on the scoring results.
[0112] In some exemplary embodiments, the status information includes at least one of a processor model, a memory percentage, and a processor temperature;
[0113] The second module 520 is further configured to:
[0114] The processor model, memory usage and / or processor temperature of any processor are scored according to set rules, and a second score of the any processor is obtained based on the scoring result.
[0115] In some exemplary embodiments, the first score corresponds to the computing power required by the task to be assigned, and the at least two second scores correspond to the remaining computing power of the at least two processors.
[0116] For the convenience of description, the above devices are described in terms of functions divided into various modules. Of course, when implementing the embodiments of the present application, the functions of each module can be implemented in the same or multiple software and / or hardware.
[0117] The apparatus of the above embodiment is used to implement the corresponding task allocation method in the above embodiment, and has the beneficial effects of the corresponding method embodiment, which will not be described in detail here.
[0118] Based on the same concept, corresponding to any of the above-mentioned embodiments, the present application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the task allocation method as described in any of the above embodiments is implemented.
[0119] Figure 6 A more specific schematic diagram of the hardware structure of an electronic device provided in this embodiment is shown, and the device may include: a processor 1010, a memory 1020, an input / output interface 1030, a communication interface 1040, and a bus 1050. The processor 1010, the memory 1020, the input / output interface 1030, and the communication interface 1040 are connected to each other through the bus 1050 in the device.
[0120] The processor 1010 can be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this specification.
[0121] The memory 1020 may be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory), static storage device, dynamic storage device, etc. The memory 1020 may store an operating system and other application programs. When the technical solutions provided in the embodiments of this specification are implemented by software or firmware, the relevant program codes are stored in the memory 1020 and are called and executed by the processor 1010.
[0122] The input / output interface 1030 is used to connect the input / output module to realize information input and output. The input / output module can be configured in the device as a component (not shown in the figure), or it can be externally connected to the device to provide corresponding functions. The input device may include a keyboard, a mouse, a touch screen, a microphone, various sensors, etc., and the output device may include a display, a speaker, a vibrator, an indicator light, etc.
[0123] The communication interface 1040 is used to connect a communication module (not shown) to realize communication interaction between the device and other devices. The communication module can realize communication through a wired mode (such as USB, network cable, etc.) or a wireless mode (such as mobile network, WIFI, Bluetooth, etc.).
[0124] The bus 1050 includes a path that transmits information between the various components of the device (eg, the processor 1010, the memory 1020, the input / output interface 1030, and the communication interface 1040).
[0125] It should be noted that, although the above device only shows the processor 1010, the memory 1020, the input / output interface 1030, the communication interface 1040 and the bus 1050, in the specific implementation process, the device may also include other components necessary for normal operation. In addition, it can be understood by those skilled in the art that the above device may also only include the components necessary for implementing the embodiments of the present specification, and does not necessarily include all the components shown in the figure.
[0126] The electronic device of the above embodiment is used to implement the corresponding task allocation method in any of the above embodiments, and has the beneficial effects of the corresponding method embodiment, which will not be described in detail here.
[0127] Based on the same concept, corresponding to any of the above-mentioned embodiment methods, the present application also provides a non-transitory computer-readable storage medium, wherein the non-transitory computer-readable storage medium stores computer instructions, and the computer instructions are used to enable the computer to execute the task allocation method described in any of the above embodiments.
[0128] The computer-readable medium of this embodiment includes permanent and non-permanent, removable and non-removable media, and information storage can be achieved by any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, read-only compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device.
[0129] The computer instructions stored in the storage medium of the above embodiment are used to enable the computer to execute the task allocation method described in any of the above embodiments, and have the beneficial effects of the corresponding method embodiments, which will not be repeated here.
[0130] Based on the same concept, corresponding to any of the above-mentioned embodiments, the present application also provides a computer program product, which includes computer program instructions. In some embodiments, the computer program instructions can be executed by one or more processors of a computer so that the computer and / or the processor execute the task allocation method. Corresponding to the execution subject corresponding to each step in each embodiment of the task allocation method, the processor that executes the corresponding step can belong to the corresponding execution subject.
[0131] The computer program product of the above embodiment is used to enable the computer and / or the processor to execute the task allocation method described in any of the above embodiments, and has the beneficial effects of the corresponding method embodiments, which will not be repeated here.
[0132] Those skilled in the art should understand that the discussion of any of the above embodiments is merely illustrative and is not intended to imply that the scope of the present application (including the claims) is limited to these examples. In line with the concept of the present application, the technical features in the above embodiments or different embodiments may be combined, the steps may be implemented in any order, and there are many other variations of the different aspects of the embodiments of the present application as described above, which are not provided in detail for the sake of simplicity.
[0133] In addition, to simplify the description and discussion, and in order not to make the embodiments of the present application difficult to understand, the known power supply / ground connection with the integrated circuit (IC) chip and other components may or may not be shown in the provided drawings. In addition, the device can be shown in the form of a block diagram to avoid making the embodiments of the present application difficult to understand, and this also takes into account the fact that the details of the implementation of these block diagram devices are highly dependent on the platform to be implemented in the embodiments of the present application (that is, these details should be fully within the scope of understanding of those skilled in the art). In the case of elaborating specific details (e.g., circuits) to describe exemplary embodiments of the present application, it is obvious to those skilled in the art that the embodiments of the present application can be implemented without these specific details or when these specific details are changed. Therefore, these descriptions should be considered to be illustrative rather than restrictive.
[0134] Although the present application has been described in conjunction with specific embodiments of the present application, many replacements, modifications and variations of these embodiments will be apparent to those skilled in the art from the foregoing description. For example, other memory architectures (e.g., dynamic RAM (DRAM)) may use the embodiments discussed.
[0135] The embodiments of the present application are intended to cover all such substitutions, modifications and variations that fall within the broad scope of the appended claims. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the embodiments of the present application should be included in the scope of protection of the present application.
Claims
1. A task allocation method, characterized in that: Applicable to networks containing at least two processors, including: In response to obtaining the task to be assigned, determining a first score of the task to be assigned; Acquire status information of the at least two processors, and determine at least two second scores corresponding to the at least two processors according to the status information; Screening the at least two second scores according to the first score, and using the ones that pass the screening as at least one third score; In response to the at least one third score being less than the first threshold, selecting one of the processors corresponding to the at least one third score as the target processor according to a set requirement; The task to be assigned is assigned to the target processor for processing.
2. The method according to claim 1, characterized in that The selecting, according to the set requirement, one of the processors corresponding to the at least one third score as the target processor comprises: A minimum value among the at least one third score is determined, and a processor corresponding to the minimum value is used as the target processor.
3. The method according to claim 1, characterized in that After taking the at least one third score as the one that passes the screening, the method further comprises: In response to at least one fourth score being higher than the first threshold among the at least one third score, one of the processors corresponding to the at least one fourth score is selected as the target processor according to the set requirement.
4. The method according to claim 3, characterized in that The selecting, according to the set requirement, one of the processors corresponding to the at least one fourth score as the target processor comprises: A maximum value among the at least one fourth score is determined, and a processor corresponding to the maximum value is used as the target processor.
5. The method according to claim 1, characterized in that After screening the at least two second scores according to the first score, the method further includes: In response to the at least two second scores failing to pass the screening of the first score, the to-be-assigned task is added to a waiting list to delay processing of the to-be-assigned task.
6. The method according to claim 5, characterized in that After adding the to-be-assigned task to a waiting list, the method further comprises: Return prompt information to the generating end of the task to be assigned.
7. The method according to claim 1, characterized in that The obtaining of the status information of the at least two processors includes: Actively obtain the status information of the at least two processors at set intervals; or The status information reported by the at least two processors is received at set intervals.
8. The method according to claim 1, characterized in that The step of determining a first score of the task to be assigned comprises: Determine the task type, resource size, encoding format, compression method and / or target requirements of the task to be assigned; The task type, resource size, encoding format, compression method and / or target requirement are scored according to set rules, and the first score is obtained based on the scoring results.
9. The method according to claim 1, characterized in that: The status information includes at least one of a processor model, a memory usage, and a processor temperature; The determining, according to the state information, at least two second scores corresponding to the at least two processors comprises: The processor model, memory usage and / or processor temperature of any processor are scored according to set rules, and a second score of the any processor is obtained based on the scoring result.
10. The method according to claim 1, characterized in that The first score corresponds to the computing power required by the task to be assigned, and the at least two second scores correspond to the remaining computing power of the at least two processors.
11. A task allocation device, characterized in that: Applicable to networks containing at least two processors, including: A first module is used for determining a first score of the task to be assigned in response to obtaining the task to be assigned; A second module is configured to obtain status information of the at least two processors, and determine at least two second scores corresponding to the at least two processors according to the status information; A third module is used to screen the at least two second scores according to the first score, and use the one that passes the screening as at least one third score; A fourth module, configured to select, in response to the at least one third score being less than the first threshold, one of the processors corresponding to the at least one third score as a target processor according to a set requirement; The fifth module is used to assign the task to be assigned to the target processor for processing.
12. An electronic device, characterized in that: The method comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the method according to any one of claims 1 to 10 is implemented.
13. A non-transitory computer-readable storage medium, characterized in that: The non-transitory computer-readable storage medium stores computer instructions, and the computer instructions are used to cause a computer to implement the method according to any one of claims 1 to 10.