A method for scheduling AI accelerator card resources based on dual optimization model

Through the resource scheduling method based on the dual optimization model, combined with the Lagrange multiplier method and the adaptive genetic algorithm, the multi-task execution and core allocation of the AI ​​accelerator card are optimized, which solves the problem of low resource scheduling efficiency of the AI ​​accelerator card and achieves Intelligent, dynamic and efficient management of AI computing resources.

CN118426971BActive Publication Date: 2024-10-11CHINESE PEOPLES LIBERATION ARMY UNIT 96901
View PDF 9 Cites 0 Cited by

Patent Information

Application Number
CN202410881509.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-03
Publication Date
2024-10-11
Estimated Expiration
2044-07-03

AI Technical Summary

Technical Problem

Existing AI accelerator card resource scheduling methods cannot make full use of multi-core parallel computing capabilities and cannot effectively schedule the priorities and memory space of different task processing, resulting in low computing efficiency, especially slow computing during peak hours of multi-tasking.

Method used

Using a resource scheduling method based on a dual optimization model, combined with the Lagrange multiplier method and an improved adaptive genetic algorithm with an elite strategy, a global-level multi-task execution sequence arrangement and a local-level acceleration card core allocation model are constructed. Optimize the task execution sequence and core allocation plan to improve computing efficiency.

Benefits of technology

It achieves intelligent, dynamic and efficient management of AI computing resources, improves the overall computing efficiency of a limited number of AI accelerator cards in multi-task processing, and fully unleashes the potential of AI accelerator cards.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118426971B_ABST
    Figure CN118426971B_ABST
Patent Text Reader

Abstract

The present invention belongs to the technical field of electronic digital data processing and resource scheduling, and discloses an AI accelerator card resource scheduling method based on a dual optimization model. The method includes: constructing an optimal resource scheduling overall model and a corresponding objective function; simplifying the optimal resource scheduling overall model into a dual optimization model of multi-task execution sequence arrangement at the global level and accelerator card core allocation at the local level; respectively using an improved adaptive genetic algorithm with an elite strategy and a Lagrange multiplier method to optimize and solve, and obtaining a solution result, namely, an accelerator card resource scheduling scheme. The method combines the characteristics of the AI ​​accelerator card itself with the needs, priorities, and required computing resources of multi-tasking processing, quickly obtains a scheduling scheme, improves the overall computing efficiency of a limited number of accelerator cards in dealing with multiple tasks, and realizes intelligent, dynamic, and efficient management of AI computing resources.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of electronic digital data processing and resource scheduling, and specifically relates to an AI accelerator card resource scheduling method based on a dual optimization model. Background Art

[0002] With the rapid development of artificial intelligence (AI), the demand for high-performance computing resources continues to increase. In order to meet this demand, AI accelerator cards came into being. Unlike the CPU and GPU of general computers, AI accelerator cards use specialized processors to efficiently perform parallel computing through multiple computing cores, and are good at processing AI tasks, including image classification, natural language processing, speech recognition, etc.

[0003] In the existing technology, an AI accelerator card usually only runs one AI task at a time, which will cause slow computing during peak times when multiple tasks need to be processed. Although deploying more AI accelerator cards can effectively alleviate this problem, in many application scenarios, it is difficult to equip a sufficient number of AI accelerator cards due to space, resource and other constraints. Therefore, it is crucial to effectively schedule the limited number of AI accelerator card resources.

[0004] The difficulty of AI accelerator card resource scheduling lies in the fact that the priority, required memory space, and computing time of different task processing are different, making it difficult to schedule with simple rules. Although AI accelerator card resource scheduling belongs to the field of dynamic scheduling of computer resources, AI accelerator card size is limited and many cores can be calculated in parallel, but how to fully mobilize the multi-core parallel computing capabilities under limited resource conditions cannot fully tap the potential and computing advantages of AI accelerator cards. In view of the above difficulties, there is currently no efficient domestic AI accelerator card resource scheduling method for multi-tasking processing. Summary of the invention

