Resource scheduling method and device, network equipment and storage medium

By determining the communication bandwidth between graphics processors in Kubernetes and using the hill-climbing algorithm to calculate the target graphics processor, the problem of unreasonable resource allocation is solved and training efficiency is improved.

CN118804328APending Publication Date: 2024-10-18CHINA MOBILE COMM LTD RES INST +1
View PDF 0 Cites 3 Cited by

Patent Information

Application Number
CN202410001928.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-01-02
Publication Date
2024-10-18

AI Technical Summary

Technical Problem

In the existing technology, the general scheduling method of Kubernetes does not consider the communication bandwidth difference between graphics processors, resulting in unreasonable resource allocation and affecting the overall training efficiency.

Method used

By determining the communication bandwidth data between multiple graphics processors, a hill-climbing algorithm is used to calculate the target graphics processor, and resource scheduling of distributed training tasks is performed to avoid assigning graphics processors with large bandwidth differences to the same task.

Benefits of technology

It improves node utilization, improves the overall efficiency of distributed training, and ensures the rationality of resource allocation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118804328A_ABST
    Figure CN118804328A_ABST
Patent Text Reader

Abstract

The invention discloses a resource scheduling method and device, network equipment and a storage medium. The method comprises the following steps: determining communication bandwidth data between every two of a plurality of graphics processors; according to the communication bandwidth data, calculating a target graphics processor used for a distributed training task by adopting a hill climbing algorithm; and performing resource scheduling on the distributed training task on the target graphics processor. According to the resource scheduling method, the hill climbing algorithm is adopted to calculate the target graphics processor, the bandwidth between the graphics processors is considered, the graphics processors with large communication bandwidth differences are prevented from being allocated to the same task, and the problems that in the prior art, resource allocation is unreasonable, the node utilization rate is low, and the resource utilization rate is low are solved. And the overall training efficiency is influenced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of mobile communication technology, and in particular to a resource scheduling method, device, network equipment and storage medium. Background Art

[0002] In the current context of big data and large models, the architecture of the distributed training platform needs to be able to meet the computing power, storage, and network required for large-scale training. Kubernetes is the most widely used cloud-native architecture. Kubernetes implements flexible container orchestration in a declarative manner and implements a container scheduling system with kube-scheduler as the core component. It supports pre-selection strategies, priority functions, affinity scheduling and other mechanisms, which better meet general scheduling scenarios.

[0003] However, in the distributed training platform, Kubernetes' general scheduling method does not take into account the problem of large amounts of data transmission between GPUs (nodes). GPUs with large differences in communication bandwidth may be assigned to the same task. The unreasonable resource allocation leads to low communication bandwidth between GPUs and low node utilization, which seriously affects the overall training efficiency. Summary of the invention

[0004] At least one embodiment of the present application provides a resource scheduling method, apparatus, network device and storage medium, which are used to solve the problem that resource scheduling in the prior art does not take into account the need to transmit a large amount of data between graphics processors, and may allocate graphics processors with large differences in communication bandwidth to the same task, resulting in unreasonable resource allocation, low node utilization, and affecting the overall training efficiency.

[0005] In order to solve the above technical problems, this application is implemented as follows:

[0006] In a first aspect, an embodiment of the present application provides a resource scheduling method, including:

[0007] Determine communication bandwidth data between two of the plurality of graphics processors;

[0008] Calculating a target graphics processor for a distributed training task using a hill climbing algorithm based on the communication bandwidth data;

[0009] The distributed training task is resource scheduled on the target graphics processor.

[0010] Further, determining the communication bandwidth data between two of the plurality of graphics processors comprises:

[0011] Determine a target container group corresponding to the distributed training task;

[0012] Filtering, according to the properties of the target container group, a plurality of graphics processors that meet the requirements of the target container group;

[0013] The communication bandwidth data is determined according to bandwidths between two of the plurality of graphics processors.

[0014] Further, the determining the communication bandwidth data according to the bandwidth between two of the plurality of graphics processors comprises:

[0015] Obtaining bandwidth between two of the plurality of graphics processors;

[0016] According to the bandwidth and the preset number of groups, the plurality of graphics processors are grouped to obtain at least one graphics processor group; the preset number of groups is determined according to the number of the graphics processors;

[0017] Determining a bandwidth range of the graphics processor group according to a first bandwidth between all two graphics processors in the graphics processor group;

[0018] Determining a second bandwidth between two graphics processors in the graphics processor group according to a bandwidth range of the graphics processor group;

[0019] The second bandwidth is determined as communication bandwidth data.

[0020] Further, determining the second bandwidth between two graphics processors in the graphics processor group according to the bandwidth range of the graphics processor group includes:

[0021] Determining a bandwidth median value of each of the graphics processor groups according to a bandwidth range of the graphics processor groups;

[0022] The bandwidth middle value is determined as the second bandwidth.

[0023] Further, the obtaining of bandwidths between two of the plurality of graphics processors includes:

[0024] Reading bandwidths between two of the plurality of graphics processors from a database through a scheduler;

