A task scheduling method and system based on priority transformation in heterogeneous platforms

By improving genetic algorithm optimization task scheduling, using priority transformation and insertion fitness function, combined with multiple optimization mechanisms, the problem of local optimal solutions in heterogeneous computing platforms is solved, and more efficient task scheduling effects are achieved.

CN120295741BActive Publication Date: 2025-08-12NANJING UNIV OF AERONAUTICS & ASTRONAUTICS +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510788754.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-06-13
Publication Date
2025-08-12
Estimated Expiration
2045-06-13

AI Technical Summary

Technical Problem

In heterogeneous computing platforms, existing static task scheduling algorithms are difficult to avoid falling into local optimal solutions, resulting in poor scheduling effects. Especially task scheduling based on random search algorithms is prone to premature maturity and cannot obtain the best scheduling results.

Method used

The task scheduling is used to use improved genetic algorithms, and the task dependency relationship and processor mapping are optimized through priority transformation and insert fitness function calculation, combined with championship selection, sub-path crossing, adaptive mutation rate control, elite retention and degeneration demise mechanisms, and the task dependency and processor mapping are improved to improve scheduling efficiency and global search capabilities.

Benefits of technology

It effectively reduces the probability of falling into local optimal solutions, improves the efficiency and accuracy of task scheduling, realizes faster and more stable optimal solutions, and reduces the total task scheduling time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120295741B_ABST
    Figure CN120295741B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of improvement of heterogeneous computing platforms, and discloses a task scheduling method and system based on priority transformation in a heterogeneous platform, comprising: obtaining heterogeneous platform task information, analyzing the heterogeneous platform task information to obtain task dependencies, task execution time, task data communication volume, and communication speed between different processors, compiling an initial fitness function based on the completion time ratio before and after task scheduling, i.e., the acceleration ratio, constructing a final fitness function based on the initial fitness function, and using an improved genetic algorithm to perform multiple iterations to obtain a target fitness function, thereby obtaining a target priority queue and a target processor queue, i.e., a target scheduling result. The present invention can achieve better scheduling effects in the heterogeneous platform scheduling process, reduce the total task scheduling time, and at the same time reduce the possibility of falling into a local optimal solution, avoid premature maturity of the genetic algorithm, and have a faster and more stable optimal solution acquisition capability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of heterogeneous computing platform improvement, and in particular to a task scheduling method and system based on priority transformation in a heterogeneous platform. Background Art

[0002] As a core component of heterogeneous computing, task scheduling is a critical issue, and static task scheduling plays a significant role in task scheduling algorithms. In static task scheduling, information such as the number of tasks, communication volume, execution time, and dependencies must be obtained in advance. Based on this data, a plan is developed to complete task scheduling before execution.

[0003] Static task scheduling can be further categorized as heuristic-based and random search-based. Heuristic-based scheduling has been widely studied due to its simplicity, low complexity, and excellent scheduling performance. Random search algorithms, however, achieve better scheduling results than heuristic algorithms by searching for the optimal solution through numerous iterations. However, random search algorithms are prone to falling into local optimal solutions, leading to premature maturity and suboptimal scheduling.

[0004] In order to solve these problems, a task scheduling method and system based on priority transformation in heterogeneous platforms are urgently needed. Summary of the Invention

[0005] To solve the above problems, this application proposes a task scheduling algorithm based on an improved genetic algorithm, which can not only improve the effect of task scheduling and reduce the execution time of the total task, but also avoid falling into local optimal solutions and stabilize the scheduling results.

[0006] A task scheduling method based on priority transformation in a heterogeneous platform includes the following steps:

[0007] S1. Obtaining heterogeneous platform task information, analyzing the heterogeneous platform task information to obtain task dependencies, task execution time, task data communication volume, and communication speed between different processors;

[0008] S2. Write an initial fitness function based on the ratio of completion time before and after task scheduling, i.e., the speedup ratio, and construct a final fitness function based on the initial fitness function. The completion time before task scheduling is the sum of the execution times of all tasks on a single processor. The completion time after task scheduling refers to the total task time obtained based on the current scheduling result after one iteration of the genetic algorithm, which includes the data communication time between tasks, i.e., the data communication volume between tasks with data dependencies but on different processors multiplied by the communication speed.

[0009] S3. Use the improved genetic algorithm to perform multiple iterations to obtain the target fitness function, and then obtain the target priority queue and target processor queue, that is, the target scheduling result.

[0010] Preferably, the expression of the initial fitness function in S2 is:

[0011] ;

[0012] in, Indicates the fitness value, It represents the ratio of the completion time before and after scheduling, Indicates the time it takes to complete all tasks on only one type of processor before scheduling; Indicates the time it takes to complete all tasks after scheduling.

[0013] Preferably, the specific content of constructing the final fitness function based on substituting the initial fitness function in S2 is to calculate the final fitness function in an inserting manner. ,Will Substitute the initial fitness function to obtain the final fitness function.

[0014] Preferably, the calculation is performed in an insert-type manner The specific content is:

[0015] For the processor The tasks performed in sequence , there is enough idle time between the two tasks, so that another task can be inserted into the idle time for execution. The specific calculation rules are:

[0016] first Indicates a task In the processor The initial start time on The expression is:

[0017] ;

[0018] in, represents the amount of inter-task communication, Indicates the processor The time it is idle and ready to execute new tasks, is the entry sub-node, i.e. the initial sub-task. is the task number, For the processor, For the task The set of dependent tasks;

[0019] for Precursor tasks In the processor The initial completion time (earliest completion time) on In the processor The execution time on The expression is:

[0020] ;

[0021] in, For the task In the processor Execution time on ;

[0022] In the processor There are two tasks that have been assigned ,and discontinuous, After the end There is a period of free time before starting, and when another task Also assigned to the processor When it is on, if it meets the preset conditions, it will be assigned to the idle time period for execution in an inserting manner;

[0023] The expression of the preset condition is:

[0024] ;

[0025] in, For the task In the processor Execution time on ;

[0026] After all tasks are assigned in an interpolated manner, the final execution time is obtained. The expression of the final execution time is:

[0027] ;

[0028] in, is the exit subnode, i.e. the last subtask. Indicates the processor where the task is located. The exit subnode is the last subtask In the processor The initial completion time (earliest completion time) on

[0029] The total unscheduled execution time is the total execution time of all tasks on the processor The execution time is , The expression is:

[0030] ;

[0031] in, For the task In the processor The execution time on N is the total number of tasks.

[0032] Preferably, the final fitness function expression is:

[0033] .

[0034] in, is the exit subnode, i.e. the last subtask. Indicates the processor where the task is located. For the processor , N is the total number of tasks, For the task In the processor The execution time.

[0035] Preferably, in S3, an improved genetic algorithm is used to perform multiple iterations to obtain a target fitness function, thereby obtaining a target priority queue and a target processor queue, that is, the specific content of the target scheduling result is:

[0036] S301, determining an initial task priority sequence based on task dependencies, and randomly determining a processor sequence for task assignment, combining a priority queue and a processor mapping queue to form a genetic algorithm chromosome, and initializing the priority queue and the processor mapping queue respectively;

[0037] S302, selecting chromosomes using a tournament selection method;

[0038] During tournament selection, the pressure on all colorings in the current iteration population is reduced, and the probability of low-fitness individuals being selected is increased by adding random numbers;

[0039] S303, performing subpath crossover processing on the task priority queue based on the subpath crossover method; performing subpath crossover processing on the task priority queue in the crossover portion, thereby ensuring the correctness of the task dependency relationship;

[0040] S304: Perform random mutation on the processor mapping part and regular mutation on the priority queue part, and control the convergence speed of the algorithm iteration by adaptively changing the mutation rate during iteration;

[0041] S305. Use the elite retention strategy to retain the target scheduling results in each generation of populations, that is, retain the results with the shortest total task completion time to reduce iteration time;

[0042] S306. Use the degradation and extinction mechanism to further optimize the target scheduling result to ensure that the final scheduling effect is improved and reduce the possibility of falling into the local optimum;

[0043] S307. Repeat S302-S306 to iterate and obtain the target scheduling result.

[0044] Preferably, in S301, the chromosome is first divided equally, with the first half being the processor number to which the subtask is assigned, and the second half being the priority number of the subtask in the task queue;

[0045] The chromosome encoding for task scheduling using genetic algorithms is the processor mapping encoding;

[0046] The method of simultaneously changing the priority number and processor number mapping during iteration can not only improve the scheduling efficiency, but also search for the optimal solution globally, thereby improving the scheduling effect.

[0047] The processor mapping part uses a random encoding method for initialization;

[0048] The priority queue is initialized using either random priority sorting or HEFT or CPOP algorithm.

[0049] Preferably, the specific content of the subpath crossover-based method in 303 for reorganizing the front and back of the chromosome is:

[0050] One of the chromosomes A set of continuous gene values is randomly selected from , and then Find the same gene value in Sequential replacement of selected genes in In the genome, keeping other genes unchanged, we get for , Similarly, two new and regular daughter chromosomes are obtained after reorganization. .

[0051] Preferably, the specific contents of performing random mutation on the processor mapping part and regular mutation on the priority queue part in S304 are as follows:

[0052] First, randomly select a gene value in a chromosome and define the task It is the second one to be allocated, and it is also searched in the queue The first predecessor node and the first successor node of the task and tasks ,at this time Can be in the task 、 After the insertion, the order of other tasks does not change and they move forward or backward in turn, thus completing a mutation;

[0053] At the same time, an adaptive mechanism is added. In the early stage of iteration, the mutation rate is 0.8, which expands the search range and jumps out of the local optimal solution. In the later stage of iteration, the mutation rate is reduced to 0.1, which speeds up the convergence speed and avoids too long iteration time.

[0054] A task scheduling system based on priority transformation in a heterogeneous platform, comprising:

[0055] Information acquisition unit: acquires heterogeneous platform task information, analyzes the heterogeneous platform task information to obtain task dependencies, task execution time, task data communication volume, and communication speed between different processors;