[0005] The purpose of the present invention is to solve the technical dilemma that the existing AI accelerator card resource scheduling belongs to the dynamic scheduling of computer resources, but the scheduling method directly borrowed from other computer hardware lacks consideration of the characteristics of tasks and AI accelerator cards themselves, and cannot give full play to the potential and computing advantages of AI accelerator cards to achieve more intelligent, dynamic and efficient management of AI computing resources. A method for AI accelerator card resource scheduling based on a dual optimization model is proposed. The method defines the resource scheduling problem when the AI ​​accelerator card handles multiple tasks, constructs a dual optimization model of global multi-task execution sequence arrangement and local accelerator card core allocation, and uses the Lagrange multiplier method and the improved adaptive genetic algorithm with elite strategy to solve the problem, quickly derive the accelerator card resource scheduling scheme, thereby improving the overall computing efficiency of a limited number of accelerator cards in dealing with multiple tasks, and realizing more intelligent, dynamic and efficient management of AI computing resources by a domestic single accelerator card.

[0006] In order to achieve the purpose of the present invention, the present invention adopts the following technical solution: an AI accelerator card resource scheduling method based on a dual optimization model, comprising:

[0007] S1. Construct the optimal resource scheduling model and the corresponding objective function;

[0008] The goal expressed by the objective function is to minimize the total task completion time and ensure that the sum of the video memory required by all tasks running at a certain time does not exceed the size of the accelerator card video memory;

[0009] S2, transforming the optimal resource scheduling overall model into a dual optimization model for realizing global multi-task execution sequence arrangement and local accelerator card core allocation;

[0010] The dual optimization model is used to determine the optimal multi-task execution order and the optimal computing core allocation scheme in the same batch of tasks, so that the computing time of the batch of tasks is the shortest;

[0011] S3, using the improved adaptive genetic algorithm with elite strategy and Lagrange multiplier method to optimize and solve, and obtain the accelerator card resource scheduling solution;

[0012] S31, set the initial population number, initialize the total rounds and the current cycle round, the current cycle round X is 1, and the task batch is M;

[0013] M≥2; the total number of rounds ranges from 200 to 500;

[0014] S32, encoding the task with real numbers, and randomly generating multiple individuals to form an initial population;

[0015] Individuals are real-number encodings of task execution sequences;

[0016] S33. For any individual i , divided into batches, calculate each individual i The fitness of the individual i , the total task completion time is the execution time of all tasks , consists of three parts: The total time taken for a batch of tasks; the interval between batch tasks ; Tasks exceeded their expected completion time; The interval time between adjacent tasks; the interval time between batch tasks includes: the time it takes for the accelerator card to start running a new task after completing a task, and the time it takes for data transmission between the CPU and the accelerator card;

[0017] The time consumption of each batch of tasks is calculated by the Lagrange multiplier method, which is as follows: through local core optimization, the optimal computing core allocation scheme is determined in the same batch of tasks to make the computing time of the batch of tasks the shortest;

[0018] S34, by dynamically adjusting the crossover probability and mutation probability of individual fitness, the crossover and mutation of the population are performed, thereby continuously evolving the population;

[0019] S35, sorting the fitness in descending order, performing individual selection, and obtaining the selected individuals;

[0020] S36, judging whether the cycle round X is equal to the total round, if not, jumping to S33, if yes, obtaining the execution order of the tasks.

[0021] As a possible implementation, in S1:

[0022] The total task completion time is equal to the time taken by each batch, the time between batch tasks, and the time that exceeds the expected completion time. times; ≥1; the completion time exceeding its expected time refers to the part of the actual completion time of the corresponding task exceeding its expected completion time; for the same task, the efficiency of multi-core parallel computing is higher than that of single-core computing, and multiple tasks are processed at a certain time with different priorities;

