Resource allocation method and device, equipment and storage medium

By intercepting resource scheduling requests and transferring resource demand information in the scheduling system, the target creation request is formed, and the problem of not being able to effectively utilize hardware device resources in the scheduling system is solved, and a more efficient hardware resource utilization rate is achieved.

CN119917261APending Publication Date: 2025-05-02DAWNING INT INFORMATION IND CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411858539.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-16
Publication Date
2025-05-02

AI Technical Summary

Technical Problem

The default scheduling mechanism in the scheduling system cannot effectively utilize the hardware resources of hardware devices such as deep calculators (DCUs) with large workload differences, resulting in waste of resources.

Method used

By intercepting the resource scheduling request sent to the target scheduling system, and identifying that the request type is the container creation type and contains the target hardware resource type, the resource requirement information is transferred from the logical code segment to the code annotation, forming a target creation request, and allocating the target resources to the target container according to the request.

Benefits of technology

It realizes that the hardware resources of the target hardware resource type are divided into resources adapted to the target container, thereby improving the utilization rate of hardware resources and avoiding resource waste.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119917261A_ABST
    Figure CN119917261A_ABST
Patent Text Reader

Abstract

The invention relates to a resource allocation method and device, equipment and a storage medium. The method comprises the following steps: intercepting a resource scheduling request sent to a target scheduling system; and under the condition that the request type of the resource scheduling request is determined to be a container creation type and the resource demand type corresponding to the resource scheduling request comprises a target hardware resource type, transferring resource demand information in the resource scheduling request to a code annotation from a logic code segment of the resource scheduling request to obtain a target creation request. Wherein the hardware resources of the target hardware resource type can be dynamically segmented. And according to the target creation request, allocating a target resource to the created target container. Wherein the target resource at least comprises a hardware resource of the target hardware resource type. By adopting the method, the utilization rate of hardware resources can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a resource allocation method, apparatus, device and storage medium. Background Art

[0002] As the demand for heterogeneous computing continues to grow, more and more computing tasks require the use of specific accelerators to improve performance. For example, hardware devices such as graphics processing units (GPUs) play an important role in deep learning, graphics rendering and other fields. In order to improve resource utilization, a scheduling system (for example, the container orchestration platform Kubernetes) can be used to manage the hardware resources corresponding to these hardware devices.

[0003] However, the default scheduling mechanism in the scheduling system can only allocate all hardware resources corresponding to a hardware device to one container. For hardware devices with large workload differences such as the Data Center Utility (DCU), if the default mechanism is used to allocate all hardware resources corresponding to such hardware devices to one container, it will lead to a waste of hardware resources. Summary of the invention

[0004] Based on this, it is necessary to provide a resource allocation method, device, equipment and storage medium that can improve hardware resource utilization in response to the above technical problems.

[0005] In a first aspect, the present application provides a resource allocation method, comprising:

[0006] Intercept resource scheduling requests sent to the target scheduling system;

[0007] When it is determined that the request type of the resource scheduling request is a container creation type, and the resource requirement type corresponding to the resource scheduling request includes a target hardware resource type, the resource requirement information in the resource scheduling request is transferred from the logical code segment of the resource scheduling request to the code annotation to obtain a target creation request; wherein the hardware resources of the target hardware resource type can be dynamically segmented;

[0008] According to the target creation request, target resources are allocated to the created target container; wherein the target resources at least include hardware resources of the target hardware resource type.

[0009] In an embodiment of the present application, by transferring the resource demand information of the hardware resources that can be dynamically divided in the resource scheduling request, and allocating the target resources to the target container according to the target creation request, the hardware resources of the target hardware resource type can be divided into hardware resources that are adapted to the target container, thereby improving the utilization rate of the hardware resources.

[0010] In one embodiment, the resource requirement information includes first resource requirement information of a hardware resource of a target hardware resource type; the resource requirement information in the resource scheduling request is transferred from a logical code segment of the resource scheduling request to a code annotation to obtain a target creation request, including:

[0011] The first resource requirement information is obtained from the logic code of the resource scheduling request; the first resource requirement information is added to the code annotation corresponding to the target container in the resource scheduling request, and the first resource requirement information in the logic code of the resource scheduling request is deleted to obtain a target creation request.

[0012] In an embodiment of the present application, the target creation request is obtained by adding the first resource requirement information to the code annotation corresponding to the target container in the resource scheduling request and deleting the first resource requirement information in the logic code, thereby ensuring the accuracy of the target creation request.

[0013] In one embodiment, allocating target resources to the created target container according to the target creation request includes:

[0014] Obtain the current resource amount of each candidate resource node in the target scheduling system; wherein each candidate resource node contains hardware resources of the target hardware resource type; select a target resource node from each candidate resource node according to the overall resource demand of the target creation request and the current resource amount of each candidate resource node; and allocate target resources to the created target container on the target resource node according to the target creation request.

[0015] In the embodiment of the present application, by selecting the target resource node from each candidate resource node based on the overall resource demand and the current resource amount of each candidate resource node, the rationality of the target resource node selection can be guaranteed, thereby ensuring the reliability of the target resource allocation.

[0016] In one embodiment, the resource requirement information includes first resource requirement information of hardware resources of the target hardware resource type and second resource requirement information of hardware resources of other hardware resource types; selecting the target resource node from the candidate resource nodes according to the overall resource requirement of the target creation request and the current resource amount of each candidate resource node includes:

[0017] Obtain dynamic resource demand from the first resource demand information, and obtain fixed resource demand from the second resource demand information; determine the overall resource demand of the target creation request based on the dynamic resource demand and the fixed resource demand; select an available resource node whose current resource amount is greater than or equal to the overall resource demand from each candidate resource node; and determine the target resource node based on the available resource nodes.

[0018] In the embodiment of the present application, by selecting an available resource node whose current resource amount is greater than or equal to the overall resource demand amount from each candidate resource node, and selecting a target resource node from the available resource nodes, the rationality of the selection of the target resource node can be ensured.

[0019] In one of the embodiments, when the number of available resource nodes is at least two, determining the target resource node according to the available resource nodes includes:

[0020] For each available resource node, determine the remaining resource amount of the current resource amount of the available resource node after dividing the overall resource demand amount; and use the available resource node with the least remaining resource amount among the available resource nodes as the target resource node.

[0021] In the embodiment of the present application, by determining the target resource node from each available resource node based on the principle of minimizing resource loss, the resource utilization rate of the hardware resources can be effectively improved.

[0022] In one of the embodiments, determining that the request type of the resource scheduling request is a container creation type, and the resource requirement type corresponding to the resource scheduling request includes a target hardware resource type, includes:

[0023] From the logic code of the resource scheduling request, obtain the request type field and the resource requirement field; when the request type field contains the first key field corresponding to the container creation type, and the resource requirement field contains the second key field corresponding to the target hardware resource type, determine that the request type of the resource scheduling request is the container creation type, and the resource requirement type corresponding to the resource scheduling request contains the target hardware resource type.

[0024] In an embodiment of the present application, by comparing the request type field with the first key field and comparing the resource requirement field with the second key field, the type of resource scheduling request is identified, thereby ensuring the accuracy of resource scheduling request identification.

[0025] In one of the embodiments, the target hardware resource type includes a depth calculator DCU resource type.

[0026] In an embodiment of the present application, a target hardware resource type is provided, namely, a DCU resource type.

[0027] In a second aspect, the present application further provides a resource allocation device, including:

[0028] A request interception module is used to intercept resource scheduling requests sent to the target scheduling system;

[0029] A request modification module, for transferring the resource requirement information in the resource scheduling request from the logical code segment of the resource scheduling request to the code annotation to obtain the target creation request when determining that the request type of the resource scheduling request is a container creation type and the resource requirement type corresponding to the resource scheduling request includes the target hardware resource type; wherein the hardware resources of the target hardware resource type can be dynamically segmented;

[0030] The resource allocation module is used to allocate target resources to the created target container according to the target creation request; wherein the target resources at least include hardware resources of the target hardware resource type.

[0031] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:

[0032] Intercept resource scheduling requests sent to the target scheduling system;

[0033] When it is determined that the request type of the resource scheduling request is a container creation type, and the resource requirement type corresponding to the resource scheduling request includes a target hardware resource type, the resource requirement information in the resource scheduling request is transferred from the logical code segment of the resource scheduling request to the code annotation to obtain a target creation request; wherein the hardware resources of the target hardware resource type can be dynamically segmented;

[0034] According to the target creation request, target resources are allocated to the created target container; wherein the target resources at least include hardware resources of the target hardware resource type.

[0035] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the following steps are implemented:

[0036] Intercept resource scheduling requests sent to the target scheduling system;

[0037] When it is determined that the request type of the resource scheduling request is a container creation type, and the resource requirement type corresponding to the resource scheduling request includes a target hardware resource type, the resource requirement information in the resource scheduling request is transferred from the logical code segment of the resource scheduling request to the code annotation to obtain a target creation request; wherein the hardware resources of the target hardware resource type can be dynamically segmented;

[0038] According to the target creation request, target resources are allocated to the created target container; wherein the target resources at least include hardware resources of the target hardware resource type.

[0039] In a fifth aspect, the present application further provides a computer program product, including a computer program, which implements the following steps when executed by a processor:

[0040] Intercept resource scheduling requests sent to the target scheduling system;

[0041] When it is determined that the request type of the resource scheduling request is a container creation type, and the resource requirement type corresponding to the resource scheduling request includes a target hardware resource type, the resource requirement information in the resource scheduling request is transferred from the logical code segment of the resource scheduling request to the code annotation to obtain a target creation request; wherein the hardware resources of the target hardware resource type can be dynamically segmented;

[0042] According to the target creation request, target resources are allocated to the created target container; wherein the target resources at least include hardware resources of the target hardware resource type.

[0043] The resource allocation method, device, equipment and storage medium described above intercept the resource scheduling request sent to the target scheduling system, and when it is determined that the request type of the resource scheduling request is a container creation type, and the resource requirement type corresponding to the resource scheduling request includes the target hardware resource type, the resource requirement information in the resource scheduling request is transferred from the logical code segment of the resource scheduling request to the code annotation to obtain the target creation request; then, according to the target creation request, the target resource of at least the target hardware resource type is allocated to the created target container. Compared with the related art, in which all hardware resources corresponding to a hardware device can only be allocated as a whole to a container, the above method is adopted to transfer the resource requirement information of the hardware resources that can be dynamically divided in the resource scheduling request, and according to the target creation request, the target resources are allocated to the target container, so that the hardware resources of the target hardware resource type can be divided into hardware resources that are adapted to the target container, thereby improving the utilization rate of the hardware resources. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0045] Figure 1 A schematic diagram of a flow chart of a resource allocation method in an embodiment;