[0056] Function writing unit: writes an initial fitness function based on the ratio of completion time before and after task scheduling, i.e., the speedup ratio, and constructs a final fitness function based on the initial fitness function. The completion time before task scheduling is the sum of the execution times of all tasks on a single processor. The completion time after task scheduling refers to the total task time obtained based on the current scheduling result after one iteration of the genetic algorithm, which includes the data communication time between tasks, i.e., the data communication volume between tasks with data dependencies but on different processors multiplied by the communication speed;

[0057] Result generation unit: Use the improved genetic algorithm to perform multiple iterations to obtain the target fitness function, and then obtain the target priority queue and target processor queue, that is, the target scheduling result.

[0058] In summary, the present invention provides a method and system for scheduling tasks based on priority transformation in a heterogeneous platform. Compared with traditional technologies, the present invention uses priority transformation as a prerequisite for iterating a genetic algorithm, while improving selection, crossover, and mutation to enhance scheduling effectiveness. It also adds elite retention, degeneration, and extinction to reduce the possibility of falling into a local optimal solution. The advantages of the present invention are as follows:

[0059] (1) This application adopts the idea of priority transformation and improves selection, crossover, and mutation while ensuring the correctness of dependency relationships, thereby improving the effect of task scheduling;

[0060] (2) This application adopts an improved genetic algorithm for scheduling, and adds elite retention, degradation and extinction mechanisms, which reduces the probability of falling into a local optimal solution and thus improves the efficiency of task scheduling.

[0061] The technical method of the present invention is further described in detail below through the accompanying drawings and examples. BRIEF DESCRIPTION OF THE DRAWINGS

[0062] Figure 1This is a step diagram of a task scheduling method based on priority transformation in a heterogeneous platform according to the present invention;

[0063] Figure 2 A cross-sectional diagram of the processor mapping portion of the present invention;

[0064] Figure 3 A schematic diagram of a partial cross section of a priority queue of the present invention;

[0065] Figure 4 Schematic diagram of the task allocation diagram of CPOP, HEFT and MGA of the present invention;

[0066] Figure 5 Schematic diagram of the convergence process of the MGA of the present invention;

[0067] Figure 6 Schematic diagram of the convergence process of the SGA of the present invention;

[0068] Figure 7 This is the DAG (Directed acyclic graph) task graph of the present invention. DETAILED DESCRIPTION

[0069] The technical method of the present invention is further described below through the accompanying drawings and embodiments. It should be noted that unless otherwise specifically stated, the relative arrangement of components and steps, numerical expressions and values described in these embodiments do not limit the scope of this application.

[0070] The following description of at least one exemplary embodiment is merely illustrative in nature and is in no way intended to limit the present disclosure, its application, or uses.

[0071] Technologies, systems, and devices known to those of ordinary skill in the relevant art may not be discussed in detail, but where appropriate, they should be considered part of the specification.

[0072] In all examples shown and discussed herein, any specific values should be interpreted as merely exemplary and not limiting. Therefore, other examples of the exemplary embodiments may have different values.

[0073] Unless otherwise defined, technical or scientific terms used in the present invention shall have the same meaning as commonly understood by one of ordinary skill in the art to which the present invention belongs.

[0074] The present invention provides a task scheduling method based on priority transformation in a heterogeneous platform. Figure 1 As shown, the following steps are included:

[0075] S1. Obtain heterogeneous platform task information, analyze the heterogeneous platform task information to obtain task dependencies, task execution time, task data communication volume, and communication speed between different processors.

[0076] S2. Write an initial fitness function based on the ratio of completion time before and after task scheduling, that is, the acceleration ratio, and construct a final fitness function based on the initial fitness function. The completion time before task scheduling is the sum of the execution time of all tasks on a single processor. The completion time after task scheduling refers to the total task time obtained according to the current scheduling result after one iteration of the genetic algorithm, which includes the data communication time between tasks, that is, the data communication volume between tasks that have data dependencies but are on different processors multiplied by the communication speed.

[0077] Furthermore, the expression of the initial fitness function in S2 is:

[0078] .

[0079] in, Indicates the fitness value, It represents the ratio of the completion time before and after scheduling, Indicates the time it takes for all tasks to complete on only one type of processor before being scheduled. Indicates the time it takes to complete all tasks after scheduling.

[0080] Furthermore, the specific content of constructing the final fitness function based on substituting the initial fitness function in S2 is to calculate the final fitness function in an inserting way. ,Will Substitute the initial fitness function to obtain the final fitness function.

[0081] Furthermore, we use the plug-in method to calculate The specific content is:

[0082] For the processor The tasks performed in sequence , there is enough idle time between the two tasks, so that another task can be inserted into the idle time for execution. The specific calculation rules are:

[0083] first Indicates a task In the processor The initial start time on The expression is:

[0084] ;

[0085] in, represents the amount of inter-task communication, Indicates the processor The time it is idle and ready to execute new tasks, is the entry sub-node, i.e. the initial sub-task. is the task number, For the processor, For the task The set of dependent tasks;