[0023] The number of cores of the accelerator card is K, and the memory size is C GB; the number of computing tasks required is R; K ≥ 2, C > 0, R ≥ 2; the required memory size remains unchanged from the start to the end of the task; the memory required for the jth task is c j ; The time required for single-core calculation is t j ; 0≤c j ≤C,t j >0.

[0024] As a possible implementation method, in S2, determining the optimal task execution order is the goal of global task optimization; determining the optimal task execution order and determining the optimal computing core allocation scheme in the same batch of tasks so that the computing time of the batch of tasks is the shortest is the goal of local core optimization; wherein:

[0025] In global task optimization, tasks are divided into multiple batches, and multi-core parallel computing is performed on tasks in the same batch. The amount of video memory occupied does not exceed the video memory limit of the accelerator card. The execution time is determined by the slowest running task; the execution time of all tasks is obtained by adding the time consumption of each batch and the interval time.

[0026] As a possible implementation, in S31, the population size remains constant during the evolution process;

[0027] In S32, the encoding position represents the order of task execution; the task sequence is divided into multiple batches of tasks according to the amount of video memory occupied;

[0028] In S33, the fitness is the inverse of the total task completion time;

[0029] In S34, the crossover probability and mutation probability of the individual fitness are dynamically adjusted, specifically including: performing individual crossover or mutation based on a random principle, and the probability thereof is related to the individual fitness and the maximum fitness of the population.

[0030] As a possible implementation method, in S34, a single-point crossover method is used for individual crossover, that is, the code after the first individual crossover point is exchanged with the code after the second individual crossover point; when the individual mutates, the codes of 2 positions are randomly selected for exchange.

[0031] As a possible implementation method, in S32, the dimension of the encoding position is R×1; the initial population size is u×R, where u is a multiple; batch tasks are obtained in the following manner: when the amount of memory required for the 1st to jth tasks is less than the video memory size C, and the amount of memory required for the 1st to j+1th tasks is greater than the video memory size C, then the 1st to jth tasks are the same batch.

[0032] As a possible implementation method, in S33, the maximum value of the task sequence fitness is the shortest time cost of the corresponding batch of tasks; the fitness of each task sequence is the inverse of the total task completion time; the total time consumed by the tasks in the same batch is The minimum value of is obtained by the Lagrange multiplier method.

[0033] As a possible implementation method, in S34, when the crossover probability and mutation probability of individual fitness are dynamically adjusted, the time cost of all individuals in population Q is calculated and the maximum value is found. The time cost of each individual is divided by the maximum value of the time cost of all individuals in population Q, and nonlinear mapping is performed to obtain the crossover probability and mutation probability.

[0034] As a possible implementation method, in S35, individual selection includes: sorting the fitness in descending order after crossover and mutation; retaining the top R individuals as offspring, and randomly selecting the remaining individuals to obtain selected individuals, and the random selection algorithm includes a roulette random algorithm.

[0035] As a possible implementation method, in S36, X≥200; the individual with the largest fitness in round X outputs its corresponding task execution order and the calculation core allocation result when each batch of tasks is executed to the accelerator card for multi-task calculation to obtain the task execution order.

[0036] The present invention has the following beneficial effects:

[0037] 1. The AI ​​accelerator card resource scheduling method based on the dual optimization model provided by the present invention defines the resource scheduling problem when the AI ​​accelerator card processes multiple tasks, constructs a dual optimization model of multi-task execution sequence arrangement at the global level and accelerator card core allocation at the local level, and uses the Lagrange multiplier method and the improved adaptive genetic algorithm with elite strategy to solve the problem, and quickly obtains the accelerator card resource scheduling solution;

[0038] 2. The AI ​​accelerator card resource scheduling method based on the dual optimization model provided by the present invention improves the overall computing efficiency of a limited number of accelerator cards in coping with multiple tasks, and realizes more intelligent, dynamic and efficient management of AI computing resources by a single accelerator card. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:

[0040] Figure 1 This is a flow chart of an AI accelerator card resource scheduling method based on a dual optimization model in an embodiment of the present invention;

