Resource scheduling method, device and scheduling equipment
By acquiring the application's current resource information and using fuzzy control methods, combined with a binary search approach to adjust resource allocation, the problem of low resource utilization in existing GPU resource scheduling methods is solved, achieving efficient utilization of the GPU resource pool. In particular, in the scenario of learning artificial intelligence courseware, the overall resource utilization rate is improved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-06
- Publication Date
- 2026-03-27
AI Technical Summary
Existing GPU resource scheduling methods cannot effectively utilize GPU resources, leading to resource shortages. This is especially problematic when university students are learning artificial intelligence courseware, as the GPU resource pool cannot meet the needs of compilation, debugging, and program test case training.
By acquiring the current resource information of the application during runtime, and combining fuzzy control methods and the binary search method to adjust resource allocation, the average resource utilization rate of the target algorithm is kept stable within a preset range. The resource monitoring system provides real-time feedback and caches scheduling information to optimize resource allocation.
This improved the utilization rate of virtual GPU resources, achieved the overall utilization rate of the GPU resource pool, ensured that the resource utilization rate of each user remained at a high level, and avoided duplicate calls and user-perceived status.
Smart Images

Figure CN116225674B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computing processing, in particular to a resource scheduling method, device and scheduling equipment. BACKGROUND
[0002] A graphics processing unit (GPU) is also known as a display core, a visual processor or a display chip. It is a microprocessor specially used for image and graphics related operations on personal computers, workstations, game consoles and some mobile devices (such as tablet computers, smart phones, etc.). GPU is good at processing matrix multiplication and convolution, so artificial intelligence algorithms often carry out efficient operation based on GPU.
[0003] The existing open source GPU virtualization method does not support resource scheduling to ensure the quality of service (QoS), and once the GPU resources are allocated to a user, the user can only use them exclusively and cannot share them with other users, so there is a large space for improvement in resource utilization. For example, when a GPU resource pool is used for artificial intelligence courseware learning by college students, it is mainly used for compilation and debugging, and there is a problem of insufficient GPU resources for related program use case training. SUMMARY
[0004] The technical scheme of the present application provides a resource scheduling method, device and scheduling equipment to solve the problem of ineffective use of GPU resources by using the prior art GPU resource scheduling method.
[0005] The present application provides a resource scheduling method, which comprises the following steps:
[0006] Obtain the current resource information of the application program running time;
[0007] When the current resource information indicates that the current resource does not meet the resource call of the application program running time, allocate resources according to the target algorithm currently run by the application program, and adjust the resource average utilization rate of the target algorithm to a target value;
[0008] When the application program runs the target algorithm, use a fuzzy control method to adjust the resources, so that the resource average utilization rate of the target algorithm is stabilized within a preset range including the target value.
[0009] Optionally, the resource scheduling method further comprises the following steps:
[0010] Cache the resource scheduling information of the application program running time;
[0011] According to the resource scheduling information, the resources required by the application program are determined when resource allocation is performed according to a target algorithm currently run by the application program and / or resource adjustment is performed by using a fuzzy control method.
[0012] Optionally, the resource scheduling method, wherein the current resource information of the application program is obtained by a resource monitoring system.
[0013] Optionally, the resource scheduling method, wherein the current resource information of the application program is obtained by a resource monitoring system.
[0014] Optionally, the resource scheduling method, wherein before resource allocation is performed according to a target algorithm currently run by the application program, the method further comprises:
[0015] According to the historical resource usage rate of the target algorithm, a K-nearest neighbor algorithm is used to calculate a clustering resource usage rate of the application program running the target algorithm.
[0016] According to the clustering resource usage rate, resource allocation is performed when resource allocation is performed according to the target algorithm currently run by the application program.
[0017] Optionally, the resource scheduling method, wherein when resource allocation is performed according to the target algorithm currently run by the application program, the resource average usage rate of the target algorithm is adjusted to a target value, comprising:
[0018] According to the target algorithm currently run by the application program, resource allocation is performed by using a dichotomy method, and the resource average usage rate of the target algorithm is adjusted to a target value.
[0019] Optionally, the resource scheduling method, wherein when resource allocation is performed according to the target algorithm currently run by the application program, the resource average usage rate of the target algorithm is adjusted to a target value, comprising:
[0020] The process of running the target algorithm of the application program under the preset allocated resources, adjusting the allocated resources by using a dichotomy method according to the difference between the resource average usage rate when the target algorithm is run and the target value, and continuing to run the target algorithm of the application program is repeatedly executed until the absolute value of the difference between the resource average usage rate when the target algorithm of the application program is run and the target value is less than a preset value.
[0021] Optionally, the resource scheduling method, wherein, in the case of the preset allocated resources, the target algorithm of the application program is run, according to the difference between the average resource usage during the running of the target algorithm and the target value, the allocated resources are adjusted by using the dichotomy, and the process of running the target algorithm of the application program is continued until the absolute value of the difference between the average resource usage during the running of the target algorithm of the application program and the target value is less than a preset value, comprising:
[0022] running the target algorithm of the application program in the case of the initial allocated resources;
[0023] adjusting the allocated resources by using the dichotomy according to the difference between the average resource usage during the running of the target algorithm of the application program and the target value, to obtain first adjusted resources;
[0024] continuing to run the target algorithm of the target application program in the case of the first adjusted resources;
[0025] continuing to adjust the allocated resources by using the dichotomy according to the difference between the average resource usage during the running of the target algorithm of the application program and the target value, to obtain second adjusted resources;
[0026] continuing to run the target algorithm of the target application program in the case of the second adjusted resources until the absolute value of the difference between the average resource usage during the running of the target algorithm of the application program and the target value is less than a preset value.
[0027] Optionally, the resource scheduling method, wherein, according to the difference between the average resource usage during the running of the target algorithm of the application program and the target value, the allocated resources are adjusted by using the dichotomy to obtain first adjusted resources, comprising:
[0028] in the case that the average resource usage is greater than the target value, it is determined that the first predetermined number of allocated resources is added on the basis of the initial allocated resources to obtain the first adjusted resources;
[0029] in the case that the average resource usage is less than the target value, it is determined that the second predetermined number of allocated resources is reduced on the basis of the initial allocated resources to obtain the first adjusted resources.
[0030] Optionally, the resource scheduling method, wherein, according to the difference between the average resource usage during the running of the target algorithm of the application program and the target value, the allocated resources are adjusted by using the dichotomy to obtain second adjusted resources, comprising:
[0031] if the first adjustment resource is obtained by increasing a first predetermined number of allocated resources based on the initial allocated resource, and the average resource usage is still greater than the target value when the target algorithm of the target application program is continuously run with the first adjustment resource, then a third predetermined number of allocated resources is added to the first adjustment resource to obtain the second adjustment resource;
[0032] if the first adjustment resource is obtained by increasing a first predetermined number of allocated resources based on the initial allocated resource, and the average resource usage is less than the target value when the target algorithm of the target application program is continuously run with the first adjustment resource, then the second adjustment resource is determined as one half of the sum of the initial allocated resource and the first adjustment resource.
[0033] Optionally, the resource scheduling method, wherein the allocated resource is continuously adjusted by using the bisection method according to the difference between the average resource usage when the target algorithm of the application program is run and the target value, to obtain a second adjustment resource, comprising:
[0034] if the first adjustment resource is obtained by reducing a second predetermined number of allocated resources based on the initial allocated resource, and the average resource usage is still less than the target value when the target algorithm of the target application program is continuously run with the first adjustment resource, then a fourth predetermined number of allocated resources is reduced from the first adjustment resource to obtain the second adjustment resource;
[0035] if the first adjustment resource is obtained by reducing a second predetermined number of allocated resources based on the initial allocated resource, and the average resource usage is greater than the target value when the target algorithm of the target application program is continuously run with the first adjustment resource, then the second adjustment resource is determined as one half of the sum of the initial allocated resource and the first adjustment resource.
[0036] Optionally, the resource scheduling method, wherein before the resource adjustment is performed by using the fuzzy control method, the method further comprises:
[0037] using an intermediate adjustment result in the resource allocation process as a training value of a control function in the fuzzy control method to determine a calculation parameter of the control function;
[0038] wherein when the resource adjustment is performed by using the fuzzy control method, the control function using the calculation parameter is subjected to fuzzy calculation to determine a resource adjustment amount for the resource adjustment.
[0039] The embodiment of the application further provides a resource scheduling device, comprising:
[0040] an information obtaining module, configured to obtain current resource information of an application running time;
[0041] a first adjusting module, configured to, when the current resource information indicates that current resources do not meet resource calling of the application running time, adjust resource allocation according to a target algorithm currently run by the application, and adjust resource average utilization of the target algorithm to a target value;
[0042] a second adjusting module, configured to, when the application runs the target algorithm, adjust resources by using a fuzzy control method, so that resource average utilization of the target algorithm is stabilized in a preset range including the target value.
[0043] The embodiment of the application further provides a scheduling device, which comprises a processor, a memory and a program stored in the memory and executable on the processor, and the program is executed by the processor to implement the resource scheduling method according to any one of the above.
[0044] The embodiment of the application further provides a readable storage medium, wherein the readable storage medium stores a program, and the program is executed by a processor to implement the steps of the resource scheduling method according to any one of the above.
[0045] The above technical solution of the application has at least one of the following beneficial effects:
[0046] The resource scheduling method according to the embodiment can allocate resources according to a target algorithm run by an application when current virtual GPU resources do not meet resource calling, and can realize effective utilization of resources by combining a fuzzy control method, so that virtual GPU resource utilization of each user can be maintained at a high level, and the overall utilization rate of a GPU resource pool can be improved. BRIEF DESCRIPTION OF DRAWINGS
[0047] Figure 1 FIG. 1 is a flowchart of a resource scheduling method according to an embodiment of the application;
[0048] Figure 2 FIG. 2 is a system workflow diagram of a resource scheduling method according to an embodiment of the application;
[0049] Figure 3 FIG. 3 is a structural diagram of a resource scheduling device according to an embodiment of the application. DETAILED DESCRIPTION
[0050] To make the technical problems, technical solutions and advantages of the application clearer, the following will describe in detail with reference to the drawings and specific embodiments.
[0051] To solve the problem that GPU resources cannot be effectively utilized by using the prior art GPU resource scheduling method, the embodiment of the present application provides a resource scheduling method, when it is determined according to current resource information that the current resources do not meet resource calling, resource allocation is performed according to a target algorithm running by an application program, and effective utilization of resources is realized by combining a fuzzy control method.
[0052] As shown in Figure 1 The resource scheduling method described in one embodiment of the present application comprises:
[0053] S110, current resource information when an application program is running is acquired;
[0054] S120, when the current resource information indicates that the current resources do not meet resource calling when the application program is running, resource allocation is performed according to a target algorithm currently running by the application program, and resource average utilization of the target algorithm is adjusted to a target value;
[0055] S130, when the application program runs the target algorithm, resource adjustment is performed by using a fuzzy control method, so that resource average utilization of the target algorithm is stabilized in a preset range including the target value.
[0056] The resource scheduling method described in the embodiment of the present application can be optionally applied to dynamic scheduling of virtual GPU resources, and is especially applied to virtual GPU resource scheduling in scenarios where program use case training is more and large-scale data processing is less, such as scenarios when college students learn artificial intelligence courseware.
[0057] By using the resource scheduling method described in the embodiment, when the current virtual GPU resources do not meet resource calling, resource allocation is performed according to a target algorithm running by an application program, and effective utilization of resources is realized by combining a fuzzy control method, so that virtual GPU resource utilization of each user can be maintained at a high level, and the purpose of improving overall utilization of a GPU resource pool is achieved.
[0058] In the embodiment of the present application, optionally, in step S110, current resource information when an application program is running is acquired, the current resource information is virtual GPU resources, and optionally, the virtual GPU resources include a number of virtual GPUs scheduled and / or a size of a graphics card memory.
[0059] Optionally, the resource scheduling method described in the embodiment of the present application, in step S110, the current resource information when an application program is running is acquired, and comprises:
[0060] The current resource information when the application program is running is acquired by a resource monitoring system.
[0061] The resource scheduling method provided in the embodiment of the application, when applied to a resource scheduling system, is connected with a resource monitoring system, and can feed back current resource information of virtual GPU resources to the resource scheduling system in real time, so that the resource scheduling system can allocate resources according to a target algorithm of an application program when the current virtual GPU resources do not meet the resource call of the application program, so as to allocate appropriate virtual GPU resources for the target algorithm of the application program.
[0062] Optionally, the method further comprises:
[0063] caching resource scheduling information of the application program when running;
[0064] When the resource allocation is performed according to the target algorithm currently run by the application program and / or the resource adjustment is performed by using the fuzzy control method, the resource required by the application program is determined according to the resource scheduling information.
[0065] As Figure 2 A system flowchart using the resource scheduling method provided in the embodiment of the application is shown in FIG. 1. When the method provided in the embodiment is used, the application program can call virtual GPU resources by using virtual Compute Unified Device Architecture (vCUDA), and the resource scheduling information (including scheduled commands and data) called by vCUDA is cached for facilitating vGPU resource scheduling. When the resource scheduling system determines that the current resources do not meet the resource call of the application program when running according to the current resource information of the application program when running fed back by the resource monitoring system, the resource allocation is performed according to the target algorithm currently run by the application program, and appropriate virtual GPU resources are allocated for the target algorithm of the application program.
[0066] By caching the resource scheduling information of the application program when running, the resource required by the application program can be determined according to the cached resource scheduling information when the resource allocation is performed according to the target algorithm currently run by the application program and / or the resource adjustment is performed by using the fuzzy control method, so that repeated calling of virtual GPU resources by vCUDA is avoided, and the user is ensured to be in a state of no perception during the resource allocation or adjustment.
[0067] It should be noted that different scenarios have different GPU usage modes, and different acceleration libraries are used. In the embodiment of the application, the GPU virtualization mentioned is mainly for scientific computing scenarios, and the acceleration library used is Nvidia CUDA.
[0068] Furthermore, the resource scheduling method described in this embodiment of the invention can be used to configure resources according to the algorithm running the application. When applied to AI courseware learning scenarios, the AI platform provides courseware and related algorithm program use cases. Generally, algorithm program use cases include the following categories: search and problem-solving (heuristic search, adversarial search, and Monte Carlo tree search), logic and reasoning (propositional logic, predicate logic, knowledge graph reasoning, causal reasoning, etc.), statistical machine learning (linear regression analysis, linear discriminant analysis, Ada boosting, etc.), unsupervised learning (K-means, principal component analysis, expectation maximization algorithm, etc.), deep learning (feedforward neural networks, convolutional neural networks, natural language understanding and visual analysis, etc.), reinforcement learning (Markov decision processes, Q-learning, deep reinforcement learning, etc.), and AI game theory (Nash equilibrium, regret minimization algorithm, virtual regret minimization algorithm, etc.).
[0069] The above algorithms will be used repeatedly in the process of artificial intelligence learning. Therefore, it is necessary to configure the most suitable resources for algorithms that consume roughly the same amount of GPU resources, which will help to achieve overall resource optimization.
[0070] The resource scheduling method described in this embodiment further includes, before allocating resources according to the target algorithm currently running by the application, the method further comprising:
[0071] Based on the historical resource utilization rate of the target algorithm, the K-nearest neighbor algorithm is used to calculate the clustering resource utilization rate of the application running the target algorithm;
[0072] Specifically, when allocating resources based on the target algorithm currently running in the application, resource allocation is performed based on the clustering resource utilization rate.
[0073] Specifically, this historical resource utilization rate can be obtained by monitoring the use of virtual GPU resources through a resource monitoring system. This historical resource utilization rate can be the historical average utilization rate of the virtual GPU resources. For each target algorithm running in the above applications, based on this historical resource utilization rate, the K-nearest neighbor algorithm is used to calculate the clustered resource utilization rate of the application running the target algorithm. For example, when using the K-nearest neighbor algorithm, K = 2 or 3, using Euclidean distance, and limiting the radius to r (e.g., r = 0.1), N approximate clustered resources can be obtained.
[0074] The resource scheduling method described in this embodiment of the invention includes, in step S120, allocating resources according to the target algorithm currently running the application, and adjusting the average resource utilization rate of the target algorithm to a target value, including:
[0075] According to a target algorithm currently run by the application program, resource allocation is performed by using dichotomy, and resource average utilization of the target algorithm is adjusted to a target value.
[0076] Optionally, the resource allocation by using dichotomy to adjust the resource average utilization of the target algorithm to the target value comprises:
[0077] The process of running the target algorithm of the application program under the preset allocated resource, adjusting the allocated resource by using dichotomy according to the difference between the resource average utilization during the running of the target algorithm and the target value, and continuing to run the target algorithm of the application program is repeatedly performed until the absolute value of the difference between the resource average utilization during the running of the target algorithm of the application program and the target value is less than a preset value. Optionally, the process of running the target algorithm of the application program under the preset allocated resource, adjusting the allocated resource by using dichotomy according to the difference between the resource average utilization during the running of the target algorithm and the target value, and continuing to run the target algorithm of the application program is repeatedly performed until the absolute value of the difference between the resource average utilization during the running of the target algorithm of the application program and the target value is less than a preset value comprises:
[0078] The target algorithm of the application program is run under the initial allocated resource.
[0079] The allocated resource is adjusted by using dichotomy according to the difference between the resource average utilization during the running of the target algorithm of the application program and the target value, and a first adjusted resource is obtained.
[0080] The target algorithm of the target application program is continued to run under the first adjusted resource.
[0081] The allocated resource is continued to be adjusted by using dichotomy according to the difference between the resource average utilization during the running of the target algorithm of the application program and the target value, and a second adjusted resource is obtained.
[0082] The target algorithm of the target application program is continued to run under the second adjusted resource until the absolute value of the difference between the resource average utilization during the running of the target algorithm of the application program and the target value is less than a preset value.
[0083] Optionally, the resource scheduling method, wherein the allocated resource is adjusted by using dichotomy according to the difference between the resource average utilization during the running of the target algorithm of the application program and the target value, and the first adjusted resource is obtained comprises:
[0084] In the case that the average resource usage is greater than the target value, it is determined that the first predetermined number of allocated resources is added on the basis of the initial allocated resources to obtain the first adjusted resources.
[0085] In the case that the average resource usage is less than the target value, it is determined that the second predetermined number of allocated resources is reduced on the basis of the initial allocated resources to obtain the first adjusted resources.
[0086] Optionally, the first predetermined number of allocated resources is equal to the initial allocated resources, that is, in the case that the first predetermined number of allocated resources is added on the basis of the initial allocated resources to obtain the first adjusted resources, the first adjusted resources are twice the initial allocated resources.
[0087] Optionally, the second predetermined number of allocated resources is equal to half of the initial allocated resources, that is, in the case that the second predetermined number of allocated resources is reduced on the basis of the initial allocated resources to obtain the first adjusted resources, the first adjusted resources are half of the initial allocated resources.
[0088] Optionally, according to the difference between the average resource usage in the runtime of the target algorithm of the application program and the target value, the binary search method is further used to adjust the allocated resources to obtain the second adjusted resources, comprising:
[0089] If the first adjusted resources are obtained by adding the first predetermined number of allocated resources on the basis of the initial allocated resources, and the average resource usage is still greater than the target value when the target algorithm of the target application program is continuously run in the case of the first adjusted resources, the third predetermined number of allocated resources is added on the basis of the first adjusted resources to obtain the second adjusted resources.
[0090] If the first adjusted resources are obtained by adding the first predetermined number of allocated resources on the basis of the initial allocated resources, and the average resource usage is less than the target value when the target algorithm of the target application program is continuously run in the case of the first adjusted resources, it is determined that the second adjusted resources are half of the sum of the initial allocated resources and the first adjusted resources.
[0091] Optionally, the third predetermined number of allocated resources is equal to the resource size of the first adjusted resources, that is, in the case that the third predetermined number of allocated resources is added on the basis of the first adjusted resources to obtain the second adjusted resources, the second adjusted resources are twice the first adjusted resources.
[0092] Optionally, based on the difference between the average resource usage of the target algorithm runtime of the application program and the target value, the binary search is continued to adjust the allocated resources to obtain second adjustment resources, comprising:
[0093] If the first adjustment resources are obtained by reducing a second predetermined number of allocated resources based on the initial allocated resources, and the average resource usage is still less than the target value when the target algorithm of the target application program is continuously run in the case of the first adjustment resources, a fourth predetermined number of allocated resources is reduced based on the first adjustment resources to obtain the second adjustment resources.
[0094] If the first adjustment resources are obtained by reducing a second predetermined number of allocated resources based on the initial allocated resources, and the average resource usage is greater than the target value when the target algorithm of the target application program is continuously run in the case of the first adjustment resources, the second adjustment resources are determined to be half of the sum of the initial allocated resources and the first adjustment resources.
[0095] Optionally, the fourth predetermined number of allocated resources is equal to half of the resource size of the first adjustment resources, that is, in the case of reducing a fourth predetermined number of allocated resources based on the first adjustment resources to obtain the second adjustment resources, the second adjustment resources are half of the first adjustment resources.
[0096] By using the above-mentioned embodiments, the binary search is used to determine the appropriate resource allocation mode for the algorithm program run by the application program. Taking the allocated virtual GPU resources including the virtual GPU number as an example, the binary search is used to determine the resource allocation mode.
[0097] It is assumed that one GPU card can be virtualized into 100 VGPU, the memory is taken as a basic unit of 256 MB, the target value of the average usage of GPU and memory is z (it is assumed that z = 80%), and the allowed fluctuation range is d (it is assumed that d = 5%). Taking the GPU resource number allocation as an example, the specific process is as follows:
[0098] The initial allocated resources are n0 vGPU, the algorithm program is run, and the average usage of GPU and memory is obtained, which can specifically include the following two cases:
[0099] If the average usage of GPU is greater than z based on the initial allocated resources n0 vGPU and the running of the algorithm program, one time vGPU is added to obtain the first adjustment resources n1, n1 = 2*n0, and the algorithm program is continuously run. After the algorithm program is continuously run, there are the following two cases:
[0100] If the GPU average usage rate is still greater than z, on the basis of the first adjusted resource n1, one vGPU is continuously added to obtain a second adjusted resource n2, that is, n2=2*n1;
[0101] If the GPU average usage rate is less than z, the second adjusted resource n2 is n2=(n0+n1) / 2.
[0102] If the GPU average usage rate is less than z on the basis of the initial allocation resource n0, one vGPU is continuously reduced to obtain the first adjusted resource n1, that is, n1=n0 / 2;
[0103] On the basis of the first adjusted resource n1, the algorithm program is continuously run, and the following two cases exist:
[0104] If the GPU average usage rate is still less than z, on the basis of the first adjusted resource n1, one vGPU is continuously reduced to obtain the second adjusted resource n2, that is, n2=n1 / 2;
[0105] If the GPU average usage rate is greater than z, the second adjusted resource n2 is determined as follows: n2=(n0+n1) / 2.
[0106] If the GPU average usage rate has not reached the target value, that is, the resource average usage rate is not in the preset range z±d, the following process is repeated until the resource average usage rate is in the preset range z±d, that is, until the absolute value of the difference between the resource average usage rate and the target value z is less than the preset value d.
[0107] The above describes in detail the determination of the resource allocation mode by using the dichotomy method by taking the virtual GPU resource as an example, wherein the process of allocating the display memory resource is the same as that of allocating the virtual GPU, and thus is not described in detail herein.
[0108] Optionally, the resource scheduling method described in the embodiment of the application further comprises:
[0109] The resource allocation information in the resource allocation process and the corresponding resource average usage rate are saved.
[0110] Because there is a process of adjusting the configuration parameters or adjusting the sample data when different users run the algorithm program, the resource average usage rate (GPU / display memory average usage rate) is not the same and has a certain fluctuation. To avoid the influence of the calculation ability caused by the fluctuation, the fuzzy control method is used to further adjust the GPU and display memory resources in the algorithm program running process.
[0111] Therefore, the resource scheduling method in the embodiment of the present application, when the application program runs the target algorithm, also adopts the fuzzy control method to adjust the resource, so that the average resource usage of the target algorithm is stabilized in a preset range including the target value.
[0112] Optionally, in the embodiment of the present application, the control function for adjusting the resource by the fuzzy control method can be expressed as the following formula:
[0113]
[0114] Wherein, k is a sequence number for adjusting the resource according to time sequence; e(k) is the difference between the average resource usage and the target value when the sequence number is k, that is, the error value; u(k) is the resource adjustment amount, T is the time for running the algorithm program each time; Kp is the proportional coefficient; Kd is the differential action coefficient; Ki is the integral action coefficient.
[0115] Wherein, the proportional coefficient Kp is to accelerate the response speed of the system and improve the regulation accuracy of the system; the integral action coefficient Ki is to eliminate the steady-state error of the system; and the differential action coefficient Kd is to improve the dynamic characteristics of the system and suppress the deviation from changing in any direction during the response process to predict the deviation change in advance.
[0116] Generally, the coefficients Kp, Ki and kd are the optimal values determined according to experience and multiple tests.
[0117] In the embodiment of the present application, in order to accelerate the convergence speed of the fuzzy control, the error e(k) and the resource adjustment amount u(k) are substituted into the above formula to solve, with the strategy of reaching the target value at the fastest speed, to obtain the approximate solution of the coefficients Kp, Ki and kd. In this way, the appropriate resource allocation scheme can be obtained through 2-3 times of adjustment, the program running time is reduced to the greatest extent, so as to not affect the user perception.
[0118] Therefore, according to the above, in the embodiment of the present application, before the resource adjustment by the fuzzy control method, the method further includes:
[0119] Using the intermediate adjustment result in the resource allocation process as the training value of the control function in the fuzzy control method, to determine the calculation parameters of the control function;
[0120] Wherein, when the resource adjustment is performed by the fuzzy control method, the fuzzy calculation is performed on the control function using the calculation parameters, to determine the resource adjustment amount for adjusting the resource.
[0121] Optionally, the calculation parameters include the above-mentioned coefficients Kp, Ki and kd.
[0122] The following is an example of a specific embodiment of the resource adjustment method according to the fuzzy control method described in the embodiments of the present application.
[0123] Specifically, the fuzzy set definition and fuzzy rules of the fuzzy control are as follows:
[0124] When the resource adjustment is performed using the fuzzy control, the value range of the error e is optionally [-z, z] (for example, z = 0.8), the resource adjustment amount u is [-w, wt] (for example, w = 100, the basic resource unit of vGPU is 1 / 100 of GPU, and the basic unit of video memory is 256M, where wt is the remaining resource of the current physical GPU card, which is also 1 / 100 of GPU as the basic resource unit), and the discretization formula is as follows:
[0125]
[0126] The above values are processed, for example, when x = 0.8 and n = 3, n is the number of resource adjustments, and the value of the error e corresponding to the fuzzy set includes: 25*(x+0.68), 25*(x+0.44), 25*(x+0.2), 37.5*x, 25*(x-0.2), 25*(x-0.44), and 25*(x-0.68).
[0127] When w = 100 and n = 4, the value of the resource adjustment amount u corresponding to the fuzzy set includes: 0.24*(x+87.5), 0.24*(x+62.5), 0.24*(x+37.5), 0.4*(x+17.5), 0.3*x, 0.4*(x-17.5), 0.24*(x-37.5), 0.24*(x-62.5), and 0.24*(x-87.5).
[0128] In addition, the error e is divided into five fuzzy sets, which can include: negative big (NB), negative small (NS), zero (O), positive small (PS), and positive big (PB). The change range of the error e can be divided into seven levels: -3, -2, -1, 0, +1, +2, and +3.
[0129] According to the above division method, the definition of the fuzzy set of the error e can be as shown in the following table:
[0130]
[0131] The resource adjustment amount u is used to represent the change of the adjusted resource, which can be divided into five fuzzy sets, including: negative big (NB), negative small (NS), zero (ZO), positive small (PS), and positive big (PB). In addition, the change range of the resource adjustment amount u can be divided into nine levels: -4, -3, -2, -1, 0, +1, +2, +3, and +4.
[0132] According to the above division manner, the definition of the fuzzy set of the resource adjustment amount u can be shown in the following table:
[0133]
[0134] Optionally, the following fuzzy rules are designed in the embodiment of the application:
[0135] (1) If e is negative large, u is negative large;
[0136] (2) If e is negative small, u is negative small;
[0137] (3) If e is 0, u is 0;
[0138] (4) If e is positive small, u is positive small;
[0139] (5) If e is positive large, u is positive large;
[0140] Wherein, u is negative when the resource is reduced, and u is positive when the resource is increased.
[0141] The fuzzy control rule table according to the fuzzy rules is shown as follows:
[0142] IF NBe NSe ZOe PSe PBe THEN NBu NSu ZOu NSu NBu
[0143] The fuzzy relation R is represented as:
[0144] R=(NBe*NBu)∪(NSe*NSu)∪(ZOe*ZOu)∪(PSe*PSu)∪(PBe*PBu);
[0145] Further, the fuzzy relation R is calculated according to the above representation, for example, the calculation manner of one sub-item is as follows:
[0146]
[0147] Other sub-items are calculated by the same method, and finally the relation matrix is obtained as:
[0148]
[0149] On the basis of the above relation, when the error e is NB, e=[1, 0.5, 0, 0, 0, 0, 0], the control function output is:
[0150] u=e*R=[1, 0.5, 0.5, 0.5, 0, 0, 0, 0, 0]
[0151] According to the fuzzy decision, when the error is negative large, the actual resource is much higher than the required resource, e=NB, the output of the control function is a fuzzy vector, which can be represented as:
[0152]
[0153] On the basis of determining the above fuzzy vector output, the resource adjustment amount is selected as u=-4, that is, the maximum step reduces the resource allocation, according to the principle of maximum membership degree.
[0154] According to the above, when the resource adjustment is performed by using the fuzzy control method of the above embodiment, the corresponding resource adjustment amount can be determined each time the resource adjustment is performed, and the resource adjustment is performed on the resource determined by the dichotomy according to the resource adjustment amount, so that the resource average utilization rate is stabilized in the preset range including the target value, the appropriate virtual GPU resource is matched for the target algorithm of the application program, and the GPU resource can be effectively utilized.
[0155] It should be noted that the specific implementation of the above fuzzy control method is only for illustration, and is not limited thereto.
[0156] By using the resource scheduling method described in the embodiment of the application, the GPU resource adaptation is performed on the artificial intelligence algorithm case based on the dichotomy, and the parameter optimization method is used to train the fuzzy control algorithm parameters by using the intermediate results, so that the GPU resource can be effectively utilized.
[0157] Another embodiment of the application also provides a resource scheduling device, as shown in Figure 3 The resource scheduling device comprises:
[0158] An information acquisition module 310 is configured to acquire current resource information of an application program running;
[0159] A first adjustment module 320 is configured to, when the current resource information indicates that the current resource does not meet the resource call of the application program running, perform resource allocation according to a target algorithm currently run by the application program, and adjust the resource average utilization rate of the target algorithm to a target value.
[0160] A second adjustment module 330 is configured to, when the application program runs the target algorithm, perform resource adjustment by using a fuzzy control method, so that the resource average utilization rate of the target algorithm is stabilized in a preset range including the target value.
[0161] By using the resource scheduling device described in the embodiment, when the current virtual GPU resource does not meet the resource call, resource allocation is performed according to the target algorithm run by the application program, and the effective utilization of the resource is realized by combining the fuzzy control method, so that the virtual GPU resource utilization rate of each user can be maintained at a high level, and the purpose of improving the overall utilization rate of the GPU resource pool is achieved.
[0162] Optionally, the resource scheduling device, wherein the information acquisition module 310 is further configured to:
[0163] cache resource scheduling information of the application runtime;
[0164] wherein, when the first adjustment module 320 performs resource allocation according to the target algorithm currently run by the application and / or the second adjustment module 330 performs resource adjustment by using the fuzzy control method, the resource scheduling information is used to determine the resource required by the application.
[0165] Optionally, the resource scheduling device, wherein the information acquisition module 310 acquires current resource information of the application runtime, including:
[0166] The current resource information of the application runtime is acquired by a resource monitoring system.
[0167] Optionally, the resource scheduling device, wherein before the first adjustment module 320 performs resource allocation according to the target algorithm currently run by the application, it is further used for:
[0168] According to the historical resource usage rate of the target algorithm, the K-nearest neighbor algorithm is used to calculate the clustering resource usage rate of the application running the target algorithm.
[0169] wherein, when the first adjustment module 320 performs resource allocation according to the target algorithm currently run by the application, the clustering resource usage rate is used to perform resource allocation.
[0170] Optionally, the resource scheduling device, wherein the first adjustment module 320 performs resource allocation according to the target algorithm currently run by the application, and adjusts the average resource usage rate of the target algorithm to a target value, including:
[0171] According to the target algorithm currently run by the application, the bisection method is used to perform resource allocation, and the average resource usage rate of the target algorithm is adjusted to a target value.
[0172] Optionally, the resource scheduling device, wherein the first adjustment module 320 performs resource allocation by using the bisection method, and adjusts the average resource usage rate of the target algorithm to a target value, including:
[0173] The process of running the target algorithm of the application in the case of pre-set allocated resources, adjusting the allocated resources by using the bisection method according to the difference between the average resource usage rate during the running of the target algorithm and the target value, and continuing to run the target algorithm of the application is repeatedly executed until the absolute value of the difference between the average resource usage rate during the running of the target algorithm of the application and the target value is less than a preset value.
[0174] Optionally, the resource scheduling apparatus, wherein the first adjusting module 320 cyclically executes the process of running the target algorithm of the application program in the case of the preset allocated resources, adjusting the allocated resources by using the dichotomy according to the difference between the average resource usage rate during the running of the target algorithm and the target value, and continuing to run the target algorithm of the application program until the absolute value of the difference between the average resource usage rate during the running of the target algorithm of the application program and the target value is less than a preset value, comprising:
[0175] running the target algorithm of the application program in the case of the initial allocated resources;
[0176] adjusting the allocated resources by using the dichotomy according to the difference between the average resource usage rate during the running of the target algorithm of the application program and the target value, to obtain first adjusted resources;
[0177] continuing to run the target algorithm of the target application program in the case of the first adjusted resources;
[0178] continuing to adjust the allocated resources by using the dichotomy according to the difference between the average resource usage rate during the running of the target algorithm of the application program and the target value, to obtain second adjusted resources;
[0179] continuing to run the target algorithm of the target application program in the case of the second adjusted resources until the absolute value of the difference between the average resource usage rate during the running of the target algorithm of the application program and the target value is less than a preset value.
[0180] Optionally, the resource scheduling apparatus, wherein the first adjusting module 320 adjusts the allocated resources by using the dichotomy according to the difference between the average resource usage rate during the running of the target algorithm of the application program and the target value, to obtain first adjusted resources, comprising:
[0181] in the case that the average resource usage rate is greater than the target value, determining to increase a first predetermined number of allocated resources on the basis of the initial allocated resources to obtain the first adjusted resources;
[0182] in the case that the average resource usage rate is less than the target value, determining to reduce a second predetermined number of allocated resources on the basis of the initial allocated resources to obtain the first adjusted resources.
[0183] Optionally, the resource scheduling apparatus, wherein the first adjusting module 320 continues to adjust the allocated resources by using the dichotomy according to the difference between the average resource usage rate during the running of the target algorithm of the application program and the target value, to obtain second adjusted resources, comprising:
[0184] If the first adjustment resource is obtained by increasing a first predetermined number of allocated resources based on the initial allocated resource, and the average resource usage is still greater than the target value when the target algorithm of the target application program is continuously run in the case of the first adjustment resource, a third predetermined number of allocated resources is added based on the first adjustment resource to obtain the second adjustment resource;
[0185] If the first adjustment resource is obtained by increasing a first predetermined number of allocated resources based on the initial allocated resource, and the average resource usage is less than the target value when the target algorithm of the target application program is continuously run in the case of the first adjustment resource, the second adjustment resource is determined to be one half of the sum of the initial allocated resource and the first adjustment resource.
[0186] Optionally, the resource scheduling apparatus, wherein the first adjustment module 320 continues to adjust the allocated resource by using the dichotomy method according to the difference between the average resource usage when the target algorithm of the application program is run and the target value, to obtain a second adjustment resource, comprising:
[0187] If the first adjustment resource is obtained by reducing a second predetermined number of allocated resources based on the initial allocated resource, and the average resource usage is still less than the target value when the target algorithm of the target application program is continuously run in the case of the first adjustment resource, a fourth predetermined number of allocated resources is reduced based on the first adjustment resource to obtain the second adjustment resource.
[0188] If the first adjustment resource is obtained by reducing a second predetermined number of allocated resources based on the initial allocated resource, and the average resource usage is greater than the target value when the target algorithm of the target application program is continuously run in the case of the first adjustment resource, the second adjustment resource is determined to be one half of the sum of the initial allocated resource and the first adjustment resource.
[0189] Optionally, the resource scheduling apparatus, wherein before the second adjustment module 330 adjusts the resource by using the fuzzy control method, the second adjustment module 330 is further used for:
[0190] Using an intermediate adjustment result in the resource allocation process as a training value of a control function in the fuzzy control method to determine a calculation parameter of the control function;
[0191] Wherein, when the resource is adjusted by using the fuzzy control method, the control function using the calculation parameter is fuzzy calculated to determine a resource adjustment amount for adjusting the resource.
[0192] The embodiment of the present application further provides a scheduling device, comprising a processor, a memory, and a program stored in the memory and executable on the processor, and the program is executed by the processor to implement the resource scheduling method according to any one of the above.
[0193] The processor in the scheduling device implements the specific implementation process of the resource scheduling method according to the above description, which will not be repeated here.
[0194] In addition, the embodiment of the present application further provides a computer readable storage medium, which stores a computer program, and the program is executed by the processor to implement the steps of the resource scheduling method according to any one of the above.
[0195] Specifically, the computer readable storage medium is applied to the scheduling device described above, and the execution steps of the scheduling method correspond to the detailed description above, which will not be repeated here.
[0196] In the several embodiments provided in the present application, it should be understood that the disclosed method and device can be implemented in other ways. For example, the device embodiments described above are only schematic. The division of the units is only a logical function division. There can be another division manner in actual implementation. For example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the displayed or discussed mutual couplings or direct couplings or communication connections between the units can be indirect couplings or communication connections through some interfaces, devices or units, and can be electrical, mechanical or in other forms.
[0197] In addition, each functional unit in the embodiments of the present application can be integrated in a processing unit, or each unit can be physically separated, or two or more units can be integrated in one unit. The above integrated unit can be implemented in the form of hardware, or in the form of hardware plus software function units.
[0198] The integrated unit implemented in the form of software function units can be stored in a computer readable storage medium. The software function unit stored in the storage medium includes a plurality of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute part of the steps of the transceiving method described in the embodiments of the present application. The foregoing storage medium includes a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and various media that can store program codes.
[0199] The above described is the preferred embodiment of the present application, it should be pointed out that for the ordinary person in the art, without departing from the principles described in the present application, can also be made several improvements and refinements, these improvements and refinements should also be considered as the protection scope of the present application.
Claims
1. A resource scheduling method, characterized in that, The method comprises the following steps: obtaining current resource information of an application runtime; when the current resource information indicates that the current resource does not meet the resource call of the application runtime, performing resource allocation according to a target algorithm currently run by the application, and adjusting the resource average utilization rate of the target algorithm to a target value; when the application runs the target algorithm, performing resource adjustment by using a fuzzy control method, so that the resource average utilization rate of the target algorithm is stabilized within a preset range including the target value; before performing resource allocation according to the target algorithm currently run by the application, the method further comprises the following steps: calculating the clustering resource utilization rate of the application running the target algorithm by using a K-nearest neighbor algorithm according to the historical resource utilization rate of the target algorithm; wherein, when performing resource allocation according to the target algorithm currently run by the application, resource allocation is performed according to the clustering resource utilization rate; the historical resource utilization rate is obtained by monitoring the use of virtual GPU resources by a resource monitoring system, and the historical resource utilization rate is the historical average utilization rate of virtual GPU resources; before performing resource adjustment by using the fuzzy control method, the method further comprises the following steps: using the intermediate adjustment result in the resource allocation process as the training value of the control function in the fuzzy control method to determine the calculation parameters of the control function; wherein, when performing resource adjustment by using the fuzzy control method, the control function using the calculation parameters is subjected to fuzzy calculation to determine the resource adjustment amount for resource adjustment.
2. The method of claim 1, wherein, The method further comprises the following steps: caching resource scheduling information of the application runtime; wherein, when performing resource allocation according to the target algorithm currently run by the application and / or performing resource adjustment by using the fuzzy control method, the resource required by the application is determined according to the resource scheduling information.
3. The method of claim 1, wherein, The method of obtaining current resource information of an application runtime comprises the following steps: obtaining the current resource information of the application runtime by a resource monitoring system.
4. The method of claim 1, wherein, The method of performing resource allocation according to the target algorithm currently run by the application to adjust the resource average utilization rate of the target algorithm to a target value comprises the following steps: performing resource allocation according to the target algorithm currently run by the application by using a dichotomy method to adjust the resource average utilization rate of the target algorithm to a target value.
5. The method of claim 4, wherein, The method of performing resource allocation by using a dichotomy method to adjust the resource average utilization rate of the target algorithm to a target value comprises the following steps: cyclically performing the process of running the target algorithm of the application in the case of preset allocation resources, adjusting the allocated resources by using a dichotomy method according to the difference between the resource average utilization rate when the target algorithm is run and the target value, and continuing to run the target algorithm of the application, until the absolute value of the difference between the resource average utilization rate when the target algorithm of the application is run and the target value is less than a preset value.
6. The method of claim 5, wherein, The target algorithm of the application program is run in the case of the preset allocated resources, the allocated resources are adjusted by using the dichotomy according to the difference between the average resource usage during the running of the target algorithm and the target value, and the process of running the target algorithm of the application program is continued until the absolute value of the difference between the average resource usage during the running of the target algorithm of the application program and the target value is less than a preset value, comprising: running the target algorithm of the application program in the case of the initial allocated resources; adjusting the allocated resources by using the dichotomy according to the difference between the average resource usage during the running of the target algorithm of the application program and the target value to obtain first adjusted resources; continuing to run the target algorithm of the target application program in the case of the first adjusted resources; continuing to adjust the allocated resources by using the dichotomy according to the difference between the average resource usage during the running of the target algorithm of the application program and the target value to obtain second adjusted resources; continuing to run the target algorithm of the target application program in the case of the second adjusted resources until the absolute value of the difference between the average resource usage during the running of the target algorithm of the application program and the target value is less than a preset value.
7. The method of claim 6, wherein, adjusting the allocated resources by using the dichotomy according to the difference between the average resource usage during the running of the target algorithm of the application program and the target value to obtain first adjusted resources, comprising: in the case that the average resource usage is greater than the target value, determining that the first predetermined number of allocated resources is added on the basis of the initial allocated resources to obtain the first adjusted resources; in the case that the average resource usage is less than the target value, determining that the second predetermined number of allocated resources is reduced on the basis of the initial allocated resources to obtain the first adjusted resources.
8. The method of claim 7, wherein, continuing to adjust the allocated resources by using the dichotomy according to the difference between the average resource usage during the running of the target algorithm of the application program and the target value to obtain second adjusted resources, comprising: if the first adjusted resources are obtained by adding the first predetermined number of allocated resources on the basis of the initial allocated resources, and the average resource usage is still greater than the target value when the target algorithm of the target application program is continued to run in the case of the first adjusted resources, then the third predetermined number of allocated resources is added on the basis of the first adjusted resources to obtain the second adjusted resources; if the first adjusted resources are obtained by adding the first predetermined number of allocated resources on the basis of the initial allocated resources, and the average resource usage is less than the target value when the target algorithm of the target application program is continued to run in the case of the first adjusted resources, then the second adjusted resources are determined to be one half of the sum of the initial allocated resources and the first adjusted resources.
9. The method of claim 7, wherein, continuing to adjust the allocated resources by using the dichotomy according to the difference between the average resource usage during the running of the target algorithm of the application program and the target value to obtain second adjusted resources, comprising: if the first adjustment resource is obtained by reducing a second predetermined number of allocated resources based on the initial allocated resource, and the average resource usage of the target algorithm of the target application continues to run in the case of the first adjustment resource is still less than the target value, then reduce a fourth predetermined number of allocated resources based on the first adjustment resource, and obtain the second adjustment resource; if the first adjustment resource is obtained by reducing a second predetermined number of allocated resources based on the initial allocated resource, and the average resource usage of the target algorithm of the target application continues to run in the case of the first adjustment resource is greater than the target value, then determine that the second adjustment resource is half of the sum of the initial allocated resource and the first adjustment resource.
10. A resource scheduling apparatus, characterized by comprising: Comprising: an information acquisition module, configured to acquire current resource information when the application program is running; a first adjustment module, configured to, when the current resource information indicates that the current resource does not meet the resource call when the application program is running, adjust the average resource usage of the target algorithm of the application program currently running to a target value according to resource allocation of the target algorithm; a second adjustment module, configured to, when the application program is running the target algorithm, adjust the resource by using a fuzzy control method, so that the average resource usage of the target algorithm is stabilized in a preset range including the target value; before the first adjustment module adjusts the resource according to the target algorithm currently running, it is further configured to: calculate the clustering resource usage of the application program running the target algorithm by using a K-nearest neighbor algorithm according to the historical resource usage of the target algorithm; wherein, when the first adjustment module adjusts the resource according to the target algorithm currently running, the resource is adjusted according to the clustering resource usage; the historical resource usage is obtained by monitoring the use of virtual GPU resources by a resource monitoring system, and the historical resource usage is the historical average usage of virtual GPU resources; wherein, before the second adjustment module adjusts the resource by using the fuzzy control method, it is further configured to: use the intermediate adjustment result in the resource allocation process as the training value of the control function in the fuzzy control method to determine the calculation parameters of the control function; wherein, when the resource is adjusted by using the fuzzy control method, the control function using the calculation parameters is fuzzy calculated to determine the resource adjustment amount for resource adjustment.
11. A scheduling device, characterized by Comprising: a processor, a memory, and a program stored on the memory and executable on the processor, wherein the program is executed by the processor to implement the resource scheduling method of any one of claims 1 to 9.
12. A readable storage medium, characterized by, The readable storage medium stores a program, and the program is executed by the processor to implement the steps in the resource scheduling method of any one of claims 1 to 9.
Citation Information
Patent Citations
Resource scheduling method and device, server and readable storage medium
CN109976901A
Data parallel job resource allocation method based on decision tree prediction
CN110321222A
Kubernetes-based scheduling method and kubernetes-based scheduling device for improving GPU (Graphics Processing Unit) utilization rate
CN111158908A