[0046] Figure 2 A schematic diagram of a process for determining a target creation request in one embodiment;

[0047] Figure 3 A schematic diagram of a process of allocating target resources in one embodiment;

[0048] Figure 4 A schematic diagram of a process for determining a target resource node in an embodiment;

[0049] Figure 5 A schematic diagram of a flow chart of a resource allocation method in another embodiment;

[0050] Figure 6 is a structural block diagram of a resource allocation device in an embodiment;

[0051] Figure 7 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0052] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0053] As the demand for heterogeneous computing continues to grow, more and more computing tasks require the use of specific accelerators to improve performance. For example, hardware devices such as GPUs play an important role in deep learning, graphics rendering and other fields. In order to improve resource utilization, a scheduling system (for example, Kubernetes) can be used to manage the hardware resources corresponding to these hardware devices.

[0054] However, the default scheduling mechanism in the scheduling system can only allocate all hardware resources corresponding to a hardware device to one container. For hardware devices with large workload differences such as DCU, if the default mechanism is used to allocate all hardware resources corresponding to such hardware devices to one container, it will lead to a waste of hardware resources.

[0055] Based on this, in an exemplary embodiment, Figure 1 As shown, a resource allocation method is provided, which is described by taking the method applied to a resource allocation device in a target scheduling system as an example, and specifically includes the following steps:

[0056] S101, intercepting a resource scheduling request sent to a target scheduling system.

[0057] The so-called target scheduling system is a system that can schedule various types of hardware resources, which can be a Kubernetes scheduling system; the so-called resource scheduling request is a request sent to the target scheduling system for scheduling hardware resources.

[0058] It can be understood that the target scheduling system includes two resource scheduling methods. One is for hardware resources such as image processors GPU that cannot be dynamically divided. The hardware resources corresponding to the entire hardware device can be directly allocated to the corresponding scheduling tasks; the other is for hardware resources such as depth calculators DCU that can be dynamically divided. The hardware resources need to be divided according to the resource scheduling amount.

[0059] Therefore, in order to avoid processing resource scheduling requests for dynamically divisible hardware resources in an overall allocation manner, it is necessary to intercept resource scheduling requests before the target scheduling system processes the scheduling requests.

[0060] In an optional implementation, the resource scheduling request can be intercepted by an information interceptor; then, in order to ensure the security of the resource scheduling request, after the resource scheduling request is intercepted, it is necessary to perform security verification on the resource scheduling request, and after the security verification passes, continue the subsequent processing of the resource scheduling request.

[0061] For example, the resource scheduling request may be securely verified by using certificate authentication and permission verification at the request initiator.

[0062] S102, when it is determined that the request type of the resource scheduling request is a container creation type, and the resource requirement type corresponding to the resource scheduling request includes the target hardware resource type, the resource requirement information in the resource scheduling request is transferred from the logical code segment of the resource scheduling request to the code annotation to obtain the target creation request.

[0063] The so-called request type is the resource usage in the resource scheduling request; the so-called resource requirement type is the type of hardware resource required in the resource scheduling request; further, the hardware resources of the target hardware resource type can be dynamically segmented. For example, the target hardware resource type may include a depth calculator DCU resource type.

[0064] The so-called resource demand information is the hardware resource information contained in the resource scheduling request; the so-called target creation request is the processed resource scheduling request.

[0065] In an optional implementation, the request type of the resource scheduling request and the resource requirement type corresponding to the resource scheduling request can be determined according to the logic code of the resource scheduling request. Subsequently, it is determined whether the request type of the resource scheduling request is a container creation type, and whether the resource requirement type corresponding to the resource scheduling request includes the target hardware resource type.

[0066] When the request type is not a container creation type and / or the resource requirement type does not include the target hardware resource type, it proves that the resource scheduling content of the resource scheduling request does not involve building a container based on hardware resources of the target hardware resource type. At this time, the ordinary resource scheduler in the target scheduling system can be used to directly process the resource scheduling request.

[0067] When the request type is a container creation type and the resource requirement type includes the target hardware resource type, it proves that the resource scheduling content of the resource scheduling request involves building a container based on the hardware resources of the target hardware resource type. At this time, in order to avoid the ordinary resource scheduler from directly processing the resource scheduling request, it is necessary to transfer the resource requirement information in the resource scheduling request from the logical code segment of the resource scheduling request to the code annotation to obtain the target creation request, so that the ordinary resource scheduler cannot read the target creation request.

[0068] It can be understood that when the resource requirement information includes both hardware resources of the target hardware resource type and hardware resources of other hardware resource types, only the resource requirement information corresponding to the hardware resources of the target hardware resource type can be transferred from the logical code segment of the resource scheduling request to the code annotation; or all resource requirement information can be transferred from the logical code segment of the resource scheduling request to the code annotation at the same time, and the present application does not impose any restrictions on this.