[0041] Figure 2 This is a Gantt chart of task execution and core allocation in an embodiment of the present invention. DETAILED DESCRIPTION

[0042] The present invention belongs to the technical field of electronic digital data processing and resource scheduling, and discloses an AI accelerator card resource scheduling method based on a dual optimization model. The method includes: constructing an optimal resource scheduling overall model and a corresponding objective function; simplifying the optimal resource scheduling overall model into a dual optimization model of multi-task execution sequence arrangement at the global level and accelerator card core allocation at the local level; respectively using an improved adaptive genetic algorithm with an elite strategy and a Lagrange multiplier method to optimize and solve, and obtaining a solution result, namely, an accelerator card resource scheduling scheme. The method combines the characteristics of the AI ​​accelerator card itself with the needs, priorities, and required computing resources of multi-tasking processing, quickly obtains an allocation scheme, improves the overall computing efficiency of a limited number of accelerator cards in dealing with multiple tasks, and realizes intelligent, dynamic, and efficient management of AI computing resources.

[0043] The present invention provides an AI accelerator card resource scheduling method based on a dual optimization model, see Figure 1 , specifically including:

[0044] S1. Construct the optimal resource scheduling model and the corresponding objective function;

[0045] The goal expressed by the objective function is to minimize the total task completion time and ensure that the sum of the video memory required by all tasks running at a certain time does not exceed the size of the accelerator card video memory;

[0046] The existing AI accelerator card needs to process multiple tasks at a certain time, and the tasks have different priorities. The optimal resource scheduling model and the corresponding objective function are:

[0047] Assume that the number of cores of the accelerator card is K, the memory size is C gigabytes (GB), and the number of required computing tasks is R . Assume that the required video memory size remains unchanged from the start to the end of the task calculation; The video memory required for each task is The time required for single-core calculation is ;

[0048] For the same task, the efficiency of multi-core parallel computing is usually higher than that of single-core computing. This application does not consider the communication time overhead of multi-core (usually considered to be very small). For any task, it is assumed that the time to calculate through k cores is the same as that of a single core. . Assume that for the same task, k cores need to start computing at the same time.

[0049] Priority of tasks and expected completion time Indicates that all cores simultaneously calculate the time required for the task of times, as shown in formula (1): (1)

[0050] in, The corresponding task priority can be defined according to the actual situation. The smaller the value, the shorter the expected completion time of the task, that is, the higher the priority. This method is simple and effective with small calculation amount. This method of defining the task priority based on the expected completion time of the task is both concise and can represent the priority.

[0051] The time from the start of a task to the end of the calculation of the last task is the total completion time. The goal of this application is to rationally plan the multi-core resources of the accelerator card and allocate corresponding computing tasks to minimize the total completion time, as shown in formula (2).

[0052] (2)

[0053]

[0054]

[0055] Due to the limited memory space of the accelerator card, The total amount of video memory required by all tasks running at any time does not exceed C;

[0056] in, Indicates the number of cores participating in computing task j; is the task allocation table, see formula (3); represents the amount of video memory occupied by task j at time s, see formula (4); Indicates that the task Actual completion time Exceeded its expected completion time After that, the excess time needs to be included in the total time times as a penalty. If the limit is not exceeded, the penalty is 0, see formula (5).

[0057] (3)

[0058] (4)

[0059] (5)

[0060] S2, transforming the optimal resource scheduling overall model into a dual optimization model for realizing global multi-task execution sequence arrangement and local accelerator card core allocation;

[0061] The dual optimization model is used to determine the optimal multi-task execution order and the optimal computing core allocation scheme in the same batch of tasks, so that the computing time of the batch of tasks is the shortest;

[0062] The solution space of the above model is composed of time, tasks, and the number of cores. The optimization search space is large and the computational complexity is high. This application proposes a method based on global task optimization and local core optimization to simplify the model of formula (2).