[0086] for Precursor tasks In the processor The initial completion time (earliest completion time) on In the processor The execution time on The expression is:

[0087] ;

[0088] in, For the task In the processor Execution time on ;

[0089] In the processor There are two tasks that have been assigned ,and discontinuous, After the end There is a period of free time before starting, and when another task Also assigned to the processor When it is on, if it meets the preset conditions, it will be assigned to the idle time period for execution in an inserting manner;

[0090] The expression of the preset condition is:

[0091] ;

[0092] in, For the task In the processor Execution time on ;

[0093] After all tasks are assigned in an interpolated manner, the final execution time is obtained. The expression of the final execution time is:

[0094] ;

[0095] in, is the exit subnode, i.e. the last subtask. Indicates the processor where the task is located. The exit subnode is the last subtask In the processor The initial completion time (earliest completion time) on

[0096] The total unscheduled execution time is the total execution time of all tasks on the processor The execution time is , The expression is:

[0097] ;

[0098] in, For the task In the processor The execution time on N is the total number of tasks.

[0099] Preferably, the final fitness function expression is:

[0100] .

[0101] in, is the exit subnode, i.e. the last subtask. Indicates the processor where the task is located. For the processor , N is the total number of tasks, For the task In the processor The execution time.

[0102] The fitness function directly affects the quality of the genetic algorithm's results, its convergence speed, and whether it can find the optimal solution. To achieve better scheduling results, this application uses the speedup ratio to calculate the fitness function. This is the ratio of the time it takes to complete all tasks before scheduling to the time it takes to complete all tasks after scheduling. However, as the genetic algorithm progresses, fitness fluctuations become smaller. Small differences may cause the algorithm to converge prematurely, leading to a local optimum.

[0103] S3. Use the improved genetic algorithm to perform multiple iterations to obtain the target fitness function, and then obtain the target priority queue and target processor queue, that is, the target scheduling result.

[0104] Furthermore, in S3, an improved genetic algorithm is used to perform multiple iterations to obtain the target fitness function, and then the target priority queue and target processor queue are obtained. The specific content of the target scheduling result is:

[0105] S301. Determine an initial task priority sequence based on task dependencies, and randomly determine a processor sequence for task assignment. Combine the priority queue and the processor mapping queue to form a genetic algorithm chromosome, and initialize the priority queue and the processor mapping queue respectively.

[0106] Furthermore, in S301 , the chromosome is first divided equally, with the first half being the processor number to which the subtask is assigned, and the second half being the priority number of the subtask in the task queue.

[0107] The chromosome encoding for task scheduling using genetic algorithms is the processor mapping encoding.

[0108] The method of simultaneously changing the priority number and processor number mapping during iteration can not only improve the scheduling efficiency, but also search for the optimal solution globally, thereby improving the scheduling effect.

[0109] The processor mapping part is initialized using a random encoding method.

[0110] The priority queue is initialized using either random priority sorting or HEFT or CPOP algorithm.

[0111] This application combines the priority queue and the processor mapping queue to form the encoding of the genetic algorithm chromosome. The first half of the chromosome is the processor number to which the subtask is assigned, and the second half is the priority of the subtask in the task queue. In some studies, the chromosome encoding for task scheduling using genetic algorithms is processor mapping encoding, which may result in the inability to search for the optimal solution. For example, when using the processor mapping queue as the chromosome encoding, it is necessary to first determine the priority and then write the fitness function. This limits the search scope to only one execution order, and it is easy to fall into a local optimal solution. Therefore, the method of changing the priority and processor mapping simultaneously during iteration proposed in this application can not only improve the scheduling efficiency, but also can search for the optimal solution globally, thereby improving the scheduling effect.

[0112] To improve the algorithm's solution quality, the generation of the initial population must not only ensure population diversity but also be representative, representing the characteristics of the solution space. This reduces the probability of premature convergence while also increasing convergence speed. Therefore, the present invention uses different initialization methods for the front and back parts of the chromosome encoding. The processor mapping part uses a random encoding method to achieve population diversity and ensure a wide distribution of the population. Since the priority queue has fewer categories than the processor mapping queue, several representative priority sorting methods are used for initialization: two random priority sorting methods, as well as priorities calculated using the HEFT (Heterogeneous-Earliest-Finish-Time) and CPOP (Critical-Path-on-a-Processor) algorithms.

[0113] S302. Select chromosomes using a tournament selection method.

[0114] During tournament selection, the pressure on all colorings in the current iteration population is reduced, and the probability of low-fitness individuals being selected is increased by adding random numbers.

[0115] This application uses tournament selection for chromosome selection. However, in order to reduce the selection pressure and increase the possibility of individuals with lower fitness being selected, random numbers are added when comparing fitness to increase the diversity of the population. The range of random numbers depends on the specific experimental conditions.

[0116] S303 , performing sub-path cross processing on the task priority queue based on the sub-path cross method; performing sub-path cross processing on the task priority queue in the cross section, thereby ensuring the correctness of the task dependency relationship.

