Resource allocation method, device, electronic device and storage medium

By determining the mapping relationship between the memory and the number of logical processors of each NUMA node in the SLURM system and allocating resources according to the remaining resource priority, the problem of NUMA load balancing in the prior art is solved, and the job operation speed is improved.

CN115098269BActive Publication Date: 2025-04-08DAWNING INT INFORMATION IND CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210883204.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-26
Publication Date
2025-04-08
Estimated Expiration
2042-07-26

AI Technical Summary

Technical Problem

The prior art does not consider load balancing of the NUMA structure when allocating logical processors, resulting in logical processors that may need to access memory across NUMA nodes, resulting in problems such as load imbalance and memory access speed.

Method used

By obtaining the computing node and logical processor requirements of the target job, the mapping relationship between the amount of memory and the number of logical processors of each NUMA node is determined, and the priority of the NUMA node is determined based on the amount of remaining memory and the number of free logical processors is determined, and the resources of the NUMA node with high priority are allocated to the target job.

Benefits of technology

Load balancing resource allocation based on NUMA structure is realized, reducing the situation where logical processors access memory across NUMA nodes, thereby improving the operation speed of jobs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115098269B_ABST
    Figure CN115098269B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention discloses a resource allocation method, device, electronic device and storage medium. The method includes obtaining the target computing node pre-allocated for the target job and the number of logical processors required for each target computing node; determining the mapping relationship between the memory amount and the number of logical processors of each non-uniform memory access NUMA node in each target computing node; determining the priority of the corresponding NUMA node according to the mapping relationship, the remaining memory amount and the number of idle logical processors of each NUMA node; determining the target NUMA node according to the priority and the number of logical processors required for each target computing node by the target job, and allocating a set number of idle logical processors of the target NUMA node to the target job, so as to realize resource allocation based on load balancing of the NUMA structure, reduce the occurrence of memory access speed reduction due to accessing memory across NUMA nodes, and improve the job running speed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to the field of resource scheduling, and in particular to a resource allocation method, device, electronic device and storage medium. Background Art

[0002] SLURM (Simple Linux Utility for Resource Management) is a highly scalable and fault-tolerant cluster manager and job scheduling system for large clusters of computing nodes.

[0003] In the related art, when SLURM allocates logical processors to target jobs that apply for logical processors in a computing node, it allocates idle logical processors to the target job in a round-robin manner between various NUMA (Non Uniform Memory Access) nodes. For example, when a target job occupies more than one logical processor, a polling method is used to allocate logical CPUs to the target job. When a target job occupies only one logical processor, each time a logical processor is allocated to the target job, it is checked from the first NUMA node whether there are idle logical processors. When the cpus-per-task specified in the job script is greater than 1, multiple logical processors need to be occupied. At this time, the logical processors of the same NUMA node are preferentially allocated to the target job.

[0004] However, in the case of using polling to allocate logical CPUs, the matching relationship between logical processors and memory on the same NUMA node is not considered, and the load balancing of the NUMA structure is not considered. For the other two allocation methods, multiple logical processors on the same NUMA node will be allocated to the job first, while the other NUMA nodes are idle; when the memory required by the allocated logical processor exceeds the memory of the NUMA node where the logical processor is located, the memory will be accessed across NUMA nodes, and the memory access speed will be reduced.

[0005] On the one hand, the solutions in the related art do not consider the load balancing of the NUMA structure when allocating logical processors, resulting in the allocated logical processors may need to access memory across NUMA nodes, resulting in a load imbalance problem; on the other hand, the solutions in the related art access memory across NUMA nodes, because the speed at which NUMA node processors access local NUMA node storage is faster than the speed at which they access non-local NUMA node storage. Accessing memory across NUMA nodes will reduce the memory access speed, thereby reducing the running speed of the target job. Summary of the invention

[0006] The embodiments of the present invention provide a resource allocation method, device, electronic device and storage medium, which solve the problem of load imbalance and the problem of reduced memory access speed caused by accessing memory across NUMA nodes.

[0007] According to one aspect of the present invention, there is provided a resource allocation method, comprising:

[0008] Obtaining the target computing nodes pre-allocated for the target job and the required number of logical processors of each of the target computing nodes;

[0009] Determine a mapping relationship between the amount of memory and the number of logical processors of each non-uniform memory access NUMA node in each of the target computing nodes;

[0010] Determine the priority of the corresponding NUMA node according to the mapping relationship, the remaining memory amount and the number of idle logical processors of each NUMA node;

[0011] The target NUMA node is determined according to the priority and the number of logical processors required by the target job for each of the target computing nodes, and a set number of idle logical processors of the target NUMA node are allocated to the target job.

[0012] Optionally, after allocating a set number of idle logical processors of the target NUMA node to the target job, the method further includes:

[0013] Determine the number of logical processor allocations according to the number of idle logical processors allocated to the target job;

[0014] When the number of logical processors allocated is less than the total number of logical processors required, performing a step of determining the priority of the corresponding NUMA node according to the mapping relationship, the remaining memory amount, and the number of idle logical processors of each NUMA node;