[0063] Global task optimization aims to determine the optimal order of task execution. Due to the limitation of the video memory size of the accelerator card, tasks are divided into multiple batches, and the tasks in the same batch are calculated in parallel on multiple cores (the same batch of tasks are put on one AI accelerator card for execution, and different tasks in the same batch are calculated by different cores). The amount of video memory occupied does not exceed the limit, and its execution time is determined by the slowest running task.

[0064] The batch tasks are divided as follows: when the memory required by the 1st to jth tasks is less than C, and the memory required by the 1st to j+1th tasks is greater than C, then the 1st to jth tasks are in the same batch, and the subsequent tasks are divided in the same way;

[0065] Since it takes a certain amount of time for the accelerator card to complete a task and then start a new task, and it takes time for the memory transfer between the CPU and the accelerator card, the sum of the two parts is equal to the interval time of the batch task. Indicates. The final execution time of all tasks It is obtained by adding the time consumed by each batch and the interval time, as shown in the following formula:

[0066] (6)

[0067] in, Indicates the mth The time consumed by the batch task, M is the total number of batches.

[0068] Formula (6) shows that the execution time T of all tasks is equal to the sum of the time taken for each batch and the interval time between batch tasks; the interval time between batch tasks includes the time taken for the accelerator card to complete a task and then start a new task plus the time taken for memory transfer between the CPU and the accelerator card.

[0069] The time consumption of each batch is achieved through local core optimization, specifically: in the same batch of tasks, find the optimal computing core allocation scheme to make the computing time of the batch of tasks the shortest. Its expression is as follows (7)

[0070]

[0071] in, represents the set of tasks to be calculated for the mth batch, Indicates the number of tasks in the task set, usually .

[0072] S3, using the improved adaptive genetic algorithm with elite strategy and Lagrange multiplier method to optimize and solve, and obtain the accelerator card resource scheduling solution;

[0073] In order to minimize the overall total time consumption, this application proposes an improved adaptive genetic algorithm with an elite strategy to obtain a better execution order of tasks.

[0074] 1. Coding. This application uses real number coding to encode the task sequence, where the number represents the task number and the coding position represents the order in which the task is executed. Its dimension is The initial population size is set to 3 times the number of tasks, that is The population is generated by random generation, denoted as Q, and the population size is kept unchanged during the evolution process.

[0075] The batch tasks are divided as follows: when the memory required by the 1st to jth tasks is less than C, and the memory required by the 1st to j+1th tasks is greater than C, then the 1st to jth tasks are in the same batch, and the subsequent tasks are divided in the same way.

[0076] 2. Fitness. The fitness of each task sequence (individual) is the inverse of the accelerator card consumption time, that is, .

[0077] The maximum value in formula (7) The optimal solution is obtained by the Lagrange multiplier method: , When the values ​​of are the same. Considering is a positive integer, the model of formula (7) can obtain an approximate optimal solution. Under this condition The result is shown in the following formula:

[0078] (8)

[0079] in, Indicates rounding down. express The sequence number of the first task in the collection.

[0080] Substituting equation (8) into equation (7) yields the approximate minimum time cost of the mth batch of tasks: .

[0081] For any , is the total time and total interval time of the previous m tasks sum.

[0082] Starting from the 0th core, according to the obtained The values ​​are sequentially assigned to the computing cores to process the corresponding tasks, as shown below: (9)

[0083] in, The last task in the task set is numbered .

[0084] Accordingly, It is obtained by substituting the result of formula (7) into formula (8).

[0085] 3. Crossover and mutation of population. Traditional genetic algorithms perform crossover and mutation of populations under pre-set crossover and mutation probabilities to make the population evolve continuously. This application proposes a method for dynamically adjusting the crossover and mutation probabilities based on individual fitness, that is, first calculate the time cost of all individuals in population Q and find the maximum value. , and then the time cost of each individual q and Divide, and its crossover and mutation probabilities are nonlinear mappings of the divided values, as shown below: (10)

