A multi-task GPU resource allocation method
The mountain climbing algorithm and utility function mechanism are used to collaboratively allocate computing resources and storage resources in a multi-task GPU environment, solving the problem of resource allocation complexity in multi-task GPUs, achieving high throughput and fairness, and improving system performance.
Patent Information
- Application Number
- CN202410981716.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-22
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2044-07-22
AI Technical Summary
In a multi-task GPU environment, the coordinated allocation of computing resources and storage resources makes it difficult to achieve efficient multi-task parallel computing, and the resource allocation problem becomes more complex as the number of tasks increases.
Using the hill climbing algorithm and the utility function mechanism, the program behavior is monitored through hardware, and the programs are divided into computing-intensive and memory-access-intensive types. The computing resources SM and storage resource bandwidth MC are bid for respectively, and resource prices and allocations are dynamically adjusted to ensure fair resource allocation. .
It achieves scalable high throughput and fair resource allocation for multi-task GPUs, avoids unfairness, and improves overall system performance.
Smart Images

Figure CN118502974B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of digital processing technology, and in particular to a multi-task GPU resource allocation method. Background Art
[0002] The architecture of GPGPU (General Purpose Graphics Processing Unit) has evolved from its original focus on processing graphics and rendering tasks to becoming a powerful tool for handling highly parallel computing tasks. This shift has made GPGPU increasingly important in scientific computing, deep learning, data analysis, and other fields that require a lot of parallel processing. The architecture of a modern GPGPU typically consists of multiple key components, including stream processors (SM, Streaming Multiprocessors), memory controllers (MC, Memory Controller), and on-chip networks (NoC, Network-on-Chip). The ability to run multiple tasks simultaneously on a GPU, i.e., a multitasking GPU, has become increasingly important because it can improve resource utilization, reduce latency, and support the execution of more applications on a single GPU.
[0003] The allocation of resources in multi-task GPUs often adopts the method of independent allocation of computing resources and storage resources. For example, when CD-Search allocates computing resources in GPUs among multiple tasks, it allocates more SMs to computing-intensive programs to improve performance, and gradually reduces the number of SMs allocated to them while maintaining the performance of memory-intensive programs. Unlike CD-Search's allocation of SMs, storage resource allocation allocates memory bandwidth resources among multiple GPU tasks according to the memory access characteristics of the programs to improve the overall performance of multi-task GPUs. However, the method of allocating computing resources or storage resources alone cannot achieve the highest performance. For example, for memory-intensive programs, it is indeed possible to reduce its SM number to a certain extent while maintaining the same performance, but after allocating additional storage resources to it, the number of SMs reduced will change. Similarly, for computing-intensive programs, blindly reducing the storage bandwidth resources allocated to it may turn it into a memory-intensive program, so that its performance cannot continue to increase with the increase in the number of SMs. Therefore, in multi-task GPUs, the allocation of computing resources and storage resources needs to be coordinated.
[0004] However, when computing resources and storage resources are co-allocated in a multi-tasking GPU, it is a huge challenge to determine the computing resources and storage resources required for each program and achieve efficient multi-tasking parallel computing. At the same time, as the number of programs running on a multi-tasking GPU increases, the problem of resource allocation becomes more difficult. Summary of the invention
[0005] The purpose of the present invention is to provide a multi-task GPU resource allocation method to solve the problem of allocating computing resources and storage resources among multiple tasks in a multi-task GPU, and to achieve scalable high throughput and fairness in the multi-task GPU.
[0006] To achieve the above object, the present invention provides a multi-task GPU resource allocation method, comprising the following steps:
[0007] S1. Divide resources equally among several programs and run a program for one cycle on the GPU. The hardware monitors the behavior of the program and divides the program into a computation-intensive program and a memory-intensive program according to whether the bandwidth of the storage resources required by the program is less than the bandwidth of the storage resources currently allocated by the system.
[0008] S2. Establish the utility function of computing resources SM and the utility function of storage resource bandwidth MC ;
[0009] S3. The master core assigns an initial price to each computing resource SM and storage resource bandwidth MC and publishes it to each core. Each core refers to the price and utility function and uses the hill climbing algorithm to give a bid for the computing resource SM and storage resource bandwidth MC.
[0010] S4, at a global barrier to ensure that all bid calculations are completed, the main core collects bids and calculates the new price of each computing resource SM and storage resource bandwidth MC, and determines whether to allocate resources; if so, allocate resources to each program; if not, publish the new price of each computing resource SM and storage resource bandwidth MC to each core, and repeat S3-S4;
[0011] S5. Complete the allocation of computing resources SM and storage resource bandwidth MC.
[0012] Preferably, in S2, the utility function of the computing resource SM is:
[0013] ;
[0014] in, c is the number of allocated computing resources SM; Performance(c) To assign a program c The system performance of computationally intensive programs when using SM as the computing resource.
[0015] Preferably, when the storage resource bandwidth MC required by the current task is less than the storage resource bandwidth MC currently allocated by the system, ; When the storage resource bandwidth MC required by the current task is greater than the storage resource bandwidth MC currently allocated by the system, .
[0016] Preferably, in S2, the utility function of the storage resource bandwidth MC is:
[0017] ;
[0018] in, b is the amount of allocated storage resource bandwidth MC; Performance(b) To assign a program b The system performance of memory-intensive programs when the storage resource bandwidth MC is 1.
[0019] Preferably, when the storage resource bandwidth MC required by the current task is greater than the storage resource bandwidth MC currently allocated by the system, = 1; When the storage resource bandwidth MC required by the current task is less than the storage resource bandwidth MC currently allocated by the system, = 0.
[0020] Preferably, in S3, the initial price of computing resources SM and storage resource bandwidth MC is determined by the total amount of money used to purchase computing resources SM and storage resource bandwidth MC and the total number of resources. The initial price of computing resources SM is the money used to purchase computing resources SM divided by the number of computing resources SM. The initial price of storage resource bandwidth MC is the money used to purchase storage resource bandwidth MC divided by the number of storage resource bandwidth MC.
[0021] Preferably, in S4, the new price of each computing resource SM and storage resource bandwidth MC is dynamically adjusted according to the total bid and the available quantity of the resource, and the formula is:
[0022] ;
[0023] in, It is a resource The price, It's a task About Resources The bidding price, It is a resource The total amount.
[0024] Preferably, in S4, the method for determining resource allocation is that the new price changes less than 2% compared with the previous iteration price or the number of bidding rounds is greater than 30 times.
[0025] Preferably, in S4, resources are allocated in proportion according to the bidding, and the allocation formula is:
[0026] ;
[0027] in, Assigned to the task Resources The number of
[0028] The advantages and positive effects of the multi-task GPU resource allocation method described in the present invention are: the GPU operates as a market, randomly allocates computing resources and storage resource bandwidth on the GPU to multiple tasks running simultaneously, treats the actual computing and memory access characteristics of the program indiscriminately, and each task obtains resources through bidding, avoiding unfairness and treating each task in an unbiased manner. Each task is independently grouped together, and resource allocation becomes a scalable and distributed decision-making process. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] Figure 1 is a flow chart of an embodiment of the present invention. DETAILED DESCRIPTION
[0030] The technical solution of the present invention is further described below through the accompanying drawings and embodiments.
[0031] like Figure 1 A multi-task GPU resource allocation method includes the following steps:
[0032] S1. Divide resources equally among several programs and run a program for one cycle on the GPU. The hardware monitors the behavior of the program and divides the program into compute-intensive programs and memory-intensive programs based on whether the bandwidth of the storage resources required by the program is less than the bandwidth of the storage resources currently allocated by the system.
[0033] S2. Establish the utility function of computing resources SM and the utility function of storage resource bandwidth MC The purpose of the utility function is to characterize the utility of allocating resources to different programs so that the resources given out can improve the overall performance of the system, that is, the throughput.
[0034] For a compute-intensive program, its performance increases linearly with the number of computing resources SM. For a memory-intensive program, when its memory access requests are not fully satisfied, its performance is not greatly affected by the number of computing resources SM.
[0035] Therefore, the utility function of computing resources is:
[0036] ;
[0037] in, c is the number of allocated computing resources SM; Performance(c) To assign a program c The system performance of computationally intensive programs when using SM computing resources.
[0038] When the bandwidth of the storage resource SM required by the current program is less than the bandwidth of the storage resource SM currently allocated by the system, the program is a computationally intensive program, and the performance increases linearly with the number of storage resources SM. The utility function of the computing resource is simplified to When the storage resource SM bandwidth required by the current program is greater than the storage resource SM bandwidth currently allocated by the system, then the program is a memory-intensive program, and the performance does not change with the number of SMs. The utility function of the computing resources is simplified to .
[0039] For a memory-intensive program, its performance increases linearly with the number of storage resource bandwidth MCs. For a computation-intensive program, its performance is not greatly affected by the number of storage resource bandwidth MCs when its memory access requests are fully satisfied.
[0040] Therefore, the utility function of the storage resource bandwidth MC is:
[0041] ;
[0042] in, b The amount of bandwidth allocated for storage resources; Performance(b) To assign a program b The system performance of memory-intensive programs when the storage resource bandwidth MC is 1.
[0043] When the storage resource bandwidth MC required by the current task is greater than the storage resource bandwidth MC currently allocated by the system, then the program is a memory-intensive program, and the performance increases linearly with the amount of storage resource bandwidth MC. The utility function of storage resource bandwidth MC is simplified to = 1. When the storage resource bandwidth MC required by the current task is less than the storage resource bandwidth MC currently allocated by the system, then the program is a memory-intensive program, and the performance does not change with the amount of storage resource bandwidth MC. The utility function of storage resource bandwidth MC is simplified to =0.
[0044] S3. The main core assigns an initial price to each computing resource SM and storage resource bandwidth MC and publishes it to each core. Each core refers to the price and utility function and uses the hill climbing algorithm to give a bidding price for the computing resource SM and storage resource bandwidth MC.
[0045] The initial price of computing resources SM and storage resource bandwidth MC is determined by the total amount of money and the total amount of resources. The initial price of computing resources SM is the money used to purchase computing resources SM divided by the number of computing resources SM. The initial price of storage resource bandwidth MC is the money used to purchase storage resource bandwidth MC divided by the number of storage resource bandwidth MC.
[0046] The hill climbing algorithm is a "guided" hill climbing search:
[0047] Computationally intensive programs start searching from the maximum affordable computing resource SM. The marginal utility of computing resource SM When the maximum affordable computing resource SM is used, it is generally smaller than when the storage resource bandwidth MC is very small. Therefore, the total utility obtained by using the money obtained from reducing one computing resource SM to purchase storage resource bandwidth MC will increase.
[0048] Memory-intensive programs search for the maximum affordable storage resource bandwidth MC. The marginal utility of storage resource bandwidth MC When the maximum affordable storage resource bandwidth MC is generally less than Therefore, the total utility obtained by using the money obtained by reducing the storage resource bandwidth MC to purchase computing resources SM will increase.
[0049] Until the utility loss of reducing resources is greater than the benefit of purchasing resources, bid to the main core.
[0050] S4. At a global barrier to ensure that all bid calculations are completed, the main core collects bids and calculates the new price of each computing resource and storage resource bandwidth to determine whether to allocate resources; if so, allocate resources to each program; if not, publish the new price of each computing resource and storage resource bandwidth to each core, and repeat S3-S4.
[0051] The new price of each computing resource and storage resource bandwidth is dynamically adjusted based on the total bid and the available quantity of the resource. The formula is:
[0052] ;
[0053] in, It is a resource The price, It's a task About Resources The bidding price, It is a resource The total amount.
[0054] The method for determining resource allocation is that the new price changes less than 2% compared to the previous iteration price or the number of bidding rounds is greater than 30.
[0055] Resources are allocated in proportion to the bids, and the allocation formula is:
[0056] ;
[0057] in, Assigned to the task Resources The number of
[0058] S5. Complete the allocation of computing resources and storage resource bandwidth.
[0059] Example
[0060] Resources are equally divided between program A and program B, and the running programs include program A and program B. Program A and program B are run on the GPU for one cycle, and program A and program B are determined to be computation-intensive programs and memory-access-intensive programs.
[0061] Program A and Program B both have 8 units of money, and the number of computing resources SM and storage resource bandwidth MC are both 8. After running Program A and Program B, it is found that Program A requires 5 computing resources SM and 3 storage resource bandwidth MC; Program B requires 6 computing resources SM and 2 storage resource bandwidth MC. Program A and Program B require a large number of computing resources SM, so Program A and Program B are both computationally intensive programs.
[0062] The main core assigns an initial price to each computing resource SM and storage resource bandwidth MC. The initial price of computing resource SM is P SM (0)=1, the initial price P of storage resource bandwidth MC M (0) = 1. Program A bids 5 units of money for computing resources SM and 3 units of money for storage resource bandwidth MC. Program B bids 6 units of money for computing resources SM and 2 units of money for storage resource bandwidth MC.
[0063] The main core re-gives new prices for computing resources and storage resource bandwidth based on the bidding of program A and program B. The new prices are determined by Calculate. Get P SM (1)=(5+6) / 8, P M (1)=(2+3) / 8.
[0064] Program A and Program B use the hill climbing algorithm to bid for computing resources SM and storage resource bandwidth MC based on the new price and utility function. Since storage resource bandwidth MC is abundant, Program A and Program B first purchase storage resource bandwidth MC. Program A bids for storage resource bandwidth MC at ((2+3)*3) / 8 units of money, and bids for storage computing resources SM at 8-(((2+3)*3) / 8 units of money. Program B bids for storage resource bandwidth MC at ((2+3)*2) / 8 units of money, and bids for storage computing resources SM at 8-(((2+3)*2) / 8 units of money.
[0065] The main core re-gives new prices for computing resources and storage resource bandwidth based on the bidding of program A and program B, and obtains PM (2)=((((2+3)*3) / 8)+(((2+3)*2) / 8)) / 8=5 2 / 8 2 , P SM (2)=((8-(((2+3)*3) / 8))+(8-(((2+3)*32) / 8))) / 8=2-(5 2 / 8 2 ).
[0066] Similarly, programs A and B use a hill climbing algorithm to bid for computing resources SM and storage resource bandwidth MC based on the new price and utility function.
[0067] Calculate in sequence and get the price in the nth round of bidding, P M (n)=5 n / 8 n , P SM (n)=2-(5 n / 8 n ). When the value of n is large, P SM (n) is about 2, P M (n) is approximately 0.
[0068] The new price changes less than 2% compared with the previous iteration price or the number of bidding rounds is greater than 30 for resource allocation. Since both program A and program B have 8 units of money, program A can purchase about 4 computing resources SM and the 3 storage resource bandwidths MC it needs. Program B can purchase about 4 computing resources SM and the 2 storage resource bandwidths MC it needs.
[0069] At this point, a cycle of resource allocation is completed.
[0070] In the second cycle, the amount of computing resources SM and storage resource bandwidth MC required by program A and program B will change according to the actual situation. Based on the results of real-time hardware monitoring in the previous cycle, the utility function of computing resources SM is obtained. and the utility function of storage resource bandwidth MC .
[0071] Resources are equally divided between program A and program B, and the running programs include program A and program B. Program A and program B are run on the GPU for one cycle, and program A and program B are determined to be computation-intensive programs and memory-access-intensive programs.
[0072] At this time, both program A and program B have 8 units of money, and the number of computing resources SM and storage resource bandwidth MC are both 8. After running program A and program B, it is found that program A requires 3 computing resources SM and 5 storage resource bandwidth MC; program B requires 6 computing resources SM and 2 storage resource bandwidth MC. Program A requires a larger number of storage resource bandwidth MCs, and program B requires a larger number of computing resources SM. Therefore, program A is a memory-intensive program, and program B is a computing-intensive program.
[0073] The main core assigns an initial price to each computing resource SM and storage resource bandwidth MC. The initial price of computing resource SM is P SM (0)=1, the initial price P of storage resource bandwidth MC M (0) = 1. Program A bids 3 units of money for computing resources SM and 5 units of money for storage resource bandwidth MC. Program B bids 6 units of money for computing resources SM and 2 units of money for storage resource bandwidth MC.
[0074] The main core re-gives new prices for computing resources and storage resource bandwidth based on the bidding of program A and program B. The new prices are determined by Calculate. Get P SM (1)=(3+6) / 8, P M (1)=(5+2) / 8.
[0075] Program A and Program B use the hill climbing algorithm to bid for computing resources SM and storage resource bandwidth MC based on the new price and utility function. Since storage resource bandwidth MC is abundant, Program A and Program B first purchase storage resource bandwidth MC. Program A bids for storage resource bandwidth MC at ((5+2)*5) / 8 units of money, and bids for storage computing resources SM at 8-(((5+2)*5) / 8 units of money. Program B bids for storage resource bandwidth MC at ((5+2)*2) / 8 units of money, and bids for storage computing resources SM at 8-(((5+2)*2) / 8 units of money.
[0076] The main core re-gives new prices for computing resources and storage resource bandwidth based on the bidding of program A and program B, and obtains P M (2)=((((5+2)*5) / 8)+(((5+2)*2) / 8)) / 8=7 2 / 8 2 , P SM (2)=((8-(((5+2)*5) / 8))+(8-(((5+2)*2) / 8))) / 8=2-(7 2 / 8 2 ).
[0077] Similarly, programs A and B use a hill climbing algorithm to bid for computing resources SM and storage resource bandwidth MC based on the new price and utility function.
[0078] Calculate in sequence and get the price in the nth round of bidding, P M (n)=7 n / 8 n , P SM (n)=2-(7 n / 8 n ). When the value of n is large, P SM (n) is about 2, P M (n) is approximately 0.
[0079] The new price changes less than 2% from the previous iteration price or the number of bidding rounds is greater than 30 for resource allocation. Since both program A and program B have 8 units of money, program A can purchase the 3 computing resources SM and the 5 storage resource bandwidths MC it needs. Program B can obtain the remaining 5 computing resources SM and the 2 storage resource bandwidths MC it needs.
[0080] At this point, the resource allocation for the second cycle is completed.
[0081] This process is repeated in turn to realize GPU resource allocation.
[0082] When running multiple programs on the GPU, resources are allocated according to utility, computing resources SM are added to computing-intensive programs, and storage resource bandwidth MC is added to memory-intensive programs, maximizing utility and greatly improving system throughput. According to the importance of tasks, different amounts of money are allocated to them to obtain resources, which can more effectively ensure the execution efficiency of high-priority tasks.
[0083] Therefore, the present invention adopts the above-mentioned multi-task GPU resource allocation method to solve the problem of allocating computing resources and storage resources among multiple tasks in a multi-task GPU, and achieves scalable high throughput and fairness in a multi-task GPU.
[0084] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution 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 solution of the present invention with equivalents, and these modifications or equivalent replacements cannot cause the modified technical solution to deviate from the spirit and scope of the technical solution of the present invention.
Claims
1. A multi-task GPU resource allocation method, It is characterized in that The following steps are involved: S1. Divide resources equally among several programs and run a program for one cycle on the GPU. The hardware monitors the behavior of the program and divides the program into a computation-intensive program and a memory-intensive program according to whether the bandwidth of the storage resources required by the program is less than the bandwidth of the storage resources currently allocated by the system. S2. Establish the utility function of computing resources SM and the utility function of storage resource bandwidth MC ; S3. The master core assigns an initial price to each computing resource SM and storage resource bandwidth MC and publishes it to each core. Each core refers to the price and utility function and uses the hill climbing algorithm to give a bid for the computing resource SM and storage resource bandwidth MC. S4, at a global barrier to ensure that all bid calculations are completed, the main core collects bids and calculates the new price of each computing resource SM and storage resource bandwidth MC, and determines whether to allocate resources; if so, allocate resources to each program; if not, publish the new price of each computing resource SM and storage resource bandwidth MC to each core, and repeat S3-S4; S5. Complete the allocation of computing resources SM and storage resource bandwidth MC; In S2, the utility function of computing resource SM is in, c is the number of allocated computing resources SM; Performance(c) To assign a program c System performance of computationally intensive programs with SM computing resources; In S2, the utility function of the storage resource bandwidth MC is: in, b is the amount of allocated storage resource bandwidth MC; Performance(b) To assign a program b System performance of memory-intensive programs when the storage resource bandwidth is MC; In S4, the new price of each computing resource SM and storage resource bandwidth MC is dynamically adjusted according to the total bid and the available quantity of the resource, and the formula is: in, It is a resource The price, It's a task About Resources The bidding price, It is a resource Total amount; In S4, resources are allocated in proportion according to the bidding, and the allocation formula is: in, Assigned to the task Resources The number of 2. A multi-task GPU resource allocation method according to claim 1, Features: When the storage resource bandwidth MC required by the current task is less than the storage resource bandwidth MC currently allocated by the system, = 1; When the storage resource bandwidth MC required by the current task is greater than the storage resource bandwidth MC currently allocated by the system, = 0.
3. A multi-task GPU resource allocation method according to claim 2, Features: When the storage resource bandwidth MC required by the current task is greater than the storage resource bandwidth MC currently allocated by the system, = 1; When the storage resource bandwidth MC required by the current task is less than the storage resource bandwidth MC currently allocated by the system, = 0.
4. A multi-task GPU resource allocation method according to claim 3, Features: In S3, the initial price of computing resources SM and storage resource bandwidth MC is determined by the total amount of money to purchase computing resources SM and storage resource bandwidth MC and the total number of resources.
5. A multi-task GPU resource allocation method according to claim 4, Features: In S4, the method for determining resource allocation is that the new price changes less than 2% compared with the previous iteration price or the number of bidding rounds is greater than 30 times.