[0025] If the reading is successful, the read bandwidth is determined as the bandwidth between two of the plurality of graphics processors;

[0026] If the reading fails, a bandwidth test is performed using a bandwidth test tool to determine the bandwidth between each of the plurality of graphics processors.

[0027] Further, the step of calculating the target graphics processor for the distributed training task using a hill climbing algorithm according to the bandwidth data includes:

[0028] Determining an initial graphics processor set from a plurality of the graphics processors according to the communication bandwidth data and the number of the target graphics processors; the number of the target graphics processors is determined according to the distributed training task;

[0029] Determine bandwidth reference value;

[0030] According to the bandwidth reference value, multiple graphics processor replacement operations are performed on the initial graphics processor set according to a hill climbing algorithm to obtain a target graphics processor set;

[0031] The target graphics processor is determined according to the target graphics processor set.

[0032] Further, determining the bandwidth reference value includes:

[0033] Randomly selecting an initial graphics processor from the graphics processor group and adding the initial graphics processor to the graphics processor set;

[0034] Selecting a first graphics processor with the largest bandwidth data with the initial graphics processor from the graphics processor group;

[0035] Adding the first graphics processor to the graphics processor set, and recording the minimum bandwidth of the graphics processor set as the first bandwidth of the graphics processor set;

[0036] Performing the first operation multiple times until the number of graphics processors in the graphics processor set is equal to the number of the target graphics processors;

[0037] A minimum bandwidth value of the graphics processor set is determined as the bandwidth reference value.

[0038] Further, the first operation includes:

[0039] Selecting a second graphics processor with the largest bandwidth data with the graphics processor set from the graphics processor group and adding it to the graphics processor set;

[0040] When the minimum bandwidth of the graphics processor set is less than the first bandwidth, the minimum bandwidth of the graphics processor set is updated; when the minimum bandwidth of the graphics processor set is greater than or equal to the first bandwidth, the first bandwidth is determined as the minimum bandwidth of the graphics processor set.

[0041] Furthermore, the graphics processor replacement operation includes:

[0042] When any graphics processor in the initial graphics processor set is replaced by a third graphics processor, calculating a minimum bandwidth corresponding to the replaced processor set;

[0043] If the minimum bandwidth corresponding to the replaced processor set is greater than the bandwidth reference value, replacing the third graphics processor with the initial graphics processor set;

[0044] If the minimum bandwidth corresponding to the replaced processor set is less than or equal to the bandwidth reference value, then the graphics processors in the initial graphics processor set are not replaced;

[0045] The third graphics processor is a graphics processor outside the graphics processor group.

[0046] Furthermore, performing resource scheduling on the target graphics processor according to the distributed training task includes:

[0047] Determine a target container group corresponding to the distributed training task;

[0048] The target container group is dispatched to the target graphics processor.

[0049] In a second aspect, an embodiment of the present invention further provides a resource scheduling device, including:

[0050] A determination module, used to determine communication bandwidth data between two of the plurality of graphics processors;

[0051] A calculation module, configured to calculate a target graphics processor for a distributed training task using a hill climbing algorithm according to the communication bandwidth data;

[0052] A scheduling module is used to schedule resources of the distributed training task on the target graphics processor.

[0053] In a third aspect, an embodiment of the present invention further provides a network device including a processor, wherein:

[0054] The processor is used to determine communication bandwidth data between two of the plurality of graphics processors;

[0055] Calculating a target graphics processor for a distributed training task using a hill climbing algorithm based on the communication bandwidth data;

[0056] The distributed training task is resource scheduled on the target graphics processor.

[0057] In a fourth aspect, an embodiment of the present invention further provides a network device, comprising: a processor, a memory, and a program stored in the memory and executable on the processor, wherein the program implements the steps of the above-described method when executed by the processor.

[0058] In a fifth aspect, an embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the method described above are implemented.

[0059] Compared with the prior art, the resource scheduling method, device, network device and storage medium provided in the embodiments of the present application can use a hill climbing algorithm to calculate the target graphics processor for a distributed training task by determining the communication bandwidth data between multiple graphics processors, thereby scheduling resources for the distributed training task on the target graphics processor. The resource scheduling method of the embodiment of the present invention uses a hill climbing algorithm to calculate the target graphics processor, taking into account the bandwidth between graphics processors, avoiding allocating graphics processors with large differences in communication bandwidth to the same task, and solving the problem of unreasonable resource allocation in the prior art, resulting in low node utilization and affecting the overall training efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0060] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present application. Also, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:

[0061] Figure 1 A schematic diagram of a scheduling process for building a Kubernetes extended scheduler framework in an embodiment of the present application;

[0062] Figure 2 A schematic diagram of a resource scheduling method according to an embodiment of the present application;

[0063] Figure 3 It is a schematic diagram of the steps of the ring full reduction algorithm;

[0064] Figure 4 This is one of the schematic diagrams of testing bandwidth data between graphics processors according to an embodiment of the present application;