[0086] (11)

[0087] (12)

[0088] in, represents the crossover probability, The above design reduces the crossover and mutation probability of excellent individuals, avoids destruction, and accelerates the convergence of the algorithm. On the other hand, it speeds up the crossover and mutation of individuals with high time cost, provides species diversity, and avoids the population from falling into the local optimal solution.

[0089] When individuals are crossed, a single-point crossover method is adopted, that is, the code after the first individual crossover point is exchanged with the code after the second individual crossover point.

[0090] When an individual mutates, the codes of 2 positions are randomly selected for exchange.

[0091] 4. Individual selection. After crossover and mutation, the fitness is sorted from small to large. The first R individuals in the sorting are retained as offspring, i.e., the strategy with elite protection. The remaining individuals are selected in a roulette wheel manner.

[0092] 5. Termination condition: The genetic algorithm stops after running 500 rounds.

[0093] Finally, the individuals with the smallest fitness in 500 rounds are counted, and the corresponding task execution order and the computing core allocation results when each batch of tasks are executed are handed over to the accelerator card for multi-task efficient computing.

[0094] The AI ​​accelerator card used in this embodiment has 16 cores K and 8 GB of memory. There are 12 tasks that need to be processed simultaneously at a certain moment. The corresponding task names, memory usage, single-core computing time, and task priorities are shown in the following table. Penalty coefficient is 0.2, the batch task interval is 3 seconds (s).

[0095] Table 1 Task information table

[0096]

[0097] Step 1: Simplify the optimization model

[0098] According to the task and accelerator card information, and referring to formula (6), the following optimal accelerator card scheduling model is constructed:

[0099] (13)

[0100] (14)

[0101] (15)

[0102]

[0103] Step 2: Solving the dual optimization model

[0104] First, 36 individuals are randomly generated; each individual is divided into batches of tasks according to the following principle: when the memory required for the 1st to jth tasks is less than 8, and the memory required for the 1st to j+1th tasks is greater than 8, then the 1st to jth tasks are in the same batch, and the subsequent tasks are analogous. Take one of the individuals as an example, and its encoding is as follows:

[0105] Table 2 Batch task table

[0106]

[0107] In the above example, [4, 7, 1] is the first batch of tasks, which requires 7.1 GB of memory; [12, 10, 2] is the second batch of tasks, which requires 6.3 GB of memory; [3, 6, 9, 8] is the third batch of tasks, which requires 7.4 GB of memory; [5, 11] is the fourth batch of tasks, which requires 3.5 GB of memory.

[0108] Next, determine the adaptability value of each batch of tasks.

[0109] According to formula (7), for the mth batch of tasks, the result of AI accelerator card computing core allocation is:

[0110] (16)

[0111] Taking the above individuals as an example, the first batch of tasks is 2, is 7, is 7, so 0.5s. And so on, add the total time of the three intervals , and the penalty time, it can be concluded that T is 56.86s and the fitness value is 1 / 56.86.

[0112] Then, the crossover and mutation of the population begins. If the maximum time consumption in the current population is 65.69s, the crossover and mutation probabilities of each individual can be calculated according to equations (10) and (11), and the corresponding crossover and mutation operations are performed at the same time. The selection of individuals first retains the first 12 individuals with the shortest time consumption, and the last 24 individuals are selected by roulette.

[0113] After 500 rounds of iterative calculations, the optimal task execution sequence is:

[0114] Table 3 Optimal task execution sequence

[0115]

[0116] Under this scheme, the final time T for all tasks is 45.84 seconds.

[0117] Gantt chart of task execution and core allocation Figure 2 shown.

[0118] So far, the rapid calculation of AI accelerator card resource scheduling has been completed. The present invention fully improves the utilization rate of the core in the accelerator card and effectively speeds up the computing efficiency of multiple tasks.

[0119] The above is only a preferred embodiment of the present invention, and the present invention should not be limited to the contents disclosed in the embodiment and the drawings. Any equivalent or modification completed without departing from the spirit disclosed in the present invention shall fall within the scope of protection of the present invention.