[0015] When the number of logical processors allocated is equal to the total number of logical processors required, it is determined that the resource allocation of the target job is completed. In the above manner, before the number of logical processors required by the target job is met, the processor resources of the NUMA node with more remaining memory and idle logical processors are preferentially allocated to the target job, thereby reducing the situation where the logical processors allocated to the target job access memory across NUMA nodes.

[0016] Optionally, determining a mapping relationship between the amount of memory and the number of logical processors of each non-uniform memory access NUMA node in each of the target computing nodes includes:

[0017] Determine the ratio of the amount of memory to the number of logical processors of each NUMA node in each of the target computing nodes, and determine the mapping relationship between the amount of memory and the number of logical processors of each NUMA node according to the ratio. The mapping relationship of mapping the amount of memory to the number of logical processors is determined by the ratio of the amount of memory to the number of logical processors of each NUMA node, and the method of determining the remaining resources is simplified based on the mapping relationship.

[0018] Optionally, after determining the priority of the corresponding NUMA node according to the mapping relationship, the remaining memory amount, and the number of idle logical processors of each NUMA node, the method further includes:

[0019] A priority list of NUMA nodes is generated based on the priority order and node identifier of each NUMA node. By storing NUMA node identifiers in priority order in the form of a priority list, the NUMA node with the highest priority can be quickly obtained, thereby improving query speed.

[0020] Optionally, determining the target NUMA node according to the priority and the number of logical processors required by the target job for each target computing node includes:

[0021] The target NUMA node is determined according to the priority order in the priority list of the NUMA node and the number of logical processors required by the target job for each target computing node. The target NUMA node is determined by the priority order and the number of logical processors required to be provided by the target computing node, so as to realize the load balancing of computing nodes while allocating resources based on the load balancing of the NUMA structure.

[0022] Optionally, determining the target NUMA node according to the priority order in the priority list of the NUMA node and the number of logical processors required by the target job for each of the target computing nodes includes:

[0023] Determine a candidate NUMA node according to the priority order in the priority list of the NUMA nodes;

[0024] For the target computing node to which the candidate NUMA node belongs, comparing the number of logical processors provided and the required number of logical processors to be provided;

[0025] When the comparison result meets the set conditions, the candidate NUMA node is determined as the target NUMA node. By comparing the number of logical processors provided by the target computing node to which the candidate NUMA node belongs with the number of logical processors to be provided, it is determined whether the candidate NUMA node is the target NUMA node, thereby achieving load balancing of computing nodes when allocating resources.

[0026] Optionally, before determining the priority of the corresponding NUMA node according to the mapping relationship, the remaining memory amount, and the number of idle logical processors of each NUMA node, the method further includes:

[0027] Obtaining the memory usage and logical processor usage of each NUMA node in the target computing node;

[0028] Determine the remaining memory of the corresponding NUMA node according to the memory amount and memory usage of each NUMA node in the target computing node;

[0029] The number of idle logical processors is determined according to the number of logical processors and the occupancy of logical processors of each NUMA node in the target computing node. The remaining memory amount and the number of idle logical processors are determined before each priority calculation in the above manner.

[0030] According to another aspect of the present invention, there is provided a resource allocation device, comprising:

[0031] A node acquisition module, used to acquire the target computing nodes pre-allocated for the target job and the required number of logical processors of each of the target computing nodes;

[0032] A relationship determination module, used to determine a mapping relationship between the amount of memory and the number of logical processors of each non-uniform memory access NUMA node in each of the target computing nodes;

[0033] A priority determination module, used to determine the priority of the corresponding NUMA node according to the mapping relationship, the remaining memory amount and the number of idle logical processors of each NUMA node;

[0034] The logical processor allocation module is used to determine the target NUMA node according to the priority and the number of logical processors required by the target job for each target computing node, and allocate a set number of idle logical processors of the target NUMA node to the target job.

[0035] Optionally, the device further comprises:

[0036] An allocation quantity determination module, configured to determine the logical processor allocation quantity according to the number of idle logical processors allocated to the target job after allocating a set number of idle logical processors of the target NUMA node to the target job;

[0037] When the number of allocated logical processors is less than the total required number of logical processors, a priority step of determining the corresponding NUMA node according to the mapping relationship, the remaining memory amount, and the number of idle logical processors of each NUMA node is performed; when the number of allocated logical processors is equal to the total required number of logical processors, resource allocation for completing the target job is determined.

[0038] Optionally, the relationship determination module is specifically used for:

[0039] Determine the ratio of the memory amount of each NUMA node to the number of logical processors in each of the target computing nodes, and determine the mapping relationship between the memory amount of each NUMA node and the number of logical processors according to the ratio.

[0040] Optionally, the device further comprises:

[0041] The priority list generation module is used to generate a priority list of NUMA nodes according to the priority order and node identifier of each NUMA node after determining the priority of the corresponding NUMA node according to the mapping relationship, remaining memory amount and number of idle logical processors of each NUMA node.

[0042] Optionally, the logical processor allocation module is specifically used for:

[0043] The target NUMA node is determined according to the priority order in the priority list of the NUMA node and the number of logical processors required by the target job for each of the target computing nodes.