[0065] Figure 5 This is a second schematic diagram of testing bandwidth data between graphics processors according to an embodiment of the present application;

[0066] Figure 6 A schematic diagram of the steps of determining the initial graphics processing set according to an embodiment of the present application;

[0067] Figure 7 A schematic diagram of the steps of determining the bandwidth reference value according to an embodiment of the present application;

[0068] Figure 8 A schematic diagram of the structure of a resource scheduling device according to an embodiment of the present application;

[0069] Fig. 9 A schematic diagram of the structure of a network device according to an embodiment of the present application;

[0070] Fig.10 This is a schematic diagram of the structure of a network device according to another embodiment of the present application. DETAILED DESCRIPTION

[0071] The exemplary embodiments of the present application will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present application are shown in the accompanying drawings, it should be understood that the present application can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided in order to enable a more thorough understanding of the present application and to fully convey the scope of the present application to those skilled in the art.

[0072] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and need not be used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchangeable in appropriate circumstances, so that the embodiments of the present application described herein can be implemented in a sequence other than those illustrated or described herein, for example. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, the process, method, system, product or equipment comprising a series of steps or units need not be limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or equipment. "And / or" in the specification and claims represents at least one of the connected objects.

[0073] The following description provides examples and does not limit the scope, applicability, or configuration set forth in the claims. Changes may be made to the functions and arrangements of the elements discussed without departing from the spirit and scope of the present disclosure. Various examples may appropriately omit, replace, or add various procedures or components. For example, the described methods may be performed in an order different from that described, and various steps may be added, omitted, or combined. In addition, features described with reference to certain examples may be combined in other examples.

[0074] Distributed training tasks require a lot of data transmission between multiple GPUs. If resource allocation is unreasonable, data transmission will take too long and training efficiency will be low. For example: two distributed training tasks A and B need to use two container groups Pod for training, which are recorded as A1, A2, B1, and B2 respectively. There are two idle GPUs in the two nodes of the current k8s cluster. There are two allocation schemes:

[0075] Solution 1: Without considering the bandwidth factor, tasks A1 and B1, A2 and B2 are assigned to the same node. The bandwidth of the two tasks is only 5G when they are running.

[0076] Solution 2: Considering the bandwidth factor, A1 and A2, B1 and B2 are assigned to the same node respectively. Then, the bandwidth of the two tasks can reach 10G when running, which can improve the data transmission efficiency during training and thus improve the training efficiency.

[0077] Therefore, the solution of the embodiment of the present invention optimizes the resource scheduling problem in the multi-task distributed training platform scenario by considering the bandwidth factor. The specific steps are as follows:

[0078] Build a Kubernetes extended scheduler framework;

[0079] Determine the actual communication bandwidth between GPUs;

[0080] Use hill climbing algorithm for distributed construction of Kubernetes extended scheduler framework training task scheduling.

[0081] It should be noted that nodes in Kubernetes are divided into Node and Master. Node is a working node that runs specific user tasks; tasks are run on Pods. The scheduler kube-scheduler component is responsible for resource scheduling in Kubernetes. Its main function is to schedule Pods to appropriate Node nodes (graphics processors GPUs) according to specific scheduling algorithms and scheduling strategies. The scheduling architecture of Kubernetes is designed as a plug-in. You can register plug-ins to the scheduling framework to implement external extension schedulers.

[0082] The extended scheduler in the solution of the embodiment of the present invention uses the bandwidth test tool to obtain the actual communication bandwidth between each GPU, and stores the data in the database redis. The data in redis is set with an effective time, and if it exceeds the effective time, it is updated to ensure the timeliness of the data and prevent the scheduling results from not meeting expectations due to network congestion and other reasons.

[0083] like Figure 1 As shown in the figure, the specific scheduling process for building the Kubernetes extended scheduler framework is:

[0084] 1. Put the distributed training tasks to be scheduled into the scheduling queue inside the scheduler. Distributed training tasks usually have multiple Pods. Label the Pods to indicate that they belong to the same task.

[0085] 2. Select the task to be scheduled from the scheduling queue, usually the task that joins the earliest or has the highest priority. Then retrieve all Pods of the same task based on the label and start the scheduling cycle to ensure that all Pods of each task are scheduled atomically. That is, the smallest unit of scheduling is the task, not the Pod, to prevent resource deadlock.

[0086] 3. Resource filtering: retrieve hardware resource requirements from each Pod attribute, such as CPU, memory, etc., filter nodes (GPUs), and calculate a candidate list of GPUs that meet the requirements; usually, the resource requirements of each Pod of a distributed task are the same. If they are different, the maximum value of the resource is selected as the filter value;

[0087] 4. The extended scheduler requests the bandwidth data in redis. If the request is successful, it is calculated directly. If the request fails, the bandwidth test tool is triggered to perform bandwidth testing, obtain bandwidth data and write it to redis storage;