[0120] The present invention proposes an AI accelerator card resource scheduling method based on a dual optimization model, which has the following beneficial effects compared with the prior art:

[0121] 1. The AI ​​accelerator card resource scheduling method based on the dual optimization model provided by the present invention defines the resource scheduling problem when the AI ​​accelerator card processes multiple tasks, constructs a dual optimization model of multi-task execution sequence arrangement at the global level and accelerator card core allocation at the local level, and uses the Lagrange multiplier method and the improved adaptive genetic algorithm with elite strategy to solve the problem, so as to quickly obtain the accelerator card resource scheduling solution.

[0122] 2. The AI ​​accelerator card resource scheduling method based on the dual optimization model provided by the present invention improves the overall computing efficiency of a limited number of accelerator cards in coping with multiple tasks, and realizes more intelligent, dynamic and efficient management of AI computing resources by a single accelerator card.

[0123] The above-mentioned embodiments will clearly and completely describe the technical solutions of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

Claims

1. A method for scheduling AI accelerator card resources based on a dual optimization model, characterized in that: include: S1. Construct the optimal resource scheduling model and the corresponding objective function; The objective expressed by the objective function is to minimize the total task completion time and ensure that the sum of the video memory required by all tasks running at a certain time does not exceed the size of the accelerator card video memory; S2, transforming the optimal resource scheduling overall model into a dual optimization model for realizing global multi-task execution sequence arrangement and local accelerator card core allocation; The dual optimization model is used to determine the optimal multi-task execution order and the optimal computing core allocation scheme in the same batch of tasks, so that the computing time of the batch of tasks is the shortest; S3, using the improved adaptive genetic algorithm with elite strategy and Lagrange multiplier method to optimize and solve, and obtain the accelerator card resource scheduling solution; S31, set the initial population number, initialize the total rounds and the current cycle round, the current cycle round X is 1, and the task batch is M; M≥2; the total number of rounds ranges from 200 to 500; S32, real number encoding the task, and randomly generating multiple individuals to form an initial population; the individuals are real number encoding forms of the task execution sequence; S33. For any individual i , divided into M i batches, calculate each individual i The fitness is the reciprocal of the total task completion time; For individuals i , the total task completion time is the execution time of all tasks , consists of three parts: The total time taken for each batch of tasks and the interval between batch tasks , each task exceeds its expected completion time; is the interval time between adjacent tasks; The batch task interval time includes: the time taken by the accelerator card to start running a new task after completing a task, and the time taken for data transmission between the CPU and the accelerator card; The time consumption of each batch of tasks is calculated by the Lagrange multiplier method, which is as follows: through local core optimization, the optimal computing core allocation scheme is determined in the same batch of tasks to make the computing time of the batch of tasks the shortest; S34, by dynamically adjusting the crossover probability and mutation probability of individual fitness, the crossover and mutation of the population are performed, thereby continuously evolving the population; S35, sorting the fitness in descending order, performing individual selection, and obtaining the selected individuals; S36, judging whether the current cycle round X is equal to the total round, if not, jumping to S33, if yes, obtaining the execution order of the tasks.

2. The AI ​​accelerator card resource scheduling method based on the dual optimization model according to claim 1 is characterized in that: In S1: The total task completion time is equal to the time taken by each batch, the time between batch tasks, and the time that exceeds the expected completion time. times; ≥1; the completion time that exceeds its expected completion time refers to the part of the actual completion time of the corresponding task that exceeds its expected completion time; for the same task, the efficiency of multi-core parallel computing is higher than that of single-core computing, and multiple tasks are processed at a certain time with different priorities; the number of cores of the accelerator card is K, and the video memory size is C GB; the number of computing tasks required is R; K≥2, C>0, R≥2; from the start to the end of the task, the required video memory size remains unchanged; the video memory required for the jth task is c j ; The time required for single-core calculation is t j ; 0≤c j ≤C,t j >0.