[0044] Furthermore, the logical processor allocation module is specifically used for:

[0045] Determine a candidate NUMA node according to the priority order in the priority list of the NUMA nodes;

[0046] For the target computing node to which the candidate NUMA node belongs, comparing the number of logical processors provided and the required number of logical processors to be provided;

[0047] When the comparison result meets the set condition, the candidate NUMA node is determined as the target NUMA node.

[0048] Optionally, the device further comprises:

[0049] An occupancy acquisition module, used to obtain the memory occupancy and logical processor occupancy of each NUMA node in the target computing node before determining the priority of the corresponding NUMA node according to the mapping relationship, the remaining memory amount and the number of idle logical processors of each NUMA node;

[0050] A remaining memory amount determination module is used to determine the remaining memory amount of the corresponding NUMA node according to the memory amount and memory occupancy of each NUMA node in the target computing node;

[0051] The idle logical processor quantity determination module is used to determine the idle logical processor quantity according to the logical processor quantity and the logical processor occupancy of each NUMA node in the target computing node.

[0052] According to another aspect of the present invention, there is provided an electronic device, the electronic device comprising:

[0053] at least one processor; and

[0054] a memory communicatively connected to the at least one processor; wherein,

[0055] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the resource allocation method described in any embodiment of the present invention.

[0056] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the resource allocation method described in any embodiment of the present invention when executed.

[0057] The technical solution of the embodiment of the present invention determines the mapping relationship between the memory amount and the number of logical processors of each NUMA node in the target computing node, determines the priority of the corresponding NUMA node according to the mapping relationship, the remaining memory amount and the number of idle logical processors of each NUMA node, and allocates the idle logical processors of the target NUMA node to the target job according to the priority, thereby realizing resource allocation based on load balancing of the NUMA structure, reducing the situation where the logical processors allocated to the target job access memory across NUMA nodes, reducing the occurrence of memory access speed reduction due to accessing memory across NUMA nodes, and improving the job running speed.

[0058] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0059] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0060] Figure 1 A cluster architecture diagram using SLURM management applicable to an embodiment of the present invention;

[0061] Figure 2 A flow chart of a resource allocation method provided by an embodiment of the present invention;

[0062] Figure 3 A flowchart of another resource allocation method provided by an embodiment of the present invention;

[0063] Figure 4 A flowchart of another resource allocation method provided by an embodiment of the present invention;

[0064] Figure 5 A schematic diagram of the structure of a resource allocation device provided by an embodiment of the present invention;

[0065] Figure 6 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0066] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0067] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0068] Figure 1 The following is a diagram of a cluster architecture managed by SLURM applicable to an embodiment of the present invention. SLURM is an open source, fault-tolerant, and highly scalable cluster job scheduling system. The main functions of SLURM include: allocating computing resources, executing work tasks, etc. SLURM provides a framework for starting, executing, and monitoring jobs on the allocated set of nodes; and arbitrating resource contention and other issues. SLURM can manage and allocate multiple resources, including CPU resources, memory resources, and GPU resources.

[0069] like Figure 1 As shown, the cluster includes a management node 110 and a computing node 120. The management node 110 may include a primary management node and a redundant management node (the redundant management node may be zero, one, two, or more). SLURM manages the computing nodes 120 in the cluster through the management node 110. Specifically, SLURM monitors, allocates, and manages computing resources through a management daemon, and maps and distributes received job sequences to each computing node 120. Each computing node 120 also has a daemon, which manages the NUMA nodes in the computing node 120 through the daemon, monitors the tasks running on the NUMA nodes, receives requests and jobs from the management node, maps jobs to the NUMA nodes inside the computing node, and so on.

[0070] It should be noted that Figure 1 The cluster architecture diagram shown can be understood as an example, not a limitation of the embodiments of the present invention. Any cluster architecture or variation of the cluster architecture managed by SLURM should be regarded as the cluster described in the embodiments of the present invention.

[0071] Figure 2 This is a flow chart of a resource allocation method provided by an embodiment of the present invention. This embodiment is applicable to the case of allocating resources for a job. The method can be executed by a resource allocation device. The resource allocation device can be implemented in the form of hardware and / or software. The resource allocation device can be configured in a management node in a cluster. Figure 2 As shown, the method includes:

[0072] S210: Obtain target computing nodes pre-allocated for a target job and the required number of logical processors of each of the target computing nodes.

[0073] The target job is the job that sends a job submission request to the management node. A job can include a set of associated resource allocation requests and a set of associated processing procedures.

[0074] The operating system can use logical processors (e.g., logical CPUs) to simulate physical processors (e.g., physical CPUs). When hyperthreading is not enabled, a logical CPU is a physical core of a single-core processor or a multi-core processor; when hyperthreading is enabled, each physical CPU core is equivalent to two logical CPUs.

[0075] The logical processor requirement number is the number of logical processors that the target job requests from the management node. For example, the logical processor requirement number is the number of logical CPU cores that the target job requests from the management node.

[0076] The target computing node is a computing node that meets the required number of logical processors determined by the scheduling system based on the remaining memory and idle CPU number of each computing node in the current cluster. For example, the SLURM scheduling system allocates the target computing node to the target job according to the preset allocation rule, and determines the required number of logical processors for each target computing node of the target job.