[0088] 5. Using bandwidth data, a hill climbing algorithm is used to calculate the best set of GPUs from the GPU candidate list as the scheduling GPUs. If the scheduling is successful, each Pod is bound to the calculated scheduling GPUs. If the scheduling fails, the whole process is rolled back, and all Pods of the task are re-joined to the scheduling queue and wait for the next scheduling cycle.

[0089] like Figure 2 As shown, a resource scheduling method provided in an embodiment of the present application includes the following steps:

[0090] Step 201, determining communication bandwidth data between two of a plurality of graphics processors;

[0091] Step 202, using a hill climbing algorithm to calculate a target graphics processor for a distributed training task according to the communication bandwidth data;

[0092] Step 203: Schedule resources for the distributed training task on the target GPU.

[0093] Compared with the prior art, the resource scheduling method, device, network device and storage medium provided in the embodiments of the present application can use a hill climbing algorithm to calculate the target graphics processor for a distributed training task by determining the communication bandwidth data between multiple graphics processors, thereby scheduling resources for the distributed training task on the target graphics processor. The resource scheduling method of the embodiment of the present invention uses a hill climbing algorithm to calculate the target graphics processor, taking into account the bandwidth between graphics processors, avoiding allocating graphics processors with large differences in communication bandwidth to the same task, and solving the problem of unreasonable resource allocation in the prior art, resulting in low node utilization and affecting the overall training efficiency.

[0094] Optionally, determining communication bandwidth data between two of the plurality of graphics processors comprises:

[0095] Determine a target container group pod corresponding to the distributed training task;

[0096] According to the properties of the target container group pod, multiple graphics processors that meet the requirements of the target container group pod are screened out;

[0097] The communication bandwidth data is determined according to bandwidths between two of the plurality of graphics processors.

[0098] In the embodiment of the present invention, the attributes of the target container group include: CPU, memory, etc.

[0099] The resource scheduling method of the embodiment of the present invention can exclude graphics processors that cannot process distributed training tasks by screening the graphics processors, thereby simplifying the computational complexity of the hill climbing algorithm.

[0100] Distributed training currently generally uses the Ring All Reduce algorithm, which can theoretically be accelerated linearly as the number of GPUs increases. Therefore, the embodiment of the present invention uses the Ring All Reduce algorithm to perform communication and calculation between the graphics processors.

[0101] The specific process of the algorithm is: each GPU is connected in a ring, and each node has a left-hand card and a right-hand card, one for receiving and the other for sending. The cycle completes the gradient accumulation, and then cycles again for parameter synchronization. It is divided into two stages: Scatter Reduce and All Gather. Scatter Reduce will gradually exchange and fuse each other's gradients, and finally each GPU will contain part of the complete fused gradient; All Gather will gradually replace the incomplete fused gradient, and finally all GPUs will get the complete fused gradient. The specific process is as follows:

[0102] 1. Divide the array into blocks on each GPU, and the number of blocks is equal to the number of GPUs;

[0103] 2. Then perform N-1 rounds of Scatter Reduce. In each round, each GPU sends one of its own blocks to its right neighbor, receives blocks from its left neighbor, and accumulates them.

[0104] 3. Finally, perform N-1 rounds of All Gather, which is similar to the Scatter Reduce operation, except that the operation in each block is changed from accumulation to replacement. Taking 3 GPUs as an example, the overall process is as follows: Figure 3 shown.

[0105] The resource scheduling method of the embodiment of the present invention can improve the processing speed of distributed training tasks through a ring full reduction algorithm.

[0106] Optionally, obtaining bandwidths between two of the plurality of graphics processors includes:

[0107] Reading bandwidths between two of the plurality of graphics processors from a database through a scheduler;

[0108] If the reading is successful, the read bandwidth is determined as the bandwidth between two of the plurality of graphics processors;

[0109] If the reading fails, a bandwidth test is performed using a bandwidth test tool to determine the bandwidth between each of the plurality of graphics processors.

[0110] If the actual communication bandwidth between GPUs is tested through bandwidth testing tools, each GPU manufacturer usually provides its own GPU communication package and bandwidth testing tools. The principles are basically the same. For the sake of convenience, the NVIDIA GPU, which is the most commonly used in distributed training, is used as an example.

[0111] NVIDIA GPU uses NCCL (Nvidia Collective multi-GPU Communication Library) for inter-GPU communication. NCCL provides inter-GPU communication primitives, has topology awareness, and can be easily integrated into applications. NCCL Tests is a test tool set that can be used to evaluate the operating performance of NCCL, and provides multiple communication mode tests: All Reduce, All Gather, Broadcast, etc. Distributed training generally uses the all-reduce communication mode.

[0112] Assume that there are N idle GPUs. For each GPU, the communication bandwidth between the GPU and the remaining N-1 GPUs needs to be tested, and a total of (N-1)^N tests are required. In actual testing, according to the understanding of the cluster network and the timeliness requirements of the test, the following two situations can be divided (for the convenience of description, the GPU that needs to be tested is called the starting GPU, and the remaining N-1 GPUs are called the end GPUs):