[0117] Furthermore, the specific contents of the subpath crossover-based method in 303 for reorganizing the front and back of the chromosome are as follows:

[0118] One of the chromosomes A set of continuous gene values is randomly selected from , and then Find the same gene value in Sequential replacement of selected genes in In the genome, keeping other genes unchanged, we get for , Similarly, two new and regular daughter chromosomes are obtained after reorganization. .

[0119] The process of selecting two chromosomes from the current generation to recombine and generate a pair of new individuals is called crossover. Crossover can improve the diversity of the population and the optimization ability of the population. It is one of the core parts of the genetic algorithm. This application uses the single-point crossover and sub-path crossover methods to recombine the front and back of the chromosomes respectively, such as Figure 2 As shown, it is a single-point crossover of the processor mapping part. The two chromosomes begin to cross at the sixth node, and the genes before and after are exchanged to obtain two new daughter chromosomes.

[0120] As for the priority queue part, its order cannot be changed arbitrarily, and it needs to be crossed while ensuring its correctness. In order to ensure that the data dependency is still met after the priority queue is crossed, this application adopts a sub-path crossover method, such as Figure 3 As shown, in one of the chromosomes A set of continuous gene values is randomly selected from , and then Find the same gene value in Sequential replacement of selected genes in In the genome, keeping other genes unchanged, we get for , Similarly, two new and regular daughter chromosomes are obtained after reorganization. .

[0121] S304: Perform random mutation on the processor mapping part and regular mutation on the priority queue part. The mutation controls the convergence speed of the algorithm iteration by adaptively changing the mutation rate during iteration.

[0122] The specific contents of random mutation of the processor mapping part and regular mutation of the priority queue part in S304 are as follows:

[0123] First, randomly select a gene value in a chromosome and define the task It is the second one to be allocated, and it is also searched in the queue The first predecessor node and the first successor node of the task and tasks ,at this time Can be in the task 、 After the insertion, the order of other tasks does not change and they move forward or backward in turn, thus completing a mutation.

[0124] At the same time, an adaptive mechanism is added. In the early stage of iteration, the mutation rate is 0.8, which expands the search range and jumps out of the local optimal solution. In the later stage of iteration, the mutation rate is reduced to 0.1, which speeds up the convergence speed and avoids too long iteration time.

[0125] Mutation is also a core element of genetic algorithms. By randomly changing a portion of an individual's genes and introducing new chromosomes, the algorithm increases population diversity, enabling it to search within an unknown solution space and avoid being trapped in local optima. Similar to crossover, random mutations are performed on the processor mapping portion, while mutations on the priority queue portion must also adhere to the principle of correct dependencies.

[0126] In addition, this application adds an adaptive mechanism to the mutation part. In the early stage of the algorithm, the mutation rate is 0.8, because a higher mutation rate can accelerate the improvement of racial diversity, expand the search range, and jump out of the local optimal solution. However, if the mutation rate is too high, the algorithm will become a random search and lose its effect. Therefore, when the number of iterations reaches a certain number, the mutation rate is reduced to 0.1, which not only ensures the scheduling effect of the genetic algorithm, but also speeds up the convergence speed and avoids too long iteration time.

[0127] S305. An elite retention strategy is used to retain the target scheduling result, i.e., the best scheduling result, in each generation of the population. That is, the result with the shortest total task completion time is retained to reduce the iteration time.

[0128] S306. Use the degradation and extinction mechanism to further optimize the target scheduling results to ensure the final scheduling effect is improved and reduce the possibility of falling into the local optimum.

[0129] In view of the fact that the task scheduling problem itself is an NP-complete problem, it is very easy to fall into the local optimal solution during the iterative process of the genetic algorithm. In order to further reduce the possibility of falling into the local optimal solution, the present application proposes an elite retention, degradation and extinction mechanism. First, the elite is retained, that is, after each iteration, the individual with the highest fitness of this generation is saved in the elite population, and the best individual in each generation is retained separately. At the same time, after multiple iterations, the individual with the highest fitness after each iteration is exchanged with the individual with the lowest fitness in the elite population, which increases the diversity of the population while retaining the better solution. Degeneration and extinction are timely stop-loss mechanisms for premature maturity. If it is judged that the algorithm is about to mature prematurely during the iterative process, the population at this time will be degraded to the previous population, and the chromosomes removed by the elite retention will be reintroduced. If the number of degenerations is too many, the population will die, and the iteration of the genetic algorithm will be repeated starting from the first generation population.

[0130] S307. Repeat S302-S306 to iterate and obtain the target scheduling result.

[0131] A task scheduling system based on priority transformation in a heterogeneous platform, comprising:

[0132] Information acquisition unit: obtains heterogeneous platform task information, analyzes the heterogeneous platform task information to obtain task dependencies, task execution time, task data communication volume and communication speed between different processors.

[0133] Function writing unit: write the initial fitness function according to the ratio of completion time before and after task scheduling, that is, the acceleration ratio, and construct the final fitness function based on the initial fitness function. The completion time before task scheduling is the sum of the execution time of all tasks on a single processor. The completion time after task scheduling refers to the total task time obtained according to the current scheduling result after one iteration of the genetic algorithm, which includes the data communication time between tasks, that is, the data communication volume between tasks with data dependencies but on different processors multiplied by the communication speed.