[0077] It should be noted that the SLURM scheduling system obtains the resource topology of each computing node in the current cluster, and determines the remaining memory and number of idle CPUs of each computing node based on the resource topology and resource allocation information. Among them, the resource topology includes the number of logical processors and the memory of each NUMA node. NUMA is a computer memory design for multiple processors. The memory access time of a NUMA node depends on the memory location of the processor. NUMA provides separate memory to each processor, and the processor accesses the local NUMA node memory faster than the non-local NUMA node memory.

[0078] There are many ways to obtain the resource topology structure of each computing node in the current cluster, and the embodiments of the present invention do not specifically limit it. For example, use the setting software to obtain the number of logical CPUs of each NUMA node in each computing node in the current cluster and the amount of memory of each NUMA node. For example, use hwloc to obtain the number of logical CPUs of each NUMA node in each computing node in the current cluster and the amount of memory of each NUMA node. Among them, hwloc is a software that can collect various system properties (such as CPU topology and memory information, etc.). Alternatively, use / proc / cpuinfo to obtain the number of logical CPUs of each NUMA node in each computing node in the current cluster and the amount of memory of each NUMA node.

[0079] It should be noted that if there is no target computing node that meets the resource allocation requirements, the target job will be added to the set task queue for queuing until a target computing node that meets the resource allocation requirements appears. The target job will be dequeued from the set task queue, and the target computing node will be determined as a computing node that meets the required number of logical processors for the target job.

[0080] S220: Determine a mapping relationship between the amount of memory and the number of logical processors of each non-uniform memory access NUMA node in each of the target computing nodes.

[0081] The mapping relationship is the proportional relationship between the memory amount and the number of logical processors of each NUMA node. Based on the proportional relationship between the memory amount and the number of logical processors of each NUMA node, it can be determined that each NUMA node can equate the memory amount to the equivalent number of logical processors.

[0082] Exemplarily, the ratio of the amount of memory to the number of logical processors of each NUMA node in each target computing node is determined, and a mapping relationship between the amount of memory and the number of logical processors of each NUMA node is determined according to the ratio.

[0083] Specifically, according to the memory amount of each NUMA node in each target computing node and the number of logical processors of each NUMA node, the ratio of the memory amount of a single NUMA node to the number of logical processors is determined, and the ratio is used as the mapping relationship between the memory amount and the number of logical processors of the corresponding NUMA node.

[0084] S230. Determine the priority of the corresponding NUMA node according to the mapping relationship, the remaining memory amount, and the number of idle logical processors of each NUMA node.

[0085] The remaining memory is the remaining amount after deducting the occupied memory from the memory of the NUMA node. The number of free logical processors is the remaining amount after deducting the number of occupied logical processors from the number of logical processors of the NUMA node.

[0086] Exemplarily, the management node obtains the memory occupancy and logical processor occupancy of each NUMA node in the target computing node. For example, the management node determines the memory occupancy and logical processor occupancy of each NUMA node in the target computing node based on the allocated resource information of the target computing node. Since the management node is responsible for allocating resources on the computing node, and the resources on the computing node include the logical processor resources and memory resources of each NUMA node, if the allocated resources are regarded as occupied resources, the management node can determine the memory occupancy and logical processor occupancy of each NUMA node in the target computing node based on the allocated resource information.

[0087] According to the memory amount and memory usage of each NUMA node in the target computing node, the remaining memory amount of the corresponding NUMA node is determined. For example, the total memory amount of each NUMA node in the target computing node is subtracted from the memory usage to obtain the remaining memory amount of the corresponding NUMA node.

[0088] The number of idle logical processors is determined according to the number of logical processors and the logical processor occupancy of each NUMA node in the target computing node. For example, the total number of logical processors of each NUMA node in the target computing node is subtracted from the logical processor occupancy to obtain the number of idle logical processors of the corresponding NUMA node.

[0089] Exemplarily, determining the priority of the corresponding NUMA node according to the mapping relationship, remaining memory, and number of idle logical processors of each NUMA node includes: taking each NUMA node in the target computing node as the current NUMA node, and determining that the remaining memory of the current NUMA node is equivalent to the equivalent number of idle logical processors according to the mapping relationship and remaining memory corresponding to the current NUMA node. Determine the priority of the current NUMA node according to the number of idle logical processors of the current NUMA node and the equivalent number of idle logical processors.

[0090] Assuming that NUMA_node[i] represents the i-th NUMA node in the target computing node, the mapping relationship between the memory amount and the number of logical processors of the NUMA node can be expressed by the following formula:

[0091] Mapping relationship = NUMA_node[i].Memory amount / NUMA_node[i].Number of logical processors.

[0092] Assuming that NUMA_node[i].Remaining memory represents the remaining memory of the i-th NUMA node in the target computing node, and NUMA_node[i].Number of idle logical processors represents the number of idle logical processors of the i-th NUMA node in the target computing node, the priority of the i-th NUMA node can be expressed by the following formula:

[0093] Priority = NUMA_node[i]. Remaining memory / mapping relationship + NUMA_node[i]. Number of idle logical processors.