[0069] In order to successfully read the adjusted target creation request, a target resource scheduler specially configured for the target hardware resource type in the target scheduling system is required to process the target creation request. The target resource scheduler can parse the resource requirement information in the code annotation.

[0070] For example, for a container creation request A that includes DCU resources, after the DCU resource requirement information in the container creation request A is transferred from the logical code segment to the code annotation to obtain the container creation request A', the container creation request A' can be sent to the virtual DCU scheduler vdcu-scheduler, which then performs subsequent processing on the container creation request A'.

[0071] S103: Allocate target resources to the created target container according to the target creation request.

[0072] The so-called target container is the creation object of the resource scheduling request; the so-called target resource is the hardware resource required by the target container. Furthermore, the target resource at least includes hardware resources of the target hardware resource type.

[0073] In an optional implementation, after the target container is created according to the container configuration information in the target creation request, the target resources required by the target container can be determined according to the target creation request, and the target resources can be bound to the target container to complete the configuration of the target container.

[0074] For example, according to the hardware resource types included in the target resource and the resource requirements under each hardware resource type, a target resource node that completely includes the target resource can be selected from each candidate resource node included in the target scheduling system; then, the target resource is divided on the target resource node, and the divided target resource is bound to the target container to complete the configuration of the target container. Each candidate resource node can be provided with hardware resources by one or more hardware devices.

[0075] It is understandable that after the target resources are divided from the hardware resources corresponding to a certain hardware device, the remaining hardware resources in the hardware device can continue to be allocated to other containers, thereby improving the utilization rate of the hardware resources.

[0076] In the above resource allocation method, by intercepting the resource scheduling request sent to the target scheduling system, and when it is determined that the request type of the resource scheduling request is a container creation type, and the resource requirement type corresponding to the resource scheduling request includes the target hardware resource type, the resource requirement information in the resource scheduling request is transferred from the logical code segment of the resource scheduling request to the code annotation to obtain the target creation request; then, according to the target creation request, the target resource of at least the target hardware resource type is allocated to the created target container. Compared with the related art, in which all hardware resources corresponding to a hardware device can only be allocated to a container as a whole, the above method is adopted to transfer the resource requirement information of the hardware resources that can be dynamically divided in the resource scheduling request, and according to the target creation request, the target resources are allocated to the target container, so that the hardware resources of the target hardware resource type can be divided into hardware resources that are adapted to the target container, thereby improving the utilization rate of the hardware resources.

[0077] In order to ensure the accuracy of the target creation request, based on the above embodiment, in the embodiment of the present application, the resource requirement information includes the first resource requirement information of the hardware resource of the target hardware resource type; further, an optional method for determining the target creation request is provided, such as Figure 2 As shown, the specific steps include:

[0078] S201: Obtain first resource requirement information from a logic code of a resource scheduling request.

[0079] The so-called first resource demand information is the demand information for hardware resources of the target hardware resource type in the resource scheduling request, and may include the resource demand amount of the hardware resource.

[0080] In an optional implementation, an information extraction model can be pre-trained based on the resource identifier corresponding to the target hardware resource type; the logic code of the resource scheduling request is directly input into the information extraction model, and the information extraction model obtains the first resource demand information based on the logic code and model parameters of the resource scheduling request.

[0081] In another optional implementation, the starting position of the field corresponding to the resource requirement information can be located in the logic code of the resource scheduling request based on the request structure of the resource scheduling request; then, the resource identification information corresponding to the target hardware resource type can be used as an index to query backward from the starting position of the field in the logic code, thereby obtaining the first resource requirement information in the logic code.

[0082] For example, for a resource scheduling request B including DCU resources, the DCU memory resource dcumem and the number of DCU cores dcucores (ie, first resource requirement information) may be obtained from the logic code of the resource scheduling request B according to the resource identifier of the DCU resource.

[0083] S202: Add the first resource requirement information to the code annotation corresponding to the target container in the resource scheduling request, and delete the first resource requirement information in the logic code of the resource scheduling request to obtain a target creation request.

[0084] In an optional implementation, to facilitate binding of container resources, the acquired first resource requirement information may be added to the code annotation corresponding to the target container in the resource scheduling request; then, the first resource requirement information in the logic code of the resource scheduling request is deleted to obtain a target creation request.

[0085] For example, for a resource scheduling request B including DCU resources, the DCU memory resource dcumem and the number of DCU cores dcucores may be transferred to the code annotation of the target container. Subsequently, the DCU memory resource dcumem and the number of DCU cores dcucores in the logic code may be deleted to obtain the target creation request B'.

[0086] In an embodiment of the present application, the target creation request is obtained by adding the first resource requirement information to the code annotation corresponding to the target container in the resource scheduling request and deleting the first resource requirement information in the logic code, thereby ensuring the accuracy of the target creation request.

[0087] In order to ensure the reliability of target resource allocation, based on the above embodiments, an optional method for allocating target resources is provided in the embodiments of the present application, such as Figure 3 As shown, the specific steps include:

[0088] S301, obtaining the current resource amount of each candidate resource node in the target scheduling system.

[0089] The so-called candidate resource node is a node in the target scheduling system that can provide hardware resources of the target hardware resource type for each resource scheduling request, that is, each candidate resource node contains hardware resources of the target hardware resource type. The so-called current resource amount is the remaining resource amount of the candidate resource node at the current moment.