[0134] Result generation unit: Use the improved genetic algorithm to perform multiple iterations to obtain the target fitness function, and then obtain the target priority queue and target processor queue, that is, the target scheduling result.

[0135] An electronic device, characterized in that it includes a memory and a processor, wherein a computer program is stored in the memory, and when the processor calls the computer program in the memory, the content of the task scheduling method based on priority transformation in a heterogeneous platform is implemented.

[0136] A storage medium is characterized in that the storage medium stores computer-executable instructions, which, when loaded and executed by a processor, implement the content of a task scheduling method based on priority transformation in a heterogeneous platform.

[0137] Compared with the classic CPOP and HEFT algorithms, Figure 4 As shown in the figure, the modified genetic algorithm (MGA), the critical path on a processor (CPOP), and the heterogeneous earnest finish time (HEFT) algorithm are three different processors, P1, P2, and P3. The scheduling effect of MGA is improved by 22.17% and 15.08% compared with the CPOP and HEFT algorithms, respectively.

[0138] like Figure 5 、 Figure 6 Shown are the convergence processes of MGA and SGA respectively. Figure 5This is the convergence diagram of the modified genetic algorithm (MGA) based on priority transformation. As can be seen from the figure, the final fitness obtained by the algorithm is stable at 7.63863, and all four simulations have completed convergence before 50 iterations. Simulation 2 also jumped out of the local optimum after degeneration and extinction to obtain the final result. It can be seen that the algorithm can not only find a better scheduling method, but also has a faster convergence speed and the ability to stably obtain the optimal solution. Compared with the standard genetic algorithm, it has achieved a huge improvement. Figure 6 In order to obtain the convergence diagram of the scheduling effect for the standard genetic algorithm (SGA), five simulation experiments were carried out for each algorithm to observe the effect of the algorithm during the simulation experiment. As can be seen from the figure, the fitness obtained by multiple simulations is 7.27327, and it can be seen that simulation 3 has reached a fitness value of 7.53241, which shows that other simulations have not reached the optimal solution. The final convergence value of SGA is up to about 7.3791, while the final convergence value of MGA can reach 7.6396, which proves that the method used in the present invention is easier to find the global optimal solution than the traditional genetic algorithm. At the same time, the use of elite retention in MGA not only makes the curve of the first half of the algorithm smoother, but also reduces the probability of falling into the local optimal solution. The existence of the degeneration and extinction mechanism ensures that the final convergence result of MGA must be the optimal fitness, and the optimization efficiency has been greatly improved.

[0139] Example

[0140] In order to obtain the scheduling results, it is necessary to first obtain the dependencies between tasks, task execution time, and data communication volume.

[0141] This application uses the following two tables as examples.

[0142] Table 1 Task execution time on the processor (unit: microseconds)

[0143] ;

[0144] Table 2 Task dependencies and data transfer size (unit: KB)

[0145] ;

[0146] Therefore, the dependencies of this task are as follows Figure 7 As shown, the task model is represented by a directed acyclic graph (DAG), which is defined as ,in express The number of the subtask node, Indicates the directed edges between each child node. At the same time, this application assumes For the task The execution time after being assigned to a specific processor, is the weight of the directed edge, which represents the data transmission time between two subtask nodes.

[0147] After obtaining the above data, first write the fitness function:

[0148] .

[0149] in Indicates the time it takes to complete all tasks before scheduling; Indicates the time it takes to complete all tasks after scheduling.

[0150] In order to obtain a shorter total task execution time, the present invention adopts an insert method to calculate , for the processor The tasks performed in sequence If there is enough idle time between two tasks, the other task can be inserted into the idle time to execute, thereby avoiding time waste and improving the scheduling effect. The specific calculation rules are as follows.

[0151] first Indicates a task In the processor The initial start time on is as shown in formula (1).

[0152] (1).

[0153] in represents the amount of inter-task communication, Indicates the processor The ready time when the system is idle and ready to execute new tasks. for Precursor tasks In the processor The initial completion time (earliest completion time) on In the processor The execution time on , as shown in (2).

[0154] (2).

[0155] in It's a task In the processor The execution time on .

[0156] Now assume that the processor There are two tasks that have been assigned ,and discontinuous, After the end There is a period of free time before starting, and when another task Also assigned to the processor When the task is executed in the idle time period, if it satisfies the conditions of formula (3), it can be allocated to the idle time period in an inserting manner.

[0157] (3).

[0158] in, It's a task In the processor The execution time on .

[0159] After all tasks are assigned in an insert-type manner, the final execution time is obtained as formula (4).

[0160] (4).

[0161] At the same time, this application assumes that the total unscheduled execution time is all tasks in the processor The execution time is as shown in formula (5).

[0162] (5).

[0163] in, It's a task In the processor The execution time on .

[0164] The final fitness function can be obtained by formula (6).