[0094] For example, a target computing node includes three NUMA nodes, wherein the first NUMA node has a memory capacity of 16 GB and eight logical processors, the second NUMA node has a memory capacity of 5 GB and four logical processors, and the third NUMA node has a memory capacity of 8 GB and four logical processors.

[0095] Accordingly, the mapping relationship between the amount of memory and the number of logical processors corresponding to the first NUMA node is 16 / 8, the mapping relationship between the amount of memory and the number of logical processors corresponding to the second NUMA node is 5 / 4, and the mapping relationship between the amount of memory and the number of logical processors corresponding to the third NUMA node is 8 / 4. Assuming that the remaining amount of memory of the first NUMA node is 2GB and the number of idle logical processors is 3, the priority of the first NUMA node is 2*16 / 8+3=7. Assuming that the remaining amount of memory of the second NUMA node is 3GB and the number of idle logical processors is 2, the priority of the second NUMA node is 3*5 / 4+2=5.75. Assuming that the remaining amount of memory of the third NUMA node is 5GB and the number of idle logical processors is 3, the priority of the third NUMA node is 5*8 / 4+3=13.

[0096] According to the priorities of the three NUMA nodes included in the target computing node, it can be determined that the priority of the third NUMA node is higher than the priority of the first NUMA node, and the priority of the first NUMA node is higher than the priority of the second NUMA node.

[0097] It is understandable that the priority of each NUMA node included in other target computing nodes can be obtained in a similar manner, which will not be described in detail here.

[0098] S240: Determine a target NUMA node according to the priority and the number of logical processors required by the target job for each of the target computing nodes, and allocate a set number of idle logical processors of the target NUMA node to the target job.

[0099] The priority list is generated based on the priorities of the NUMA nodes included in each target computing node. Optionally, the NUMA nodes in the priority list are arranged in order of priority.

[0100] Exemplarily, a priority list is generated according to the priority order and node identification of each NUMA node. If there is only one target computing node, a priority list is generated according to the priority order of the NUMA nodes included in the target computing node and the node identification of each NUMA node. If there are at least two target computing nodes, a priority list is generated according to the priority order of the NUMA nodes included in all target computing nodes and the node identification of each NUMA node.

[0101] In an embodiment of the present invention, the target NUMA node is determined according to the priority and the number of logical processors required by the target job for each of the target computing nodes, and a set number of idle logical processors of the target NUMA node are allocated to the target job, including: the management node queries the priority list to obtain the node identifier of the target NUMA node that meets the conditions. The management node determines the target computing node to which the corresponding NUMA node in the cluster belongs according to the node identifier, and determines whether to use the NUMA node corresponding to the node identifier as the target NUMA node according to the number of logical processors required by the target job for the target computing node. If the NUMA node corresponding to the node identifier is used as the target NUMA node, a logical processor of the target NUMA node is allocated to the target job.

[0102] It should be noted that allocating a logical processor to a target job can be understood as allocating processor resources corresponding to the logical processor to the target job. Processor resources include CPU resources and memory resources.

[0103] For example, the target NUMA node that meets the conditions may be a NUMA node with the highest priority in the priority list. The embodiment of the present invention determines the mapping relationship between the memory amount and the number of logical processors of each NUMA node in the target computing node, determines the priority of the corresponding NUMA node according to the mapping relationship, the remaining memory amount and the number of idle logical processors of each NUMA node, and allocates the idle logical processors of the target NUMA node to the target job according to the priority, thereby realizing resource allocation based on the load balancing of the NUMA structure, reducing the situation where the logical processors allocated to the target job access the memory across NUMA nodes, reducing the situation where the memory access speed is reduced due to accessing the memory across NUMA nodes, and improving the job running speed.

[0104] Figure 3 This is a flow chart of another resource allocation method provided by an embodiment of the present invention. This embodiment adds a feature of determining whether the resource allocation of the target job is completed according to the number of logical processors allocated based on the above embodiment. Figure 3 As shown, the method includes:

[0105] S310: Obtain target computing nodes pre-allocated for a target job and the required number of logical processors of each target computing node.

[0106] S320: Determine a mapping relationship between the amount of memory and the number of logical processors of each non-uniform memory access NUMA node in each of the target computing nodes.

[0107] S330. Determine the priority of the corresponding NUMA node according to the mapping relationship, the remaining memory amount, and the number of idle logical processors of each NUMA node.

[0108] S340: Determine a target NUMA node according to the priority and the number of logical processors required by the target job for each of the target computing nodes, and allocate a set number of idle logical processors of the target NUMA node to the target job.

[0109] S350: Determine the number of logical processor allocations according to the number of idle logical processors allocated to the target job.

[0110] Exemplarily, after allocating a logical processor of the target NUMA node to the target job, the management node counts the number of logical processors that have been allocated to the target job as the number of allocated logical processors.

[0111] S360, determining whether the number of logical processor allocations is less than the total number of logical processor requirements, if so, executing S330, otherwise executing S370.

[0112] The total number of logical processor requirements is the sum of the number of logical processor requirements of the target job for each target computing node.