3. The AI ​​accelerator card resource scheduling method based on the dual optimization model according to claim 1 is characterized in that: In S2, the goal of global task optimization is to determine the optimal task execution order; the goal of local core optimization is to determine the optimal task execution order and the optimal computing core allocation scheme in the same batch of tasks so that the computing time of the batch of tasks is the shortest; wherein: In global task optimization, tasks are divided into multiple batches, and multi-core parallel computing is performed on tasks in the same batch. The amount of video memory occupied does not exceed the video memory limit of the accelerator card. The execution time is determined by the slowest running task; the execution time of all tasks is obtained by adding the time consumption of each batch and the interval time.

4. The AI ​​accelerator card resource scheduling method based on the dual optimization model according to claim 1 is characterized in that: In S31, the population size remains constant during evolution; In S32, the encoding position represents the order of task execution; the task sequence is divided into multiple batches of tasks according to the amount of video memory occupied; In S33, the fitness is the inverse of the total task completion time; In S34, the crossover probability and mutation probability of the individual fitness are dynamically adjusted, specifically including: performing individual crossover or mutation based on a random principle, and the probability thereof is related to the individual fitness and the maximum fitness of the population.

5. The AI ​​accelerator card resource scheduling method based on the dual optimization model according to claim 4 is characterized in that: In S34, a single-point crossover method is used when individuals cross, and the code after the first individual crossover point is exchanged with the code after the second individual crossover point; when individuals mutate, the codes of 2 positions are randomly selected for exchange.

6. The AI ​​accelerator card resource scheduling method based on the dual optimization model according to claim 1 is characterized in that: In S32, the dimension of the encoding position is R×1; the initial population size is u×R, where u is a multiple; batch tasks are obtained in the following manner: when the amount of memory required for the 1st to jth tasks is less than the video memory size C, and the amount of memory required for the 1st to j+1th tasks is greater than the video memory size C, then the 1st to jth tasks are the same batch.

7. The AI ​​accelerator card resource scheduling method based on the dual optimization model according to claim 1 is characterized in that: In S33, the maximum value of the task sequence fitness is the shortest time cost of the corresponding batch of tasks; the fitness of each task sequence is the inverse of the total task completion time; the total time consumed by the tasks in the same batch is The minimum value of is obtained by the Lagrange multiplier method.

8. The AI ​​accelerator card resource scheduling method based on the dual optimization model according to claim 1 is characterized in that: In S34, when the crossover probability and mutation probability of individual fitness are dynamically adjusted, the time cost of all individuals in population Q is calculated and the maximum value is found. The time cost of each individual is divided by the maximum value of the time cost of all individuals in population Q, and nonlinear mapping is performed to obtain the crossover probability and mutation probability.

9. The AI ​​accelerator card resource scheduling method based on the dual optimization model according to claim 1, characterized in that: In S35, individual selection includes: sorting the fitness in descending order after crossover and mutation; retaining the top R individuals as offspring, and randomly selecting the remaining individuals to obtain selected individuals, and the random selection algorithm includes a roulette random algorithm.

10. The AI ​​accelerator card resource scheduling method based on the dual optimization model according to claim 1, characterized in that: In S36, X≥200; the individual with the largest fitness in round X outputs its corresponding task execution order and the calculation core allocation result when each batch of tasks is executed to the accelerator card for multi-task calculation to obtain the task execution order.

Citation Information

Patent Citations

  • Space-ground integrated network resource allocation method based on improved genetic algorithm

    CN108880663A

  • Artificial intelligence accelerator card scheduling method and device based on domestic CPU and OS

    CN113835876A

  • Available resource coding-based many-to-many cargo scheduling optimal distribution method

    CN114493047A

  • Method for rapidly evaluating feasibility of multi-target attack task

    CN116090357A

  • K8s-based heterogeneous accelerator card management scheduling system and method

    CN117032935A