[0113] Case 1: If you have a good understanding of the cluster network, have high requirements for test timeliness, and can tolerate the impact of real-time bandwidth errors, you can perform the following optimizations to reduce the number of tests:

[0114] 1. If the starting GPU and the ending GPU are on the same server (same node), according to the server's network configuration, you only need to test one GPU in the same network and one GPU in different networks. For example, if a server (one node) has 8 GPUs, divided into two IB networks, then test the bandwidth between the starting GPU and a GPU on the same IB network, and the bandwidth between the starting GPU and a GPU on different IB networks. The bandwidth of each GPU in the two IB networks is the same.

[0115] 2. If the starting GPU and the ending GPU are not on the same server, since the GPUs on the same server share the external network, you only need to test the bandwidth between the starting GPU and any GPU on the server. The bandwidth data of other GPUs on the same server are the same.

[0116] The bandwidth data between each node (graphics processor) obtained by the test is as follows Figure 4 As shown (s represents the bandwidth data between GPUs).

[0117] Case 2: If you do not understand the cluster network structure and do not require high test timeliness, then test the bandwidth between the remaining N-1 GPUs for each GPU. The actual bandwidth data between the nodes (graphics processors) obtained by the test is as follows: Figure 5 As shown (s represents the bandwidth data between GPUs).

[0118] Optionally, determining the communication bandwidth data according to bandwidths between two of the plurality of graphics processors comprises:

[0119] Obtaining bandwidth between two of the plurality of graphics processors;

[0120] According to the bandwidth and the preset number of groups, the plurality of graphics processors are grouped to obtain at least one graphics processor group; the preset number of groups is determined according to the number of the graphics processors;

[0121] Determining a bandwidth range of the graphics processor group according to a first bandwidth between all two graphics processors in the graphics processor group;

[0122] Determining a second bandwidth between two graphics processors in the graphics processor group according to a bandwidth range of the graphics processor group;

[0123] The second bandwidth is determined as communication bandwidth data.

[0124] In one embodiment of the present invention, a plurality of graphics processors are grouped to obtain at least one graphics processor group S = {S1, S2, ... S n}, where n is the number of the graphics processor groups; each graphics processor group in S is a set of graphics processors. For example, the first graphics processor group S1 = {GPU1, GPU2, … GPU n}, and the number of GPUs in it is denoted as count(S1). The bandwidth of the first graphics processor group is denoted as weight(S1), and weight(S1) > weight(S2) > … > weight(S n ).

[0125] Optionally, determining the second bandwidth between every two graphics processors in the graphics processor group according to the bandwidth range of the graphics processor group includes:

[0126] Determining the bandwidth median value of each graphics processor group according to the bandwidth range of the graphics processor group;

[0127] Determining the bandwidth median value as the second bandwidth.

[0128] In an embodiment of the present invention, for the actual bandwidths between each GPU obtained through bandwidth testing by a bandwidth testing tool, theoretically all values are different. However, to simplify the calculation complexity, the tested values are binned (i.e., multiple graphics processors are grouped). The specific steps are as follows:

[0129] 1. Determine the maximum value sMax, minimum value sMin, and the number of bins n of all bandwidths; the number of bins can be set according to the number of nodes;

[0130] 2. Calculate the bandwidth size of each bin: m = (sMax - sMin) / n

[0131] 3. Determine the bandwidth range of each bin (i.e., the bandwidth range of the graphics processor group) as: [sMin + m*(i - 1), sMin + m*i), where i is the sequence number of the bin; for example, the range of bin 1 is [sMin, sMin + m), the range of bin 2 is [sMin + m, sMin + m*2), and so on;

[0132] 4. Determine the bin to which each actual bandwidth belongs. For example, if sMin < s1 < sMin + m, then the bandwidth s1 is in bin 1;

[0133] 5. After all binning is completed, take the median value ti = sMin + m*i - m / 2 of the bandwidth of each bin, update the bandwidth data between GPUs, and update the bandwidth of each GPU to the median value of the bin (graphics processor group) corresponding to the GPU.

[0134] In an embodiment of the present invention, grouping multiple graphics processors includes:

[0135] The bandwidth weights of each group of the graphics processor groups are sorted from large to small; and the bandwidth differences between two adjacent graphics processor groups in the sorting are the same.

[0136] It should be noted that when using the Ring All Reduce communication method, each GPU needs to form a ring. According to the barrel principle, the communication bandwidth is determined by the minimum communication bandwidth between GPUs on the ring. Multiple GPUs in a cluster can be regarded as a complete graph. The vertices of the graph are GPUs, and the weights on the edges are the communication bandwidth between GPUs. The weights can be divided into n groups, and the weights in each group are equal. Therefore, the distributed training resource scheduling problem can be abstracted as: select W vertices from the complete graph to form a ring, and the minimum edge weight of the ring is the largest among all rings. This problem is similar to the traveling salesman problem, which is an NP problem and has the following two conditions:

[0137] 1. The graph in this problem is a complete graph, and any set of child nodes can form a ring;

