A link allocation method, apparatus, device and medium
By employing a low-granularity link allocation strategy at the data stream level, the problem of network congestion in distributed training is solved, achieving load balancing and efficient communication, improving the training efficiency of large models, and is applicable to various communication protocols and scenarios.
Patent Information
- Application Number
- CN202410417325.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-08
- Publication Date
- 2025-11-18
- Estimated Expiration
- 2044-04-08
AI Technical Summary
In distributed training, network congestion leads to decreased communication efficiency, which in turn reduces the efficiency of distributed training. Existing methods have low versatility and are difficult to deploy.
By employing a low-granularity link allocation strategy at the data flow level, target data flow groups are filtered based on the global traffic set. Combining traffic type and allocated data flow information, available links for the data flow to be allocated are determined, and an interleaved incremental link numbering strategy is adopted to achieve load balancing.
It effectively improves network congestion, enhances the efficiency of large model training, and is applicable to different network communication protocols and non-distributed training scenarios. It has strong load balancing capabilities and is easy to deploy.
Smart Images

Figure CN118233356B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of communication technology, and in particular to a link allocation method, apparatus, device and medium. Background Technology
[0002] Large models refer to deep learning models with a large number of parameters and complex structures. These models typically consist of multiple layers and a large number of neurons, enabling them to handle and learn more complex and massive tasks. Due to the rapidly increasing number of parameters and the amount of training data required for large models, distributed training has been proposed to improve training efficiency. In distributed training, the model training process is broken down into multiple parts, which can be processed in parallel, accelerating training while handling larger datasets or more complex models.
[0003] In the process of distributed training, there are a large number of information synchronization and data update requirements. Traditional point-to-point communication methods cannot meet the requirements of frequent, high-performance, and multi-node simultaneous communication in distributed training. To provide high-performance distributed training communication, collection communication libraries have emerged.
[0004] Because the network environment for distributed training is complex and prone to network congestion, and because aggregated communication libraries are susceptible to network congestion, communication efficiency decreases, overall bandwidth utilization is reduced, and consequently, the efficiency of distributed training is lowered. Therefore, network congestion becomes a bottleneck for efficient training. Summary of the Invention
[0005] To address the problem in related technologies where network congestion in distributed training leads to decreased communication efficiency, thereby reducing the efficiency of distributed training, embodiments of this application provide a link allocation method, apparatus, device, and medium that effectively improves network congestion.
[0006] In a first aspect, embodiments of this application provide a link allocation method, applied to any terminal device in a communication network. The communication network includes multiple terminal devices and multiple network devices, including access switches and core switches. Each terminal device accesses the communication network through a connected access switch and transmits data streams based on a corresponding link. The method includes:
[0007] Based on the link information corresponding to the data stream groups, target data stream groups are selected from the data stream groups corresponding to each terminal device, and a global traffic set is generated. Each target data stream group includes at least one data stream to be allocated. The global traffic set includes: the correspondence between terminal devices and target data stream groups, the data streams to be allocated included in each target data stream group, and the corresponding link information. The link information includes the available links corresponding to the corresponding data stream groups.
[0008] For each target data stream group corresponding to the current terminal device, based on the global traffic set, determine the first information of the data stream to be allocated for the associated target data stream group;
[0009] For each data stream to be allocated, based on the first information mentioned above and the second information of the reference data stream, the available links corresponding to the current data stream to be allocated are determined from the available links corresponding to the corresponding target data stream group; the reference data stream mentioned above is: the data stream in the corresponding target data stream group that has completed link allocation.
[0010] In one possible implementation, the link information above further includes: indication information for indicating whether the available link corresponding to the corresponding data flow packet passes through the core switch;
[0011] The above-mentioned filtering of target data stream packets from the data stream packets corresponding to each terminal device based on the link information corresponding to the data stream packets includes:
[0012] For each data flow packet, based on the indication information corresponding to the data flow packet, if it is determined that all available links corresponding to the current data flow packet pass through the core switch, the current data flow packet is identified as the target data flow packet.
[0013] In one possible implementation, the aforementioned associated target data stream group is: the target data stream group arranged before the current target data stream group in the global traffic set; the global traffic set also includes the traffic type corresponding to each data stream to be allocated; the first information includes: the first number of data streams to be detected corresponding to each traffic type in the data streams to be allocated arranged before the current target data stream group; the second information includes: the second number of data streams to be detected corresponding to each traffic type in the reference data stream.
[0014] Based on the aforementioned global traffic set, the first information of the data stream to be allocated for the associated target data stream group is determined, including:
[0015] For each traffic type, based on the aforementioned global traffic set, determine the first number of data streams to be allocated corresponding to the aforementioned traffic type in the associated target data stream group;
[0016] For each data stream to be allocated, based on the first information and the second information of the reference data stream, the available links corresponding to the current data stream to be allocated are determined from the available links corresponding to the corresponding target data stream group, including:
[0017] For each data stream to be allocated, based on the first quantity and the second quantity corresponding to the corresponding traffic type, the available links corresponding to the current data stream to be allocated are determined from the available links corresponding to the corresponding target data stream group.
[0018] In one possible implementation, each target data stream group corresponds to a first sequence number, and the target data stream groups in the global traffic set are arranged in ascending order according to the value of their corresponding first sequence numbers. The determination of the first number of data streams to be allocated corresponding to the traffic type in the associated target data stream groups, based on the aforementioned global traffic set, includes:
[0019] From the above global traffic set, determine the target data stream whose first sequence number is less than the current target data stream group;
[0020] The number of data streams to be allocated corresponding to the above traffic types in each target data stream is counted, and the counted number is used as the first quantity mentioned above.
[0021] In one possible implementation, the available links corresponding to the current target data stream group are arranged sequentially. The determination of the available links corresponding to the current data stream to be allocated from the available links corresponding to the corresponding target data stream group, based on a first number corresponding to the corresponding traffic type and a second number corresponding to the corresponding traffic type in the reference data stream, includes:
[0022] The first and second quantities are summed and then 1 is added. Based on the result of adding 1, a modulo operation is performed on the third quantity, and the result of the modulo operation is determined as the target position of the available link corresponding to the current data stream to be allocated among the above available links. The third quantity is: the number of available links corresponding to the corresponding target data stream group.
[0023] Based on the target location mentioned above, the available links corresponding to the data stream to be allocated are determined from the available links mentioned above.
[0024] In one possible implementation, each available link corresponds to a second sequence number, and each available link includes a core switch. The available links corresponding to the current target data flow packet are arranged in order of the second sequence number. The second sequence numbers of the available links are alternately incremented among different core switches.
[0025] In one possible implementation, each available link corresponds to a control identifier;
[0026] After determining the available links corresponding to the data stream to be allocated, the process also includes:
[0027] Assign the control identifier corresponding to the above available link to the current data stream to be allocated, so as to configure the actual transmission link of the current data stream to be allocated as the corresponding available link.
[0028] Secondly, embodiments of this application provide a link allocation device, applied to any terminal device in a communication network. The communication network includes multiple terminal devices and multiple network devices, including access switches and core switches. Each terminal device accesses the communication network through a connected access switch and transmits data streams based on a corresponding link, including:
[0029] The set generation unit is used to filter target data stream groups from the data stream groups corresponding to each terminal device based on the link information corresponding to the data stream groups, and generate a global traffic set; each target data stream group includes at least one data stream to be allocated; the global traffic set includes: the correspondence between terminal devices and target data stream groups, the data streams to be allocated included in each target data stream group, and the corresponding link information; the link information includes the available links corresponding to the corresponding data stream group;
[0030] The determining unit is used to determine the first information of the data stream to be allocated for each target data stream group corresponding to the current terminal device, based on the above-mentioned global traffic set;
[0031] The allocation unit is used to determine, for each data stream to be allocated, the available links corresponding to the current data stream from the available links corresponding to the corresponding target data stream group, based on the first information mentioned above and the second information of the reference data stream; the reference data stream is: the data stream in the corresponding target data stream group that has completed link allocation.
[0032] In one possible implementation, the above-mentioned set generation unit is specifically used for
[0033] For each data flow packet, based on the indication information corresponding to the data flow packet, if it is determined that all available links corresponding to the current data flow packet pass through the core switch, the current data flow packet is identified as the target data flow packet.
[0034] In one possible implementation, the associated target data stream group is: the target data stream group arranged before the current target data stream group in the global traffic set; the global traffic set also includes the traffic type corresponding to each data stream to be allocated; the first information includes: the first number of data streams to be detected corresponding to each traffic type in the data streams to be allocated arranged before the current target data stream group; the second information includes: the second number of data streams to be detected corresponding to each traffic type in the reference data stream.
[0035] Then the unit is determined, specifically for:
[0036] For each traffic type, based on the aforementioned global traffic set, determine the first number of data streams to be allocated corresponding to the aforementioned traffic type in the associated target data stream group;
[0037] The allocation unit is specifically used for:
[0038] For each data stream to be allocated, based on the first quantity and the second quantity corresponding to the corresponding traffic type, the available links corresponding to the current data stream to be allocated are determined from the available links corresponding to the corresponding target data stream group.
[0039] In one possible implementation, each target data stream packet corresponds to a first sequence number, and in the global traffic set, the target data stream packets are arranged in ascending order according to the value of their corresponding first sequence numbers; the determining unit is specifically used for:
[0040] From the above global traffic set, determine the target data stream whose first sequence number is less than the current target data stream group; count the number of data streams to be allocated corresponding to the above traffic type in each determined target data stream, and use the counted number as the above first quantity.
[0041] In one possible implementation, the available links corresponding to the aforementioned current target data stream packets are arranged sequentially, and the allocation unit is specifically used for:
[0042] The first and second quantities are summed and then 1 is added. Based on the result of adding 1, a modulo operation is performed on the third quantity, and the result of the modulo operation is determined as the target position of the available link corresponding to the current data stream to be allocated among the above available links. The third quantity is: the number of available links corresponding to the corresponding target data stream group. Based on the target position, the available link corresponding to the current data stream to be allocated is determined from the above available links.
[0043] In one possible implementation, each available link corresponds to a second sequence number, and each available link includes a core switch. The available links corresponding to the current target data flow packet are arranged in order of the second sequence number. The second sequence numbers of the available links are alternately incremented among different core switches.
[0044] In one possible implementation, each available link corresponds to a control identifier; after determining the available link corresponding to the current data stream to be allocated, the allocation unit is further used for:
[0045] Assign the control identifier corresponding to the above available link to the current data stream to be allocated, so as to configure the actual transmission link of the current data stream to be allocated as the corresponding available link.
[0046] Thirdly, embodiments of this application provide an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the steps in the link allocation method described above.
[0047] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the steps in the link allocation method described above.
[0048] Fifthly, embodiments of this application provide a computer program product, including a computer program stored in a computer-readable storage medium; when a processor of a memory access device reads the computer program from the computer-readable storage medium, the processor executes the computer program, causing the memory access device to perform the steps in the link allocation method described above in this application.
[0049] The beneficial effects of this application are as follows:
[0050] Based on the link information corresponding to data stream groups, target data stream groups are selected from the data stream groups corresponding to each terminal device to generate a global traffic set. Then, based on the records in the global traffic set, the links corresponding to the data streams to be allocated in the associated target data stream groups, and the data streams to be allocated in the corresponding target data stream groups that have already completed link allocation, are determined. This method performs link allocation at the data stream level, which is relatively low-granularity. By combining information from other related links to be allocated, it performs link allocation from a global perspective, making the load on the communication network more balanced, effectively improving the network congestion problem of the aggregated communication library, and thus improving the efficiency of large model training. At the same time, this method is easy to deploy and has strong applicability.
[0051] Other features and advantages of this application will be set forth in the description which follows, and will be apparent in part from the description, or may be learned by practicing the application. The objectives and other advantages of this application may be realized and obtained by means of the structures particularly pointed out in the written description, claims, and drawings. Attached Figure Description
[0052] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:
[0053] Figure 1 This application provides a schematic diagram of a possible communication network architecture for an embodiment of the present application.
[0054] Figure 2 This is a schematic diagram of the link allocation method provided in the embodiments of this application;
[0055] Figure 3 A schematic diagram illustrating the implementation process of the link allocation method provided in this application embodiment;
[0056] Figure 4 A schematic diagram illustrating a link numbering process provided in an embodiment of this application;
[0057] Figure 5 A schematic diagram illustrating a possible link allocation process provided in an embodiment of this application;
[0058] Figure 6 A schematic diagram illustrating another possible link allocation process provided for an embodiment of this application;
[0059] Figure 7 A schematic diagram of a link allocation device provided in an embodiment of this application;
[0060] Figure 8 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0061] To address the problem in related technologies where network congestion in distributed training leads to decreased communication efficiency, thereby reducing the efficiency of distributed training, embodiments of this application provide a link allocation method, apparatus, device, and medium that effectively improves network congestion.
[0062] The present application will be further described in detail below with reference to the accompanying drawings.
[0063] The application scenarios described in this application are for the purpose of more clearly illustrating the technical solutions of this application, and do not constitute a limitation on the technical solutions provided in this application. Those skilled in the art will understand that with the emergence of new application scenarios, the technical solutions provided in this application are also applicable to similar technical problems. In the description of this application, unless otherwise stated, "multiple" means two or more.
[0064] It should be noted that the terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present invention. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without inventive effort are within the scope of protection of this application.
[0065] Deep learning has developed rapidly in recent years and has become a solution in many fields. With the improvement of computing power, the increase in datasets, and the refinement of algorithms, deep learning models are becoming increasingly complex and powerful, thus giving rise to the application of large-scale models. Large-scale models refer to deep learning models with a large number of parameters and complex structures. These models typically consist of multiple layers and a large number of neurons, capable of handling and learning more complex and large-scale tasks. Large-scale models have demonstrated superior results in various fields such as complex natural language tasks, computer vision, and recommendation algorithms, providing a new approach to solving complex practical problems.
[0066] Due to the rapid increase in the number of parameters and training data required for large models, distributed training has been proposed to improve training efficiency. In distributed training, the model training process is broken down into multiple parts, which can be processed in parallel, accelerating training while handling larger datasets or more complex models. During distributed training, there are numerous needs for information synchronization and data updates. Traditional point-to-point communication methods cannot meet the requirements of frequent, high-performance, and multi-node simultaneous communication in distributed training. To provide high-performance distributed training communication, aggregated communication libraries (such as NCCL) have emerged.
[0067] In large-scale distributed environments, ensemble communication libraries are frequently invoked. Due to the complexity of the network environment in distributed training, network congestion is a common problem, and ensemble communication libraries are susceptible to its effects, leading to decreased communication efficiency, reduced overall bandwidth utilization, and consequently, lower distributed training efficiency. Therefore, effectively mitigating network congestion becomes a bottleneck for efficient training.
[0068] Among related technologies, there are the following two methods to improve network congestion:
[0069] One approach is to improve network congestion using the Halving-Doubling (HD) algorithm. In practice, a communication library performs topology probing through probe packets and groups communication processes between nodes. The HD algorithm then performs multiple grouping operations on the data to be communicated before communication, thus reducing communication steps and latency. This grouping operation also provides a more efficient allocation of links, thereby improving congestion. This method offers good network bandwidth utilization and low latency. However, it requires a maximum of 2 to n communication processes between nodes, and the use of a Clos architecture and fat-tree topology between core and access switches. This means it requires a specific topology and a specific number of GPUs (graphics processing units), resulting in low versatility and high deployment difficulty.
[0070] Secondly, network device ports are numbered sequentially, and forwarding paths are evenly distributed based on the number of equivalent forwarding paths to achieve load balancing and improve congestion. However, since this method balances traffic at the port and terminal device level, it is highly likely to cause load imbalance and bandwidth waste when port traffic is uneven or even when a port has no traffic.
[0071] To address the aforementioned issues, embodiments of this application provide a link allocation method, apparatus, device, and medium that effectively improves network congestion in aggregated communication libraries and significantly enhances the training efficiency of large models through a low-granularity allocation strategy at the data stream level.
[0072] In some embodiments, the link allocation scheme based on data flow in this application can adapt to different network communication protocols, such as RDMA (Remote Direct Memory Access), TCP (Transmission Control Protocol) / IP (Internet Protocol) communication based on Socket, etc., and this scheme can also be applied to non-distributed training scenarios, such as applying it to traditional cluster communication scenarios for balanced scheduling.
[0073] The link allocation scheme provided in this application is applied to a communication network, which includes both terminal devices and network devices. There is no limit to the number of terminal devices or network devices. Network devices include, but are not limited to, access switches (Leaf) and core switches (Spine). Each terminal device accesses the communication network through a connected access switch. This terminal device can be a server or a virtual machine implementing server functions. When different terminal devices need to communicate, data flow forwarding is achieved through the connected network devices based on corresponding links. The aggregated communication described in this application is commonly used when multiple servers execute AI (Artificial Intelligence) training or inference tasks, but it is not limited to this AI scenario.
[0074] Figure 1 This application provides a schematic diagram of a possible communication network architecture, as shown in the embodiments of this application. Figure 1 As shown, the communication network includes two core switches Spine1-2, four access switches Leaf1-4, and 4n terminal devices Server1-4n, where n is a positive integer.
[0075] Figure 1 Ports 1-8, A1-N1, and A2-N2 are network ports of network devices or terminal devices. For example... Figure 1 As shown, the four network ports 1, 3, 5, and 7 of Spine1 are connected to the corresponding network ports of Leaf1 to Leaf4, respectively. The four network ports 2, 4, 6, and 8 of Spine1 are connected to the corresponding network ports of Leaf1 to Leaf4, respectively. The network ports A1 and A2 of Server1 are connected to the corresponding network ports A1 and A2 of Leaf1. Other connection methods are similar.
[0076] In some possible implementations, each access switch can be connected to each core switch using a Clos architecture.
[0077] In some possible implementations, there is one or more connections between each access switch and each core switch.
[0078] In some possible implementations, the terminal devices and network devices are deployed in a fat tree network.
[0079] In some possible implementations, one or more terminal devices are connected to each access switch.
[0080] In some possible implementations, each terminal device has one or more connections to the access switch.
[0081] Based on the above application scenarios, the following will refer to the appendix. Figures 2-8 The exemplary embodiments of this application are described in more detail below. It should be noted that the above application scenarios are shown only to facilitate understanding of the spirit and principles of this application, and the implementation methods of this application are not limited in any way. On the contrary, the implementation methods of this application can be applied to any applicable scenario.
[0082] Figure 2 This is a schematic diagram of the link allocation method provided in the embodiments of this application, as shown below. Figure 2 As shown, the link allocation scheme in this application embodiment includes two main parts: global flow table establishment and traffic link allocation. First, in the global flow table establishment stage, traffic control information can be obtained through methods such as terminal device probing or external SDN (Software Defined Network) controller distribution, and then distributed to each terminal device. Upon receiving the traffic control information, each terminal device determines the flow that needs subsequent link allocation (i.e., the data flow to be allocated) based on the traffic control information, and detects the traffic type corresponding to different data flows to be allocated, such as high traffic or low traffic (e.g., high flow rate). Figure 2 (As shown in the diagram, traffic volume detection) is used to establish a global flow table based on the above information. During the link allocation phase, each terminal device will allocate links according to different traffic types based on the information recorded in the global flow table (e.g., ...). Figure 2 (This shows the allocation of low-traffic links and high-traffic links).
[0083] In some embodiments, the above-mentioned method for detecting the traffic type corresponding to different data streams to be allocated can be as follows: if the terminal device itself has the function of traffic type detection, the terminal itself can perform traffic type detection; if the terminal device itself does not have the function of traffic type detection, a component with this function can be called to perform traffic type detection, for example, by using the communication mechanism of the collection communication library to perform large and small traffic detection.
[0084] In some embodiments, the above-mentioned flow control information includes information related to the flow type of each data stream. When performing flow type detection, the flow type of each data stream can be determined by parsing this information.
[0085] In some embodiments, the principles of the above link allocation include, but are not limited to: global sequential cyclic allocation, independent allocation of high-volume and low-volume traffic, and load balancing between switches.
[0086] like Figure 3 The diagram shown illustrates the implementation flow of the link allocation method provided in this application embodiment. This method is applied to any terminal device in the aforementioned communication network and may specifically include the following steps:
[0087] Step S31: Based on the link information corresponding to the data stream packets, select the target data stream packets from the data stream packets corresponding to each terminal device and generate a global traffic set;
[0088] Each target data stream group includes at least one data stream to be allocated; the global traffic set includes: the correspondence between terminal devices and target data stream groups, the data streams to be allocated included in each target data stream group, and the corresponding link information; the link information includes the available links corresponding to the corresponding data stream group;
[0089] In some embodiments, before performing step S31 as described above, flow control information is obtained in advance through methods such as terminal device probing or packet probing by external SDN controllers, and this flow control information is then distributed to each terminal device. The flow control information includes data flow information for all data flows and link information for all available links that each data flow can traverse. The flow control information also includes a control identifier corresponding to each available link. The control identifier can be any actual factor controlling the corresponding available link, such as the port number of an IP packet, flow label (i.e., flow identifier), etc., and is not limited in this embodiment. This control identifier is used to configure the actual transmission link of the corresponding data flow to be allocated as an available link allocated to that data flow.
[0090] In some embodiments, each terminal device may include one or more GPUs, each of which can generate one or more data streams. These multiple data streams correspond to the same initiator (i.e., the terminal device sending the data stream) and the same receiver (i.e., the terminal device receiving the data stream). It should be noted that the same initiator and receiver means that the initiator of the multiple data streams is the same port of the same terminal device, and the receiver is also the same port of the same terminal device. For ease of explanation, a data stream generated by one GPU will be defined as belonging to a single data stream group.
[0091] It should be noted that since the data streams in each data stream group correspond to the same initiator and receiver, the data streams in each data stream group correspond to the same available link information, that is, the link information corresponding to the data stream group in the following text.
[0092] In some embodiments, the link information further includes: indication information for indicating whether the available links corresponding to the corresponding data flow group pass through the core switch; at this time, when selecting the target data flow group from the data flow groups corresponding to each terminal device based on the link information corresponding to the data flow group, firstly, for each data flow group, based on the indication information corresponding to the data flow group, if it is determined that all available links corresponding to the current data flow group pass through the core switch, the current data flow group is determined as the target data flow group.
[0093] Since some data streams do not need to pass through the core switch, for example, two terminal devices (nodes) connected to the same access switch can directly transmit data streams through the access switch, or the same terminal device can directly transmit data streams within the device; for such data streams, there is no need to allocate links based on the above method. It is only necessary to forward them within the node or on the access switch based on existing rules. Therefore, in this embodiment of the application, before allocating links, the target data stream packets (including data streams that need to pass through the core switch) are first filtered based on the link information corresponding to the data stream packets, so as to avoid allocating links for data streams that do not pass through the core switch, thereby wasting bandwidth.
[0094] After determining the target data stream packets, a global traffic set is generated based on the target data stream packets corresponding to each terminal device (i.e., the correspondence), the information of the data streams to be allocated included in each target data stream packet, and the link information of the available links corresponding to each target data stream packet. In some embodiments, this set may exist in the form of a table.
[0095] In some embodiments, since the traffic of data streams of different traffic types differs, in order to avoid assigning the same allocation weight to data streams of different traffic types, which would lead to different traffic sizes on different links and reduce bandwidth utilization, in this embodiment, after determining the target data stream group, the terminal device divides the data streams to be allocated within each target data stream group based on their corresponding traffic type. For example, when the traffic type includes two categories, large traffic and small traffic, the data streams to be allocated within each target data stream group can be divided into large traffic data streams and small traffic data streams based on the underlying principle of the collection communication library. In subsequent link allocation, the data streams to be allocated of different traffic types are allocated links separately without interfering with each other.
[0096] The following is an example of a possible global traffic table, as shown in Table 1. In this example, the global traffic table records the number of data flows to be detected for each traffic type between the sender and receiver, i.e., the number of large and small traffic flows in the table, as well as the corresponding flow control information. This global traffic table removes data flows that do not pass through the core switch, avoids allocating useless links, and distinguishes between large and small traffic flows, which can further improve congestion prevention.
[0097] It should be noted that each row in this table corresponds to a target data stream group, and the terminal device corresponding to each row is the initiator. Taking the first row as an example, the corresponding terminal device is terminal device Server1. Here, A1 and A2 are the port numbers of the terminal device, and n is a positive integer.
[0098] Table 1 Global Traffic Table
[0099]
[0100]
[0101] It should be noted that the above global flow table is only one possible example, and the global flow table in the embodiments of this application includes, but is not limited to, the above format.
[0102] Step S32: For each target data stream group corresponding to the current terminal device, determine the first information of the data stream to be allocated for the associated target data stream group based on the global traffic set;
[0103] In some embodiments, the associated target data stream group described above can be set based on requirements, for example, it can be set as: the target data stream group in the global traffic set that is arranged before the current target data stream group.
[0104] Step S33: For each data stream to be allocated, based on the first information and the second information of the reference data stream, determine the available links corresponding to the current data stream to be allocated from the available links corresponding to the corresponding target data stream group;
[0105] The reference data stream refers to the data stream in the corresponding target data stream group that has completed link allocation.
[0106] In some embodiments, if the data streams to be allocated are grouped based on the traffic type of the data stream in step 31 above, i.e., the traffic type corresponding to each data stream to be allocated is recorded in the global traffic set; then the first information above includes: the first number of data streams to be detected corresponding to each traffic type in the data streams to be allocated arranged before the current target data stream group (i.e. in the associated target data stream group), and the second information above includes: the second number of data streams to be detected corresponding to each traffic type in the reference data stream.
[0107] At this point, in the specific implementation of the above steps S32-S33, it is necessary to perform link allocation for each traffic type of data stream to be allocated. That is, for each traffic type, based on the global traffic set, determine the first number of data streams to be allocated corresponding to that traffic type in the associated target data stream group; and for each data stream to be allocated, based on the first number and the second number corresponding to the corresponding traffic type, determine the available links corresponding to the current data stream to be allocated from the available links corresponding to the corresponding target data stream group.
[0108] In this embodiment, based on the number of GPUs (i.e., target data stream packets) corresponding to each terminal device, a certain sequence number is assigned to each terminal device, wherein each GPU corresponds to one sequence number (i.e., the first sequence number). Taking the current terminal device as an example, if the current terminal device uses 5 GPUs, then the number of first sequence numbers corresponding to the terminal device is 5.
[0109] In some embodiments, the value of the first sequence number is sequentially increased according to the arrangement order of the terminal devices. For example, if the terminal devices are Server1 and Server2, where Server1 uses 4 GPUs and Server2 uses 3 GPUs, then the first sequence number corresponding to Server1 is 1-4 and the first sequence number corresponding to Server2 is 5-7.
[0110] Optionally, in a distributed environment, since each terminal device uses only one GPU, the terminal device's rank number can be used as the first sequence number.
[0111] Optionally, in AI scenarios, since each terminal device typically uses multiple GPUs, the rank number of the GPU used by the terminal device can be used as the first sequence number corresponding to that terminal device.
[0112] Optionally, for each terminal device, the first sequence number of each GPU in the terminal device is incremented based on the arrangement order of each GPU, and each GPU can be sorted in either order or reverse order based on the corresponding rank number.
[0113] At this point, when each target data stream group corresponds to a first sequence number, and the target data stream groups in the global traffic set are arranged in ascending order of the corresponding first sequence number, when determining the first number of data streams to be allocated corresponding to the traffic type in the associated target data stream group, the target data streams whose corresponding first sequence number is less than that of the current target data stream group can be determined from the global traffic set; the number of data streams to be allocated corresponding to the traffic type in each determined target data stream is counted, and the counted number is used as the first number.
[0114] It should be noted that the above is only an example. In the actual implementation, the first sequence number and the sorting of the target data stream groups in the global traffic set can be set according to the requirements. For example, the target data stream groups in the global traffic set can be arranged in descending order of the value of the corresponding first sequence number. In this case, when determining the first number of data streams to be allocated corresponding to the traffic type in the associated target data stream group, the target data streams with a first sequence number value greater than the current target data stream group can be determined from the global traffic set. The number of data streams to be allocated corresponding to the traffic type in each target data stream can be counted, and the counted number can be used as the first number.
[0115] In some embodiments, after determining the first quantity and the second quantity corresponding to each traffic type, link allocation is performed for the data streams to be allocated in each target data stream group of the current terminal device in the following manner: For each data stream to be allocated, the first quantity and the second quantity corresponding to the corresponding traffic type of the data stream to be allocated are summed and then incremented by 1. Based on the result of the increment, a modulo operation is performed on a third quantity (the third quantity is the number of available links corresponding to the corresponding target data stream group). The result of the modulo operation (remainder) is the target position of the available link corresponding to the current data stream to be allocated among the available links corresponding to the current target data stream group. In some embodiments, the target position is used to identify which link the available link is among the available links. Based on the target position, the available links corresponding to the current data stream to be allocated can be determined from the available links.
[0116] In specific implementation, each available link is assigned a second sequence number in this embodiment of the application, and the available links corresponding to the current target data stream group are arranged in the order of the second sequence number.
[0117] In the actual implementation, each available link passes through a core switch. However, for each target data flow packet, there may be multiple available links that pass through different ports of the same core switch. If the available links are randomly ordered, it may lead to problems such as uneven load distribution among the switches after allocation. For example, suppose there are available links 1, 2, and 3. Core switch Spine1 includes ports 1, 3, 5, and 7, and core switch Spine2 includes ports 2, 4, 6, and 8. Link 1 passes through port 1 of Spine1, link 2 passes through port 2 of Spine2, and link 3 passes through port 3 of Spine1. If there are only two data flows to be allocated, and the order of links 1-3 is link 1, 3, and 2, then according to the above allocation strategy, the two data flows to be allocated will be assigned to links 1 and 3 respectively. Therefore, there will be an uneven load distribution between Spine1 and Spine2.
[0118] To address the aforementioned issues, this embodiment sets the second sequence number of each available link to increase alternately across different core switches, thereby ensuring load balancing among core switches during subsequent link allocation.
[0119] For ease of understanding, this section uses... Figure 4 Taking this as an example, let's explain the link numbering process described above. Assume that the core switch Spine1 has four ports: 1, 3, 5, and 7. Ports 1 and 3 are connected to two ports of access switch Leaf1, and port 5 is connected to a port of access switch Leaf2. Spine2 has four ports: 2, 4, 6, and 8. Ports 2 and 4 are connected to two ports of access switch Leaf1, and port 6 is connected to a port of access switch Leaf2. Terminal devices Server1 and Leaf1 are connected, and Server2 and Leaf2 are connected. In this case, when there is a target data stream packet with Server1 as the sender and Server2 as the receiver, there are four available links: one through port 1 of Spine1, one through port 3 of Spine1, one through port 2 of Spine2, and one through port 4 of Spine2. When numbering the above four available links, the principle of alternating increments between different core switches is followed, that is, the first link in Spine1 (corresponding to port 1) is numbered X, the first link in Spine2 (corresponding to port 2) is numbered X+1, the second link in Spine1 (corresponding to port 3) is numbered X+2, and the second link in Spine2 (corresponding to port 4) is numbered X+3; X can be set according to requirements.
[0120] The method described above allocates links at the data stream level, which is relatively low-granularity. Furthermore, it allocates links from a global perspective, resulting in a more balanced load on the communication network. This effectively improves network congestion issues in aggregated communication libraries, thereby enhancing the efficiency of training large models. Additionally, this method is easy to deploy and has strong applicability.
[0121] The following combination Figure 5 and 6 The specific example shown illustrates the link allocation process described above in detail.
[0122] In this example, assume the global flow table includes terminal devices Server1 and Server2. Server1 has a server sequence number of 1, corresponding to target data flow group 1 (receiver is Server2). This group includes three data flows of high traffic type to be allocated: flow 1, flow 2, and flow 3. Target data flow group 1 has two available links: Server1-Leaf1-Spine1-Leaf2-Server2 via Spine1, and Server1-Leaf1-Spine2-Leaf2-Server2 via Spine2. Server2 has a server sequence number of 2, also corresponding to target data flow group 2 (receiver is Server3). This group includes three data flows of high traffic type to be allocated: flow 4, flow 5, and flow 6. Target data flow group 2 has two available links: Server1-Leaf1-Spine1-Leaf2-Server2 via Spine1, and Server1-Leaf1-Spine2-Leaf2-Server2 via Spine2.
[0123] In the specific implementation, Server1 allocates links to flows 1 through 3 within group 1. First, it allocates links to flow 1. Since there are no large-volume data flows to be allocated before the current target data flow group 2 in the global traffic set (i.e., the first quantity is 0), and there are no data flows to be allocated that have already had their links allocated within the target data flow group 1 (i.e., the second quantity is also 0), it can be determined through calculation that the corresponding link is the link corresponding to the first core switch, Spine1, i.e., link 1 shown in the figure. Following the sequential cyclic allocation strategy, flow 2 is allocated to the second core switch, Spine2, i.e., link 2 shown in the figure; since there are only two core switches, flow 3 is allocated to the first core switch, Spine1, i.e., link 3 shown in the figure.
[0124] Simultaneously, Server2 synchronously allocates links to flows 4-6 included in group 2. First, link allocation is performed on flow 4. Since the number of large-volume data flows to be allocated before the current target data flow group 2 in the global traffic set is 3 (3 flows in target data flow group 1), i.e., the first quantity is 3, and there are no data flows to be allocated that have already completed link allocation in target data flow group 2, i.e., the second quantity is also 0, it can be determined through calculation that it is allocated to the link corresponding to the second core switch Spine2, i.e., link 4 shown in the figure. Similarly, flow 5 is allocated to the link corresponding to the first core switch Spine1, i.e., link 5 shown in the figure; flow 6 is allocated to the link corresponding to the second core switch Spine2, i.e., link 6 shown in the figure.
[0125] In some embodiments, after determining the available link corresponding to the current data stream to be allocated, it is also necessary to assign the control identifier corresponding to the available link to the current data stream to be allocated, so as to configure the actual transmission link of the current data stream to be allocated as the corresponding available link, that is, to complete the actual link switching.
[0126] In practice, by assigning the control identifier corresponding to the available link to the current data stream to be allocated, the address information in the packets of the data stream to be allocated can be modified, thereby completing the actual link switching. In some embodiments, a specific packet field can be used as the control identifier. When the access switch Leaf uses the ECMP (Equal-cost multipath routing) mechanism to determine the path selection, the specific packet field will affect the ECMP result of the access switch Leaf, and thus affect the selection of subsequent paths. Therefore, different values of the specific packet field will be mapped to the final actual link selection. After assigning the specific value to the packet on a certain data stream, the actual link switching can be completed.
[0127] like Figure 7 The diagram shown is a structural schematic of the link allocation device provided in this application embodiment, applied to any terminal device in a communication network. The communication network includes multiple terminal devices and multiple network devices, including access switches and core switches. Each terminal device accesses the communication network through a connected access switch and transmits data streams based on the corresponding link, including:
[0128] The set generation unit 701 is used to filter target data stream groups from the data stream groups corresponding to each terminal device based on the link information corresponding to the data stream groups, and generate a global traffic set; each target data stream group includes at least one data stream to be allocated; the global traffic set includes: the correspondence between terminal devices and target data stream groups, the data streams to be allocated included in each target data stream group, and the corresponding link information; the link information includes the available links corresponding to the corresponding data stream groups;
[0129] The determining unit 702 is used to determine the first information of the data stream to be allocated for each target data stream group corresponding to the current terminal device, based on the above-mentioned global traffic set;
[0130] The allocation unit 703 is used to determine, for each data stream to be allocated, the available links corresponding to the current data stream from the available links corresponding to the corresponding target data stream group based on the first information mentioned above and the second information of the reference data stream; the reference data stream is: the data stream in the corresponding target data stream group that has completed link allocation.
[0131] Optionally, the above link information also includes: indication information for indicating whether the available link corresponding to the corresponding data flow packet passes through the core switch;
[0132] The aforementioned set generation unit 701 is specifically used for
[0133] For each data flow packet, based on the indication information corresponding to the data flow packet, if it is determined that all available links corresponding to the current data flow packet pass through the core switch, the current data flow packet is identified as the target data flow packet.
[0134] Optionally, the aforementioned associated target data stream group is: the target data stream group arranged before the current target data stream group in the global traffic set; the aforementioned global traffic set also includes the traffic type corresponding to each data stream to be allocated; the aforementioned first information includes: the first number of data streams to be detected corresponding to each traffic type in the data streams to be allocated arranged before the current target data stream group; the aforementioned second information includes: the second number of data streams to be detected corresponding to each traffic type in the aforementioned reference data stream.
[0135] Unit 702 is then determined to be used specifically for:
[0136] For each traffic type, based on the aforementioned global traffic set, determine the first number of data streams to be allocated corresponding to the aforementioned traffic type in the associated target data stream group;
[0137] Allocation unit 703 is specifically used for:
[0138] For each data stream to be allocated, based on the first quantity and the second quantity corresponding to the corresponding traffic type, the available links corresponding to the current data stream to be allocated are determined from the available links corresponding to the corresponding target data stream group.
[0139] Optionally, each target data stream group corresponds to a first sequence number, and the target data stream groups in the global traffic set are arranged in ascending order according to the value of their corresponding first sequence numbers; the determining unit 702 is specifically used for:
[0140] From the above global traffic set, determine the target data stream whose first sequence number is less than the current target data stream group; count the number of data streams to be allocated corresponding to the above traffic type in each determined target data stream, and use the counted number as the above first quantity.
[0141] Optionally, the available links corresponding to the current target data stream packets are arranged in order, and the allocation unit 703 is specifically used for:
[0142] The first and second quantities are summed and then 1 is added. Based on the result of adding 1, a modulo operation is performed on the third quantity, and the result of the modulo operation is determined as the target position of the available link corresponding to the current data stream to be allocated among the above available links. The third quantity is: the number of available links corresponding to the corresponding target data stream group. Based on the target position, the available link corresponding to the current data stream to be allocated is determined from the above available links.
[0143] Optionally, each available link corresponds to a second sequence number, and each available link includes a core switch. The available links corresponding to the current target data flow packets are arranged in order of the second sequence number. The second sequence numbers of the available links are alternately incremented among different core switches.
[0144] Optionally, each available link corresponds to a control identifier; after determining the available link corresponding to the current data stream to be allocated, the allocation unit 703 is also used for:
[0145] Assign the control identifier corresponding to the above available link to the current data stream to be allocated, so as to configure the actual transmission link of the current data stream to be allocated as the corresponding available link.
[0146] Based on the same technical concept, this application also provides an electronic device 800, referring to... Figure 8 As shown, the electronic device 800 is used to implement the link allocation method described in the above-described method embodiments. The electronic device 800 in this embodiment may include: a memory 801, a processor 802, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the steps in the various link allocation method embodiments described above.
[0147] This application embodiment does not limit the specific connection medium between the memory 801 and the processor 802. This application embodiment... Figure 8 The memory 801 and the processor 802 are connected via a bus 803, and the bus 803 is in Figure 8 The connections between other components are indicated by thick lines and are for illustrative purposes only, not as limiting information. The aforementioned bus 803 can be divided into address bus, data bus, control bus, etc. For ease of illustration, Figure 8 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.
[0148] Memory 801 may be volatile memory, such as random-access memory (RAM); memory 801 may also be non-volatile memory, such as read-only memory, flash memory, hard disk drive (HDD), or solid-state drive (SSD); or memory 801 may be any other medium capable of carrying or storing desired program code in the form of instructions or data structures and accessible by a computer, but is not limited thereto. Memory 801 may be a combination of the above-described memories.
[0149] Processor 802 is used to implement the link allocation method of various exemplary embodiments of this application.
[0150] This application also provides a computer-readable storage medium storing computer-executable instructions required to execute the processor, including a program required to execute the processor.
[0151] In some possible implementations, various aspects of the link allocation method provided in this application can also be implemented as a program product, which includes program code. When the program product is run on an electronic device, the program code is used to cause the electronic device to perform the steps in the link allocation method according to the various exemplary embodiments of this application described above.
[0152] Those skilled in the art will understand that embodiments of this application can be provided as methods, apparatus, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0153] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (devices), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0154] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0155] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0156] Although preferred embodiments of this application have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of this application.
[0157] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Therefore, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application also intends to include such modifications and variations.
Claims
1. A link allocation method, characterized in that, The method is applicable to any terminal device in a communication network, wherein the communication network includes multiple terminal devices and multiple network devices, the network devices including access switches and core switches, each terminal device accesses the communication network through a connected access switch, and transmits data streams based on a corresponding link. Based on the link information corresponding to the data stream groups, target data stream groups are selected from the data stream groups corresponding to each terminal device, and a global traffic set is generated; each target data stream group includes at least one data stream to be allocated; the global traffic set includes: the correspondence between terminal devices and target data stream groups, the data streams to be allocated included in each target data stream group, and the corresponding link information; the link information includes the available links corresponding to the corresponding data stream group; For each target data stream group corresponding to the current terminal device, based on the global traffic set, determine the first information of the data stream to be allocated for the associated target data stream group; For each data stream to be allocated, based on the first information and the second information of the reference data stream, the available links corresponding to the current data stream to be allocated are determined from the available links corresponding to the corresponding target data stream group; the reference data stream is: the data stream in the corresponding target data stream group that has completed link allocation.
2. The method as described in claim 1, characterized in that, The link information also includes: indication information for indicating whether the available link corresponding to the corresponding data flow packet passes through the core switch; The step of filtering target data stream packets from the data stream packets corresponding to each terminal device based on the link information corresponding to the data stream packets includes: For each data flow packet, based on the indication information corresponding to the data flow packet, if it is determined that all available links corresponding to the current data flow packet pass through the core switch, the current data flow packet is identified as the target data flow packet.
3. The method as described in claim 1, characterized in that, The associated target data stream group is: the target data stream group arranged before the current target data stream group in the global traffic set; the global traffic set also includes the traffic type corresponding to each data stream to be allocated; the first information includes: the first number of data streams to be detected corresponding to each traffic type in the data streams to be allocated arranged before the current target data stream group; the second information includes: the second number of data streams to be detected corresponding to each traffic type in the reference data stream. Based on the global traffic set, the first information of the data stream to be allocated for the associated target data stream group is determined, including: For each traffic type, based on the global traffic set, determine the first number of data streams to be allocated corresponding to the traffic type in the associated target data stream group; For each data stream to be allocated, based on the first information and the second information of the reference data stream, determining the available links corresponding to the current data stream to be allocated from the available links corresponding to the corresponding target data stream group includes: For each data stream to be allocated, based on the first quantity and the second quantity corresponding to the corresponding traffic type, the available links corresponding to the current data stream to be allocated are determined from the available links corresponding to the corresponding target data stream group.
4. The method as described in claim 3, characterized in that, Each target data stream group corresponds to a first sequence number. In the global traffic set, each target data stream group is arranged in ascending order according to the value of its corresponding first sequence number. The step of determining the first number of data streams to be allocated corresponding to the traffic type in the associated target data stream group based on the global traffic set includes: From the global traffic set, determine the target data stream whose first sequence number is less than the current target data stream group; The number of data streams to be allocated corresponding to the traffic type in each of the determined target data streams is counted, and the counted number is used as the first number.
5. The method as described in claim 3, characterized in that, The available links corresponding to the current target data stream group are arranged in order. The step of determining the available links corresponding to the current data stream to be allocated from the available links corresponding to the corresponding target data stream group based on the first and second quantities corresponding to the corresponding traffic type includes: The first and second quantities are summed and then 1 is added. Based on the result after adding 1, a modulo operation is performed on the third quantity, and the result of the modulo operation is determined as the target position of the available link corresponding to the current data stream to be allocated in each available link. The third quantity is: the number of available links corresponding to the corresponding target data stream group. Based on the target location, the available links corresponding to the data stream to be allocated are determined from the available links.
6. The method as described in claim 5, characterized in that, Each available link corresponds to a second sequence number, and each available link includes a core switch. The available links corresponding to the current target data flow packet are arranged in order of the second sequence number. The second sequence number of each available link is alternately incremented among different core switches.
7. The method according to any one of claims 1 to 6, characterized in that, Each available link corresponds to a control identifier; After determining the available link corresponding to the current data stream to be allocated, the process further includes: Assign the control identifier corresponding to the available link to the current data stream to be allocated, so as to configure the actual transmission link of the current data stream to be allocated as the corresponding available link.
8. A link allocation device, characterized in that, This method applies to any terminal device in a communication network, which includes multiple terminal devices and multiple network devices. The network devices include access switches and core switches. Each terminal device accesses the communication network through a connected access switch and transmits data streams based on a corresponding link, including: A traffic set generation unit is used to filter target data stream groups from the data stream groups corresponding to each terminal device based on the link information corresponding to the data stream groups, and generate a global traffic set; each target data stream group includes at least one data stream to be allocated; the global traffic set includes: the correspondence between terminal devices and target data stream groups, the data streams to be allocated included in each target data stream group, and the corresponding link information; the link information includes available links corresponding to the corresponding data stream group; The determining unit is used to determine, based on the global traffic set, the first information of the data stream to be allocated for each target data stream group corresponding to the current terminal device; The allocation unit is used to determine, for each data stream to be allocated, the available links corresponding to the current data stream from the available links corresponding to the corresponding target data stream group, based on the first information and the second information of the reference data stream; the reference data stream is: the data stream in the corresponding target data stream group that has completed link allocation.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 7.
10. A computer-readable storage medium having computer program instructions stored thereon, characterized in that, When executed by a processor, the computer program instructions implement the steps of the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Data center congestion control method and device based on software defined network (SDN)
CN108833293A
Faulty distributed system component identification
CN112585926A