[0113] Exemplarily, the number of logical processor allocations and the total number of logical processor requirements are compared. If the number of logical processor allocations does not reach the total number of logical processor requirements, the management node recalculates the priorities of all NUMA nodes included in the target computing node, and determines the target NUMA node based on the priority and the number of logical processor requirements of the target job for each of the target computing nodes, and allocates a set number of idle logical processors of the target NUMA node to the target job until the number of logical processor allocations is equal to the total number of logical processor requirements. It should be noted that the priority calculation method is the same as that in the above embodiment and will not be repeated here.

[0114] S370: When the number of allocated logical processors is equal to the total required number of logical processors, determine that resource allocation for the target job is completed.

[0115] Exemplarily, if the number of allocated logical processors is equal to the total required number of logical processors, it is determined that resource allocation of the target job is completed.

[0116] The embodiment of the present invention determines the priority of the corresponding NUMA node according to the mapping relationship, remaining memory and number of idle logical processors of each NUMA node when the number of allocated logical processors is less than the total required number of logical processors, and then determines the target NUMA node according to the priority and the number of logical processors required for each target computing node of the target job, and allocates processor resources corresponding to a set number of idle logical processors of the target NUMA node to the target job, so as to preferentially allocate processor resources of NUMA nodes with more remaining memory and number of idle logical processors to the target job, further reduce the situation where the logical processors allocated to the target job access memory across NUMA nodes, and improve the job running speed.

[0117] Figure 4 This is a flowchart of another resource allocation method provided by an embodiment of the present invention. This embodiment further defines the method for determining the target NUMA node based on the above embodiment. Figure 4 As shown, the method includes:

[0118] S401: Obtain target computing nodes pre-allocated for a target job and the required number of logical processors of each target computing node.

[0119] S402: Determine a mapping relationship between the amount of memory and the number of logical processors of each non-uniform memory access NUMA node in each of the target computing nodes.

[0120] S403: Obtain the memory occupancy and logical processor occupancy of each NUMA node in the target computing node.

[0121] Exemplarily, the memory usage of each NUMA node in the target computing node is obtained by parsing the return result of the setting command. For example, the setting command may be a numatcl -H command, where numatcl is a Linux tool that can be used to view the NUMA node configuration and node status of the server and bind a process to a specified processor core.

[0122] When the management node receives the resource allocation request submitted by the target job, it obtains the memory usage status of each NUMA node in the target computing node by parsing the return result of the numatcl -H command.

[0123] The management node determines the logical processor usage according to the number of allocated logical processors corresponding to the target computing node.

[0124] S404: Determine the remaining memory amount of the corresponding NUMA node according to the memory amount and memory occupancy of each NUMA node in the target computing node.

[0125] Exemplarily, the management node calculates the difference between the memory amount and the memory occupancy of each NUMA node in the target computing node to obtain the remaining memory amount of the corresponding NUMA node.

[0126] S405. Determine the number of idle logical processors according to the number of logical processors and the occupancy of logical processors of each NUMA node in the target computing node.

[0127] Exemplarily, the management node calculates the difference between the number of logical processors and the occupancy of the logical processors of each NUMA node in the target computing node, and obtains the number of idle logical processors of the corresponding NUMA node.

[0128] S406: Determine the priority of the corresponding NUMA node according to the mapping relationship, the remaining memory amount, and the number of idle logical processors of each NUMA node.

[0129] Exemplarily, for each NUMA node in the target computing node, the priority of the corresponding NUMA node is determined according to the mapping relationship, the remaining memory amount and the number of idle logical processors. The method for determining the priority has been recorded in the above embodiment and will not be repeated here.

[0130] S407: Generate a priority list of NUMA nodes according to the priority order and node identifier of each NUMA node.

[0131] S408: Determine the target NUMA node according to the priority order in the priority list of the NUMA node and the number of logical processors required by the target job for each of the target computing nodes.

[0132] In an embodiment of the present invention, an alternative NUMA node is determined according to the priority order in the priority list of the NUMA node; for the target computing node to which the alternative NUMA node belongs, the number of provided logical processors and the required number of logical processors are compared; when the comparison result meets the set conditions, the alternative NUMA node is determined as the target NUMA node.

[0133] Exemplarily, obtain the first NUMA node with the highest priority in the priority list of NUMA nodes, obtain the first allocated number of logical processors corresponding to the first target computing node to which the first NUMA node belongs, and determine whether the first allocated number of logical processors is less than the number of logical processors required by the target job for the first target computing node. If so, determine the first NUMA node as the target NUMA node; otherwise, obtain the second NUMA node with a priority second only to the first NUMA node, obtain the second allocated number of logical processors corresponding to the second target computing node to which the second NUMA node belongs, and determine whether the second allocated number of logical processors is less than the number of logical processors required by the target job for the second target computing node. If so, determine the second NUMA node as the target NUMA node. Otherwise, repeat the above process until the target NUMA node is obtained.