[0138] 2. The weights are divided into n groups, and the weight values ​​in each group are equal. Therefore, the nodes can be grouped according to the edge weights, and the edge weights between the nodes in each group are equal.

[0139] The resource scheduling method of the embodiment of the present invention can obtain the actual bandwidth between each GPU by performing bandwidth testing through a bandwidth testing tool, and save the actual bandwidth between each GPU to the database; the GPUs can be grouped according to the actual bandwidth, and the difference in bandwidth of each group of graphics processors is an integer multiple of the bandwidth step (m). The solution of the embodiment of the present invention can simplify the computational complexity of the hill climbing algorithm and improve the computational efficiency by grouping the graphics processors.

[0140] Optionally, the calculating a target graphics processor for a distributed training task using a hill climbing algorithm according to the bandwidth data includes:

[0141] Determining an initial graphics processor set from a plurality of the graphics processors according to the communication bandwidth data and the number of the target graphics processors; the number of the target graphics processors is determined according to the distributed training task;

[0142] Determine bandwidth reference value;

[0143] According to the bandwidth reference value, multiple graphics processor replacement operations are performed on the initial graphics processor set according to a hill climbing algorithm to obtain a target graphics processor set;

[0144] The target graphics processor is determined according to the target graphics processor set.

[0145] It should be noted that the specific process of the hill climbing algorithm is as follows:

[0146] 1. Use random generation or other methods to construct the initial solution;

[0147] 2. Select a neighboring solution of the current solution, compare the objective function values ​​of the current solution and the neighboring solution, and update the current solution if the latter is larger;

[0148] 3. Repeat the second step until the number of iterations is reached or all possibilities have been traversed. The hill climbing algorithm regards the solution space as a continuous function space, so it is suitable for solving continuous optimization problems with unimodal properties. It may not be able to solve the optimal solution for non-unimodal optimization problems.

[0149] Optionally, the determining the initial graphics processing set is to construct the initial solution.

[0150] In one embodiment of the present invention, the step of determining the initial graphics processing set (constructing the initial solution) is as follows: Figure 6 As shown:

[0151] The number of graphics processors in the initial graphics processor set is zero;

[0152] Determine whether L is greater than zero (i.e., whether the initial graphics processor set selects enough initial graphics processors); wherein L is the difference between the number of target graphics processors and the number of graphics processors in the initial graphics processor set;

[0153] If L is greater than zero (i.e., the initial GPU set has not selected enough initial GPUs), it is determined whether L is less than the number of GPUs in the GPU set, which is recorded as count (S i );

[0154] If L≤count(S i ), then all graphics processors in the graphics processor group except the initial graphics processor set are added to the initial graphics processor set;

[0155] If L>count(S i ), then select L graphics processors from the graphics processor group except the initial graphics processor set to add to the initial graphics processor set.

[0156] Optionally, determining the bandwidth reference value includes:

[0157] Randomly selecting an initial graphics processor from the graphics processor group and adding the initial graphics processor to the graphics processor set;

[0158] Selecting a first graphics processor with the largest bandwidth data with the initial graphics processor from the graphics processor group;

[0159] Adding the first graphics processor to the graphics processor set, and recording the minimum bandwidth of the graphics processor set as the first bandwidth of the graphics processor set;

[0160] Performing the first operation multiple times until the number of graphics processors in the graphics processor set is equal to the number of the target graphics processors;

[0161] A minimum bandwidth value of the graphics processor set is determined as the bandwidth reference value.

[0162] In the embodiment of the present invention, for the determined initial set of graphics processors, a depth first search is used to find a ring composed of graphics processors, and each time a new node is selected, the edge with the largest weight is used, and the bandwidth reference value is the minimum weight on the ring;

[0163] The determining of the bandwidth reference value is specifically as follows: Figure 7 As shown:

[0164] Initializing the initial graphics processor set, and randomly selecting an initial graphics processor as an initial graphics processor to add to the graphics processor set;

[0165] Determine a minimum bandwidth (first bandwidth) P of the initial graphics processor;

[0166] Selecting a second graphics processor having the largest bandwidth with the initial graphics processor and adding the second graphics processor to the graphics processor set;

[0167] Calculating a minimum bandwidth Q of the graphics processor set after adding the second graphics processor;

[0168] If P>Q, the minimum bandwidth of the graphics processor set is updated to Q; if P≤Q, the minimum bandwidth of the graphics processor set is not updated;

[0169] The following steps are executed in a loop:

[0170] Selecting a third graphics processor having the largest bandwidth with the graphics processor set and adding the third graphics processor to the graphics processor set;

[0171] Calculating a minimum bandwidth Q of the graphics processor set after adding the third graphics processor;

[0172] If P>Q, the minimum bandwidth of the graphics processor set is updated to Q; if P≤Q, the minimum bandwidth of the graphics processor set is not updated;

[0173] When the number of graphics processors in the graphics processor set is greater than or equal to the number W of the target graphics processors, the loop ends;

[0174] The bandwidth reference value is determined to be the minimum bandwidth of the current graphics processor set.