[0165] (6).

[0166] After completing the writing of the fitness function, the steps of improving the genetic algorithm are carried out in sequence. First, the initial population is generated. The present invention uses different initialization methods for the front and back parts of the chromosome encoding. In order to achieve population diversity, the processor mapping part adopts a random encoding method to ensure the wide distribution of the population. Compared with the processor mapping queue, the priority queue has fewer categories that can reasonably exist. Therefore, several representative priority sorting methods are used for initialization, namely two random priority sortings and the priorities calculated by the HEFT and CPOP algorithms.

[0167] Next, selection, crossover, and adaptive mutation are performed. By comparing two randomly selected chromosomes, the one with higher fitness enters the next iteration. However, to reduce selection pressure and increase the likelihood of individuals with lower fitness being selected, random numbers are added when comparing fitness to increase population diversity. Single-point crossover and sub-path crossover are then used for the processor mapping portion and the priority queue portion, respectively, to achieve chromosome recombination while ensuring correctness. Chromosome mutation is then completed by randomly selecting a point for mutation, and the algorithm's convergence speed is controlled by adaptive mutation rate. Finally, after the population iteration is completed, the global optimal solution is obtained through elite retention, degeneration, and extinction screening. The above steps are repeated until the algorithm converges and the final scheduling result is obtained.

[0168] Finally, it should be noted that the above embodiments are only used to illustrate the technical method of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that they can still modify or replace the technical method of the present invention with equivalents, and these modifications or equivalent replacements cannot cause the modified technical method to deviate from the spirit and scope of the technical method of the present invention.

Claims

1. A task scheduling method based on priority transformation in a heterogeneous platform, characterized in that: The following steps are involved: S1. Obtaining heterogeneous platform task information, analyzing the heterogeneous platform task information to obtain task dependencies, task execution time, task data communication volume, and communication speed between different processors; S2. Write an initial fitness function based on the ratio of completion time before and after task scheduling, i.e., the speedup ratio, and construct a final fitness function based on the initial fitness function. The completion time before task scheduling is the sum of the execution times of all tasks on a single processor. The completion time after task scheduling refers to the total task time obtained based on the current scheduling result after one iteration of the genetic algorithm, which includes the data communication time between tasks, i.e., the data communication volume between tasks with data dependencies but on different processors multiplied by the communication speed. S3, using an improved genetic algorithm to perform multiple iterations to obtain a target fitness function, and then obtaining a target priority queue and a target processor queue, that is, a target scheduling result; In S3, an improved genetic algorithm is used to perform multiple iterations to obtain the target fitness function, and then the target priority queue and target processor queue are obtained. The specific content of the target scheduling result is: S301, determining an initial task priority sequence based on task dependencies, and randomly determining a processor sequence for task assignment, combining a priority queue and a processor mapping queue to form a genetic algorithm chromosome, and initializing the priority queue and the processor mapping queue respectively; S302, selecting chromosomes using a tournament selection method; During tournament selection, the pressure on all colorings in the current iteration population is reduced, and the probability of low-fitness individuals being selected is increased by adding random numbers; S303, performing sub-path cross processing on the task priority queue based on a sub-path cross method; The crossover part performs sub-path crossover processing on the task priority queue to ensure the correctness of task dependencies; S304: Perform random mutation on the processor mapping part and regular mutation on the priority queue part, and control the convergence speed of the algorithm iteration by adaptively changing the mutation rate during iteration; S305, using the elite retention strategy to retain the target scheduling results in each generation of population; S306. Using the degradation and extinction mechanism to further optimize the target scheduling result; S307, repeat S302-S306, iteratively obtain the target scheduling result; The specific content of the method based on subpath crossover in S303 for reorganizing the front and back of the chromosome is as follows: One of the chromosomes Randomly select a continuous set of gene values in Find the same gene value in Sequential replacement of selected genes in in the genome, keeping other genes unchanged, Similarly, two new and regular daughter chromosomes are obtained after recombination. .

2. The method for scheduling tasks based on priority transformation in a heterogeneous platform according to claim 1, characterized in that: The expression of the initial fitness function in S2 is: ; in, Indicates the fitness value, It represents the ratio of the completion time before and after scheduling, Indicates the time it takes to complete all tasks on only one type of processor before scheduling; Indicates the time it takes to complete all tasks after scheduling.

3. The method for scheduling tasks based on priority transformation in a heterogeneous platform according to claim 2, characterized in that: The specific content of constructing the final fitness function based on substituting the initial fitness function in S2 is to calculate it in an inserting way. ,Will Substitute the initial fitness function to obtain the final fitness function.