[0090] It is understandable that in order to ensure the rationality of resource node selection, it is necessary to obtain in advance the current resource amount of each candidate resource node of the hardware resource containing the target hardware resource type in the target scheduling system.

[0091] In order to ensure the accuracy of the current resource quantity, the current resource quantity of each candidate resource node can be automatically obtained through the resource quantity acquisition device in each node according to the preset resource quantity acquisition cycle. For example, for a candidate resource node containing DCU resources, the DCU status interface can be called in a regular loop to obtain the current resource quantity of the DCU resources in the candidate resource node.

[0092] Alternatively, when a resource scheduling request is detected, the current resource amount of each candidate resource node may be acquired through a resource amount acquisition device in each node. This application does not impose any limitation on this.

[0093] S302 : Select a target resource node from each candidate resource node according to the overall resource demand of the target creation request and the current resource amount of each candidate resource node.

[0094] The so-called overall resource demand is the resource demand for various hardware resources in the target creation request. The so-called target resource node is the resource node used to provide hardware resources for the target container.

[0095] In an optional implementation, the overall resource requirement for each hardware resource type required by the target container can be determined based on the resource requirement information in the target creation request; then, the overall resource requirement is compared with the current resource quantity one by one, and based on the comparison result, the target resource node is selected from each candidate resource node.

[0096] Exemplarily, for each candidate resource node, the current resource quantity of the candidate resource node can be compared with the overall resource demand quantity from the hardware resource type dimension and the demand quantity dimension to determine whether the current resource quantity completely includes the overall resource demand quantity. If so, the candidate resource node is used as the target resource node; if not, the next candidate resource node is compared.

[0097] In another optional implementation, the overall resource demand and the current resource quantity of each candidate resource node may be simultaneously input into a trained similarity judgment model, and the similarity judgment model outputs the similarity between the current resource quantity of each candidate resource node and the overall resource demand based on the overall resource demand, the current resource quantity of each candidate resource node and the model parameters.

[0098] In order from large to small, the candidate resource nodes are sorted according to the similarity between each candidate resource node and the overall resource demand; then, according to the sorting result, it is determined one by one whether the current resource amount of each candidate resource node completely includes the overall resource demand, and the candidate resource node that is ranked first and whose current resource amount completely includes the overall resource demand is selected as the target resource node.

[0099] S303: Allocate target resources for the created target container on the target resource node according to the target creation request.

[0100] In an optional implementation, after determining the target resource node, the target resource can be divided out from the hardware resources of the target resource node according to the overall resource demand; then, the target resource is bound to the target container, allowing the target container to directly use the target resource to complete the computing task.

[0101] In the embodiment of the present application, by selecting the target resource node from each candidate resource node based on the overall resource demand and the current resource amount of each candidate resource node, the rationality of the target resource node selection can be guaranteed, thereby ensuring the reliability of the target resource allocation.

[0102] In order to ensure the rationality of the determined target resource node, based on the above embodiment, in the embodiment of the present application, the resource requirement information includes the first resource requirement information of the hardware resource of the target hardware resource type, and the second resource requirement information of the hardware resource of other hardware resource types; further, an optional method for determining the target resource node is provided, such as Figure 4 As shown, the specific steps include:

[0103] S401, obtaining a dynamic resource requirement from the first resource requirement information, and obtaining a fixed resource requirement from the second resource requirement information.

[0104] Among them, the so-called other hardware resource types are the resource types corresponding to the hardware resources that cannot be dynamically divided, for example, the GPU type; the so-called dynamic resource demand is the demand for hardware resources that can be dynamically divided, that is, the demand for hardware resources of the target hardware resource type; the fixed resource demand is the demand for hardware resources that cannot be dynamically divided, that is, the demand for hardware resources of other hardware resource types.

[0105] After obtaining the first resource requirement information and the second resource requirement information from the resource requirement information, the dynamic resource requirement under each target hardware resource type can be extracted from the first resource requirement information, and the fixed resource requirement under each other hardware resource type can be extracted from the second resource requirement information.

[0106] S402: Determine the overall resource requirement of the target creation request according to the dynamic resource requirement and the fixed resource requirement.

[0107] In an optional implementation, after the dynamic resource requirement and the fixed resource requirement are determined, the dynamic resource requirement and the fixed resource requirement may be directly concatenated to obtain the overall resource requirement of the target creation request.

[0108] Alternatively, the dynamic resource requirements and the fixed resource requirements may be mapped to a fixed requirement template to obtain the overall resource requirements of the target creation request.

[0109] S403: Select, from each candidate resource node, an available resource node whose current resource amount is greater than or equal to the overall resource demand amount.

[0110] The so-called available resource nodes are resource nodes that can provide target resources.

[0111] In an optional implementation, for each candidate resource node, the current resource amount of the candidate resource node can be compared with the overall resource demand. If the current resource amount of the candidate resource node is greater than or equal to the overall resource demand, the candidate resource node is treated as an available resource node; if the current resource amount of the candidate resource node is less than the overall resource demand, the candidate resource node is treated as an unavailable resource node.

[0112] S404: Determine a target resource node according to available resource nodes.

[0113] After the available resource node is determined, if there is only one available resource node, the available resource node can be directly used as the target resource node.