[0175] Optionally, the first operation includes:

[0176] Selecting a second graphics processor with the largest bandwidth data with the graphics processor set from the graphics processor group and adding it to the graphics processor set;

[0177] When the minimum bandwidth of the graphics processor set is less than the first bandwidth, the minimum bandwidth of the graphics processor set is updated; when the minimum bandwidth of the graphics processor set is greater than or equal to the first bandwidth, the first bandwidth is determined as the minimum bandwidth of the graphics processor set.

[0178] Optionally, the graphics processor replacement operation includes:

[0179] When any graphics processor in the initial graphics processor set is replaced by a third graphics processor, calculating a minimum bandwidth corresponding to the replaced processor set;

[0180] If the minimum bandwidth corresponding to the replaced processor set is greater than the bandwidth reference value, replacing the third graphics processor with the initial graphics processor set;

[0181] If the minimum bandwidth corresponding to the replaced processor set is less than or equal to the bandwidth reference value, then the graphics processors in the initial graphics processor set are not replaced;

[0182] The third graphics processor is a graphics processor outside the graphics processor group.

[0183] The resource scheduling method of the embodiment of the present invention can take into account the bandwidth between graphics processors through a hill climbing algorithm, avoid allocating graphics processors with large differences in communication bandwidth to the same task, and solve the problem of unreasonable resource allocation in the prior art, resulting in low node utilization and affecting the overall training efficiency.

[0184] Optionally, performing resource scheduling on the target graphics processor according to the distributed training task includes:

[0185] Determine a target container group corresponding to the distributed training task;

[0186] The target container group is dispatched to the target graphics processor.

[0187] The resource scheduling method of an embodiment of the present invention, after determining the target graphics processor to the target graphics processor, schedules the target container group determined according to the distributed training task to the target graphics processor to process and calculate the distributed training task.

[0188] The above describes various methods of the embodiments of the present application. The following further provides devices for implementing the above methods.

[0189] like Figure 8 As shown, the embodiment of the present invention further provides a resource scheduling device 800, including:

[0190] A determination module 801 is used to determine communication bandwidth data between two of a plurality of graphics processors;

[0191] A calculation module 802 is used to calculate a target graphics processor for a distributed training task using a hill climbing algorithm according to the communication bandwidth data;

[0192] The scheduling module 803 is used to schedule resources of the distributed training task on the target graphics processor.

[0193] The resource scheduling device provided in the embodiment of the present application can use a hill climbing algorithm to calculate the target graphics processor for the distributed training task by determining the communication bandwidth data between multiple graphics processors, so as to perform resource scheduling on the target graphics processor for the distributed training task. The resource scheduling method of the embodiment of the present invention uses a hill climbing algorithm to calculate the target graphics processor, takes into account the bandwidth between graphics processors, avoids allocating graphics processors with large communication bandwidth differences to the same task, and solves the problem of unreasonable resource allocation in the prior art, resulting in low node utilization and affecting the overall training efficiency.

[0194] It should be noted that the resource scheduling device in this embodiment is a device corresponding to the resource scheduling method described above, and the implementation methods in the above embodiments are all applicable to the embodiments of the device, and can also achieve the same technical effects. The above device provided in the embodiment of the present application can implement all the method steps implemented in the above method embodiment, and can achieve the same technical effects. The parts and beneficial effects that are the same as those in the method embodiment in this embodiment will not be specifically described here.

[0195] like Fig. 9 As shown, the embodiment of the present application further provides a network device 900, including a processor 910, wherein:

[0196] The processor 910 is used to determine communication bandwidth data between two of the multiple graphics processors;

[0197] Calculating a target graphics processor for a distributed training task using a hill climbing algorithm based on the communication bandwidth data;

[0198] The distributed training task is scheduled on the target graphics processor.

[0199] like Fig.10 As shown, an embodiment of the present application also provides a network device 100, including a processor 1001, a memory 1002, and a computer program stored in the memory 1002 and executable on the processor 1001. When the computer program is executed by the processor 1001, the various processes of the resource scheduling method embodiment performed by the network device are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0200] The embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, each process of the above-mentioned resource scheduling method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it is not repeated here. The computer-readable storage medium is, for example, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0201] It should be noted that, in this article, the terms "include", "include" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "includes a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.

[0202] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present application.

[0203] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.

Claims

1. A resource scheduling method, characterized in that: include: Determine communication bandwidth data between two of the plurality of graphics processors; Calculating a target graphics processor for a distributed training task using a hill climbing algorithm based on the communication bandwidth data; The distributed training task is resource scheduled on the target graphics processor.

2. The resource scheduling method according to claim 1, characterized in that: The step of determining communication bandwidth data between two of the plurality of graphics processors comprises: Determine a target container group corresponding to the distributed training task; Filtering, according to the properties of the target container group, a plurality of graphics processors that meet the requirements of the target container group; The communication bandwidth data is determined according to bandwidths between two of the plurality of graphics processors.