4. The method for scheduling tasks based on priority transformation in a heterogeneous platform according to claim 3, characterized in that: Calculate using plug-in method The specific content is: For the processor The tasks performed in sequence , there is idle time between the two tasks, let the other task be inserted into the idle time for execution. The specific calculation rules are: first Indicates a task In the processor The initial start time on The expression is: ; in, represents the amount of inter-task communication, Indicates the processor The time it is idle and ready to execute new tasks, is the entry sub-node, i.e. the initial sub-task. is the task number, For the processor, For the task The set of dependent tasks; for Precursor tasks In the processor The initial completion time on In the processor The execution time on The expression is: ; in, For the task In the processor Execution time on ; In the processor There are two tasks that have been assigned ,and discontinuous, After the end There is free time before starting, and when another task Also assigned to the processor When it is on, if it meets the preset conditions, it will be allocated to the idle time for execution in an inserting manner; The expression of the preset condition is: ; in, For the task In the processor Execution time on ; After all tasks are assigned in an insert-based manner, the final execution time is obtained. The expression for the final execution time is: ; in, is the exit subnode, i.e. the last subtask. Indicates the processor where the task is located. The exit subnode is the last subtask In the processor Initial completion time on The total unscheduled execution time is the total execution time of all tasks on the processor The execution time is , The expression is: ; in, For the task In the processor The execution time, N is the total number of tasks.

5. The method for scheduling tasks based on priority transformation in a heterogeneous platform according to claim 4, characterized in that: The final fitness function expression is: ; in, is the exit subnode, i.e. the last subtask. Indicates the processor where the task is located. For the processor , N is the total number of tasks, For the task In the processor The execution time.

6. The method for scheduling tasks based on priority transformation in a heterogeneous platform according to claim 1, characterized in that: In S301, the chromosome is first divided equally, with the first half being the processor number to which the subtask is assigned, and the second half being the priority number of the subtask in the task queue; The chromosome encoding for task scheduling using genetic algorithms is the processor mapping encoding; The processor mapping part is initialized using a random encoding method; The priority queue is initialized using either random priority sorting or HEFT or CPOP algorithm.

7. The method for scheduling tasks based on priority transformation in a heterogeneous platform according to claim 1, characterized in that: The specific contents of random mutation of the processor mapping part and regular mutation of the priority queue part in S304 are as follows: First, randomly select a gene value in a chromosome and define the task It is the second one to be allocated, and it is also searched in the queue The first predecessor node and the first successor node of the task and tasks ,at this time Able to 、 After the insertion, the order of other tasks does not change and they move forward or backward in turn, thus completing a mutation; At the same time, an adaptive mechanism is added. In the early stage of iteration, the mutation rate is 0.8, which expands the search range and jumps out of the local optimal solution. In the later stage of iteration, the mutation rate is reduced to 0.1, which speeds up the convergence speed and avoids too long iteration time.

8. A task scheduling system based on priority transformation in a heterogeneous platform, characterized in that: include: Information acquisition unit: acquires heterogeneous platform task information, analyzes the heterogeneous platform task information to obtain task dependencies, task execution time, task data communication volume, and communication speed between different processors; Function writing unit: writes an initial fitness function based on the ratio of completion time before and after task scheduling, i.e., the speedup ratio, and constructs a final fitness function based on the initial fitness function. The completion time before task scheduling is the sum of the execution times of all tasks on a single processor. The completion time after task scheduling refers to the total task time obtained based on the current scheduling result after one iteration of the genetic algorithm, which includes the data communication time between tasks, i.e., the data communication volume between tasks with data dependencies but on different processors multiplied by the communication speed; Result generation unit: uses the improved genetic algorithm to perform multiple iterations to obtain the target fitness function, and then obtains the target priority queue and target processor queue, that is, the target scheduling result; The improved genetic algorithm is used to perform multiple iterations to obtain the target fitness function, and then the target priority queue and target processor queue are obtained. The specific content of the target scheduling result is: S301, determining an initial task priority sequence based on task dependencies, and randomly determining a processor sequence for task assignment, combining a priority queue and a processor mapping queue to form a genetic algorithm chromosome, and initializing the priority queue and the processor mapping queue respectively; S302, selecting chromosomes using a tournament selection method; During tournament selection, the pressure on all colorings in the current iteration population is reduced, and the probability of low-fitness individuals being selected is increased by adding random numbers; S303, performing sub-path cross processing on the task priority queue based on a sub-path cross method; The crossover part performs sub-path crossover processing on the task priority queue to ensure the correctness of task dependencies; S304: Perform random mutation on the processor mapping part and regular mutation on the priority queue part, and control the convergence speed of the algorithm iteration by adaptively changing the mutation rate during iteration; S305, using the elite retention strategy to retain the target scheduling results in each generation of population; S306. Using the degradation and extinction mechanism to further optimize the target scheduling result; S307, repeat S302-S306, iteratively obtain the target scheduling result; The specific content of the method based on subpath crossover in S303 for reorganizing the front and back of the chromosome is as follows: One of the chromosomes Randomly select a continuous set of gene values in Find the same gene value in Sequential replacement of selected genes in in the genome, keeping other genes unchanged, Similarly, two new and regular daughter chromosomes are obtained after recombination. .

Citation Information

Patent Citations

  • Heterogeneous multi-core energy-saving task schedule method based on improved genetic algorithm

    CN102508708A

  • Task scheduling method, device and equipment for multiple pieces of Internet of Things equipment and storage medium

    CN118916126A