Task allocation method and task allocation device
By quantitative characterization of computing tasks and resource units and multi-objective optimization algorithm solutions, the problem of uneven allocation of heterogeneous computing resources is solved, efficient integration and reasonable allocation of computing resources is achieved, and computing efficiency and service quality are improved.
Patent Information
- Application Number
- CN202111663346.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-30
- Publication Date
- 2025-08-19
- Estimated Expiration
- 2041-12-30
AI Technical Summary
In the prior art, heterogeneous computing resources lack a unified scheduling and allocation platform, which leads to inefficient allocation of computing tasks to the most suitable computing resources, resulting in inefficient computing efficiency and increased costs.
By quantitatively characterizing the computing tasks and resource units, the objective functions and constraints are determined, and multi-objective optimization algorithms such as genetic algorithms are used to solve, obtain a set of non-inferior solutions, and select the optimal solution for task allocation, realizing the integration and reasonable allocation of computing resources.
It improves computing efficiency, reduces computing costs, improves service quality, and realizes efficient unified management and allocation of heterogeneous computing resources.
Smart Images

Figure CN114461386B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a task allocation method and a task allocation device. Background Art
[0002] As artificial intelligence (AI) technology continues to advance, its applications and data types continue to expand, and the model training used in AI production is becoming increasingly complex. The types of computing tasks are constantly expanding, and the computing resources they support are also constantly developing and enriching. For example, central processing units (CPUs), graphics processing units (GPUs), neural network processing units (NPUs), field-programmable gate arrays (FPGAs), and so on, their computing performance and computing properties also vary greatly.
[0003] However, in traditional solutions, heterogeneous computing resources are often separated from each other and calculated independently. Different types of tasks need to be manually submitted to the corresponding computing resources (for example, calculations for image-based CNN networks are processed by dedicated servers equipped with GPUs, and matrix-based computing tasks are submitted to NPU computing devices). There is a lack of a unified scheduling and allocation platform to uniformly submit multiple types of computing tasks and assign them to corresponding computing resources for processing. Summary of the Invention
[0004] In view of this, embodiments of the present invention provide a task allocation method and a task allocation device, which can achieve the integration and reasonable allocation of computing resources.
[0005] According to a first aspect of an embodiment of the present invention, a task allocation method is provided, comprising: quantitatively characterizing a plurality of computing tasks and a plurality of computing resource units to obtain quantitative characterization results; determining, for the plurality of computing tasks and the plurality of computing resource units, a plurality of objective functions and corresponding plurality of constraints based on the quantitative characterization results; solving the plurality of objective functions using a multi-objective optimization algorithm based on the plurality of constraints to obtain a set of non-inferior solutions, wherein each non-inferior solution in the set of non-inferior solutions corresponds to a task allocation strategy; selecting an optimal solution from the set of non-inferior solutions, and allocating the plurality of computing tasks to the plurality of computing resource units for execution based on the optimal solution.
[0006] In one embodiment of the present invention, the multi-objective optimization algorithm includes a genetic algorithm, and the length of the sequence targeted by the genetic operator in the solution search process of the genetic algorithm is variable.
[0007] In one embodiment of the present invention, the genetic algorithm includes:
[0008] a. Randomly generated N p feasible solutions as the initial population P; and generate an external archive set Q, and set Q to be empty;
[0009] b. Assign fitness to the initialized population and perform the environmental selection process;
[0010] c. Determine whether the termination conditions are met;
[0011] d. When the termination condition is met, return the solutions in the external archive set Q as the non-inferior solution set;
[0012] e. When the termination condition is not met, a pairing selection operation is performed, and an evolution operation is performed based on a genetic operator with variable sequence length to obtain a new population;
[0013] The N in the new population p The feasible solutions are used as the initial population, and the above steps b to e are iteratively performed.
[0014] In one embodiment of the present invention, the genetic operator includes a crossover operator, and the above-mentioned genetic operator based on variable sequence length performs an evolutionary operation to obtain a new population, including: randomly selecting a crossover starting point from any two feasible solutions to be crossed that satisfy multiple objective functions; performing a crossover operation on any two feasible solutions to be crossed item by item from the crossover starting point to the left or right; calculating multiple objective function values of each new feasible solution generated by each crossover operation; when the multiple objective function values of one of the new feasible solutions generated by the crossover operation are completely inferior to the multiple objective function values of any solution before the crossover operation, the crossover operation stops.
[0015] In one embodiment of the present invention, the genetic operator includes a mutation operator, and the above-mentioned genetic operator based on variable sequence length performs an evolutionary operation to obtain a new population, including: randomly selecting a mutation point position in a feasible solution to be mutated that satisfies multiple objective functions; performing a mutation operation on the feasible solutions to be mutated item by item from the mutation point position to the left or right; calculating multiple objective function values of the new solution generated by each mutation operation; when the multiple objective function values of the new solution generated by the mutation operation are not completely inferior to the multiple objective function values of any solution before the mutation operation, the mutation operation continues; when the multiple objective function values of the new solution generated by the mutation operation are completely inferior to the multiple objective function values of any solution before the mutation operation, the mutation operation stops.
[0016] In one embodiment of the present invention, the task allocation method further includes: performing resource constraint judgment on a new solution generated by each mutation operation, and discarding invalid solutions.
[0017] In one embodiment of the present invention, the objective function includes a time function, an execution cost function and / or a service quality function.
[0018] In one embodiment of the present invention, the time function satisfies: the total running time of multiple computing tasks is the shortest, wherein the running time of each computing task in the multiple computing tasks is represented by the task computing amount of the computing task divided by the computing efficiency of the corresponding computing resource unit.
[0019] In one embodiment of the present invention, the execution cost function satisfies: the total execution cost of multiple computing tasks is the lowest, wherein the execution cost of each computing task in the multiple computing tasks is represented by multiplying the running time of the computing task by the unit computing cost of the corresponding computing resource unit.
[0020] In one embodiment of the present invention, the service quality function satisfies: the total service quality of the multiple computing tasks is the highest, wherein the service quality of each computing task in the multiple computing tasks is characterized by the service quality of the corresponding computing resource unit.
[0021] In one embodiment of the present invention, the above-mentioned constraints include at least one of the following: the first computing task among multiple computing tasks is assigned to the first computing resource unit; the service quality of the first computing resource unit is greater than or equal to the service quality requirement of the first computing task; the hardware type of the first computing resource unit meets the resource constraint type of the first computing task.
[0022] In one embodiment of the present invention, the multiple computing tasks include at least two of feature extraction tasks, network convolution tasks, and matrix calculation tasks, and the multiple computing resource units include at least two of the central processing unit CPU, graphics processing unit GPU, neural network processor NPU, and field programmable gate array FPGA.
[0023] In one embodiment of the present invention, each of the multiple computing tasks is characterized by at least one of the resource constraint type, task computing amount and service quality requirements, and each of the multiple computing resource units is characterized by at least one of the hardware type, computing efficiency, unit computing cost and service quality.
[0024] According to a second aspect of an embodiment of the present invention, a task allocation device is provided, comprising: a quantification module for quantitatively characterizing a plurality of computing tasks and a plurality of computing resource units to obtain a quantitative characterization result; a determination module for determining, for the plurality of computing tasks and the plurality of computing resource units, a plurality of objective functions and corresponding plurality of constraints based on the quantitative characterization result; a solution module for solving the plurality of objective functions based on the plurality of constraints using a multi-objective optimization algorithm to obtain a set of non-inferior solutions, wherein each non-inferior solution in the set of non-inferior solutions corresponds to a task allocation strategy; and an allocation module for selecting an optimal solution from the set of non-inferior solutions, and allocating the plurality of computing tasks to the plurality of computing resource units for execution based on the optimal solution.
[0025] According to a third aspect of an embodiment of the present invention, a computer-readable storage medium is provided, on which computer-executable instructions are stored, characterized in that when the executable instructions are executed by a processor, any of the above-mentioned task allocation methods is implemented.
[0026] According to a fourth aspect of an embodiment of the present invention, an electronic device is provided, characterized in that the electronic device includes: a processor; a memory for storing instructions executable by the processor; and the processor is used to execute any one of the task allocation methods described above.
[0027] According to the technical solution provided by the embodiment of the present invention, a quantitative characterization result is obtained by quantitatively characterizing multiple computing tasks and multiple computing resource units. For the multiple computing tasks and multiple computing resource units, multiple objective functions and corresponding multiple constraints are determined based on the quantitative characterization result. Based on the multiple constraints, the multiple objective functions are solved using a multi-objective optimization algorithm to obtain a set of non-inferior solutions. The optimal solution is selected from the non-inferior solution set, and the multiple computing tasks are allocated to multiple computing resource units for execution based on the optimal solution, thereby realizing the integration and reasonable allocation of computing resources. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0029] Figure 1 FIG2 is a flow chart of a task allocation method provided in an embodiment of the present invention.
[0030] Figure 2 FIG2 is a diagram showing a mapping relationship between a solution space and a task allocation strategy provided by an embodiment of the present invention.
[0031] Figure 3 Shown is a flow chart of a genetic algorithm provided by one embodiment of the present invention.
[0032] Figure 4 FIG. 1 is a schematic diagram showing a crossover operator according to an embodiment of the present invention.
[0033] Figure 5 FIG. 1 is a schematic diagram showing the principle of a mutation operator provided in one embodiment of the present invention.
[0034] Figure 6 FIG. 1 is a block diagram of a task allocation device provided by an embodiment of the present invention.
[0035] Figure 7 FIG2 is a block diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0036] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.
[0037] Figure 1 FIG. 1 is a flow chart of a task allocation method according to an embodiment of the present invention. The method may be executed by a computer device (eg, a server). Figure 1 As shown, the method includes the following contents.
[0038] S110: Quantitatively characterize the plurality of computing tasks and the plurality of computing resource units to obtain quantitative characterization results.
[0039] The above-mentioned computing tasks can be deep learning tasks, such as feature extraction tasks, network convolution tasks, matrix calculation tasks, etc. It should be understood that the computing tasks can also be other types of computing tasks. The present invention does not specifically limit the type of computing tasks.
[0040] The above-mentioned multiple computing resource units can be heterogeneous computing resources. For example, the multiple computing resource units can include at least two of a CPU, a GPU, an NPU, and an FPGA. It should be understood that the present invention does not specifically limit the type of computing resource unit.
[0041] Specifically, as shown in Table 1, each computing task can be characterized by at least one of the resource constraint type, task computing amount and QoS (Quality of Service) requirements, and each computing resource unit can be characterized by at least one of the hardware type, computing efficiency, unit computing cost and service quality.
[0042] Table 1
[0043]
[0044] It should be noted that cr represents the resource constraint type of the computing task, such as CPU task, GPU task or FPGA task; ht represents the corresponding hardware type; the running time of the computing task is the task computing volume CQ divided by the computing efficiency ce; the running cost is the unit computing cost c of the corresponding computing resource unit multiplied by the time; the service quality qos of the computing resource unit running the computing task needs to be greater than or equal to the QoS requirement QR of the computing task.
[0045] It should be understood that computing tasks and computing resource units may also be characterized by other attributes, which is not specifically limited in the present invention.
[0046] S120: For the multiple computing tasks and the multiple computing resource units, determine multiple objective functions and corresponding multiple constraints according to the quantitative characterization results.
[0047] Specifically, the problem of computing task allocation of heterogeneous computing resource units can be abstracted into a multi-objective optimization problem. For example, an enterprise user has n computing tasks {t1, t2, ..., t n}, and there are m heterogeneous computing resource units {U1, U2, ..., U m} is connected to the enterprise's deep learning service system, then the multi-objective optimization problem can be viewed as: how does the enterprise allocate N tasks to M service units so that multiple objective functions obtain optimal values, for example, the time function f1(t i ,U j ) as short as possible, executing the cost function f2(t i ,U j ) is as low as possible, the service quality function f3(t i ,U j ) as high as possible.
[0048] It should be understood that the above-mentioned multiple objective functions may include a time function, an execution cost function and / or a service quality function, etc. The number and type of objective functions can be set differently as needed, and the present invention does not make specific limitations on this.
[0049] In one embodiment of the present invention, the time function may satisfy the following requirement: the total running time of the plurality of computing tasks is the shortest, wherein the running time of each computing task in the plurality of computing tasks is represented by the task computation amount of the computing task divided by the computing efficiency of the corresponding computing resource unit. For example, as shown in formula (1).
[0050]
[0051] Among them, ti represents the i-th computing task, U j represents the jth computing resource unit, D(t i ) represents the computing time of the i-th computing task, represents the computational amount of the i-th computational task, Represents the computational efficiency of the jth computing resource unit.
[0052] In one embodiment of the present invention, the execution cost function may satisfy the following requirement: the total execution cost of the plurality of computing tasks is the lowest, wherein the execution cost of each computing task in the plurality of computing tasks is represented by the running time of the computing task multiplied by the unit computing cost of the corresponding computing resource unit. For example, as shown in Formula (2).
[0053]
[0054] Among them, t i represents the i-th computing task, U j represents the jth computing resource unit, C(t i ) represents the computational cost of the i-th computational task, represents the computational amount of the i-th computational task, represents the computational efficiency of the jth computing resource unit, represents the unit computation cost of the jth computing resource unit.
[0055] In one embodiment of the present invention, the service quality function may satisfy the following conditions: the total service quality of the multiple computing tasks is the highest, wherein the service quality of each computing task in the multiple computing tasks is characterized by the service quality of the corresponding computing resource unit, as shown in Formula (3).
[0056]
[0057] Among them, t i represents the i-th computing task, U j represents the jth computing resource unit, QoS(t i ) represents the service quality of the i-th computing task, Indicates the quality of service of the j-th computing resource unit.
[0058] By setting time function, execution cost function and service quality function, we can strive to improve computing efficiency, reduce computing costs and improve service quality.
[0059] It should be understood that the above description is merely exemplary, and the present invention does not impose any specific limitation on the specific representation of the time function, the execution cost function, and the service quality function.
[0060] In one embodiment of the present invention, the above constraints include at least one of the following: i Assigned to computing resource unit U j Calculate the quality of service (QoS) of the resource unit j Should be greater than or equal to the service quality requirement QR of the computing task i ;Hardware type of computing resource unit ht j The resource constraint type cr that should be satisfied for the computing task i For example, GPU tasks must run on GPU devices, where the associated demand relationship of computing devices can be represented by n×m dimensional matrices CR and HT.
[0061] For example, in one embodiment of the present invention, the constraint condition may be as shown in formula (4).
[0062]
[0063] Among them, t i represents the i-th computing task, U j represents the jth computing resource unit, represents the service quality of the j-th computing resource unit, represents the service quality requirement of the i-th computing task, htj represents the hardware type of the j-th computing resource unit, cr i It should be understood that the above description is only an example description, and the present invention does not specifically limit the specific representation of the constraint conditions.
[0064] S130: Based on multiple constraints, multiple objective functions are solved using a multi-objective optimization algorithm to obtain a non-inferior solution set, wherein each non-inferior solution in the non-inferior solution set corresponds to a task allocation strategy.
[0065] For example, under the constraints expressed by equation (4), a multi-objective optimization algorithm is used to solve the time function, execution cost function, and service quality function expressed by equations (1) to (3) above to obtain a non-inferior solution set.
[0066] The multi-objective optimization algorithm may be a SPEA2 algorithm, etc. It should be understood that the present invention does not limit the specific type of the multi-objective optimization algorithm.
[0067] In the embodiment of the present invention, different task allocation strategies can be mapped to corresponding solution spaces through coding representation. Specifically, a one-dimensional matrix can be used to represent the solution space of a multi-objective optimization problem, where the position of the elements in the matrix represents the task coding, and the size information of the elements in the matrix represents the coding of the computing resource unit. For example, the value of the i-th column of the matrix is j, which represents the computing task t i Allocated computing resource unit uj For example, Figure 2 As shown, the solution space is ε k =[3 4 1 2 3 11 4 3], which means that the computing task t1 is assigned to the computing resource unit u3, the computing task t2 is assigned to the computing resource unit u4, and so on. k For example, the matrix length |ε k | represents the number of computing tasks, and the element ε in the matrix k [x]∈Computational task set {t i}.
[0068] S140: Select an optimal solution from the non-inferior solution set, and allocate multiple computing tasks to multiple computing resource units for execution according to the optimal solution.
[0069] Specifically, the target selection method can be used to select the task allocation strategy that best meets the current goal from the non-inferior solution set, and based on this task allocation strategy, the computing tasks can be distributed to the corresponding heterogeneous hardware computing resource units for execution, so as to optimize the overall computing efficiency while satisfying resource constraints.
[0070] For example, the weighted sum of multiple objective function values for each non-inferior solution can be used, and then the optimal solution can be selected based on different requirements. For example, the non-inferior solution corresponding to the maximum or minimum can be selected as the optimal solution, and then multiple computing tasks can be allocated to multiple computing resource units based on the task allocation strategy corresponding to the optimal solution. It should be understood that the above description is merely exemplary, and the optimal solution selection method can be set as needed, and the present invention is not specifically limited to this.
[0071] According to the technical solution provided by the embodiment of the present invention, a quantitative characterization result is obtained by quantitatively characterizing multiple computing tasks and multiple computing resource units. For the multiple computing tasks and multiple computing resource units, multiple objective functions and corresponding multiple constraints are determined based on the quantitative characterization result. Based on the multiple constraints, the multiple objective functions are solved using a multi-objective optimization algorithm to obtain a set of non-inferior solutions. The optimal solution is selected from the non-inferior solution set, and the multiple computing tasks are allocated to multiple computing resource units for execution based on the optimal solution, thereby realizing the integration and reasonable allocation of computing resources.
[0072] In one embodiment of the present invention, the multi-objective optimization algorithm includes a genetic algorithm, and the length of the sequence targeted by the genetic operator in the solution search process of the genetic algorithm is variable.
[0073] For example, for the crossover operator in the genetic operator, the crossover operation can be continued or ended in real time based on the quality of the newly generated solution, that is, the crossover length is variable. For another example, for the mutation operator in the genetic operator, the mutation operation can be continued or ended in real time based on the quality of the newly generated solution, that is, the mutation length is variable.
[0074] According to the technical solution provided by the embodiment of the present invention, by introducing an improved variable-length sequence genetic operator, the search ability and convergence ability of the traditional genetic algorithm on the non-smooth and discontinuous boundaries in the solution space can be balanced, and the search efficiency for the local optimal boundary can be enhanced.
[0075] In one embodiment of the present invention, Figure 3 As shown, the genetic algorithm may include:
[0076] S310: Randomly generated N p feasible solutions as the initial population P; and generate an external archive set Q, and set Q to be empty.
[0077] Specifically, N can be generated by initialization function first p feasible solutions to ensure that there are enough initial samples for the algorithm to iteratively search.
[0078] It should be noted that in order to consider the richness and diversity of solution space samples, the initialization function should follow the basic elements of randomness and ensure that the distribution information contained in each solution meets the multi-objective constraints through the strategy of adding random functions and constraints.
[0079] S320: Assign fitness to the initialized population and execute the environment selection process.
[0080] In this embodiment of the present invention, the fitness allocation strategy considers both the dominant and dominated information of an individual, and has a strong ability to search for optimal solutions in a targeted manner. The dominant information is obtained from the individual's strength value, and the dominated information is obtained from the individual's quasi-fitness r(i). This is then combined with the density d(i) to ultimately generate the fitness f(i), as shown in Equation (5):
[0081] f(i)=r(i)+d(i) (5)
[0082] The components of the formula are as follows:
[0083] S(i)=|{j|j∈P+Q∧i>j}| (6)
[0084] r(i)=∑ j∈P+Q,j>i S(i) (7)
[0085]
[0086] Among them, the strength value S(i) represents the number of individuals dominated by individual i; the quasi-initial fitness r(i) represents the number of individuals dominating i; d(i) is the density function, σ k i is the Euclidean distance from individual i to the kth nearest neighbor. The algorithm defines the inverse of the distance to point k as its density estimate.
[0087] The environmental selection process is an important step in generating a new generation of archive sets Q from the population P. The process first copies all non-dominated individuals with fitness less than 1 and puts them into the external archive set, as shown in Equation (9):
[0088] Q t+1 ={i|i∈P+Q∧F(i)<1} (9)
[0089] When all individuals with fitness less than 1 are placed in the external archive set, the number of individuals in the external archive set |Q t+1 |With the specified scale N q If |Q t+1 | <N q , then perform the filling operation, that is, arrange P in increasing order of fitness t and Q t Among the remaining individuals, select the first (N q -|Q t+1 |) individuals with smaller fitness values are added to Q t+1 In. If |Q t+1 |>N q , then perform pruning operations from Q t+1 Individual i is removed from the archive, and the pruning process is shown in the following formula (10). Its essence is to delete the individuals closest to individual i in the archive set in sequence until |Q t+1 |=N q .
[0090]
[0091] S330: Determine whether the termination condition is met.
[0092] For example, when the current number of iterations reaches the maximum number of iterations, the termination condition is considered to be satisfied. It should be understood that the present invention does not impose any specific limitation on the setting of the termination condition, and it can be set according to different needs.
[0093] S340: When the termination condition is met, the solutions in the external archive set Q are returned as the non-inferior solution set.
[0094] S350: When the termination condition is not met, a pairing selection operation is performed, and an evolution operation is performed based on a genetic operator with variable sequence length to obtain a new population.
[0095] The N in the new population p The feasible solutions are used as the initial population, and the above steps b to e are iteratively performed.
[0096] Evolutionary operations may include crossover operations and mutation operations, etc. By performing pair selection operations and evolutionary operations, a new population is obtained, which can expand the search range of solutions and facilitate the generation of optimal solutions.
[0097] The embodiment of the present invention performs evolutionary operations based on genetic operators with variable sequence lengths, integrating an improved variable-length sequence genetic operator into the SPEA2 algorithm. Since the traditional SPEA2 algorithm is an unimproved strongly Pareto-dominated evolutionary algorithm, its individual dominance and dominated information are reflected by strength values, and it has a strong ability to search for directional optimization in the solution space. However, the traditional SPEA2 algorithm emphasizes global search speed, but its search and convergence capabilities on non-smooth and discontinuous boundaries are poor, and it is easy to ignore local optimal solutions. The overall computational efficiency is low, and some resources may also wait for an excessively long time due to resource constraints, resulting in overall task failure. The technical solution provided by the embodiment of the present invention, by integrating the improved variable-length sequence genetic operator into the SPEA2 algorithm, can balance the algorithm's search and convergence capabilities on non-smooth and discontinuous boundaries in the solution space on the basis of the global search capability of non-dominated solutions, thereby enhancing the search efficiency of local optimal boundaries.
[0098] In one embodiment of the present invention, the genetic operator includes a crossover operator, and the above-mentioned genetic operator based on variable sequence length performs an evolutionary operation to obtain a new population, including: randomly selecting a crossover starting point from any two feasible solutions to be crossed that satisfy multiple objective functions; performing a crossover operation on any two feasible solutions to be crossed item by item from the crossover starting point to the left or right; calculating multiple objective function values of each new feasible solution generated by each crossover operation; when the multiple objective function values of one of the new feasible solutions generated by the crossover operation are completely inferior to the multiple objective function values of any solution before the crossover operation, the crossover operation stops.
[0099] For example, Figure 4 As shown, t5 of the two feasible solutions to be crossed [3,4,1,2,3,1,4,2] and [4,3,2,1,2,1,2,3] is selected as the crossover starting point. The crossover operation is then performed on each solution item to the right, and the Pareto dominance of each new solution is calculated. This is the Pareto dominance of multiple objective functions (e.g., time function value, execution cost function value, and service quality function value) corresponding to each solution is calculated. If a fully inferior solution is found, the crossover range is no longer expanded. For example, if the time function value, execution cost function value, and service quality function value are all inferior to the time function value, execution cost function value, and service quality function value of any solution before the crossover operation, the crossover operation is terminated.
[0100] It should be noted that the initial solution generation strategy adds resource type constraints so that the generated solution space is a valid solution. Therefore, the crossover operation will not generate invalid solutions.
[0101] According to the technical solution provided by the embodiment of the present invention, by introducing an improved variable-length crossover operation, the search ability and convergence ability of the algorithm on non-smooth and discontinuous boundaries in the solution space can be balanced, thereby enhancing the search efficiency for local optimal boundaries.
[0102] In one embodiment of the present invention, the genetic operator includes a mutation operator, and the above-mentioned genetic operator based on variable sequence length performs an evolutionary operation to obtain a new population, including: randomly selecting a mutation point position in a feasible solution to be mutated that satisfies multiple objective functions; performing a mutation operation on the feasible solutions to be mutated item by item from the mutation point position to the left or right; calculating multiple objective function values of the new solution generated by each mutation operation; when the multiple objective function values of the new solution generated by the mutation operation are not completely inferior to the multiple objective function values of any solution before the mutation operation, the mutation operation continues; when the multiple objective function values of the new solution generated by the mutation operation are completely inferior to the multiple objective function values of any solution before the mutation operation, the mutation operation stops.
[0103] Specifically, the mutation operator in the embodiment of the present invention adopts a multi-gene mutation strategy. The number of gene mutations adopts the method of trial and error of adjacent genes. The mutations are performed randomly from the mutation point to the left or right, and the objective function value after each mutation operation is calculated. The solution set θ of each mutation operation is retained until the generated new solution is completely inferior to any solution in θ. The mutation operation stops and all θ are retained.
[0104] For example, Figure 5 As shown, t3 is selected as the mutation point position in the feasible solution to be mutated [2,3,1,4,2,3], and the value at position t3 is randomly mutated to 2, that is, the first mutation operation generates a new solution [2,3,2,4,2,3]; multiple objective function values corresponding to the new solution [2,3,2,4,2,3] are calculated, and F(1) is obtained; the mutation operation continues to the right, and the value at position t4 is randomly mutated to 3, that is, the second mutation operation generates a new solution [2,3,2,3,2,3], and multiple objective function values corresponding to the new solution [2,3,2,3,2,3] are calculated, and F(2) is obtained; if F(2) is not completely inferior to F(1), the third mutation operation is continued. When F(3) is completely inferior to F(2), the mutation operation stops.
[0105] The mutation operation itself is designed to prevent local convergence of the solution space and trapping in a local optimal scenario, and it inherently possesses randomness. In the original genetic algorithm, the mutation operation is single-point random, and the solution search is a single gene fragment. It has a strong convergence ability. When the boundary of the solution space is discontinuous and non-smooth, the fragmented optimal boundary seriously restricts the convergence ability of this type of algorithm. In the technical solution provided by the embodiment of the present invention, by introducing an improved variable-length gene fragment mutation operation, it is possible to balance the algorithm's search ability and convergence ability on the non-smooth and discontinuous boundaries in the solution space, thereby enhancing the efficiency of the search for the local optimal boundary.
[0106] In one embodiment of the present invention, the task allocation method further includes: performing resource constraint judgment on a new solution generated by each mutation operation, and discarding invalid solutions.
[0107] Invalid solutions generated during the exploration of the solution space must be discarded. Therefore, resource constraint judgment can be performed on the solutions generated by each mutation operation, and invalid solutions can be discarded. This ensures that the genes that mutate into new offspring in each population do not contain abnormal allocation schemes, taking into account the rationality and openness of the solution space search. Therefore, the solution set obtained for each mutation operation can be shown in Equation (11).
[0108]
[0109] All the above optional technical solutions can be arbitrarily combined to form optional embodiments of the present invention, and will not be described in detail here.
[0110] The following are embodiments of the apparatus of the present invention, which can be used to implement the method embodiments of the present invention. For details not disclosed in the apparatus embodiments of the present invention, please refer to the method embodiments of the present invention.
[0111] Figure 6 FIG. 1 is a block diagram of a task allocation device provided by an embodiment of the present invention. Figure 6 As shown, the task allocation device 600 includes:
[0112] A quantification module 610 is used to quantitatively characterize multiple computing tasks and multiple computing resource units to obtain quantitative characterization results;
[0113] A determination module 620 is configured to determine, for a plurality of computing tasks and a plurality of computing resource units, a plurality of objective functions and corresponding plurality of constraints according to the quantitative characterization results;
[0114] A solution module 630 is configured to solve multiple objective functions using a multi-objective optimization algorithm based on multiple constraints to obtain a set of non-inferior solutions, wherein each non-inferior solution in the set corresponds to a task allocation strategy;
[0115] The allocation module 640 is used to select an optimal solution from the non-inferior solution set and allocate multiple computing tasks to multiple computing resource units for execution according to the optimal solution.
[0116] According to the technical solution provided by the embodiment of the present invention, a quantitative characterization result is obtained by quantitatively characterizing multiple computing tasks and multiple computing resource units. For the multiple computing tasks and multiple computing resource units, multiple objective functions and corresponding multiple constraints are determined based on the quantitative characterization result. Based on the multiple constraints, the multiple objective functions are solved using a multi-objective optimization algorithm to obtain a set of non-inferior solutions. The optimal solution is selected from the non-inferior solution set, and the multiple computing tasks are allocated to multiple computing resource units for execution based on the optimal solution, thereby realizing the integration and reasonable allocation of computing resources.
[0117] In one embodiment of the present invention, the multi-objective optimization algorithm includes a genetic algorithm, and the length of the sequence targeted by the genetic operator in the solution search process of the genetic algorithm is variable.
[0118] In one embodiment of the present invention, the genetic algorithm includes:
[0119] a. Randomly generated N p feasible solutions as the initial population P; and generate an external archive set Q, and set Q to be empty;
[0120] b. Assign fitness to the initialized population and perform the environmental selection process;
[0121] c. Determine whether the termination conditions are met;
[0122] d. When the termination condition is met, return the solutions in the external archive set Q as the non-inferior solution set;
[0123] e. When the termination condition is not met, a pairing selection operation is performed, and an evolution operation is performed based on a genetic operator with variable sequence length to obtain a new population;
[0124] The N in the new population p The feasible solutions are used as the initial population, and the above steps b to e are iteratively performed.
[0125] In one embodiment of the present invention, the genetic operator includes a crossover operator, and the above-mentioned genetic operator based on variable sequence length performs an evolutionary operation to obtain a new population, including: randomly selecting a crossover starting point from any two feasible solutions to be crossed that satisfy multiple objective functions; performing a crossover operation on any two feasible solutions to be crossed item by item from the crossover starting point to the left or right; calculating multiple objective function values of each new feasible solution generated by each crossover operation; when the multiple objective function values of one of the new feasible solutions generated by the crossover operation are completely inferior to the multiple objective function values of any solution before the crossover operation, the crossover operation stops.
[0126] In one embodiment of the present invention, the genetic operator includes a mutation operator, and the above-mentioned genetic operator based on variable sequence length performs an evolutionary operation to obtain a new population, including: randomly selecting a mutation point position in a feasible solution to be mutated that satisfies multiple objective functions; performing a mutation operation on the feasible solutions to be mutated item by item from the mutation point position to the left or right; calculating multiple objective function values of the new solution generated by each mutation operation; when the multiple objective function values of the new solution generated by the mutation operation are not completely inferior to the multiple objective function values of any solution before the mutation operation, the mutation operation continues; when the multiple objective function values of the new solution generated by the mutation operation are completely inferior to the multiple objective function values of any solution before the mutation operation, the mutation operation stops.
[0127] In one embodiment of the present invention, the task allocation apparatus further includes a judgment module 650 for performing resource constraint judgment on a new solution generated by each mutation operation and discarding invalid solutions.
[0128] In one embodiment of the present invention, the objective function includes a time function, an execution cost function and / or a service quality function.
[0129] In one embodiment of the present invention, the time function satisfies: the total running time of multiple computing tasks is the shortest, wherein the running time of each computing task in the multiple computing tasks is represented by the task computing amount of the computing task divided by the computing efficiency of the corresponding computing resource unit.
[0130] In one embodiment of the present invention, the execution cost function satisfies: the total execution cost of multiple computing tasks is the lowest, wherein the execution cost of each computing task in the multiple computing tasks is represented by multiplying the running time of the computing task by the unit computing cost of the corresponding computing resource unit.
[0131] In one embodiment of the present invention, the service quality function satisfies: the total service quality of the multiple computing tasks is the highest, wherein the service quality of each computing task in the multiple computing tasks is characterized by the service quality of the corresponding computing resource unit.
[0132] In one embodiment of the present invention, the above-mentioned constraints include at least one of the following: the first computing task among multiple computing tasks is assigned to the first computing resource unit; the service quality of the first computing resource unit is greater than or equal to the service quality requirement of the first computing task; the hardware type of the first computing resource unit meets the resource constraint type of the first computing task.
[0133] In one embodiment of the present invention, each of the multiple computing tasks includes at least two of a feature extraction task, a network convolution task, and a matrix calculation task, and each of the multiple computing resource units includes at least two of a CPU, a GPU, an NPU, and an FPGA.
[0134] In one embodiment of the present invention, multiple computing tasks are characterized by at least one of resource constraint type, task computing amount and service quality requirements, and multiple computing resource units are characterized by at least one of hardware type, computing efficiency, unit computing cost and service quality.
[0135] The implementation process of the functions and effects of each module in the above-mentioned device is specifically described in the implementation process of the corresponding steps in the above-mentioned method, and will not be repeated here.
[0136] Figure 7 FIG. 7 is a block diagram of an electronic device 700 according to an embodiment of the present invention.
[0137] Reference Figure 7 The electronic device 700 includes a processing component 710, which further includes one or more processors, and a memory resource represented by a memory 720 for storing instructions executable by the processing component 710, such as an application. The application stored in the memory 720 may include one or more modules, each corresponding to a set of instructions. In addition, the processing component 710 is configured to execute the instructions to perform the above-mentioned task allocation method.
[0138] The electronic device 700 may further include a power supply component configured to perform power management of the electronic device 700, a wired or wireless network interface configured to connect the electronic device 700 to a network, and an input / output (I / O) interface. The electronic device 700 may operate based on an operating system stored in the memory 720, such as Windows Server 200. TM , Mac OSX TM , Unix TM , Linux TM , FreeBSD TM or similar.
[0139] A non-transitory computer-readable storage medium, when executed by the processor of the electronic device 700, enables the electronic device 700 to perform a task allocation method, comprising: quantitatively characterizing multiple computing tasks and multiple computing resource units to obtain quantitative characterization results; determining multiple objective functions and corresponding multiple constraints for the multiple computing tasks and multiple computing resource units based on the quantitative characterization results; solving the multiple objective functions using a multi-objective optimization algorithm based on the multiple constraints to obtain a set of non-inferior solutions, wherein each non-inferior solution in the set corresponds to a task allocation strategy; selecting an optimal solution from the set of non-inferior solutions, and allocating the multiple computing tasks to the multiple computing resource units for execution based on the optimal solution.
[0140] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present invention.
[0141] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0142] In the several embodiments provided in this application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of the units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0143] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.
[0144] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0145] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program check codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0146] In addition, it should be noted that the combination of the various technical features in this case is not limited to the combination described in the claims of this case or the combination described in the specific embodiments. All technical features recorded in this case can be freely combined or combined in any way unless there is a contradiction between them.
[0147] It should be noted that the above examples are merely specific embodiments of the present invention. Obviously, the present invention is not limited to the above examples, and many similar variations are possible. All variations directly derived from or associating with the present invention by those skilled in the art are intended to fall within the scope of protection of the present invention.
[0148] It should be understood that the first, second, etc. qualifiers mentioned in the embodiments of the present invention are only used to more clearly describe the technical solutions of the embodiments of the present invention and cannot be used to limit the scope of protection of the present invention.
[0149] The above are only preferred embodiments of the present invention and are not intended to limit the scope of protection of the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A task allocation method, characterized in that: include: Quantitatively characterize multiple computing tasks and multiple computing resource units to obtain quantitative characterization results; For the plurality of computing tasks and the plurality of computing resource units, determining a plurality of objective functions and corresponding plurality of constraints according to the quantitative characterization results; Based on the multiple constraints, a multi-objective optimization algorithm is used to solve the multiple objective functions to obtain a non-inferior solution set, wherein each non-inferior solution in the non-inferior solution set corresponds to a task allocation strategy; the multi-objective optimization algorithm includes a genetic algorithm, and the length of the sequence targeted by the genetic operator in the solution search process of the genetic algorithm is variable, and the multi-objective optimization algorithm is the SPEA2 algorithm; the genetic algorithm includes performing an evolutionary operation based on a genetic operator with a variable sequence length to obtain a new population: wherein the genetic operator includes a mutation operator, and the mutation operator adopts a multi-gene mutation strategy, and the number of gene mutations adopts a method of successive trial of adjacent genes. The method comprises executing an evolutionary operation based on a variable sequence length genetic operator to obtain a new population, comprising: randomly selecting a mutation point position in a feasible solution to be mutated that satisfies the multiple objective functions; performing a mutation operation on the feasible solution to be mutated item by item from the mutation point position to the left or right; calculating multiple objective function values of a new solution generated by each mutation operation; continuing the mutation operation when the multiple objective function values of the new solution generated by the mutation operation are not completely inferior to the multiple objective function values of any solution before the mutation operation; and stopping the mutation operation when the multiple objective function values of the new solution generated by the mutation operation are completely inferior to the multiple objective function values of any solution before the mutation operation. An optimal solution is selected from the non-inferior solution set, and the multiple computing tasks are allocated to the multiple computing resource units for execution according to the optimal solution.
2. The task allocation method according to claim 1, characterized in that: The genetic algorithm comprises: a. Randomly generated N p feasible solutions as the initial population P; and generate an external archive set Q, and set Q to be empty; b. assigning fitness to the initialized population and performing an environment selection process; c. Determine whether the termination conditions are met; d. When the termination condition is met, returning the solutions in the external archive set Q as the non-inferior solution set; e. When the termination condition is not met, performing a pairing selection operation and performing an evolution operation based on a genetic operator with variable sequence length to obtain a new population; The N in the new population p feasible solutions as the initialization population, and iteratively perform the above steps b to e.
3. The task allocation method according to claim 2, characterized in that: The genetic operator includes a crossover operator. The genetic operator based on variable sequence length performs an evolution operation to obtain a new population, including: Randomly selecting a crossover starting point from any two feasible solutions to be crossed that satisfy the multiple objective functions; Performing a crossover operation on any two feasible solutions to be crossed item by item from the crossover starting point to the left or right; Calculate multiple objective function values for each new feasible solution generated by each crossover operation; When multiple objective function values of one of the new feasible solutions generated by the crossover operation are completely inferior to multiple objective function values of any solution before the crossover operation, the crossover operation stops.
4. The task allocation method according to claim 1, characterized in that: Also includes: The resource constraints of the new solutions generated by each mutation operation are judged, and invalid solutions are discarded.
5. The task allocation method according to any one of claims 1 to 4, characterized in that: The objective function includes a time function, an execution cost function and / or a service quality function.
6. The task allocation method according to claim 5, characterized in that: The time function satisfies: the total running time of the multiple computing tasks is the shortest, wherein the running time of each computing task in the multiple computing tasks is represented by the task computing amount of the computing task divided by the computing efficiency of the corresponding computing resource unit.
7. The task allocation method according to claim 5, characterized in that: The execution cost function satisfies: the total execution cost of the multiple computing tasks is the lowest, wherein the execution cost of each computing task in the multiple computing tasks is represented by multiplying the running time of the computing task by the unit computing cost of the corresponding computing resource unit.
8. The task allocation method according to claim 5, characterized in that: The service quality function satisfies: the total service quality of the multiple computing tasks is the highest, wherein the service quality of each computing task in the multiple computing tasks is represented by the service quality of the corresponding computing resource unit.
9. The task allocation method according to any one of claims 1 to 4, characterized in that: The constraint condition includes at least one of the following: A first computing task among the plurality of computing tasks is allocated to a first computing resource unit; The quality of service of the first computing resource unit is greater than or equal to the quality of service requirement of the first computing task; The hardware type of the first computing resource unit meets the resource constraint type of the first computing task.
10. The task allocation method according to any one of claims 1 to 4, characterized in that: The multiple computing tasks include at least two of feature extraction tasks, network convolution tasks, and matrix calculation tasks, and the multiple computing resource units include at least two of a central processing unit (CPU), a graphics processing unit (GPU), a neural network processor (NPU), and a field programmable gate array (FPGA).
11. The task allocation method according to any one of claims 1 to 4, characterized in that: Each of the multiple computing tasks is characterized by at least one of a resource constraint type, a task computing amount, and a service quality requirement; and each of the multiple computing resource units is characterized by at least one of a hardware type, computing efficiency, a unit computing cost, and a service quality.
12. A task allocation device, characterized in that: include: A quantification module is used to quantitatively characterize multiple computing tasks and multiple computing resource units to obtain quantitative characterization results; a determination module, configured to determine, for the plurality of computing tasks and the plurality of computing resource units, a plurality of objective functions and corresponding plurality of constraints according to the quantitative characterization results; A solution module is used to solve the multiple objective functions based on the multiple constraints using a multi-objective optimization algorithm to obtain a non-inferior solution set, wherein each non-inferior solution in the non-inferior solution set corresponds to a task allocation strategy; the multi-objective optimization algorithm includes a genetic algorithm, and the length of the sequence targeted by the genetic operator in the solution search process of the genetic algorithm is variable, and the multi-objective optimization algorithm is the SPEA2 algorithm; the genetic algorithm includes performing an evolutionary operation based on a genetic operator with variable sequence length to obtain a new population, wherein the genetic operator includes a mutation operator, and the mutation operator adopts a multi-gene mutation strategy, and the number of gene mutations adopts a neighboring gene-by-neighbor mutation strategy. The method is a trial and error method, wherein the genetic operator based on a variable sequence length executes an evolution operation to obtain a new population, including: randomly selecting a mutation point position in a feasible solution to be mutated that satisfies the multiple objective functions; performing a mutation operation on the feasible solution to be mutated item by item from the mutation point position to the left or right; calculating multiple objective function values of a new solution generated by each mutation operation; continuing the mutation operation when the multiple objective function values of the new solution generated by the mutation operation are not completely inferior to the multiple objective function values of any solution before the mutation operation; and stopping the mutation operation when the multiple objective function values of the new solution generated by the mutation operation are completely inferior to the multiple objective function values of any solution before the mutation operation. An allocation module is used to select an optimal solution from the non-inferior solution set and allocate the multiple computing tasks to the multiple computing resource units for execution according to the optimal solution.
13. A computer-readable storage medium having computer-executable instructions stored thereon, characterized in that: When the executable instructions are executed by a processor, the task allocation method according to any one of claims 1 to 11 is implemented.
14. An electronic device, characterized in that: The electronic device comprises: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the task allocation method according to any one of claims 1 to 11.