3. The resource scheduling method according to claim 2, characterized in that: The step of determining the communication bandwidth data according to the bandwidth between two of the plurality of graphics processors comprises: Obtaining bandwidth between two of the plurality of graphics processors; According to the bandwidth and the preset number of groups, the plurality of graphics processors are grouped to obtain at least one graphics processor group; the preset number of groups is determined according to the number of the graphics processors; Determining a bandwidth range of the graphics processor group according to a first bandwidth between all two graphics processors in the graphics processor group; Determining a second bandwidth between two graphics processors in the graphics processor group according to a bandwidth range of the graphics processor group; The second bandwidth is determined as communication bandwidth data.

4. The resource scheduling method according to claim 3, characterized in that: The step of determining the second bandwidth between two graphics processors in the graphics processor group according to the bandwidth range of the graphics processor group includes: Determining a bandwidth median value of each of the graphics processor groups according to a bandwidth range of the graphics processor groups; The bandwidth middle value is determined as the second bandwidth.

5. The resource scheduling method according to claim 3, characterized in that: The obtaining of bandwidths between two of the plurality of graphics processors comprises: Reading bandwidths between two of the plurality of graphics processors from a database through a scheduler; If the reading is successful, the read bandwidth is determined as the bandwidth between two of the plurality of graphics processors; If the reading fails, a bandwidth test is performed using a bandwidth test tool to determine the bandwidth between each of the plurality of graphics processors.

6. The resource scheduling method according to claim 4, characterized in that: The step of calculating a target graphics processor for a distributed training task using a hill climbing algorithm according to the bandwidth data includes: Determining an initial graphics processor set from a plurality of the graphics processors according to the communication bandwidth data and the number of the target graphics processors; the number of the target graphics processors is determined according to the distributed training task; Determine bandwidth reference value; According to the bandwidth reference value, multiple graphics processor replacement operations are performed on the initial graphics processor set according to a hill climbing algorithm to obtain a target graphics processor set; The target graphics processor is determined according to the target graphics processor set.

7. The resource scheduling method according to claim 6, characterized in that: The determining of the bandwidth reference value comprises: Randomly selecting an initial graphics processor from the graphics processor group and adding the initial graphics processor to the graphics processor set; Selecting a first graphics processor with the largest bandwidth data with the initial graphics processor from the graphics processor group; Adding the first graphics processor to the graphics processor set, and recording the minimum bandwidth of the graphics processor set as the first bandwidth of the graphics processor set; Performing the first operation multiple times until the number of graphics processors in the graphics processor set is equal to the number of the target graphics processors; A minimum bandwidth value of the graphics processor set is determined as the bandwidth reference value.

8. The resource scheduling method according to claim 7, characterized in that: The first operation includes: Selecting a second graphics processor with the largest bandwidth data with the graphics processor set from the graphics processor group and adding it to the graphics processor set; When the minimum bandwidth of the graphics processor set is less than the first bandwidth, the minimum bandwidth of the graphics processor set is updated; when the minimum bandwidth of the graphics processor set is greater than or equal to the first bandwidth, the first bandwidth is determined as the minimum bandwidth of the graphics processor set.

9. The resource scheduling method according to claim 6, characterized in that: The graphics processor replacement operation includes: When any graphics processor in the initial graphics processor set is replaced by a third graphics processor, calculating a minimum bandwidth corresponding to the replaced processor set; If the minimum bandwidth corresponding to the replaced processor set is greater than the bandwidth reference value, replacing the third graphics processor with the initial graphics processor set; If the minimum bandwidth corresponding to the replaced processor set is less than or equal to the bandwidth reference value, then the graphics processors in the initial graphics processor set are not replaced; The third graphics processor is a graphics processor outside the graphics processor group.

10. The resource scheduling method according to claim 1, characterized in that: The performing resource scheduling on the target graphics processor according to the distributed training task includes: Determine a target container group corresponding to the distributed training task; The target container group is dispatched to the target graphics processor.

11. A resource scheduling device, characterized in that: include: A determination module, used to determine communication bandwidth data between two of the plurality of graphics processors; A calculation module, configured to calculate a target graphics processor for a distributed training task using a hill climbing algorithm according to the communication bandwidth data; A scheduling module is used to schedule resources of the distributed training task on the target graphics processor.

12. A network device, characterized in that: comprising a processor, wherein The processor is used to determine communication bandwidth data between two of the plurality of graphics processors; Calculating a target graphics processor for a distributed training task using a hill climbing algorithm based on the communication bandwidth data; The distributed training task is resource scheduled on the target graphics processor.

13. A network device, characterized in that: include: A processor, a memory, and a program stored in the memory and executable on the processor, wherein the program, when executed by the processor, implements the steps of the method according to any one of claims 1 to 10.

14. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 10 are implemented.

Citation Information

Cited By

  • Efficient parameter synchronization method based on AllReduce architecture

    CN119788688A

  • An efficient parameter synchronization method based on the AllReduce architecture

    CN119788688B

  • Large file distribution method and device, equipment, medium and product

    CN120935160A