[0114] In the case where there are multiple available resource nodes, in an optional implementation manner, the available resource node with the least number of historical failures may be selected as the target resource node according to the historical failure records of each available resource node.

[0115] In another optional implementation, the target resource node may be determined from the available resource nodes based on the current amount of resources on each available resource node and on the principle of minimizing resource loss.

[0116] Exemplarily, for each available resource node, the remaining resource amount of the available resource node after dividing the overall resource demand amount is determined; and the available resource node with the least remaining resource amount among the available resource nodes is used as the target resource node.

[0117] It is understandable that for any resource node, after the resource node splits out some of its hardware resources, there may be a situation where the remaining hardware resources are insufficient to provide computing tasks to other containers, resulting in hardware resource loss. Based on this, when selecting a target resource node, the target resource node can be selected with the goal of having the least amount of remaining resources after splitting out the target resources.

[0118] In an optional implementation, for each available resource node, the remaining resource amount of the available resource node after the overall resource demand is divided can be calculated based on the current resource amount of the available resource node; then, the remaining resource amounts of each available resource node can be compared, and the available resource node with the least remaining resource amount among the available resource nodes can be selected as the target resource node.

[0119] In the embodiment of the present application, by selecting an available resource node whose current resource amount is greater than or equal to the overall resource demand amount from each candidate resource node, and selecting a target resource node from the available resource nodes, the rationality of the selection of the target resource node can be ensured.

[0120] In order to ensure the rationality of the determined target resource node, based on the above embodiments, in an embodiment of the present application, an optional method for identifying a resource scheduling request is provided, specifically, obtaining a request type field and a resource requirement field from the logical code of the resource scheduling request; when the request type field contains the first key field corresponding to the container creation type, and the resource requirement field contains the second key field corresponding to the target hardware resource type, it is determined that the request type of the resource scheduling request is the container creation type, and the resource requirement type corresponding to the resource scheduling request contains the target hardware resource type.

[0121] Among them, the so-called request type field is the code field in the logic code used to characterize the request type; the so-called resource requirement field is the code field in the logic code used to characterize resource requirement information; the so-called first key field is the code field corresponding to the container creation type; the so-called second key field is the code field corresponding to the target hardware resource type.

[0122] In an optional implementation, the request type field and the resource requirement field can be obtained from the logic code of the resource scheduling request according to the code format of the resource scheduling request; then, the request type field can be compared with the first key field corresponding to the predetermined container creation type for consistency. If the comparison result is consistent, it is determined that the request type of the resource scheduling request is the container creation type.

[0123] Similarly, the resource requirement field can be used as an index to query the second key field corresponding to each target hardware resource type. When any second key field is found to be consistent with the resource requirement field, it is determined that the resource requirement type corresponding to the resource scheduling request includes the target hardware resource type.

[0124] In an embodiment of the present application, by comparing the request type field with the first key field and comparing the resource requirement field with the second key field, the type of resource scheduling request is identified, thereby ensuring the accuracy of resource scheduling request identification.

[0125] On the basis of the above embodiments, in an embodiment of the present application, when the target scheduling system is a Kubernetes cluster and the target hardware resource type is a DCU resource type, a dynamic segmentation method of DCU resources is provided, which specifically includes the following steps:

[0126] In the first step, when it is determined that the resource scheduling request meets the preset conditions, the resource scheduling request is determined to be an original container Pod creation request, and the api-server in the Kubernetes cluster (the management API layer in Kubernetes) is used to process the original Pod creation request to obtain the target Pod creation request.

[0127] Specifically, the resource scheduling request can be intercepted by the admission webhook (Kubernetes admission control for the original Pod creation request) in the api-server. Then, if it is determined that the resource scheduling request satisfies the following three preset conditions at the same time, the resource scheduling request is determined to be the original Pod creation request.

[0128] The preset conditions include: 1) create a request of type create; 2) the request object includes any of pod, deployment, and daemonset; 3) the created container contains DCU resources. Among them, deployment is a mechanism in Kubernetes for managing a group of pods running an application load; daemonset is a type of controller object in Kubernetes, which is used to run a pod replica version on each node to ensure that each node has one or more pod replicas.

[0129] Furthermore, the dcumem and dcucores resource information in the logic code corresponding to the original Pod creation request may be added to the Pod code annotation, and the dcumem and dcucores resource information in the logic code may be deleted to obtain the target Pod creation request.

[0130] In the second step, the target Pod creation request is sent to the custom virtual DCU scheduler vdcu-scheduler, which selects the target node from the nodes in Kubernetes based on the resource requirements in the target Pod creation request.

[0131] In the pre-scoring phase (preScore), vdcu-scheduler will read the Pod's code annotations to obtain the required dcumem and dcucores resources. At this time, vdcu-scheduler will select nodes with sufficient remaining DCU resources from each node in Kubernetes based on the resource requirements of these resources.

[0132] Then, in the scoring phase (score), the scheduler will score the selected nodes and use the node with the highest score as the target node. The specific scoring criteria are based on the principle of minimum resource loss. For example, vdcu-scheduler will assign a higher score to the node that can split the required dcumem and dcucores with the minimum remaining resources to maximize resource utilization and reduce resource waste.

[0133] The third step is to divide the target resources required by the target Pod in the target node and bind the target resources to the target Pod, thereby completing the creation of the target Pod.

