A communication method and related device
By calculating the phase deflection value and adjusting the network interface card communication objects in Mesh networking, and by using specific algorithms and operators, the problem of communication performance degradation in Mesh networking is solved, achieving more efficient communication performance and bandwidth utilization.
Patent Information
- Application Number
- CN202310957997.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-31
- Publication Date
- 2025-11-07
- Estimated Expiration
- 2043-07-31
AI Technical Summary
In Mesh networking scenarios, the performance of symmetric set communication deteriorates significantly, leading to increased communication time. Especially in ultra-large-scale networks, existing technologies struggle to effectively address the link congestion problem between nodes.
By calculating the phase deflection value of the communication plane, the communication target of the network card is redefined, so that the traffic of different communication planes produces phase differences. The Having-Doubling or Pairwise algorithm is used for communication, and the Reduce-Scatter and All-Gather operators are used for aggregated communication to balance the overall network traffic and reduce the link bandwidth load.
It reduces the probability of link congestion between nodes, improves communication performance, reduces communication latency, increases the overall network bandwidth utilization, and reduces networking costs.
Smart Images

Figure CN119450447B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of communication, and in particular to a communication method and related equipment. BACKGROUND
[0002] In the AI scenario, the amount of calculation is increasing, and the demand for the networking scale of the computing cluster is also increasing. The mainstream computing networking form in the market is Fat-tree topology, but when Fat-tree is applied to a super-large-scale networking scheme, the number of layers of Fat-tree increases, that is, a large number of switches for core layer communication are needed, resulting in high networking cost. In the super-large-scale networking scenario, the scalability and networking cost of Mesh-type networking are much better than those of Fat-tree, so Mesh-type networking is an effective alternative solution.
[0003] Mesh-type networking is a networking topology similar to a mesh, including Full Mesh networking and Dragonfly networking, etc. It is found in practical applications that in the case of multi-network card parallel communication, the symmetric collection communication in Mesh-type networking has longer communication time than in Fat-tree topology. For example, in a Dragonfly networking of 8 servers and 64 network cards (8 network cards per server), compared with an actual test of a Fat-tree topology of the same scale, it is found that the communication time of the All-Reduce operator in the symmetric collection communication increases by more than 50%, and the communication time of the All-to-all operator increases by more than 1 times.
[0004] Therefore, it can be seen that the performance of symmetric collection communication in the Mesh-type networking scenario deteriorates seriously, and an improvement and innovation solution is urgently needed. SUMMARY
[0005] The present application provides a communication method and related equipment, which can reduce the probability of link congestion between nodes and improve communication performance.
[0006] The first aspect of the application provides a communication method, which can be applied to a communication device. The method comprises the following steps: obtaining a first serial number, the first serial number being a serial number of a first network card on a target server, the target server comprising N network cards, each of the N network cards corresponding to a communication plane, wherein the first network card corresponds to a target communication plane, the target communication plane comprising M network cards, the M network cards belonging to different servers respectively, the serial numbers of the M network cards on the respective servers being the same as the first serial number, the M network cards communicating with each other through a target communication algorithm, the target communication algorithm comprising a plurality of algorithm steps; obtaining a second serial number, the second serial number being a serial number of the first network card on the target communication plane; calculating a phase deflection value of the target communication plane based on the first serial number, the number of network cards included in the target server and the number of network cards included in the target communication plane; calculating a first communication partner serial number based on the second serial number, the first communication partner serial number being a serial number of a communication object of the first network card at a Kth algorithm step on the target communication plane, the first communication partner serial number corresponding to a second network card; combining the first communication partner serial number and the phase deflection value to obtain a second communication partner serial number, the second communication partner serial number being a serial number of a third network card on the target communication plane; and replacing the communication object of the first network card at the Kth algorithm step by the second network card with the third network card.
[0007] The N network cards of the target server correspond to one communication plane respectively, so that the number of network cards included in the target server is equal to the number of communication planes, and the plurality of communication planes can communicate in parallel.
[0008] The first network card corresponds to the target communication plane, and the serial numbers of the network cards in the target communication plane on the respective servers are the same as the first serial number, the first serial number being the serial number of the target communication plane. The network cards in the same communication plane can communicate with each other, and the target communication algorithm used for communication has a plurality of types, and the number of algorithm steps included in different communication algorithms is different.
[0009] In the first aspect of the application, the phase deflection value of the communication plane is calculated according to the number of network cards in the communication plane, the number of total communication planes and the serial number of the communication plane, and then the communication object of the network card is recalculated according to the phase deflection value of the communication plane, so that the flow difference between different communication planes between two nodes is generated, thereby balancing the whole network flow, reducing the bandwidth load of a single link, improving the whole network bandwidth utilization, reducing the probability of congestion and improving the communication performance.
[0010] In a possible implementation manner of the first aspect, the target communication algorithm is a Having-Doubling algorithm, and the plurality of algorithm steps are log2M algorithm steps.
[0011] In this possible implementation manner, the target communication algorithm is limited to the Having-Doubling algorithm, thereby improving the practicability of the scheme.
[0012] In a possible implementation of the first aspect, before the step of obtaining the first sequence number, the method further includes: performing collective communication on the N NICs using a Reduce-Scatter operator.
[0013] When the target communication algorithm is the Having-Doubling algorithm, before performing the inter-node communication, the NICs in the target server need to be collectively communicated using a Reduce-Scatter operator. At the end of the communication process, the NICs in the target server need to be collectively communicated using an All-Gather operator.
[0014] In a possible implementation of the first aspect, the step of calculating the first communication partner sequence number based on the second sequence number includes: calculating based on the following formula: first communication partner sequence number = second sequence number ^ (1 << ((K + first sequence number) % log2M)), where ^ represents a bitwise XOR operation, << represents a left shift operation, and % represents a modulo operation.
[0015] When the target communication algorithm is the Having-Doubling algorithm, the total number of algorithm steps is log2M steps, and M is the number of NICs included in the target communication plane. Then, the first communication partner sequence number is calculated according to the first sequence number of the first NIC in the target server, the second sequence number in the target communication plane, the step number K of the algorithm, and the total number of algorithm steps.
[0016] In this possible implementation, the way of calculating the first communication partner sequence number is limited, which improves the practicability of the scheme.
[0017] In a possible implementation of the first aspect, the target communication algorithm is the Pairwise algorithm, and the plurality of algorithm steps are M-1 algorithm steps.
[0018] In this possible implementation, the target communication algorithm is limited to the Pairwise algorithm, which expands the application scenarios of the scheme and improves the practicability of the scheme.
[0019] In a possible implementation of the first aspect, before the step of obtaining the first sequence number, the method further includes: performing collective communication on the N NICs using an All-to-all operator.
[0020] When the target communication algorithm is the Pairwise algorithm, before performing the inter-node communication, the NICs in the target server need to be collectively communicated using an All-to-all operator.
[0021] In a possible implementation of the first aspect, the first communication partner sequence number comprises a third communication partner sequence number and a fourth communication partner sequence number, and the step of calculating the first communication partner sequence number based on the second sequence number comprises: calculating the third communication partner sequence number and the fourth communication partner sequence number based on the second sequence number; the third communication partner sequence number and the fourth communication partner sequence number are calculated based on the following formula: third communication partner sequence number = (second sequence number + M - K) % M, fourth communication partner sequence number = (second sequence number + K) % M, where % represents the remainder.
[0022] When the target communication algorithm is the Pairwise algorithm, the total number of algorithm steps is M-1 steps. The first network card has two communication objects in each algorithm step under the Pairwise algorithm, and therefore has two communication partner sequence numbers, which are the third communication partner sequence number and the fourth communication partner sequence number. The third communication partner sequence number and the fourth communication partner sequence number are calculated according to the second sequence number of the first network card in the target communication plane, the number of network cards included in the target communication plane, and the step number K of the algorithm.
[0023] In this possible implementation, the manner of calculating the first communication partner sequence number is limited, and the practicability of the scheme is improved.
[0024] The second aspect of the present application provides a communication device, comprising an obtaining unit, a calculating unit, a combining unit, and a replacing unit. The obtaining unit is configured to obtain a first sequence number, the first sequence number being a sequence number of a first network card in a target server, the target server comprising N network cards, each of the N network cards corresponding to a communication plane, wherein the first network card corresponds to a target communication plane, the target communication plane comprising M network cards, the M network cards belonging to different servers respectively, the sequence numbers of the M network cards in the respective servers being the same as the first sequence number, the M network cards communicating with each other through a target communication algorithm, the target communication algorithm comprising a plurality of algorithm steps; the obtaining unit is further configured to obtain a second sequence number, the second sequence number being a sequence number of the first network card in the target communication plane; the calculating unit is configured to calculate a phase deflection value of the target communication plane based on the first sequence number, the number of network cards included in the target server, and the number of network cards included in the target communication plane; the calculating unit is further configured to calculate a first communication partner sequence number based on the second sequence number, the first communication partner sequence number being a sequence number of a communication object of the first network card in the Kth algorithm step in the target communication plane, the first communication partner sequence number corresponding to a second network card; the combining unit is configured to combine the first communication partner sequence number and the phase deflection value to obtain a second communication partner sequence number, the second communication partner sequence number being a sequence number of a third network card in the target communication plane; and the replacing unit is configured to replace the communication object of the first network card in the Kth algorithm step from the second network card to the third network card.
[0025] In a possible implementation manner of the second aspect, the target communication algorithm is a Having-Doubling algorithm, and the multiple algorithm steps are log2M algorithm steps.
[0026] In a possible implementation manner of the second aspect, the communication device further includes a communication unit, configured to perform collective communication on the N network cards using a Reduce-Scatter operator; and the communication unit is further configured to perform collective communication on the N network cards using an All-Gather operator.
[0027] In a possible implementation manner of the second aspect, the calculation unit is specifically configured to calculate the first communication partner sequence number based on the following formula: first communication partner sequence number = second sequence number ^ (1 << ((K + first sequence number) % log2M)), where ^ represents a bitwise XOR operation, << represents a left shift operation, and % represents a modulo operation.
[0028] In a possible implementation manner of the second aspect, the target communication algorithm is a Pairwise algorithm, and the multiple algorithm steps are M-1 algorithm steps.
[0029] In a possible implementation manner of the second aspect, the communication unit is further configured to perform collective communication on the N network cards using an All-to-all operator.
[0030] In a possible implementation manner of the second aspect, the first communication partner sequence number includes a third communication partner sequence number and a fourth communication partner sequence number, and the calculation unit is specifically configured to calculate the third communication partner sequence number and the fourth communication partner sequence number based on the second sequence number; the third communication partner sequence number and the fourth communication partner sequence number are calculated based on the following formula: third communication partner sequence number = (second sequence number + M-K) % M, and fourth communication partner sequence number = (second sequence number + K) % M, where % represents a modulo operation.
[0031] The communication device provided in the second aspect of the present application is used to perform the method in the first aspect or any possible implementation manner of the first aspect.
[0032] The third aspect of the present application provides a communication device including a processor and a memory. The memory is used to store instructions, and the processor is used to acquire the instructions stored in the memory to perform the method in the first aspect or any possible implementation manner of the first aspect.
[0033] The fourth aspect of the present application provides a computer-readable storage medium including instructions, when the instructions run on a computer, causing the computer to perform the method in the first aspect or any possible implementation manner of the first aspect.
[0034] The fifth aspect of the present application provides a computer program product comprising instructions which, when the computer program product runs on a computer, enable the computer to perform the method described in the first aspect or any possible implementation manner of the first aspect.
[0035] The sixth aspect of the present application provides a chip system, comprising at least one processor and a communication interface, the communication interface and the at least one processor are interconnected through a line, and the at least one processor is configured to run a computer program or instructions to perform the method described in the first aspect or any possible implementation manner of the first aspect. BRIEF DESCRIPTION OF DRAWINGS
[0036] Figure 1a An architecture diagram of a communication system to which embodiments of the present application are applied;
[0037] Figure 1b Another architecture diagram of a communication system to which embodiments of the present application are applied;
[0038] Figure 2 An embodiment diagram of a communication method provided by the embodiments of the present application;
[0039] Figure 3 Another embodiment diagram of a communication method provided by the embodiments of the present application;
[0040] Figure 4a Another diagram of a communication traffic feature in the embodiments of the present application;
[0041] Figure 4b Another diagram of a communication traffic feature in the embodiments of the present application;
[0042] Figure 5 Another embodiment diagram of a communication method provided by the embodiments of the present application;
[0043] Figure 6a Another diagram of a communication traffic feature in the embodiments of the present application;
[0044] Figure 6b Another diagram of a communication traffic feature in the embodiments of the present application;
[0045] Figure 7 An architecture diagram of a communication device provided by the embodiments of the present application;
[0046] Figure 8 Another architecture diagram of a communication device provided by the embodiments of the present application. DETAILED DESCRIPTION
[0047] The embodiments of the present application will be described below in conjunction with the drawings, obviously, the described embodiments are only a part of the embodiments of the present application, not all the embodiments. Those skilled in the art can know that with the development of technology and the emergence of new scenarios, the technical solutions provided by the embodiments of the present application are also applicable to similar technical problems.
[0048] The terms "system" and "network" in the specification and claims of the present application and the above-mentioned drawings can be used interchangeably. Unless otherwise specified, the ordinal numbers "first", "second", etc. are used to distinguish a plurality of objects, and are not used to limit the order, time sequence, priority or importance of the plurality of objects. It should be understood that the terms used in this way can be interchanged under appropriate circumstances, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device including a series of steps or units does not have to be limited to those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to these processes, methods, products or devices.
[0049] In order to facilitate understanding, the related terms and concepts mainly involved in the embodiments of the present application are introduced first.
[0050] 1. Mesh class networking
[0051] Mesh class networking is a general term for networking topology similar to mesh networking. Mesh class networking includes Full Mesh networking and Dragonfly networking.
[0052] 2. Collective communication
[0053] Collective communication refers to a global communication operation in which all processes in a process group participate.
[0054] 3. Symmetric collective communication
[0055] Symmetric collective communication is a type of collective communication that contains the following features: for each process, its communication purpose and behavior are equivalent, and there is no concept of master and slave process. Typical symmetric collective communication includes All-Reduce, All-to-all, All-Gather and Reduce-Scatter, etc.
[0056] 4. In-phase superposition
[0057] Under the superposition of multiple same communication traffics, the time domain characteristics of the traffic with larger traffic will generate larger traffic due to the amplitude superposition at the same time, that is, the multiple same communication traffics generate in-phase superposition phenomenon.
[0058] 5. Phase deflection
[0059] By adding a deflection factor in the communication algorithm, the time domain characteristics of multiple communication traffics generated by the communication algorithm change in phase. That is, the order and interval of the communication traffic characteristics are consistent, but the starting points are different. If the time domain characteristics of the communication traffic are plotted with time as the horizontal axis and communication traffic as the vertical axis, each characteristic generates a phase difference similar to a waveform diagram. This phenomenon is called phase deflection of the time domain characteristics of multiple communication traffics.
[0060] Embodiments of the present application provide a communication method, which can reduce the probability of congestion of inter-node communication links and reduce communication latency. Embodiments of the present application also provide corresponding devices, computer-readable storage media, and computer program products, etc. The following are described respectively.
[0061] Please refer to Figure 1a and Figure 1b for the architecture schematic diagram of the communication system to which embodiments of the present application are applied.
[0062] The application scenarios of the present application are as follows:
[0063] Figure 1a and Figure 1b are both Mesh networking scenarios. Among them, Figure 1a is a communication system under a Full Mesh networking architecture, as shown in Figure 1a , the communication system includes four servers, A0, A1, A2 and A3, each server includes four network cards, and the network cards are numbered 0 to 3 in the server. Figure 1b is a communication system under a Dragonfly networking architecture, as shown in Figure 1b , the communication system includes eight servers, B0 to B7. Among them, B0 and B1 are connected with switch S0, B2 and B3 are connected with switch S1, B4 and B5 are connected with switch S2, and B6 and B7 are connected with switch S3. Each server includes four network cards, and the network cards are numbered 0 to 3 in the server.
[0064] A server is considered a node, and multiple network interface cards (NICs) within a server can communicate within that node via interconnect. For example, for server A0, the four NICs within A0 can communicate with each other. NICs with the same NIC number can communicate between servers, forming a communication plane. For example, for... Figure 1a In the communication system shown, network interface cards (NICs) 1 in A0, A1, A2, and A3 form a communication plane. NICs within the same communication plane can communicate with each other. For Full Mesh networking, NICs with the same NIC number communicate directly between nodes. In Dragonfly networking, NICs first communicate with the connected switch, and then the switch communicates with other NICs with the same NIC number. A server with multiple NICs can form multiple communication planes, for example... Figure 1a The communication system shown includes four network interface cards (NICs) per server, thus forming four communication planes. Multiple NICs on a single server can communicate in parallel, meaning that multiple communication planes can communicate in parallel.
[0065] Currently, when performing symmetric set communication, although multiple communication planes can communicate in parallel, the traffic of multiple network cards included in the same server has almost identical characteristics in the time domain. This causes the traffic of different communication planes between nodes to overlap in the same phase, resulting in peak traffic being concentrated on some links, which easily leads to network congestion, and consequently, higher communication time and poor communication performance.
[0066] In view of this, the embodiments of this application provide a communication method that can be applied to communication devices. By adding a process of constructing phase-deflection communication traffic, phase differences are generated in the traffic between nodes of different parallel communication planes, thereby balancing the overall network traffic, reducing the bandwidth load of local links, reducing network congestion, and thus reducing communication time, improving the overall network bandwidth utilization, and improving communication performance.
[0067] The communication method provided in this application is mainly applied to symmetric class set communication scenarios in Mesh-type networking.
[0068] Please refer to the following: Figure 2 This is a schematic diagram of one embodiment of the communication method provided in this application. Figure 2 As shown, this embodiment includes steps 201 to 206.
[0069] 201. Obtain the first serial number of the first network card.
[0070] The first network card is located in the target server. The communication device obtains the first serial number of the first network card by obtaining an environment variable or reading a network card configuration, and the first serial number is the serial number of the first network card in the target server. The target server includes N network cards, and the serial numbers of the N network cards in the target server are numbered in sequence from 0. For example, if the target server includes four network cards, the serial numbers of the four network cards in the target server are 0, 1, 2, and 3, respectively.
[0071] The target server can communicate with the remaining servers in the communication system. Specifically, the network cards with the same serial number in each server form a communication plane, and the network cards in the same communication plane can communicate with each other. One serial number in a server corresponds to one network card, so the network cards in one communication plane come from different servers. For example, if the communication system includes four servers, each server includes eight network cards, then the network cards with serial number 0 in each server form a communication plane, the network cards with serial number 1 form another communication plane, and so on. Multiple communication planes can communicate in parallel, and each communication plane includes four network cards. The network cards included in one communication plane have the same serial number in their respective servers, so the serial number of the network cards in the server is also the serial number of the communication plane in the many parallel communication planes.
[0072] That is, the N network cards included in the target server correspond to N communication planes, and each network card corresponds to one communication plane. Among them, the communication plane corresponding to the first network card is the target communication plane, the target communication plane includes M network cards, and the M network cards belong to different servers, that is, the communication system includes at least M servers, and the serial numbers of the M network cards in their respective servers are all the same as the first serial number, and the serial number of the target communication plane is also the first serial number. For example, if the serial number of the first network card in the target server is 2, then the serial numbers of the remaining network cards in the target communication plane in their respective servers are also 2, and the serial number of the target communication plane is also 2.
[0073] The M network cards in the target communication plane communicate through a target communication algorithm, which can be a Having-Doubling algorithm or a Pairwise algorithm, etc. The target communication algorithm includes multiple algorithm steps.
[0074] 202、Obtain the second serial number of the first network card.
[0075] The network cards in the communication plane are numbered in sequence from 0. For example, if the communication plane includes five network cards, the serial numbers of the five network cards in the target communication plane are 0, 1, 2, 3, and 4, respectively.
[0076] The target communication plane includes M network cards, and the M network cards have sequence numbers 0 to M in the target communication plane. The communication device obtains the second sequence number of the first network card by reading the network card configuration and the like, and the second sequence number is the sequence number of the first network card in the target communication plane.
[0077] 203. Calculate the phase deflection value of the target communication plane.
[0078] Since one network card corresponds to one communication plane, the communication device can obtain the number of communication planes according to the number of network cards included in the target server. The communication device obtains the sequence number of the target communication plane according to the first sequence number of the first network card.
[0079] The communication device takes the sequence number of the target communication plane as a deflection factor, and combines the number N of communication planes and the number M of network cards included in the target communication plane to calculate the phase deflection value θp of the target communication plane. Specifically, the communication device calculates the deflection value of the target communication plane according to the following formula:
[0080] θp = M / N * first sequence number
[0081] Wherein, θp is rounded, and less than 1 is taken as 1.
[0082] For example, the number of network cards included in the target communication plane is 4, the number of network cards included in the target server is also 4, and the first sequence number of the first network card is 2. Then the phase deflection value θp of the target communication plane is 4 / 4*2 = 2.
[0083] 204. Calculate the first communication partner sequence number, which is the sequence number of the communication object of the first network card in the target communication plane in the K algorithm step, and the first communication partner sequence number corresponds to the second network card.
[0084] The first network card communicates with the remaining network cards in the target communication plane through the target communication algorithm. The communication device calculates the communication object of the first network card at the K algorithm step according to the sequence number of the first network card in the target communication plane (i.e. the second sequence number). The K algorithm step is any step in the plurality of algorithm steps included in the target communication algorithm. Specifically, the communication device calculates the first communication partner sequence number according to the second sequence number, which is the sequence number of the communication object of the first network card in the target communication plane in the K algorithm step. The first communication partner sequence number corresponds to the second network card, which is the sequence number of the second network card in the target communication plane. In other words, the first network card will communicate with the second network card at the K algorithm step.
[0085] 205. Obtain the second communication partner sequence number according to the phase deflection value and the first communication partner sequence number, which is the sequence number of the third network card in the target communication plane.
[0086] The new communication partner of the first network interface card (NIC) in the Kth algorithm step is obtained by phase-shifting the first communication partner number. Specifically, the phase-shifted value of the target communication plane is combined with the first communication partner number to obtain the second communication partner number. The second communication partner number is the number of the new communication partner in the target communication plane of the first NIC in the Kth algorithm step. The second communication partner number corresponds to the third NIC and is the signal of the third NIC in the target communication plane.
[0087] 206. Replace the communication target of the first network card in the Kth algorithm step with the third network card instead of the second network card.
[0088] The communication device updates the communication object of the first network card to the third network card at the Kth algorithm step.
[0089] In this embodiment, the phase deflection value of the communication plane is first calculated based on the number of network cards in the communication plane, the total number of communication planes, and the sequence number of the communication plane. Then, the communication objects of the network cards are recalculated based on the phase deflection value of the communication plane, so that the traffic of different communication planes between two nodes produces a phase difference, thereby balancing the traffic of the entire network, reducing the bandwidth load of a single communication link, improving the bandwidth utilization of the entire network, reducing the probability of congestion, and improving communication performance.
[0090] Furthermore, this embodiment is applied to Mesh networking scenarios, which can reduce networking costs.
[0091] This application provides several target communication algorithms, such as the Having-Doubling algorithm or the Pairwise algorithm. Different target communication algorithms require different methods for calculating the first and second communication partner numbers, which will be explained below.
[0092] Please see Figure 3 This is a schematic diagram of another embodiment of the communication method provided in this application. Figure 3 In the illustrated embodiment, nodes communicate via the All-Reduce operator, using the Having-Doubling algorithm. Figure 3 The illustrated embodiment includes steps 301 to 309.
[0093] 301. Perform aggregated communication on N network cards within the target server.
[0094] Based on the node interconnection characteristics between network interface cards (NICs), the Reduce-Scatter operator is used to perform aggregated communication on N NICs.
[0095] 302. Obtain the first and second serial numbers of the first network card.
[0096] The communication device obtains the first sequence number of the first network card on the target server and the second sequence number of the first network card on the target communication plane by obtaining an environmental variable or reading a network card configuration.
[0097] 303. In the All-Reduce operator scenario, the Having-Doubling algorithm is used for collective communication of the network cards in the target communication plane.
[0098] The target communication plane includes M network cards, and the Having-Doubling algorithm generates log2M algorithm steps. For example, the target communication plane includes 4 network cards, and 2 algorithm steps are generated in the communication process.
[0099] 304. The phase deflection value of the target communication plane is calculated.
[0100] Step 304 in this embodiment is similar to step 203 in the embodiment shown in Figure 2 Step 203 in the embodiment shown in
[0101] 305. The communication object of the first network card at the Kth algorithm step is calculated.
[0102] The communication device calculates the communication object of the first network card at the Kth algorithm step based on the second sequence number of the first network card and the step number of the algorithm step. The sequence number of the communication object in the target communication plane is the first communication partner sequence number, and the first communication partner sequence number corresponds to the second network card.
[0103] Specifically, the communication object of the first network card at the Kth algorithm step is calculated based on the following formula:
[0104] First communication partner sequence number = second sequence number ^ (1 << ((K + first sequence number) % log2M))
[0105] Where ^ represents bitwise XOR operation, << represents left shift operation, and % represents modulo operation. Bitwise XOR operation and left shift operation are binary operations.
[0106] For example, the target communication plane includes 4 network cards, the first sequence number of the first network card is 2, the second sequence number is 3, and the first sequence number is the sequence number of the target communication plane. The total number of algorithm steps is log24 = 2, and K is the first algorithm step. Then (K + first sequence number) % log2M is (1 + 2) % 2 = 1, i.e. the number of bits to be left shifted is 1. The binary left shift of 1 by 1 is 10, which is equal to 2 in decimal. Therefore, the first communication partner sequence number is 3^2, the binary representation of 3 is 11, the binary representation of 2 is 10, and the binary number obtained by 3^2 is 01, which is equal to 1 in decimal. That is, the sequence number of the communication object of the first network card at the first algorithm step in the target communication plane is 1, and the sequence number 1 corresponds to the second network card.
[0107] 306、Calculate the second communication partner sequence number.
[0108] The communication device combines the phase deflection value of the target communication plane with the first communication partner sequence number to obtain the second communication partner sequence number, which is the sequence number of the new communication object of the first network card in the target communication plane at the Kth algorithm step.
[0109] Specifically, the new communication object of the first network card at the Kth algorithm step is calculated based on the following formula:
[0110] Second communication partner sequence number = (first communication partner sequence number + θp) % M
[0111] Wherein, θp is the phase deflection value of the target communication plane, M is the number of network cards in the target communication plane, and % is the remainder operation.
[0112] Taking the step 305 as an example, the target communication plane includes 4 network cards, the target server also includes 4 network cards, the first sequence number of the first network card is 2, the second sequence number is 3, and the first communication partner sequence number is calculated to be 1. The phase deflection value θp of the target communication plane is 4 / 4*2=2. Therefore, the second communication partner sequence number=(1+2)%4=3, that is, the sequence number of the new communication object of the first network card in the target communication plane at the Kth algorithm step is 3.
[0113] 307、Update the communication object of the first network card at the Kth algorithm step.
[0114] The communication device searches for the network card with the sequence number equal to the second communication partner sequence number in the target communication plane, determines that the third network card corresponds to the second communication partner sequence number, that is, the third network card is the new communication object of the first network card at the Kth algorithm step. The communication device replaces the communication object of the first network card at the Kth algorithm step from the second network card to the third network card, and communicates with the first network card and the third network card at the Kth algorithm step.
[0115] 308、Update the communication object of the N network cards in the target server at each algorithm step according to the method described in steps 305 to 307, and communicate with the N network cards and the updated communication object when executing the algorithm step.
[0116] 309、Perform collective communication on the N network cards in the target server.
[0117] After the N network cards have all executed the communication process of the entire algorithm step, the All-Gather operator is used to perform collective communication on the N network cards.
[0118] Figure 3 The theoretical communication flow characteristics before and after updating the communication object in the illustrated embodiment are shown in Figure 4a and Figure 4b .Figure 4a and Figure 4b The communication system includes 4 servers, each of which includes 4 network cards, and the Having-Doubling algorithm is used, which includes two algorithm steps, and the line segment represents the communication flow between the network cards.
[0119] Please refer to Figure 4a , Figure 4a The theoretical communication flow characteristics before replacing the communication object (before constructing the phase deflection process). As shown in Figure 4a , in the first algorithm step, the 4 network cards of server A are all in communication with the 4 network cards of server B, the 4 network cards of server C are all in communication with the 4 network cards of server D, the inter-node flow is concentrated in the communication links between server A and server B and the communication links between server C and server D, and the remaining links are idle. In the second algorithm step, the 4 network cards of server A are all in communication with the 4 network cards of server C, the 4 network cards of server B are all in communication with the 4 network cards of server D, the inter-node flow is concentrated in the communication links between server A and server C and the communication links between server B and server D, and the remaining links are idle. In this case, the flow is concentrated in part of the links, which is prone to congestion.
[0120] Please refer to Figure 4b , Figure 4b The theoretical communication flow characteristics after replacing the communication object (after constructing the phase deflection process). As shown in Figure 4b , after updating the communication object, the communication object of the server in the two algorithm steps becomes multiple, thereby increasing the number of links that can be used simultaneously, balancing the inter-node communication flow, reducing the congestion probability, and reducing the communication delay by 20% in the All-Reduce collective communication scenario.
[0121] In this embodiment, the process of using the Having-Doubling algorithm for inter-node communication in the All-Reduce collective communication scenario is described, which expands the application scenario of the scheme and improves the realizability of the scheme.
[0122] Please refer to Figure 5 , another embodiment of the communication method provided by the present application is shown. Figure 5 In the embodiment shown, the nodes communicate through the All-to-all operator, and the communication algorithm used is the Pairwise algorithm. Figure 5 The embodiment shown includes steps 501 to 508.
[0123] 501, performing collective communication on N network cards in a target server.
[0124] Based on the node interconnection characteristics between the network cards, the N network cards are first subjected to collective communication using an All-to-all operator.
[0125] 502. Obtain the first sequence number and the second sequence number of the first network card.
[0126] The step 502 in this embodiment is similar to the step 202 in the embodiment shown in Figure 3 The step 302 in this embodiment is similar to the step 202 in the embodiment shown in
[0127] 503. In the All-to-all operator scenario, the Pairwise algorithm is used to perform collective communication on the network cards in the target communication plane.
[0128] The target communication plane includes M network cards, and the Pairwise algorithm will generate M-1 algorithm steps. For example, if the target communication plane includes 4 network cards, then 4-1 = 3 algorithm steps will be generated in the communication process.
[0129] 504. Calculate the phase deflection value of the target communication plane.
[0130] The step 504 in this embodiment is similar to the step 203 in the embodiment shown in Figure 2 The step 203 in this embodiment is similar to the step 202 in the embodiment shown in
[0131] 505. Calculate the communication object of the first network card at the Kth algorithm step.
[0132] In each algorithm step of the Pairwise algorithm, the network card has two communication objects. The communication device calculates the communication object of the first network card at the Kth algorithm step based on the second sequence number of the first network card, and the sequence number of the communication object in the target communication plane is the first communication partner sequence number. The communication object has two, so the first communication partner sequence number includes the third communication partner sequence number and the fourth communication partner sequence number. The first communication partner sequence number corresponds to the second network card, and the first communication partner sequence number includes the third communication partner sequence number and the fourth communication partner sequence number, so the second network card also includes two network cards, which are the fourth network card and the fifth network card. Among them, the third communication partner sequence number corresponds to the fourth network card, and the fourth communication partner sequence number corresponds to the fifth network card.
[0133] Specifically, the communication object of the first network card at the Kth algorithm step is calculated based on the following formula:
[0134] Third communication partner sequence number = (second sequence number + M-K) % M
[0135] Fourth communication partner sequence number = (second sequence number + K) % M
[0136] Where % represents the modulo operation.
[0137] For example, the target communication plane includes four network cards, the first network card has a first sequence number of 2 and a second sequence number of 3, and the first sequence number is the sequence number of the target communication plane. The total number of algorithm steps is 4-1=3, K is the first algorithm step. The third communication partner sequence number is (3+4-1) % 4=2, and the fourth communication partner sequence number is (3+1) % 4=0. That is, the communication object of the first network card at the first algorithm step has a sequence number of 2 and 0 in the target communication plane, and the sequence number 2 corresponds to the fourth network card and the sequence number 3 corresponds to the fifth network card.
[0138] 506、Calculate the second communication partner sequence number.
[0139] The communication device combines the phase deflection value of the target communication plane with the first communication partner sequence number to obtain the second communication partner sequence number, which is the sequence number of the new communication object of the first network card in the target communication plane at the Kth algorithm step. The first communication partner sequence number includes two sequence numbers, so after adding the phase deflection value, the second communication partner sequence number also includes two sequence numbers, which are the fifth communication partner sequence number and the sixth communication partner sequence number. Among them, the fifth communication partner sequence number is obtained by combining the third communication partner sequence number with the phase deflection value, and the fifth communication partner sequence number corresponds to the sixth network card. The sixth communication partner sequence number is obtained by combining the fourth communication partner sequence number with the phase deflection value, and the sixth communication partner sequence number corresponds to the seventh network card.
[0140] Specifically, the new communication object of the first network card at the Kth algorithm step is calculated based on the following formula:
[0141] The fifth communication partner sequence number=(third communication partner sequence number+θp) % M
[0142] The sixth communication partner sequence number=(fourth communication partner sequence number+θp) % M
[0143] Where % represents the remainder operation.
[0144] For example, the target communication plane includes four network cards, the target server also includes four network cards, the first network card has a first sequence number of 2 and a second sequence number of 3, K is the first algorithm step, the third communication partner sequence number is calculated to be 2, and the fourth communication partner sequence number is 0. The phase deflection value of the target communication plane is θp=4 / 4*2=2. Therefore, the fifth communication partner sequence number=(3+2) % 4=1, and the sixth communication partner sequence number=(0+2) % 4=2. That is, the new communication object of the first network card at the Kth algorithm step has a sequence number of 1 and 2 in the target communication plane, and the sequence number 1 corresponds to the sixth network card and the sequence number 2 corresponds to the seventh network card.
[0145] It can be understood that the fourth network card and the seventh network card can be the same network card, and the fifth network card and the sixth network card can be the same network card. For example, the fourth network card and the seventh network card in the above example are the same network card. Alternatively, the fourth network card and the sixth network card can be the same network card, and the fifth network card and the seventh network card can be the same network card, for example, when the first serial number is 0, the phase deflection value is 0, and at this time the original communication object and the new communication object are the same network card.
[0146] 507. Updating the communication object of the first network card in the Kth algorithm step.
[0147] The communication device replaces the communication object of the first network card in the Kth algorithm step by the fourth network card with the sixth network card and the fifth network card with the seventh network card, and communicates with the sixth network card and the seventh network card in the Kth algorithm step.
[0148] 508. Updating the communication object of N network cards in each algorithm step in the target server according to the method described in steps 505 to 507, and communicating with the updated communication object of the N network cards in the execution of the algorithm step.
[0149] Figure 5 The theoretical communication flow characteristics before and after updating the communication object in the illustrated embodiment are shown in Figure 6a and Figure 6b . Figure 6a and Figure 6b In the communication system including 4 servers, each server including 4 network cards, as an example, using the Pairwise algorithm, which includes 3 algorithm steps, and the line segment represents the communication flow between the network cards.
[0150] Please refer to Figure 6a , Figure 6a for the theoretical communication flow characteristics before replacing the communication object (before constructing the phase deflection flow). As shown in Figure 6a , in the three algorithm steps, the communication flow is concentrated in part of the link, and some links are idle. In this case, congestion is easy to occur, affecting the communication performance.
[0151] Please refer to Figure 6b , Figure 6b for the theoretical communication flow characteristics after replacing the communication object (after constructing the phase deflection flow). As shown in Figure 6b , after updating the communication object, the communication flow between nodes is more balanced than before replacing the communication object, and the number of links that can be used at the same time increases, thereby reducing the probability of congestion and improving the communication performance. It is expected that in the All-to-all set communication scenario, the communication delay can be reduced by 20%.
[0152] The embodiment of the present application illustrates the flow of node-to-node communication using Pairwise algorithm in the all-to-all set communication scenario, expands the application scenario of the scheme, and improves the realizability of the scheme.
[0153] The above describes the embodiments of the present application from the perspective of method, and the following introduces the related devices in the embodiments of the present application from the perspective of specific device implementation.
[0154] Please refer to Figure 7 The embodiment of the present application provides a schematic diagram of a communication device 700, wherein the communication device 700 comprises an acquisition unit 701, a calculation unit 702, a combination unit 703, and a replacement unit 704.
[0155] The acquisition unit 701 is configured to acquire a first serial number, the first serial number being a serial number of a first network card in a target server, the target server comprising N network cards, each network card in the N network cards corresponding to a communication plane, wherein the first network card corresponds to a target communication plane, the target communication plane comprising M network cards, the M network cards belonging to different servers respectively, the serial numbers of the M network cards in the respective servers being the same as the first serial number, and the M network cards communicating through a target communication algorithm.
[0156] The acquisition unit 701 is further configured to acquire a second serial number, the second serial number being a serial number of the first network card in the target communication plane.
[0157] The calculation unit 702 is configured to calculate a phase deflection value of the target communication plane based on the first serial number, the number of network cards included in the target server, and the number of network cards included in the target communication plane.
[0158] The calculation unit 702 is further configured to calculate a first communication partner serial number based on the second serial number, the first communication partner serial number being a serial number of a communication object of the first network card in the target communication plane in a Kth algorithm step, and the first communication partner serial number corresponding to a second network card.
[0159] The combination unit 703 is configured to combine the first communication partner serial number and the phase deflection value to obtain a second communication partner serial number, the second communication partner serial number being a serial number of a third network card in the target communication plane.
[0160] The replacement unit 704 is configured to replace the communication object of the first network card in the Kth algorithm step by the third network card from the second network card.
[0161] Optionally, the target communication algorithm is a Having-Doubling algorithm, and the plurality of algorithm steps are log2M algorithm steps.
[0162] Optionally, the communication device 700 further comprises a communication unit 705, configured to perform collective communication on the N NICs using a Reduce-Scatter operator; and perform collective communication on the N NICs using an All-Gather operator.
[0163] Optionally, the calculation unit 702 is specifically configured to calculate the first communication partner sequence number based on the following formula: the first communication partner sequence number = the second sequence number ^ (1 << ((K + the first sequence number) % log 2 M)), wherein ^ represents a bitwise XOR operation, << represents a left shift operation, and % represents a modulo operation.
[0164] Optionally, the target communication algorithm is a Pairwise algorithm, and the plurality of algorithm steps are M-1 algorithm steps.
[0165] Optionally, the communication unit 705 is further configured to perform collective communication on the N NICs using an All-to-all operator.
[0166] Optionally, the first communication partner sequence number comprises a third communication partner sequence number and a fourth communication partner sequence number, and the calculation unit 702 is specifically configured to calculate the third communication partner sequence number and the fourth communication partner sequence number based on the second sequence number; the third communication partner sequence number and the fourth communication partner sequence number are calculated based on the following formula: the third communication partner sequence number = (the second sequence number + M-K) % M, and the fourth communication partner sequence number = (the second sequence number + K) % M, wherein % represents a modulo operation.
[0167] The units in the communication device 700 perform operations of the communication device in the embodiments described before Figure 2 , Figure 3 and Figure 5 . Details are not described herein again.
[0168] Please refer to Figure 8 , a possible structural schematic diagram of a communication device 800 provided by the embodiments of the present application, which comprises a processor 801, a communication interface 802, a memory 803, and a bus 804. The processor 801, the communication interface 802, and the memory 803 are connected with each other through the bus 804. In the embodiments of the present application, the processor 801 is configured to control and manage actions of the communication device, for example, the processor 801 is configured to perform steps performed by the communication device in the method embodiments shown in Figure 2 . The communication interface 802 is configured to support the communication device to communicate. The memory 803 is configured to store program codes and data of the communication device.
[0169] The processor 801 can be a central processing unit, a general purpose processor, a digital signal processor, an application specific integrated circuit, a field programmable gate array, or other programmable logic device, transistor logic, hardware component, or any combination thereof. It can implement or execute various example logical blocks, modules, and circuits described in connection with the disclosure. The processor can also be a combination of computing components, such as a combination of one or more microprocessors, a combination of a digital signal processor and a microprocessor, or the like. The bus 804 can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, or the like. The bus can be divided into an address bus, a data bus, a control bus, and the like. For ease of representation, Figure 8 Only one thick line is used to represent the bus in the figure, but it does not mean that there is only one bus or only one type of bus.
[0170] The embodiments of the present application also provide a computer readable storage medium, which includes instructions, when the instructions are run on a computer, cause the computer to execute the method in the embodiments shown in Figure 2 、 Figure 3 and Figure 5 .
[0171] The embodiments of the present application also provide a computer program product including instructions, when the computer program product is run on a computer, cause the computer to execute the method in the embodiments shown in Figure 2 、 Figure 3 and Figure 5 .
[0172] The embodiments of the present application also provide a chip system, which includes at least one processor and a communication interface, the communication interface and the at least one processor are interconnected through a line, the at least one processor is used to run a computer program or instructions, to execute the method in the embodiments shown in Figure 2 、 Figure 3 and Figure 5 .
[0173] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the system, device and unit described above can refer to the corresponding process in the foregoing method embodiments, which will not be described here.
[0174] In several embodiments provided in the present application, it should be understood that the disclosed system, device and method can be implemented in other manners. For example, the described device embodiments are merely schematic. The division of the units is merely a logical function division. There can be another division manner for the actual implementation, for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the displayed or discussed mutual couplings or direct couplings or communication connections between the units can be indirect couplings or communication connections through some interfaces, devices or units, and can be electrical, mechanical or in other forms.
[0175] The units described as separated components can or can not be physically separated, and the components displayed as units can or can not be physical units, i.e., can be located in one place, or can be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purposes of the embodiments of the present application.
[0176] In addition, each functional unit in the embodiments of the present application can be integrated in one processing unit, or each unit can exist physically as a separate unit, or two or more units can be integrated in one unit. The integrated unit can be implemented in the form of hardware, or in the form of a software functional unit.
[0177] When the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer readable storage medium. Based on such an understanding, the technical solutions of the present application essentially or substantially, or all or part of the technical solutions, can be embodied in the form of a software product. The computer software product is stored in a storage medium, and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the embodiments of the present application. The foregoing storage medium includes: U disk, mobile hard disk, read-only memory (ROM, read-only memory), random access memory (RAM, random access memory), magnetic disk or optical disk, and various other media that can store program codes.
Claims
1. A communication method characterized by comprising: The method comprises the following steps: obtaining a first serial number, the first serial number being a serial number of a first network card in a target server, the target server comprising N network cards, each of the N network cards corresponding to a communication plane, wherein the first network card corresponds to a target communication plane, the target communication plane comprising M network cards, the M network cards belonging to different servers respectively, the serial numbers of the M network cards in the respective servers being the same as the first serial number, the M network cards communicating with each other through a target communication algorithm, the target communication algorithm comprising a plurality of algorithm steps; obtaining a second serial number, the second serial number being a serial number of the first network card in the target communication plane; calculating a phase deflection value of the target communication plane based on the first serial number, the number of network cards included in the target server, and the number of network cards included in the target communication plane; calculating a first communication partner serial number based on the second serial number, the first communication partner serial number being a serial number of a communication object of the first network card in the target communication plane in a Kth algorithm step, the first communication partner serial number corresponding to a second network card; combining the first communication partner serial number and the phase deflection value to obtain a second communication partner serial number, the second communication partner serial number being a serial number of a third network card in the target communication plane; replacing the communication object of the first network card in the Kth algorithm step by the second network card with the third network card.
2. The method of claim 1, wherein, The target communication algorithm is a Having-Doubling algorithm, and the plurality of algorithm steps are log2M algorithm steps.
3. The method of claim 2, wherein, Before the step of obtaining the first serial number, the method further comprises: performing collective communication on the N network cards using a Reduce-Scatter operator. After the step of replacing the communication object of the first network card in the Kth algorithm step by the second network card with the third network card, the method further comprises: performing collective communication on the N network cards using an All-Gather operator.
4. The method according to claim 2 or 3, characterized in that, The step of calculating the first communication partner serial number based on the second serial number comprises: calculating based on the following formula: first communication partner serial number = second serial number ^ (1 << ((K + first serial number) % log2M)), wherein ^ represents a bitwise XOR operation, << represents a left shift operation, and % represents a modulo operation.
5. The method of claim 1, wherein, The target communication algorithm is a Pairwise algorithm, and the plurality of algorithm steps are M-1 algorithm steps.
6. The method of claim 5, wherein, Before the step of obtaining the first serial number, the method further comprises: performing collective communication on the N network cards using an All-to-all operator.
7. The method according to claim 5 or 6, characterized in that, The first communication partner serial number comprises a third communication partner serial number and a fourth communication partner serial number, and the step of calculating the first communication partner serial number based on the second serial number comprises: calculating the third communication partner serial number and the fourth communication partner serial number based on the second serial number; The third communication partner serial number and the fourth communication partner serial number are calculated based on the following formula: third communication partner serial number = (second serial number + M - K) % M, fourth communication partner serial number = (second serial number + K) % M, wherein % represents a modulo operation.
8. A communication device, characterized by The method comprises the following steps: The acquisition unit is configured to acquire a first serial number, the first serial number being a serial number of a first network card at a target server, the target server including N network cards, each of the N network cards corresponding to a communication plane, wherein the first network card corresponds to a target communication plane, the target communication plane including M network cards, the M network cards belonging to different servers respectively, the M network cards having the same serial number as the first serial number at the respective servers, the M network cards communicating with each other through a target communication algorithm, the target communication algorithm including a plurality of algorithm steps; The acquisition unit is further configured to acquire a second serial number, the second serial number being a serial number of the first network card at the target communication plane; The calculation unit is configured to calculate a phase deflection value of the target communication plane based on the first serial number, a number of network cards included in the target server, and a number of network cards included in the target communication plane; The calculation unit is further configured to calculate a first communication partner serial number based on the second serial number, the first communication partner serial number being a serial number of a communication object of the first network card at a Kth algorithm step at the target communication plane, the first communication partner serial number corresponding to a second network card; The combination unit is configured to combine the first communication partner serial number and the phase deflection value to obtain a second communication partner serial number, the second communication partner serial number being a serial number of a third network card at the target communication plane; The replacement unit is configured to replace the communication object of the first network card at the Kth algorithm step by the second network card with the third network card.
9. The communication device of claim 8, wherein, The target communication algorithm is a Having-Doubling algorithm, and the plurality of algorithm steps are log2M algorithm steps.
10. The communication device of claim 9, wherein, The communication device further includes: The communication unit is configured to perform collective communication on the N network cards using a Reduce-Scatter operator; The communication unit is further configured to: perform collective communication on the N network cards using an All-Gather operator.
11. The communication device according to claim 9 or 10, characterized by The calculation unit is specifically configured to: calculate the first communication partner serial number based on the following formula: First communication partner serial number = second serial number ^ (1 << ((K + first serial number) % log2M)), wherein ^ represents a bitwise XOR operation, << represents a left shift operation, and % represents a modulo operation.
12. The communication device of claim 8, wherein, The target communication algorithm is a Pairwise algorithm, and the plurality of algorithm steps are M-1 algorithm steps.
13. The communication device of claim 10, wherein, The communication unit is further configured to: perform collective communication on the N network cards using an All-to-all operator.
14. The communication device according to claim 12 or 13, characterized by The first communication partner serial number includes a third communication partner serial number and a fourth communication partner serial number, and the calculation unit is specifically configured to: calculate the third communication partner serial number and the fourth communication partner serial number based on the second serial number; The third communication partner serial number and the fourth communication partner serial number are calculated based on the following formula: Third communication partner serial number = (second serial number + M - K) % M, and fourth communication partner serial number = (second serial number + K) % M, wherein % represents a modulo operation.
15. A communication device, characterized by include: a processor and a memory; the memory is configured to store instructions; The processor is configured to execute instructions stored in the memory to implement the method of any one of claims 1 to 7.
16. A computer readable storage medium having stored thereon a computer program, characterized in that, The computer program, which causes one or more processors to implement the method of any one of claims 1 to 7.
17. A computer program product comprising instructions, characterized in that, The computer program product, when run on a computer, causes the computer to implement the method of any one of claims 1 to 7.
Citation Information
Patent Citations
Data transmission system and method and related equipment
CN114979000A
Communication partner selection method, and communication equipment
JP2009021820A