Processor resource scheduling method and device
By building the initial population collection and setting transfer parameters and penalty parameters, optimizing processor resource scheduling, the problem of low GPU resource utilization in the existing technology is solved, and the resource utilization rate and task processing efficiency of cloud computer products are improved.
Patent Information
- Application Number
- CN202410871024.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-01
- Publication Date
- 2024-11-01
AI Technical Summary
The existing GPU resource scheduling algorithm (packaged scheduling) in cloud computing failed to make full use of GPU resources, resulting in low GPU resource utilization, limiting the profitability of cloud computer products, and not considering that the GPU load is lighter after the task is completed. Condition.
A processor resource scheduling method is proposed. By building an initial population set, setting transfer parameters and penalty parameters, performing optimization iterations, generating target population sets, and determining the optimal allocation plan based on the fitness value to improve the utilization rate of processor resources .
By setting penalty parameters and transfer parameters, processor resource scheduling is optimized, the utilization rate of GPU resources and task processing efficiency are improved, and the profitability of cloud computer products is improved.
Smart Images

Figure CN118885288A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the fields of cloud computing and big data, and in particular to a processor resource scheduling method and device. Background Art
[0002] Cloud computing (English: cloud computing) is an Internet-based computing method, through which shared software and hardware resources and information can be provided to various computer terminals and other devices on demand, using the infrastructure provided by the service provider for computing and storage. In current technology, the scheduling of graphics processing units (GPUs) in cloud desktop environments is mainly achieved through binpack scheduling, the core principle of which is to prioritize the scheduling of incoming tasks to GPUs with high computing power and video memory usage.
[0003] However, the bin-packing scheduling algorithm only considers the computing power and memory usage of multiple GPUs when new tasks arrive, and does not consider the situation where the GPU load is light after some computing tasks are completed. This results in low GPU resource utilization, which in turn limits the profitability of cloud computer products. Summary of the invention
[0004] The present disclosure aims to solve one of the technical problems in the related art at least to some extent.
[0005] To this end, an objective of the present disclosure is to provide a processor resource scheduling method.
[0006] A second objective of the present disclosure is to provide a processor resource scheduling device.
[0007] A third objective of the present disclosure is to provide an electronic device.
[0008] A fourth object of the present disclosure is to provide a non-transitory computer-readable storage medium.
[0009] A fifth object of the present disclosure is to provide a computer program product.
[0010] To achieve the above-mentioned purpose, the first aspect of the present disclosure proposes a processor resource scheduling method, including: obtaining a set of tasks to be executed and a set of processors, and constructing an initial population set based on the set of processors and the set of tasks to be executed, wherein the initial population set includes multiple individuals, each of which is a set of server allocation schemes, and the server allocation scheme is the correspondence between the servers in the processor set executing the tasks in the set of tasks to be executed; for any individual in the initial population set, determining the transfer parameters and penalty parameters of the individual; optimizing and iterating the initial population set based on the transfer parameters and the penalty parameters until the iteration ends to generate a target population set; calculating the fitness value of each individual in the target population set, and taking the factor with the largest fitness value in the target population set as the target factor, taking the allocation scheme corresponding to the target factor as the target allocation scheme, and scheduling the processors in the processor set based on the target allocation scheme.
[0011] According to one embodiment of the present disclosure, constructing the initial population set based on the processor set and the task set to be executed includes: obtaining the physical environment parameters of the processor set and the number of tasks of the task set to be executed, and determining the crossover rate and mutation rate of the initial population set; determining the population size parameter and the number of population iterations based on the physical environment parameters and the number of tasks; and constructing the initial population set based on the population size parameter, the number of population iterations, the crossover rate and the mutation rate.
[0012] According to one embodiment of the present disclosure, determining the population size parameter based on the physical environment parameter and the number of tasks includes: obtaining a basic population size and a first preset adjustment coefficient, and determining a task change index based on the number of tasks; calculating the population size parameter based on the basic population size, the task change index, the first preset adjustment coefficient and the task change index.
[0013] According to one embodiment of the present disclosure, the population size parameter is calculated based on the basic population size, the task change index, the first preset adjustment coefficient and the task change index, including: adding the task change index and the number of tasks to calculate a first factor; multiplying the first factor and the first preset adjustment coefficient to calculate a second factor; adding the second factor and the basic population size to calculate the population size parameter.
[0014] According to one embodiment of the present disclosure, the number of population iterations is determined based on the physical environment parameters and the number of tasks, including: obtaining a basic number of iterations and a second preset adjustment coefficient, and determining a task change index based on the number of tasks; and calculating and obtaining the number of population iterations based on the basic number of iterations, the second preset adjustment coefficient and the task change index.
[0015] According to one embodiment of the present disclosure, determining the mutation rate of the initial population set includes: obtaining a basic mutation rate and a third preset adjustment coefficient, and obtaining the resource utilization of the processor set; and calculating and obtaining the mutation rate of the initial population set based on the basic mutation rate, the third preset adjustment coefficient and the resource utilization.
[0016] According to one embodiment of the present disclosure, determining the crossover rate of the initial population set includes: obtaining a basic crossover rate, a fourth preset adjustment coefficient, a processor diversity index and an optimal diversity value; and calculating and obtaining the crossover rate of the initial population set based on the basic crossover rate, the fourth preset adjustment coefficient, the processor diversity index and the optimal diversity value.
[0017] According to one embodiment of the present disclosure, the calculation of the fitness value of each individual in the target population set includes: for any individual in the target population set, obtaining the processor usage rate of the solution corresponding to the individual; obtaining the first weight, second weight and third weight corresponding to the processor usage rate, transfer parameter and penalty parameter of the individual; and calculating the fitness value of the individual based on the processor usage rate, transfer parameter, penalty parameter, the first weight, the second weight and the third weight of the individual.
[0018] To achieve the above-mentioned purpose, the second aspect of the present disclosure proposes a processor resource scheduling device, including: an acquisition module, used to acquire a set of tasks to be executed and a set of processors, and construct an initial population set based on the set of processors and the set of tasks to be executed, wherein the initial population set includes multiple individuals, each of which is a set of server allocation schemes, and the server allocation scheme is the correspondence between the servers in the processor set executing the tasks in the set of tasks to be executed; a determination module, used to determine the transfer parameters and penalty parameters of the individual for any individual in the initial population set; an optimization module, used to optimize and iterate the initial population set based on the transfer parameters and the penalty parameters until the iteration ends to generate a target population set; a determination module, used to calculate the fitness value of each individual in the target population set, and take the factor with the largest fitness value in the target population set as the target factor, take the allocation scheme corresponding to the target factor as the target allocation scheme, and schedule the processors in the processor set based on the target allocation scheme.
[0019] To achieve the above-mentioned purpose, the third aspect embodiment of the present disclosure proposes an electronic device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to implement the processor resource scheduling method as described in the first aspect embodiment of the present disclosure.
[0020] To achieve the above-mentioned purpose, the fourth aspect embodiment of the present disclosure proposes a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to implement the processor resource scheduling method as described in the first aspect embodiment of the present disclosure.
[0021] To achieve the above-mentioned purpose, the fifth aspect of the present disclosure proposes a computer program product, including a computer program, which, when executed by a processor, is used to implement the processor resource scheduling method as described in the first aspect of the present disclosure.
[0022] Therefore, by setting penalty parameters and transfer parameters, the iteration direction of the initial population set can be restricted, the target population set can be obtained, and the optimal target factor can be determined according to the fitness value as the final allocation plan, so that an allocation plan suitable for the current set of tasks to be executed and the set of processors can be selected, thereby improving the efficiency of subsequent processors in processing tasks and the resource utilization of the processor set. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Figure 1 is a schematic diagram of a processor resource scheduling method according to an embodiment of the present disclosure;
[0024] Figure 2 is a schematic diagram of another processor resource scheduling method according to an embodiment of the present disclosure;
[0025] Figure 3 Generate a distribution map of 100 points in the interval [0, 1] using random initialization and good point set initialization;
[0026] Figure 4 is a schematic diagram of another processor resource scheduling method according to an embodiment of the present disclosure;
[0027] Figure 5 is a schematic diagram of a processor resource scheduling device according to an embodiment of the present disclosure;
[0028] Figure 6 is a schematic diagram of an electronic device according to an embodiment of the present disclosure. DETAILED DESCRIPTION
[0029] Embodiments of the present disclosure are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present disclosure, and should not be construed as limiting the present disclosure.
[0030] The acquisition, storage, use, and processing of data in the technical solution disclosed in this disclosure are in compliance with the relevant provisions of relevant laws and regulations.
[0031] Figure 1 is a schematic diagram of a processor resource scheduling method according to an embodiment of the present disclosure, such as Figure 1 As shown, the processor resource scheduling method includes the following steps:
[0032] S101, obtain a set of tasks to be executed and a set of processors, and construct an initial population set based on the set of processors and the set of tasks to be executed, wherein the initial population set includes multiple individuals, each individual is a set of server allocation schemes, and the server allocation scheme is the correspondence between the servers in the processor set executing the tasks in the set of tasks to be executed.
[0033] The processor resource scheduling method of the embodiment of the present application can be applied to the GPU scheduling scenario in a cloud desktop environment. The executor of the processor resource scheduling of the embodiment of the present application can be the processor resource scheduling device of the embodiment of the present application, and the processor resource scheduling device can be set on an electronic device.
[0034] It should be noted that the processor set is a set of processors in cloud computer products or local computer products. The processor set can be applied to a variety of scenarios, for example, graphic design office scenarios: 3D graphic design, such as architecture, automobile, ship, aircraft, animation design, etc., teaching and training computer room scenarios: design majors in higher vocational colleges, architectural majors using 3D design software, non-linear editing software, etc., Internet cafes and individual customer game scenarios: cloud game services allow users to play high-quality video games on any device through cloud desktops without the need for high-end local hardware.
[0035] The processor set includes multiple processors, and the processors can be of various types, without any limitation herein. For example, the processor can be a graphics processing unit (GPU) or a central processing unit (CPU).
[0036] The pending task set is the tasks that need to be processed currently. The pending task set may contain one task or multiple tasks, depending on the actual situation.
[0037] In the embodiment of the present disclosure, the initial population set is a set of allocation schemes, and the initial population set includes multiple individuals, each of which is a set of server allocation schemes. For example, the set of tasks to be executed may include tasks A and B to be executed, and the set of processors may include processors C and D. Then the individuals in the initial population set may include (AC BD)(AD BC)(AC AD)(BC BD), where (AC BD) is taken as an example, AC indicates that processor C processes task A, and BD indicates that processor D processes task B.
[0038] It should be noted that the initial population set can be manually established or established through a population establishment model, and the set of tasks to be executed and the set of processors can be input into the population establishment model to generate the initial population set. The population establishment model is trained in advance and stored in the storage space of the electronic device to facilitate retrieval and use when needed.
[0039] S102, for any individual in the initial population set, determine the individual's transfer parameter and penalty parameter.
[0040] A task can be transferred from one processor to another for processing. In the disclosed embodiment, in order to prevent the task from being frequently transferred between processors, the iteration direction of the population is restricted by setting the transfer parameter. At the same time, in order to prevent the computing power / video memory required by the task from exceeding the maximum computing power and maximum storage capacity in the individual corresponding solution, a penalty parameter is set.
[0041] It should be noted that transition parameters describe the probability of transition between states. For example, in a hidden Markov model, transition parameters define the probability of transition between hidden states, that is, the probability of transitioning to another hidden state at the next moment given the current hidden state. These parameters are part of the model structure and are used to describe the dependencies between states, which are crucial for model learning and prediction.
[0042] Penalty parameters are an important concept used in regularization techniques, and are commonly found in a variety of machine learning models such as linear regression, logistic regression, and neural networks. Regularization is to prevent the model from overfitting, that is, the model performs well on the training data, but has poor generalization ability on unseen data. By adding a penalty term to the loss function, the size of the model parameters can be limited, the sparsity of the model parameters can be promoted, or the complexity of the model can be reduced. Common penalty parameters include λ (lambda), which plays a key role in L1 regularization (Lasso regression) and L2 regularization (Ridge regression). L1 regularization tends to produce sparse solutions, causing some parameters to become 0, thereby achieving feature selection; while L2 regularization tends to reduce the values of all parameters, making the model smoother. The choice of penalty parameters (its size) has a direct impact on the performance of the model, and the optimal penalty parameter value is usually determined through cross-validation.
[0043] It should be noted that the transfer parameter and penalty parameter of an individual can be calculated and obtained by a transfer parameter algorithm and a penalty parameter algorithm respectively. The transfer parameter algorithm and the penalty parameter algorithm are designed in advance and can be changed according to actual design needs, and no limitation is made here.
[0044] S103, optimizing the initial population set iteratively based on the transfer parameter and the penalty parameter until the iteration ends, and generating a target population set.
[0045] In the disclosed embodiment, the initial population set can be optimized and iterated by using a metaheuristic algorithm. It should be noted that metaheuristic algorithms are a class of advanced search strategies that are designed to solve complex optimization problems, especially those that are difficult to solve with precise methods (such as linear programming and dynamic programming). Metaheuristic algorithms combine global search capabilities and local search techniques to find high-quality solutions that are close to the optimal solution in a limited time.
[0046] It should be noted that the meta-heuristic algorithm in the present disclosure may be of various types, and no limitation is made herein. For example, the meta-heuristic algorithm in the present disclosure may be a genetic algorithm, a gray wolf optimization algorithm, and the like.
[0047] S104, calculating the fitness value of each individual in the target population set, taking the factor with the largest fitness value in the target population set as the target factor, taking the allocation scheme corresponding to the target factor as the target allocation scheme, and scheduling the processors in the processor set based on the target allocation scheme.
[0048] The fitness value is a parameter value used to evaluate the quality of the solution corresponding to an individual. It should be noted that the larger the fitness value of an individual, the more suitable its corresponding allocation solution is for the current set of tasks to be executed and the set of processors. Therefore, the optimal allocation solution can be determined by the size of each individual's fitness value.
[0049] In the disclosed embodiment, firstly, a set of tasks to be executed and a set of processors are obtained, and an initial population set is constructed according to the set of processors and the set of tasks to be executed, wherein the initial population set includes a plurality of individuals, each of which is a set of server allocation schemes, and the server allocation scheme is the correspondence between the servers in the processor set executing the tasks in the set of tasks to be executed, and then for any individual in the initial population set, the transfer parameter of the individual is determined, and a penalty parameter is set for the individual, and then the initial population set is optimized and iterated based on the transfer parameter and the penalty parameter until the iteration ends, and a target population set is generated, and finally the fitness value of each individual in the target population set is calculated, and the factor with the largest fitness value in the target population set is used as the target factor, and the allocation scheme corresponding to the target factor is used as the target allocation scheme, and the processors in the processor set are scheduled based on the target allocation scheme. Thus, by setting the penalty parameter and the transfer parameter, the iteration direction of the initial population set can be restricted, the target population set can be obtained, and the optimal target factor can be determined according to the fitness value as the final allocation scheme, so that the allocation scheme suitable for the current set of tasks to be executed and the set of processors can be selected, and the efficiency of subsequent processor processing tasks and the resource utilization rate of the processor set can be improved.
[0050] In the embodiment of the present disclosure, the optimization iteration of the initial population set may perform the following process:
[0051] If the number of reproduction generations reproductionNum is less than the number of population iterations generations, reproductionNum increases by 1 and the process goes to step (1). Otherwise, the process goes to step (6).
[0052] Step (1), perform the selection operation: If the number of iterations is less than populationSize / 2, randomly select 5 individuals from the population, and then select the individual with the largest fitness from the 5 individuals as the parent, denoted as parent1. Use the same method to select the second parent, denoted as parent2; otherwise, go to step (4).
[0053] Step (2), perform a crossover operation: randomly generate a number between [0, 1) and compare it with crossoverRate.
[0054] If it is greater, then child = parent1, child2 = parent2; otherwise, a random integer between [1, parent1.genes.length-2] is selected as the crossover point. child1 inherits the genetic information of parent1 before the crossover point and the genetic information of parent2 after the crossover point; child2 inherits the genetic information of parent2 before the crossover point and the genetic information of parent1 after the crossover point.
[0055] Step (3), perform mutation operation: traverse the genes of chi ld1 and chi ld2, for each gene, randomly generate a number between [0, 1) and compare it with mutationRate, if the number is less than the mutation rate, randomly select a GPU index as the new gene value to replace the original gene value. Add chi ld1 and chi ld2 to the next generation population, the number of iterations iterationNum increases by 1, and go to step 5.
[0056] Step (4), calculate the fitness of each individual in the new generation population, select the individual with the largest fitness, and compare it with the fitness of the best individual bestIndividual. If the fitness is larger, update bestIndividual.
[0057] Step (5): completely replace the original population with the new generation population and go to step 4.
[0058] Step (6), output bestIndividual, and end.
[0059] In the above embodiment, the initial population set is constructed according to the processor set and the task set to be executed, and the initial population set can also be constructed by Figure 2 Explaining further, the method includes:
[0060] S201, obtaining physical environment parameters of a processor set and the number of tasks in a task set to be executed, and determining a crossover rate and a mutation rate of an initial population set.
[0061] It should be noted that the crossover rate determines the probability of two parent individuals performing a crossover operation to produce a new individual in each generation. A higher crossover rate means that more new individuals will be generated by combining the genetic information of existing individuals, which helps the algorithm to explore more extensively in the solution space. The crossover rate is usually set to a value close to 1, such as between 0.8 and 0.99, because the crossover operation is the main way to generate new solutions in the genetic algorithm, which helps the global search ability of the genetic algorithm.
[0062] The mutation rate refers to the probability that an individual's genes will change randomly when they are copied to the next generation. The mutation operation increases the randomness and diversity of the genetic algorithm, which helps to prevent the algorithm from converging to a local optimal solution too early. The mutation rate is usually set low, such as between 0.001 and 0.1, because too many mutations may undermine the stability of the algorithm and cause the search process to become disordered.
[0063] In an embodiment of the present disclosure, the crossover rate of the initial population set is determined, and the basic crossover rate, the fourth preset adjustment coefficient, the processor diversity index and the optimal diversity value can be obtained. Then, based on the basic crossover rate, the third preset adjustment coefficient, the processor diversity index and the optimal diversity value, the crossover rate of the initial population set is calculated.
[0064] The formula for calculating the crossover rate can be expressed as follows:
[0065] CrossoverRate=BaseRate+γ×(GPUDiversityIndex-OptimalDiversity)
[0066] Among them, BaseRate is the basic crossover rate. For example, according to the current GPU diversity, the value can be 0.4, that is, at least 40% of the individuals will perform crossover operations.
[0067] γ: The fourth preset adjustment coefficient controls the effect of GPU performance diversity on the crossover rate. It should be noted that the fourth preset adjustment coefficient is set in advance and can be adjusted according to actual design needs. No adjustment is made here. For example, the third preset adjustment coefficient can be 0.05, which means that if the difference between the current GPU performance diversity and the optimal diversity is 1, the crossover rate increases by 0.05.
[0068] GPUDiversityIndex: GPU diversity index, reflecting the differences in GPU computing power and memory capacity.
[0069] OptimalDiversity: The optimal diversity value, which indicates the desired GPU performance diversity level. The calculation process of OptimalDiversity is as follows:
[0070] Data collection: Collect resource scheduling and task execution data over a period of time, and divide the time period according to specific events, such as GPU hardware upgrades, energy management strategy adjustments, etc. Historical data includes:
[0071] GPU configuration (computing power, memory capacity, etc.).
[0072] Task characteristics (CPU requirements, memory requirements, execution time, etc.).
[0073] System performance indicators (task completion rate, average execution time, resource utilization, etc.).
[0074] Categorizing data: The historical data is divided into three groups based on the diversity of GPU configurations, and the diversity level is defined based on the standard deviation of computing power and memory capacity:
[0075] D=ω c ·σ c +ω m ·σ m
[0076] Among them, σ c is the standard deviation of GPU computing power. m is the standard deviation of GPU memory capacity. ω c ,ω m is a weight used to balance the importance of computing power and memory capacity in the diversity metric.
[0077] Low diversity group: The diversity is in the range of [0, 0.33) and the standard deviation is small, indicating that the GPU configurations are relatively similar.
[0078] Medium diversity group: The diversity is in the interval [0.33, 0.66) and the standard deviation is in the medium range.
[0079] High diversity group: The diversity is in the range of [0.66, 1] and the standard deviation is large, indicating that the GPU configurations are significantly different.
[0080] Performance Analysis: Perform performance analysis for each diversity group. Evaluate each group’s average task completion rate (TCR), average execution time (AET), and average resource utilization (UR). This can help identify which diversity level is associated with the best performance.
[0081]
[0082] Determine the optimal diversity: Based on the performance indicators, calculate a comprehensive performance score (P) for each diversity grouping. By comparing the comprehensive performance scores (P) of different diversity groups, the group with the highest score represents the optimal GPU configuration diversity level.
[0083]
[0084] Among them, ω TCR ,ω AET and ω UR is the weight used to balance the importance of different performance indicators.
[0085] To determine the mutation rate of the initial population set, the basic mutation rate and the third preset adjustment coefficient can be first obtained, the resource utilization of the processor set can be obtained, and then the mutation rate of the initial population set can be calculated based on the basic mutation rate, the third preset adjustment coefficient and the resource utilization.
[0086] The formula for calculating the mutation rate can be expressed as follows:
[0087] MutationRate=BaseMutationRate+δ×(1-ResourceUtilizationRatio)
[0088]
[0089] Among them, BaseMutationRate: The base mutation rate is designed in advance and can be changed according to actual design needs. There is no limitation here. For example, the base mutation rate can be 0.001 (that is, each gene has a probability of at least one in a thousand to mutate).
[0090] δ: The third preset adjustment coefficient is used to control the impact of resource utilization on the mutation rate. The third preset adjustment coefficient is set in advance and can be changed according to actual design needs. There is no limitation here. For example, the third preset adjustment coefficient can be 0.002, which means that if the resource utilization rate is 10%, the mutation rate increases by 0.0018.
[0091] ResourceUtilizationRatio: resource utilization, calculate the average utilization of all current GPUs.
[0092] GPUComputeUtilization: The utilization of each GPU computing resource.
[0093] GPUMemoryUtilization: The utilization of each GPU memory resource.
[0094] TotalNumberOfGpus: Total number of GPUs
[0095] The mutation rate is adjusted based on resource utilization, so that when resources are underutilized, the mutation rate is increased, thereby improving the algorithm's ability to explore new solutions in the hope of finding solutions that more effectively utilize existing resources. This helps to better utilize these resources when resources are more abundant, improve overall resource utilization efficiency, and reduce the number of task transfers.
[0096] S202, determining a population size parameter and a population iteration number based on a physical environment parameter and a task number.
[0097] In an embodiment of the present disclosure, the population size parameters are determined based on the physical environment parameters and the number of tasks. The basic population size and the first preset adjustment coefficient are first obtained, and the task change index is determined based on the number of tasks. Then, the population size parameters are calculated based on the basic population size, the task change index, the first preset adjustment coefficient and the task change index.
[0098] It should be noted that to calculate the population size parameter, the task change index and the number of tasks can be added to calculate the first factor, and then the first factor and the first preset adjustment coefficient can be multiplied to calculate the second factor, and finally the second factor and the basic population size can be added to calculate the population size parameter.
[0099] The formula for calculating the population size parameter can be expressed as follows:
[0100] PopulationSize=BaseSize+α×(GPUCount+TaskVariabilityIndex)
[0101] Among them, BaseSize: basic population size, this parameter is a starting point of the algorithm, which is determined according to the number of GPUs and the number of tasks to be processed of the current cloud computer product. In this application, the example value is 20.
[0102] α: The first preset adjustment coefficient, which is used to characterize the impact of changes in the number of GPUs and the number of tasks on the population size. For example, when α is 2, it means that when the number of GPUs increases by 5 and the task change index increases by 1, the population size increases by 12.
[0103] GPUCount: The total number of available GPUs.
[0104] TaskVariabilityIndex: Task variation index. By introducing the task variation index, when the task variation rate increases, that is, the solution space becomes larger, the solution space can be searched more fully by increasing the population size accordingly, thus having a greater probability of finding the optimal solution in the solution space. The calculation method is as follows:
[0105]
[0106] Tasks current : The number of tasks in the current time period; Tasks previous The number of tasks in the last time period. The length of the time period should be determined according to the nature of the specific problem.
[0107] In an embodiment of the present disclosure, the number of population iterations is determined based on physical environment parameters and the number of tasks. The basic number of iterations and the second preset adjustment coefficient are first obtained, and the task change index is determined based on the number of tasks. Then, the number of population iterations is calculated based on the basic number of iterations, the second preset adjustment coefficient and the task change index.
[0108] The formula for calculating the number of population iterations can be expressed as follows:
[0109] Generations=BaseGenerations-β×TaskStabilityIndex
[0110] Among them, BaseGenerations: basic generation number, the value is 500.
[0111] β: The second preset adjustment coefficient is used to control the impact of task stability on the number of generations. The second preset adjustment coefficient is set in advance and can be changed according to actual design needs. No evaluation is made here. For example, the second preset adjustment coefficient can be 100, which means that when the task stability index increases by 0.1, the number of population iterations decreases by 10.
[0112] TaskStabilityIndex: Task stability index. This index is opposite to the task change index. The larger the value, the more unstable the task. This is because when the task changes frequently (i.e., the task stability is low), the algorithm should increase the number of iterations to adapt to such changes and find a better scheduling solution. On the contrary, if the task is relatively stable, the number of iterations can be reduced, and it can run efficiently in a stable environment without excessive resource consumption.
[0113] The task stability index is calculated as follows:
[0114] TaskStabilityIndex=1-TaskVariabilityIndex
[0115] Among them, TaskStabilityIndex is the task stability index, and TaskVariabilityIndex is the task variability index.
[0116] S203, constructing an initial population set based on population size parameters, population iteration times, crossover rate, and mutation rate.
[0117] In the disclosed embodiments, there are multiple methods for constructing an initial population set based on population size parameters, population iteration times, crossover rate, and mutation rate, which are not limited here. For example, the initial population set can be constructed by random initialization or good point set initialization. Taking the construction of the initial population set by good point set initialization as an example, the population can be first initialized according to the good point set theory to obtain a more uniformly distributed initialization population and improve the diversity of the initial population. The population size is populationSize. The definition and construction method of the good point set are given by the following method:
[0118] Assume G s is a unit cube in s-dimensional Euclidean space, if r∈G s ,but
[0119] gather
[0120] If the deviation of formula (1) satisfies formula (2):
[0121] φ(n)=C(r, ε)n -1+ε (2)
[0122] Where C(r, ε) is a constant that is only related to r and ε (any positive number); then P n (k) is the set of good points,
[0123] r is a good point. To intuitively see the advantages of using a good point set for initialization, for example, Figure 3 As shown, Figure 3 A distribution graph of 100 points is generated in the interval [0, 1] using random initialization and good point set initialization respectively.
[0124] In the disclosed embodiment, the physical environment parameters of the processor set and the number of tasks of the task set to be executed are first obtained, and the crossover rate and mutation rate of the initial population set are determined. Then, the population size parameters and the number of population iterations are determined based on the physical environment parameters and the number of tasks. Finally, the initial population set is constructed based on the population size parameters, the number of population iterations, the crossover rate and the mutation rate. Thus, the number of population iterations in the algorithm is adjusted according to the stability of the number of tasks currently to be processed, thereby achieving the effect of improving resource utilization. The crossover rate in the algorithm is further determined according to the diversity index of the processor. When the diversity of the processor is high, the crossover rate is correspondingly increased, and vice versa, the crossover rate should be correspondingly reduced. Thus, the algorithm can be prevented from converging to the local optimal solution too early, and the approximate global optimality of the final result obtained can be ensured. The mutation rate in the algorithm is set according to the resource utilization in the current system environment, so that the mutation rate is increased when the resource utilization is insufficient, thereby improving the ability of the algorithm to explore new solutions, playing a role in improving the overall resource utilization efficiency and reducing the number of task transfers.
[0125] In the above embodiment, the fitness value of each individual in the target population set is calculated, and the fitness value of each individual in the target population set can also be calculated by Figure 4 Explaining further, the method includes:
[0126] S401, for any individual in the target population set, obtain the processor usage rate of the solution corresponding to the individual.
[0127] It should be noted that the processor usage rate is the ratio of the number of processors in the processor set that are used to process tasks to the total number of processors in the processor set.
[0128] S402, obtaining first weights, second weights, and third weights corresponding to individual processor usage rates, transfer parameters, and penalty parameters, respectively.
[0129] It should be noted that the first weight, the second weight and the third weight are designed in advance and can be changed according to actual design requirements, and no limitation is made here.
[0130] S403, calculating the fitness value of the individual based on the processor usage rate, transfer parameter, penalty parameter, first weight, second weight and third weight of the individual.
[0131] In the embodiment of the present disclosure, the calculated fitness value can be obtained by the following formula:
[0132] fitness i =100-ω1×usedGpus-ω2×transferCost-ω3×overloadPenalty
[0133] Among them, usedGpus is the processor usage rate, transferCost is the transfer parameter. If the computing task is not executed in its initial graphics card, the transfer cost increases by 1; overloadPenalty is the penalty parameter. If the computing power and / or video memory required by the task executed in a graphics card in the current solution exceeds the maximum computing power and maximum video memory, it increases by 1. ω1, ω2 and ω3 are the first weight, the second weight and the third weight respectively. The larger the weight coefficient, the less likely the population will evolve in this direction. For example, the larger ω1 is, the more inclined the population evolution direction is to use fewer processors in the next generation.
[0134] In the embodiment of the present disclosure, first, for any individual in the target population set, the processor usage rate of the solution corresponding to the individual is obtained, and then the first weight, second weight and third weight corresponding to the processor usage rate, transfer parameter and penalty parameter of the individual are obtained. Finally, based on the processor usage rate, transfer parameter, penalty parameter, first weight, second weight and third weight of the individual, the fitness value of the individual is calculated.
[0135] Corresponding to the processor resource scheduling methods provided in the above-mentioned embodiments, an embodiment of the present disclosure further provides a processor resource scheduling device. Since the processor resource scheduling device provided in the embodiment of the present disclosure corresponds to the processor resource scheduling methods provided in the above-mentioned embodiments, the implementation methods of the above-mentioned processor resource scheduling methods are also applicable to the processor resource scheduling device provided in the embodiment of the present disclosure, and will not be described in detail in the following embodiments.
[0136] Figure 5 is a schematic diagram of a processor resource scheduling device according to an embodiment of the present disclosure. Figure 5 As shown, the processor resource scheduling device 500 includes: an acquisition module 510, a determination module 520, an optimization module 530 and a determination module 540.
[0137] The acquisition module 510 is used to obtain a set of tasks to be executed and a set of processors, and to construct an initial population set based on the set of processors and the set of tasks to be executed, wherein the initial population set includes multiple individuals, each individual is a set of server allocation schemes, and the server allocation scheme is the correspondence between the servers in the processor set executing tasks in the set of tasks to be executed.
[0138] The determination module 520 is used to determine the transfer parameter and penalty parameter of an individual for any individual in the initial population set.
[0139] The optimization module 530 is used to optimize the initial population set iteratively based on the transfer parameter and the penalty parameter until the iteration ends to generate a target population set.
[0140] The determination module 540 is used to calculate the fitness value of each individual in the target population set, and take the factor with the largest fitness value in the target population set as the target factor, take the allocation scheme corresponding to the target factor as the target allocation scheme, and schedule the processors in the processor set based on the target allocation scheme.
[0141] In one possible implementation, the acquisition module 510 is also used to: obtain the physical environment parameters of the processor set and the number of tasks in the task set to be executed, and determine the crossover rate and mutation rate of the initial population set; determine the population size parameters and the number of population iterations based on the physical environment parameters and the number of tasks; and construct the initial population set based on the population size parameters, the number of population iterations, the crossover rate and the mutation rate.
[0142] In one possible implementation, the acquisition module 510 is also used to: obtain the basic population size and the first preset adjustment coefficient, and determine the task change index based on the number of tasks; calculate the population size parameter based on the basic population size, the task change index, the first preset adjustment coefficient and the task change index.
[0143] In one possible implementation, the acquisition module 510 is also used to: add the task change index and the number of tasks to calculate a first factor; multiply the first factor and the first preset adjustment coefficient to calculate a second factor; add the second factor and the basic population size to calculate a population size parameter.
[0144] In one possible implementation, the acquisition module 510 is further used to: obtain a basic number of iterations and a second preset adjustment coefficient, and determine a task change index based on the number of tasks; and calculate and obtain the number of population iterations based on the basic number of iterations, the second preset adjustment coefficient and the task change index.
[0145] In one possible implementation, the acquisition module 510 is also used to: obtain a basic mutation rate and a third preset adjustment coefficient to obtain resource utilization of a processor set; and calculate the mutation rate of an initial population set based on the basic mutation rate, the third preset adjustment coefficient and resource utilization.
[0146] In one possible implementation, the acquisition module 510 is also used to: obtain a basic crossover rate, a fourth preset adjustment coefficient, a processor diversity index and an optimal diversity value; and calculate the crossover rate of the initial population set based on the basic crossover rate, the third preset adjustment coefficient, the processor diversity index and the optimal diversity value.
[0147] In one possible implementation, the determination module 540 is also used to: obtain, for any individual in the target population set, the processor usage of the solution corresponding to the individual; obtain the first weight, second weight and third weight corresponding to the processor usage, transfer parameter and penalty parameter of the individual; and calculate the fitness value of the individual based on the processor usage, transfer parameter, penalty parameter, first weight, second weight and third weight of the individual.
[0148] Therefore, by setting penalty parameters and transfer parameters, the iteration direction of the initial population set can be restricted, the target population set can be obtained, and the optimal target factor can be determined according to the fitness value as the final allocation plan, so that an allocation plan suitable for the current set of tasks to be executed and the set of processors can be selected, thereby improving the efficiency of subsequent processors in processing tasks and the resource utilization of the processor set.
[0149] In order to implement the above embodiment, the present disclosure further provides an electronic device 600, Figure 6 is a schematic diagram of an electronic device according to an embodiment of the present disclosure, such as Figure 6 As shown, the electronic device 600 includes: a processor 601 and a memory 602 that is communicatively connected to the processor, the memory 602 stores instructions that can be executed by at least one processor, and the instructions are executed by at least one processor 601 to implement the present disclosure. Figure 1-Figure 4A processor resource scheduling method according to an embodiment.
[0150] In order to implement the above embodiments, the present disclosure also provides a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable the computer to implement the above embodiments. Figure 1-Figure 4 A processor resource scheduling method according to an embodiment.
[0151] In order to implement the above embodiments, the present disclosure also provides a computer program product, including a computer program. When the computer program is executed by a processor, the computer program implements the above embodiments. Figure 1-Figure 4 A processor resource scheduling method according to an embodiment.
[0152] It should be noted that personal information from users should be collected for legitimate and reasonable purposes and should not be shared or sold outside of these legitimate uses. In addition, such collection / sharing should be carried out after receiving the user's informed consent, including but not limited to notifying the user to read the user agreement / user notice and sign the agreement / authorization including authorization of relevant user information before the user uses the function. In addition, any necessary steps should be taken to protect and safeguard access to such personal information data and ensure that others who have access to personal information data comply with its privacy policy and procedures.
[0153] The present application is expected to provide an implementation scheme for users to selectively block the use or access of personal information data. That is, the present disclosure is expected to provide hardware and / or software to prevent or block access to such personal information data. Once the personal information data is no longer needed, the risk can be minimized by limiting data collection and deleting the data. In addition, when applicable, such personal information is de-identified to protect the privacy of the user.
[0154] In the description of the aforementioned embodiments, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, without contradiction.
[0155] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In the description of this application, the meaning of "plurality" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined.
[0156] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, fragment or portion of code comprising one or more executable instructions for implementing the steps of a custom logical function or process, and the scope of the preferred embodiments of the present application includes alternative implementations in which functions may not be performed in the order shown or discussed, including performing functions in a substantially simultaneous manner or in the reverse order depending on the functions involved, which should be understood by technicians in the technical field to which the embodiments of the present application belong.
[0157] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in combination with these instruction execution systems, devices or apparatuses. For the purpose of this specification, "computer-readable medium" can be any device that contains, stores, communicates, propagates or transmits a program for use by an instruction execution system, device or apparatus, or in combination with these instruction execution systems, devices or apparatuses. More specific examples (non-exhaustive list) of computer-readable media include the following: an electrical connection with one or more wires (electronic device), a portable computer disk box (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), a fiber optic device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium and then editing, interpreting or processing in other suitable ways if necessary, and then stored in a computer memory.
[0158] It should be understood that the various parts of the present application can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0159] A person skilled in the art may understand that all or part of the steps in the method for implementing the above-mentioned embodiment may be completed by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, which, when executed, includes one or a combination of the steps of the method embodiment.
[0160] In addition, each functional unit in each embodiment of the present application may be integrated into a processing module, or each unit may exist physically separately, or two or more units may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it may also be stored in a computer-readable storage medium.
[0161] The storage medium mentioned above may be a read-only memory, a magnetic disk or an optical disk, etc. Although the embodiments of the present application have been shown and described above, it can be understood that the above embodiments are exemplary and cannot be understood as limiting the present application. A person of ordinary skill in the art may change, modify, replace and modify the above embodiments within the scope of the present application.
Claims
1. A processor resource scheduling method, characterized in that: include: Acquire a set of tasks to be executed and a set of processors, and construct an initial population set according to the set of processors and the set of tasks to be executed, wherein the initial population set includes a plurality of individuals, each of which is a set of server allocation schemes, and the server allocation scheme is a correspondence between servers in the set of processors executing tasks in the set of tasks to be executed; For any individual in the initial population set, determining a transfer parameter and a penalty parameter of the individual; Optimizing and iterating the initial population set based on the transfer parameter and the penalty parameter until the iteration ends to generate a target population set; The fitness value of each individual in the target population set is calculated, and the factor with the largest fitness value in the target population set is used as the target factor, the allocation scheme corresponding to the target factor is used as the target allocation scheme, and the processors in the processor set are scheduled based on the target allocation scheme.
2. The method according to claim 1, characterized in that The step of constructing an initial population set according to the processor set and the set of tasks to be executed includes: Acquire the physical environment parameters of the processor set and the number of tasks of the task set to be executed, and determine the crossover rate and mutation rate of the initial population set; Determine a population size parameter and a population iteration number based on the physical environment parameter and the number of tasks; The initial population set is constructed based on the population size parameter, the number of population iterations, the crossover rate and the mutation rate.
3. The method according to claim 2, characterized in that The determining of the population size parameter based on the physical environment parameter and the number of tasks includes: Obtaining a basic population size and a first preset adjustment coefficient, and determining a task change index based on the number of tasks; The population size parameter is calculated based on the basic population size, the task change index, the first preset adjustment coefficient and the task change index.
4. The method according to claim 4, characterized in that: The calculating the population size parameter based on the basic population size, the task change index, the first preset adjustment coefficient and the task change index includes: Adding the task change index and the number of tasks to calculate a first factor; Multiplying the first factor by the first preset adjustment coefficient to calculate a second factor; The second factor and the basic population size are added to calculate and obtain the population size parameter.
5. The method according to claim 2, characterized in that: Determining the number of population iterations based on the physical environment parameter and the number of tasks includes: Obtaining a basic number of iterations and a second preset adjustment coefficient, and determining a task change index based on the number of tasks; The population iteration number is calculated and obtained based on the basic iteration number, the second preset adjustment coefficient and the task change index.
6. The method according to claim 2, characterized in that Determining the mutation rate of the initial population set includes: Obtaining a basic mutation rate and a third preset adjustment coefficient to obtain resource utilization of the processor set; Based on the basic mutation rate, the third preset adjustment coefficient and the resource utilization rate, the mutation rate of the initial population set is calculated and obtained.
7. The method according to claim 2, characterized in that Determining the crossover rate of the initial population set includes: Obtaining a basic crossover rate, a fourth preset adjustment coefficient, a processor diversity index, and an optimal diversity value; The crossover rate of the initial population set is calculated based on the basic crossover rate, the fourth preset adjustment coefficient, the processor diversity index and the optimal diversity value.
8. The method according to claim 1, characterized in that The calculating the fitness value of each individual in the target population set includes: For any individual of the target population set, obtaining a processor usage rate of a solution corresponding to the individual; Obtaining the first weight, the second weight and the third weight corresponding to the processor usage rate, the transfer parameter and the penalty parameter of the individual; The fitness value of the individual is calculated based on the processor usage rate of the individual, the transfer parameter, the penalty parameter, the first weight, the second weight and the third weight.
9. A processor resource scheduling device, characterized in that: include: An acquisition module is used to acquire a set of tasks to be executed and a set of processors, and to construct an initial population set according to the set of processors and the set of tasks to be executed, wherein the initial population set includes a plurality of individuals, each of which is a set of server allocation schemes, and the server allocation scheme is a correspondence between the servers in the processor set executing the tasks in the set of tasks to be executed; A determination module, used for determining a transfer parameter and a penalty parameter of any individual in the initial population set; An optimization module, used for iterating the optimization of the initial population set based on the transfer parameter and the penalty parameter until the iteration is completed to generate a target population set; A determination module is used to calculate the fitness value of each individual in the target population set, and take the factor with the largest fitness value in the target population set as the target factor, take the allocation scheme corresponding to the target factor as the target allocation scheme, and schedule the processors in the processor set based on the target allocation scheme.
10. An electronic device, characterized in that: Including memory and processor; The processor runs a program corresponding to the executable program code by reading the executable program code stored in the memory, so as to implement the method according to any one of claims 1 to 8.