[0134] Specifically, after vdcu-scheduler selects the target node, the vdcu plug-in vdcu-device-plugin calls the underlying interface to dynamically split the physical DCU according to the dcumem and dcucores information recorded in the Pod code annotation, and uses the split DCU resources as a complete virtual DCU (vDCU) that includes the computing cores and memory required by the Pod.

[0135] After the segmentation is completed, vdcu-device-plugin will bind the vDCU resources to the target Pod and allow the target Pod to directly use these virtualized DCU devices to complete computing tasks.

[0136] In an embodiment of the present application, the original Pod creation request for creating the target Pod is processed, and then the DCU resources required for the target Pod are segmented in the target node, and the DCU resources are bound to the target Pod, thereby completing the creation of the target Pod, which can improve the utilization rate of the DCU resources.

[0137] Figure 5 FIG. 1 is a flow chart of a resource allocation method in another embodiment. Based on the above embodiment, this embodiment provides an optional example of a resource allocation method. Figure 5 The specific implementation process is as follows:

[0138] S501, intercepting a resource scheduling request sent to a target scheduling system.

[0139] S502: Obtain a request type field and a resource requirement field from the logic code of the resource scheduling request.

[0140] S503, when the request type field contains the first key field corresponding to the container creation type, and the resource requirement field contains the second key field corresponding to the DCU resource type, obtain the first resource requirement information corresponding to the DCU resource from the logic code of the resource scheduling request.

[0141] Among them, the hardware resources of the target hardware resource type can be dynamically divided.

[0142] S504: Add the first resource requirement information to the code annotation corresponding to the target container in the resource scheduling request, and delete the first resource requirement information in the logic code of the resource scheduling request to obtain a target creation request.

[0143] S505: Obtain the current resource amount of each candidate resource node in the target scheduling system.

[0144] Each candidate resource node includes hardware resources of the target hardware resource type.

[0145] S506: Acquire dynamic resource requirements from the first resource requirement information, and acquire fixed resource requirements from second resource requirement information of hardware resources of other hardware resource types.

[0146] S507: Determine the overall resource requirement of the target creation request according to the dynamic resource requirement and the fixed resource requirement.

[0147] S508: Select, from each candidate resource node, an available resource node whose current resource amount is greater than or equal to the overall resource demand amount.

[0148] S509: for each available resource node, determine the remaining resource amount of the current resource amount of the available resource node after dividing the overall resource demand amount.

[0149] S510: The available resource node with the least amount of remaining resources among the available resource nodes is selected as the target resource node.

[0150] S511, allocating target resources for the created target container on the target resource node according to the target creation request.

[0151] The target resources include at least DCU resources.

[0152] The specific process of S501-S511 can refer to the description of the above method embodiment, and its implementation principle and technical effect are similar, which will not be repeated here.

[0153] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0154] Based on the same inventive concept, the embodiment of the present application also provides a resource allocation device for implementing the resource allocation method involved above. The implementation solution provided by the device to solve the problem is similar to the implementation solution recorded in the above method, so the specific limitations in one or more resource allocation device embodiments provided below can refer to the limitations on the resource allocation method above, and will not be repeated here.

[0155] In an exemplary embodiment, Figure 6 As shown, a resource allocation device 1 is provided, comprising: a request interception module 10, a request modification module 20 and a resource allocation module 30, wherein:

[0156] A request interception module 10, used to intercept resource scheduling requests sent to a target scheduling system;

[0157] The request modification module 20 is used to transfer the resource requirement information in the resource scheduling request from the logical code segment of the resource scheduling request to the code annotation to obtain the target creation request when it is determined that the request type of the resource scheduling request is a container creation type and the resource requirement type corresponding to the resource scheduling request includes the target hardware resource type; wherein the hardware resources of the target hardware resource type can be dynamically segmented;

[0158] The resource allocation module 30 is used to allocate target resources to the created target container according to the target creation request; wherein the target resources at least include hardware resources of the target hardware resource type.

[0159] In an exemplary embodiment, the resource requirement information includes first resource requirement information of a hardware resource of a target hardware resource type; further, the request modification module 20 is specifically configured to:

[0160] The first resource requirement information is obtained from the logic code of the resource scheduling request; the first resource requirement information is added to the code annotation corresponding to the target container in the resource scheduling request, and the first resource requirement information in the logic code of the resource scheduling request is deleted to obtain a target creation request.

[0161] In an exemplary embodiment, the resource allocation module 30 includes:

[0162] A resource quantity acquisition unit is used to acquire the current resource quantity of each candidate resource node in the target scheduling system; wherein each candidate resource node includes hardware resources of the target hardware resource type;

[0163] A node selection unit, configured to select a target resource node from each candidate resource node according to the overall resource demand of the target creation request and the current resource amount of each candidate resource node;

[0164] The resource allocation unit is used to allocate target resources to the created target container on the target resource node according to the target creation request.

[0165] In an exemplary embodiment, the resource requirement information includes first resource requirement information of hardware resources of the target hardware resource type and second resource requirement information of hardware resources of other hardware resource types; further, the node selection unit is specifically used to:

[0166] Obtain dynamic resource demand from the first resource demand information, and obtain fixed resource demand from the second resource demand information; determine the overall resource demand of the target creation request based on the dynamic resource demand and the fixed resource demand; select an available resource node whose current resource amount is greater than or equal to the overall resource demand from each candidate resource node; and determine the target resource node based on the available resource nodes.