[0134] Specifically, assume that the SLURM scheduling system determines that the target computing node A needs to provide 4 logical processors, and the target computing node B needs to provide 6 logical processors, but the target computing node includes 6 NUMA nodes and the target computing node B includes 8 NUMA nodes. Assume that a priority list of NUMA nodes has been obtained, wherein the priority list of NUMA nodes includes all NUMA nodes corresponding to the target computing node A and the target computing node B. During the first resource allocation, the NUMA node with the highest priority is determined as the target NUMA node, and the processor resources corresponding to the set number of idle logical processors of the target NUMA node are allocated to the target job. Compare the number of logical processor allocations and the number of logical processor requirements. Among them, the number of logical processor allocations is the number of logical processors that the management node has allocated to the target job.

[0135] When the number of logical processors allocated is less than the number of logical processors required, the management node obtains the memory occupancy and logical processor occupancy of each NUMA node in the target computing node, and determines the remaining memory and the number of idle logical processors of each NUMA node according to the memory occupancy and logical processor occupancy of each NUMA node, recalculates the priority of each NUMA node in the target computing node, and obtains a priority list of NUMA nodes. The NUMA node with the highest priority in the priority list is determined as the target NUMA node, and processor resources corresponding to the set number of idle logical processors of the target NUMA node are allocated to the target job.

[0136] Repeat the above steps and regenerate the priority list of NUMA nodes after each allocation of processor resources. In the case where the target computing node A has provided 4 logical processors, if the NUMA node in the target computing node A has the highest priority in the newly determined priority list, the NUMA node with the highest priority in the target computing node A is abandoned as the target NUMA node, and the NUMA node with the highest priority corresponding to the target computing node B in the priority list is determined as the target NUMA node.

[0137] S409: Allocate a set number of idle logical processors of the target NUMA node to the target job.

[0138] Exemplarily, according to the target node identifier of the target NUMA node, a set number of idle logical processors of the target NUMA node in the cluster are allocated to the target job.

[0139] S410: Determine the number of logical processor allocations according to the number of idle logical processors allocated to the target job.

[0140] S411 , determining whether the number of logical processor allocations is less than the total number of logical processor requirements, if so, executing S406 , otherwise executing S412 .

[0141] S412: When the number of allocated logical processors is equal to the total required number of logical processors, determine that resource allocation for the target job is completed.

[0142] The embodiment of the present invention determines the target NUMA node according to the priority of each NUMA node in each target computing node and the number of logical processors required by the target job for each target computing node, thereby allocating resources based on the load balancing of the NUMA structure while taking into account the load balancing of the computing nodes.

[0143] Figure 5 A schematic diagram of the structure of a resource allocation device provided by an embodiment of the present invention. Figure 5 As shown, the device includes: a node acquisition module 510, a relationship determination module 520, a priority determination module 530 and a logical processor allocation module 540.

[0144] A node acquisition module 510 is used to acquire a target computing node pre-allocated for a target job and the required number of logical processors of each target computing node;

[0145] A relationship determination module 520, configured to determine a mapping relationship between the amount of memory and the number of logical processors of each non-uniform memory access NUMA node in each of the target computing nodes;

[0146] A priority determination module 530, configured to determine the priority of a corresponding NUMA node according to the mapping relationship, the remaining memory amount, and the number of idle logical processors of each NUMA node;

[0147] The logical processor allocation module 540 is used to determine the target NUMA node according to the priority and the number of logical processors required by the target job for each target computing node, and allocate a set number of idle logical processors of the target NUMA node to the target job.

[0148] Optionally, the device further comprises:

[0149] An allocation quantity determination module, configured to determine the logical processor allocation quantity according to the number of idle logical processors allocated to the target job after allocating a set number of idle logical processors of the target NUMA node to the target job;

[0150] When the number of allocated logical processors is less than the total required number of logical processors, a priority step of determining the corresponding NUMA node according to the mapping relationship, the remaining memory amount, and the number of idle logical processors of each NUMA node is performed; when the number of allocated logical processors is equal to the total required number of logical processors, resource allocation for completing the target job is determined.

[0151] Optionally, the relationship determination module 520 is specifically configured to:

[0152] Determine the ratio of the memory amount of each NUMA node to the number of logical processors in each of the target computing nodes, and determine the mapping relationship between the memory amount of each NUMA node and the number of logical processors according to the ratio.

[0153] Optionally, the device further comprises:

[0154] The priority list generation module is used to generate a priority list of NUMA nodes according to the priority order and node identifier of each NUMA node after determining the priority of the corresponding NUMA node according to the mapping relationship, remaining memory amount and number of idle logical processors of each NUMA node.

[0155] Optionally, the logical processor allocation module 540 is specifically configured to:

[0156] The target NUMA node is determined according to the priority order in the priority list of the NUMA node and the number of logical processors required by the target job for each of the target computing nodes.

[0157] Furthermore, the logical processor allocation module 540 is specifically used for:

[0158] Determine a candidate NUMA node according to the priority order in the priority list of the NUMA nodes;

[0159] For the target computing node to which the candidate NUMA node belongs, comparing the number of logical processors provided and the required number of logical processors to be provided;

[0160] When the comparison result meets the set condition, the candidate NUMA node is determined as the target NUMA node.

[0161] Optionally, the device further comprises:

[0162] An occupancy acquisition module, used to obtain the memory occupancy and logical processor occupancy of each NUMA node in the target computing node before determining the priority of the corresponding NUMA node according to the mapping relationship, the remaining memory amount and the number of idle logical processors of each NUMA node;

[0163] A remaining memory amount determination module is used to determine the remaining memory amount of the corresponding NUMA node according to the memory amount and memory occupancy of each NUMA node in the target computing node;

[0164] The idle logical processor quantity determination module is used to determine the idle logical processor quantity according to the logical processor quantity and the logical processor occupancy of each NUMA node in the target computing node.

[0165] The resource allocation device provided in the embodiment of the present invention can execute the resource allocation method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0166] Figure 6 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or claimed herein.

[0167] like Figure 6As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0168] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0169] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as a resource allocation method.

[0170] In some embodiments, the resource allocation method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the resource allocation method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform the resource allocation method in any other appropriate manner (e.g., by means of firmware).

[0171] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0172] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0173] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0174] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).

[0175] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0176] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.

[0177] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.

[0178] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A resource allocation method, characterized in that: include: Obtaining the target computing nodes pre-allocated for the target job and the required number of logical processors of each of the target computing nodes; Determine a mapping relationship between the amount of memory and the number of logical processors of each non-uniform memory access NUMA node in each of the target computing nodes; Determine the priority of the corresponding NUMA node according to the mapping relationship, the remaining memory amount and the number of idle logical processors of each NUMA node; Determine a target NUMA node according to the priority and the number of logical processors required by the target job for each target computing node, and allocate a set number of idle logical processors of the target NUMA node to the target job; Determining the mapping relationship between the amount of memory and the number of logical processors of each non-uniform memory access NUMA node in each of the target computing nodes includes: Determine the ratio of the memory amount of each NUMA node to the number of logical processors in each of the target computing nodes, and determine the mapping relationship between the memory amount of each NUMA node and the number of logical processors according to the ratio.

2. The method according to claim 1, characterized in that After allocating a set number of idle logical processors of the target NUMA node to the target job, the method further includes: Determine the number of logical processor allocations according to the number of idle logical processors allocated to the target job; When the number of logical processors allocated is less than the total number of logical processors required, performing a step of determining the priority of the corresponding NUMA node according to the mapping relationship, the remaining memory amount, and the number of idle logical processors of each NUMA node; When the number of allocated logical processors is equal to the total required number of logical processors, it is determined that resource allocation for the target job is completed.

3. The method according to claim 1, characterized in that: After determining the priority of the corresponding NUMA node according to the mapping relationship, the remaining memory amount and the number of idle logical processors of each NUMA node, the method further includes: A priority list of NUMA nodes is generated according to the priority order and node ID of each NUMA node.

4. The method according to claim 1, characterized in that: Determining the target NUMA node according to the priority and the number of logical processors required by the target job for each target computing node includes: The target NUMA node is determined according to the priority order in the priority list of the NUMA node and the number of logical processors required by the target job for each of the target computing nodes.

5. The method according to claim 4, characterized in that The determining the target NUMA node according to the priority order in the priority list of the NUMA node and the number of logical processors required by the target job for each of the target computing nodes includes: Determine a candidate NUMA node according to the priority order in the priority list of the NUMA nodes; For the target computing node to which the candidate NUMA node belongs, comparing the number of provided logical processors with the required number of logical processors; When the comparison result meets the set condition, the candidate NUMA node is determined as the target NUMA node.

6. The method according to claim 1, characterized in that Before determining the priority of the corresponding NUMA node according to the mapping relationship, the remaining memory amount, and the number of idle logical processors of each NUMA node, the method further includes: Obtaining the memory usage and logical processor usage of each NUMA node in the target computing node; Determine the remaining memory of the corresponding NUMA node according to the memory amount and memory usage of each NUMA node in the target computing node; The number of idle logical processors is determined according to the number of logical processors and the occupancy of the logical processors of each NUMA node in the target computing node.

7. A resource allocation device, characterized in that: include: A node acquisition module, used to acquire the target computing nodes pre-allocated for the target job and the required number of logical processors of each of the target computing nodes; A relationship determination module, used to determine a mapping relationship between the amount of memory and the number of logical processors of each non-uniform memory access NUMA node in each of the target computing nodes; A priority determination module, used to determine the priority of the corresponding NUMA node according to the mapping relationship, the remaining memory amount and the number of idle logical processors of each NUMA node; A logical processor allocation module, configured to determine a target NUMA node according to the priority and the number of logical processors required by the target job for each target computing node, and allocate a set number of idle logical processors of the target NUMA node to the target job; Wherein, the relationship determination module is specifically used for: Determine the ratio of the memory amount of each NUMA node to the number of logical processors in each of the target computing nodes, and determine the mapping relationship between the memory amount of each NUMA node and the number of logical processors according to the ratio.

8. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can perform the resource allocation method according to any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the resource allocation method according to any one of claims 1 to 6 when executed.

Citation Information

Patent Citations

  • Virtual machine resource allocation method and device, electronic equipment and storage medium

    CN113760457A

  • Adaptive CPU NUMA Scheduling

    US20160085571A1