[0167] In an exemplary embodiment, the node selection unit is further configured to:

[0168] For each available resource node, determine the remaining resource amount of the current resource amount of the available resource node after dividing the overall resource demand amount; and use the available resource node with the least remaining resource amount among the available resource nodes as the target resource node.

[0169] In an exemplary embodiment, the resource allocation device 1 further includes a request analysis module, wherein the request analysis module is specifically used to:

[0170] From the logic code of the resource scheduling request, obtain the request type field and the resource requirement field; when the request type field contains the first key field corresponding to the container creation type, and the resource requirement field contains the second key field corresponding to the target hardware resource type, determine that the request type of the resource scheduling request is the container creation type, and the resource requirement type corresponding to the resource scheduling request contains the target hardware resource type.

[0171] In an exemplary embodiment, the target hardware resource type includes a depth calculator DCU resource type.

[0172] Each module in the resource allocation device can be implemented in whole or in part by software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.

[0173] In an exemplary embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as shown in FIG. Figure 7 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store hardware resource data. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a resource allocation method is implemented.

[0174] Those skilled in the art will understand that Figure 7 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0175] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.

[0176] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.

[0177] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.

[0178] It should be noted that the data involved in this application (including but not limited to hardware resource data, etc.) are all authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.

[0179] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.

[0180] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.

[0181] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A resource allocation method, characterized in that: The method comprises: Intercept resource scheduling requests sent to the target scheduling system; When it is determined that the request type of the resource scheduling request is a container creation type, and the resource requirement type corresponding to the resource scheduling request includes a target hardware resource type, the resource requirement information in the resource scheduling request is transferred from the logical code segment of the resource scheduling request to the code annotation to obtain a target creation request; wherein the hardware resources of the target hardware resource type can be dynamically segmented; According to the target creation request, target resources are allocated to the created target container; wherein the target resources at least include hardware resources of the target hardware resource type.

2. The method according to claim 1, characterized in that The resource requirement information includes first resource requirement information of a hardware resource of the target hardware resource type; The step of transferring the resource requirement information in the resource scheduling request from the logical code segment of the resource scheduling request to the code annotation to obtain the target creation request includes: Acquire the first resource requirement information from the logic code of the resource scheduling request; The first resource requirement information is added to the code annotation corresponding to the target container in the resource scheduling request, and the first resource requirement information in the logic code of the resource scheduling request is deleted to obtain a target creation request.

3. The method according to claim 1, characterized in that: The allocating target resources to the created target container according to the target creation request includes: Acquire the current resource amount of each candidate resource node in the target scheduling system; wherein each candidate resource node includes hardware resources of the target hardware resource type; Selecting a target resource node from the candidate resource nodes according to the overall resource demand of the target creation request and the current resource amount of each candidate resource node; According to the target creation request, target resources are allocated to the created target container on the target resource node.

4. The method according to claim 3, characterized in that The resource requirement information includes first resource requirement information of hardware resources of the target hardware resource type, and second resource requirement information of hardware resources of other hardware resource types; The selecting a target resource node from each candidate resource node according to the overall resource demand of the target creation request and the current resource amount of each candidate resource node comprises: Acquire a dynamic resource requirement from the first resource requirement information, and acquire a fixed resource requirement from the second resource requirement information; Determining the overall resource requirement of the target creation request according to the dynamic resource requirement and the fixed resource requirement; Selecting, from each candidate resource node, an available resource node whose current resource amount is greater than or equal to the overall resource demand amount; A target resource node is determined according to the available resource nodes.

5. The method according to claim 4, characterized in that In a case where the number of the available resource nodes is at least two, determining the target resource node according to the available resource nodes includes: For each available resource node, determine the remaining resource amount of the current resource amount of the available resource node after dividing the overall resource demand amount; The available resource node with the least amount of remaining resources among all available resource nodes is used as the target resource node.

6. The method according to claim 1, characterized in that The determining that the request type of the resource scheduling request is a container creation type, and the resource requirement type corresponding to the resource scheduling request includes a target hardware resource type, includes: Obtaining a request type field and a resource requirement field from the logic code of the resource scheduling request; When the request type field contains a first key field corresponding to a container creation type, and the resource requirement field contains a second key field corresponding to a target hardware resource type, it is determined that the request type of the resource scheduling request is a container creation type, and the resource requirement type corresponding to the resource scheduling request contains a target hardware resource type.

7. The method according to any one of claims 1 to 6, characterized in that The target hardware resource type includes a depth calculator DCU resource type.

8. A resource allocation device, characterized in that: The device comprises: A request interception module is used to intercept resource scheduling requests sent to the target scheduling system; A request modification module, for transferring the resource requirement information in the resource scheduling request from the logical code segment of the resource scheduling request to the code annotation to obtain a target creation request when it is determined that the request type of the resource scheduling request is a container creation type and the resource requirement type corresponding to the resource scheduling request includes a target hardware resource type; wherein the hardware resources of the target hardware resource type can be dynamically segmented; The resource allocation module is used to allocate target resources to the created target container according to the target creation request; wherein the target resources at least include hardware resources of the target hardware resource type.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.