WO2021143911A1 - 通信方法及装置 - Google Patents
通信方法及装置 Download PDFInfo
- Publication number
- WO2021143911A1 WO2021143911A1 PCT/CN2021/072543 CN2021072543W WO2021143911A1 WO 2021143911 A1 WO2021143911 A1 WO 2021143911A1 CN 2021072543 W CN2021072543 W CN 2021072543W WO 2021143911 A1 WO2021143911 A1 WO 2021143911A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- message
- messages
- parameter data
- same
- index
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Ceased
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L69/00—Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
- H04L69/22—Parsing or analysis of headers
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/23—Clustering techniques
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/045—Combinations of networks
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/08—Learning methods
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/08—Learning methods
- G06N3/09—Supervised learning
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/08—Learning methods
- G06N3/098—Distributed learning, e.g. federated learning
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L49/00—Packet switching elements
- H04L49/90—Buffering arrangements
- H04L49/9057—Arrangements for supporting packet reassembly or resequencing
Definitions
- This application relates to the field of communication technology, and in particular to a communication method and device.
- a distributed deep neural network (deep neural network, DNN) training method is usually used to train the DNN model.
- DNN deep neural network
- p computing nodes respectively exchange DNN model parameters with the same parameter server through a communication network.
- p is a positive integer greater than 1.
- the amount of data that needs to be transmitted is twice that of the DNN model parameter; for the parameter server, In other words, the amount of data to be transmitted is 2p times the data amount of the DNN model parameters, and the amount of data is huge.
- the parameter server has a communication bottleneck problem.
- p computing nodes exchange DNN model parameters through a communication network. If p computing nodes complete a ring-all-reduce process, for each computing node in p computing nodes, the amount of data that needs to be transmitted is 2(p -1)/p times. When the number of computing nodes is huge, if p computing nodes complete a full ring protocol processing, for each computing node in p computing nodes, the amount of data that needs to be transmitted is close to twice the data volume of the DNN model parameters . In other words, the amount of data that the computing node needs to transmit is always greater than the data amount of the DNN model parameters. Compared with the data volume of the DNN model parameters, the communication network always transmits additional data volume, which is susceptible to the limitation of the network bandwidth of the communication network, and the communication delay is large.
- the embodiments of the present application provide a communication method and device, which can reduce communication delay and data redundancy in a communication network.
- an embodiment of the present application provides a communication method, which includes: receiving at least two messages, and then aggregating the at least two messages to obtain an aggregated message.
- the messages to which at least two packets belong respectively have the same message index, and the message index is used to index the messages to which the at least two packets belong respectively.
- the network device aggregates the received messages, thereby avoiding the network bandwidth limitation of the communication network, reducing the communication delay and the communication network. Data redundancy. Since the parameter data in the message identified by the same message index is the parameter data at the same position in the same DNN model, the network device can accurately identify the message to be aggregated and ensure the accuracy of the network device aggregation processing, thereby Improve the efficiency of DNN model training without affecting the network equipment's forwarding function of non-aggregated packets.
- At least two messages respectively have the same sequence number in messages with the same message index. Because the sequence number in the message can also indicate the position of the parameter data in the message in the DNN model.
- the network device determines the message to be aggregated according to the message index and sequence number, so as to ensure the accuracy of the aggregation processing of the network device.
- the first message is the first message of the message to which the first message belongs
- the first message further includes a first field
- the first field is used to indicate the message to which the first message belongs.
- the parameter data in performs aggregation processing.
- the first message is any one of at least two messages.
- the first message is the first message of the message to which the first message belongs
- the first message further includes a third field
- the third field is used to carry the message where the first message belongs.
- the first message is any one of at least two messages. In this way, the network device can determine the number of messages included in the message to which the first message belongs according to the third field.
- the first message further includes a sequence number
- the sequence number is used to indicate the transmission sequence of the first message in the connection for transmitting the first message.
- the communication method of the embodiment of the present application further includes: determining a connection for transmitting the first message. According to the sequence number in the first message and the number of messages indicated by the third field in the first message, the first interval range of the sequence number of the message included in the message to which the first message belongs is determined. The corresponding relationship between the first interval range and the connection for transmitting the first message is stored. The first end value of the first interval range is the serial number of the first packet, and the second end value of the first interval range is based on the serial number of the first packet and the third field in the first packet. A value determined by the number of messages.
- the network device can determine the connection for transmitting the message to be aggregated and the range of the sequence number of the message to be aggregated transmitted through the connection.
- the first message further includes a sequence number, and the sequence number is used to indicate the transmission sequence of the first message in the connection for transmitting the first message. If the first message is not the first message of the message to which the first message belongs, the communication method in this embodiment of the present application further includes: determining a connection for transmitting the first message. If the sequence number of the first message is within the range of the first interval corresponding to the connection through which the first message is transmitted, the message corresponding to the first interval range where the serial number of the first message is located is determined as the first message to which the message belongs News.
- the first message is any one of at least two messages. That is, for the non-first message of a message, the network device determines the message to which the first message belongs through the stored correspondence between the connection and the first range, and the sequence number of the first message .
- the communication method of the embodiment of the present application further includes: determining the first quantity value of the first message belonging to the message with the same message index and having the same sequence number among the messages with the same message index. If the first number value is less than the first preset value, waiting to receive the first message that belongs to the message with the same message index and has the same sequence number among the messages with the same message index. That is to say, when the network device determines that it belongs to a message with the same message index and the first message with the same sequence number among the messages with the same message index has not arrived, the network device continues to wait for the reception of messages with the same message index. The first message with the same sequence number among the messages with the same message index.
- the message indexes of the messages to which the first messages transmitted by different channels belong are the same, or The message indexes of the messages to which the first messages transmitted by different channels belong are different. That is to say, when multiple first messages are transmitted through different channels, the positions of the parameter data in the first messages transmitted by different channels in the DNN model are different.
- the message index of the message to which the first message belongs on different channels may be the same or different.
- the current network card when the current network card sends the first message, the current network card receives the message from the computing device.
- the preset field in the message from the computing device is carried in the first first message among the multiple first messages.
- the parameter data of different parts in the message from the computing device is carried in different first messages among the multiple first messages.
- the parameter data in the second message includes the second aggregation result of the parameter data of the xth part
- the second aggregation result of the parameter data of the xth part is the result of the xth part of the first local logical ring network topology.
- the first aggregation result of the parameter data and the first aggregation result of the x-th part of the parameter data in the other local logical ring network topology are aggregated.
- the number of computing devices used to train the DNN model in different local logical ring network topologies is the same.
- the parameter data in the first message sent by the network card is the first aggregation result of a certain part of the parameter data, so that the network devices can aggregate Parameter data of different local logical ring network topologies.
- the parameter data in the second message received by the network card is the second aggregation result of the corresponding part of the parameter data, so as to obtain the parameter data of different local logical ring network topologies.
- the first message is a message sent for the first time
- the first message belongs to any one of the N messages
- N is a positive integer greater than 1.
- the k-th message index is used for indexing
- the first message belongs to any one of the (N+k)th messages, and k is a positive integer.
- the current network card uses a sliding window mechanism to send messages to network devices.
- the parameter data of N messages can always be cached in the network device, which enables the network device to continuously perform aggregation operations and ensure the efficiency of aggregation operations.
- an embodiment of the present application provides a communication method.
- the method includes: an i-th computing device trains a DNN model to obtain n parts of parameter data.
- the i-th computing device sends the (x+i-j+1)-th part of the parameter data to the (i+1)-th computing device the aggregation processing result of the (j-1) iteration;
- the i-th computing device receives the (x+ij)th part of the parameter data from the (i-1)th computing device through the (j-1) iteration of the aggregation processing result, and compares it with its own (x+ij)th Part of the data aggregation, the parameter data of the (x+ij) part is obtained through j iterations of the aggregation processing result, so that in the (j+1)th iteration, the i-th computing device will transfer to the (i+1)th
- the computing device sends the (x+ij)th part of the parameter data through
- i, j and x are all positive integers, and 1 ⁇ i ⁇ n, 1 ⁇ x ⁇ n; the (i-1)th computing device, the ith computing device, and the (i+1)th computing device Are distributed in the first partial logical ring network topology; n computing devices in the first partial logical ring network topology are connected sequentially, and the first computing device of the n computing devices is connected to the last computing device of the n computing devices; if i-1 ⁇ 1, replace (i-1) with (i-1+n); if i+1>n, replace (i+1) with (i+1-n); if x+ij ⁇ 1, replace (x+ij) with (x+i-j+n); if x+i-j+1>n, replace (x+i-j+1-n) with (x+i- j+1); n is a positive integer, and n ⁇ 2.
- data is transmitted between different computing devices through a bus, and n computing devices form a first local logical ring network top
- an embodiment of the present application provides a communication method, the method includes: the i-th computing device receives a second aggregation result of the (x+i-j+1)-th part of the parameter data from the network card.
- the second aggregation result of the parameter data of the part (x+i-j+1) is the first aggregation result of the parameter data of the part (x+i-j+1) in the first local logical ring network topology and The first aggregation result of the parameter data of the (x+i-j+1) part in other local logical ring network topologies;
- the first aggregation result of the parameter data of the (x+i-j+1) part is It is obtained by aggregation of the parameter data of the (x+i-j+1)th part of the n computing devices in the first local logical ring network topology.
- the i-th computing device sends the second aggregation result of the parameter data of the (x+i-j+1)th part to the (i+1)th computing device; the i-th computing device receives from The second aggregation result of the parameter data of the (x+ij)th part of the (i-1)th computing device replaces the second aggregation result of the parameter data of the (x+ij)th part with its own (x+ij)th ) Part of the data, so that in the (j+1)th iteration, the i-th computing device sends the second aggregation result of the parameter data of the (x+ij)th part to the (i+1)th computing device until j traverses 1 to (n-1) to obtain the second aggregation result of the (x+i+1)th part.
- i, j and x are all positive integers, and 1 ⁇ i ⁇ n, 1 ⁇ x ⁇ n; the (i-1)th computing device, the ith computing device, and the (i+1)th computing device Are distributed in the first partial logical ring network topology; n computing devices in the first partial logical ring network topology are connected sequentially, and the first computing device of the n computing devices is connected to the last computing device of the n computing devices; if i-1 ⁇ 1, replace (i-1) with (i-1+n); if i+1>n, replace (i+1) with (i+1-n); if x+ij ⁇ 1, replace (x+ij) with (x+i-j+n); if x+i-j+1>n, replace (x+i-j+1-n) with (x+i- j+1); n is a positive integer, and n ⁇ 2.
- an embodiment of the present application provides a terminal device.
- the terminal device includes a network card and n computing devices.
- the network card is used to implement the communication method as described in the second aspect or any one of the second aspects.
- the n computing devices are connected in sequence, and the first computing device of the n computing devices is connected to the last computing device of the n computing devices to form a local logical ring network topology.
- the second computing device of any adjacent three computing devices among the n computing devices is used to execute the communication method according to the third aspect or the fourth aspect described above.
- n is a positive integer, and n ⁇ 2.
- an embodiment of the present application provides a communication device, the communication device including: a unit for executing each step in any one of the foregoing aspects.
- the communication device may be the network device in the first aspect described above, or a device including the network device described above; or, the communication device may be the network card in the second aspect described above, or a device including the network card described above; or, the communication device may Is the computing device in the third aspect described above, or a device including the foregoing computing device; or, the communication device may be the computing device in the fourth aspect described above, or a device including the foregoing computing device; or, the communication device may be the foregoing The terminal device in the fifth aspect, or a device including the above-mentioned terminal device.
- an embodiment of the present application provides a communication device, including a processor and an interface circuit.
- the processor is configured to communicate with other devices through the interface circuit and execute the communication method provided in any of the above aspects.
- the processor includes one or more.
- the communication device may be the network device in the first aspect described above, or a device including the network device described above; or, the communication device may be the network card in the second aspect described above, or a device including the network card described above; or, the communication device may Is the computing device in the third aspect described above, or a device including the foregoing computing device; or, the communication device may be the computing device in the fourth aspect described above, or a device including the foregoing computing device; or, the communication device may be the foregoing The terminal device in the fifth aspect, or a device including the above-mentioned terminal device.
- an embodiment of the present application provides a communication device, including a processor, configured to be connected to a memory, and configured to call a program stored in the memory to execute the communication method provided in any aspect.
- the memory may be located in the communication device or outside the communication device.
- the processor includes one or more.
- the communication device may be the network device in the first aspect described above, or a device including the network device described above; or, the communication device may be the network card in the second aspect described above, or a device including the network card described above; or, the communication device may Is the computing device in the third aspect described above, or a device including the foregoing computing device; or, the communication device may be the computing device in the fourth aspect described above, or a device including the foregoing computing device; or, the communication device may be the foregoing The terminal device in the fifth aspect, or a device including the above-mentioned terminal device.
- an embodiment of the present application provides a computer-readable storage medium that stores instructions in the computer-readable storage medium, which when run on a computer, enables the computer to perform any one of the above-mentioned communications method.
- an embodiment of the present application provides a computer program product containing instructions, which, when run on a computer, enables the computer to execute the communication method of any one of the foregoing aspects.
- an embodiment of the present application provides a circuit system, the circuit system includes a processing circuit, and the processing circuit is configured to execute the communication method according to any one of the foregoing aspects.
- an embodiment of the present application provides a chip.
- the chip includes a processor.
- the processor is coupled to a memory.
- the memory stores program instructions. When the program instructions stored in the memory are executed by the processor, any one of the above aspects is implemented. Communication method.
- Figure 1 is a schematic diagram of a deep neural network provided by related technologies
- Figure 2 is a schematic flow diagram of a distributed DNN training method provided by related technologies
- FIG. 3 is a schematic diagram of another distributed DNN training system architecture provided by related technologies
- Fig. 4 is a schematic diagram of the first phase of the loop full protocol provided by the related technology
- Figure 5 is a schematic flow diagram of the second phase of the full ring protocol provided by related technologies
- FIG. 6 is an architecture diagram of a communication system provided by an embodiment of this application.
- FIG. 7 is a schematic structural diagram of a terminal device provided by an embodiment of this application.
- FIG. 8 is a schematic flowchart of a communication method provided by an embodiment of this application.
- FIG. 9 is a schematic flowchart of yet another communication method provided by an embodiment of this application.
- FIG. 10 is a schematic diagram of the structure of a message after message segmentation according to an embodiment of the application.
- FIG. 11 is a schematic structural diagram of another message after message segmentation according to an embodiment of the application.
- FIG. 12 is a schematic flowchart of yet another communication method provided by an embodiment of this application.
- FIG. 13 is a schematic flowchart of yet another communication method provided by an embodiment of this application.
- FIG. 14 is a schematic flowchart of yet another communication method provided by an embodiment of this application.
- FIG. 16 is a schematic flowchart of yet another communication method provided by an embodiment of this application.
- FIG. 17 is a schematic flowchart of yet another communication method provided by an embodiment of this application.
- FIG. 18 is a diagram of another communication system architecture provided by an embodiment of this application.
- FIG. 19 is a schematic flowchart of another communication method provided by an embodiment of this application.
- FIG. 25 is a schematic diagram of the process of yet another communication method provided by an embodiment of this application.
- a neural network is a network formed by connecting multiple single virtual neurons, that is, the output of one virtual neuron can be the input of another virtual neuron.
- Deep neural network deep neural network, DNN
- Deep neural network also known as multilayer neural network
- the DNN model is divided according to the positions of different layers.
- the neural network inside the DNN model can be divided into three categories: input layer, hidden layer, and output layer.
- the first layer is the input layer
- the last layer is the output layer
- the number of layers in the middle are all hidden layers.
- the connections between virtual neurons are assigned random values or "weights.”
- Fig. 1 shows a DNN model. In the DNN model shown in Fig. 1, the connections between layers are fully connected.
- a circle represents a virtual neuron.
- Circles filled with diagonal lines represent virtual neurons in the input layer, circles without filling represent virtual neurons in the hidden layer, circles filled with vertical lines represent virtual neurons in the output layer, and circles filled with grid lines represent deviations. ⁇ Node. Any virtual neuron in the xth layer must be connected to each virtual neuron in the (x+1)th layer.
- the parameter data in the DNN model is defined as follows:
- the coefficients from the kth virtual neuron in the L-1th layer to the jth virtual neuron in the Lth layer are defined as Exemplarily, in a three-layer DNN model, the linear coefficients from the fourth virtual neuron in the second layer to the second virtual neuron in the third layer are defined as
- the superscript 3 represents the number of layers where the coefficient W is located, and the subscript corresponds to the output third-level index 2 and the input second-level index 4.
- the parameter data of the DNN model needs to be retrained periodically.
- Step 1 Upward convergence, all computing nodes transmit the gradient of parameter data to the PS, such as ⁇ w 1 , ⁇ w 2 or ⁇ w 3 , so that the PS end can aggregate the parameter data; Step 2. : Downward distribution, PS distributes updated parameter data, such as w', to all computing nodes.
- the computing device on computing node 0 is denoted as DEV0
- the computing device on computing node 1 is denoted as DEV1
- the computing device on computing node 2 is denoted as DEV2
- the computing device on computing node 3 is denoted as DEV3.
- Different computing nodes are trained separately based on different training data, and the parameter data of the DNN model is obtained respectively.
- the parameter data of the same part (like a layer) of the DNN model can be identified by the same letter.
- the parameter data of the DNN model includes the weight vectors of different layers.
- the realization process of the full protocol includes two stages: scatter-reduce (scatter-reduce) and all-gather. Assuming that there are p computing nodes, each computing node has a computing device DEV, and one DEV executes one process.
- the parameter data in the data block transmitted by DEV0 to DEV1 is: a0.
- the parameter data in the data block transmitted from DEV1 to DEV2 is: b1.
- the parameter data in the data block transmitted from DEV2 to DEV3 is: c2.
- the parameter data in the data block transmitted by DEV3 to DEV0 is: d3.
- the parameter data in the four data blocks obtained by DEV0 are respectively denoted as: a0, b0, c0, (d0+d3).
- (d0+d3) represents parameter data in a data block, and the parameter data in the data block is obtained by aggregation of parameter data "d0" and parameter data "d3".
- the parameter data in the four data blocks obtained by DEV1 are respectively denoted as: (a1+a0), b1, c1, and d1.
- (a1+a0) represents parameter data in a data block, and the parameter data in the data block is obtained by aggregation of parameter data "a1” and parameter data "a0".
- the parameter data in the four data blocks obtained by DEV2 are respectively denoted as: a2, (b2+b1), c2, and d2.
- the parameter data in the data block transmitted from DEV0 to DEV1 is (d0+d3).
- the parameter data in the data block transmitted from DEV1 to DEV2 is (a1+a0).
- the parameter data in the data block transmitted from DEV2 to DEV3 is (b2+b1).
- the parameter data in the data block transmitted from DEV3 to DEV0 is (c3+c2).
- the parameter data in the four data blocks obtained by DEV0 are respectively denoted as: a0, b0, (c0+c3+c2), (d0+d3).
- the parameter data in the four data blocks obtained by DEV1 are respectively denoted as: (a1+a0), b1, c1, (d1+d0+d3).
- the parameter data in the four data blocks obtained by DEV2 are respectively denoted as: (a2+a1+a0), (b2+b1), c2, and d2.
- the parameter data in the four data blocks obtained by DEV3 are respectively denoted as: a3, (b3+b2+b1), (c3+c2), d3.
- the parameter data in the four data blocks obtained by DEV1 are respectively denoted as: (a1+a0), b1, (c1+c0+c3+c2), (d1+d0+d3).
- the parameter data in the four data blocks obtained by DEV2 are respectively denoted as: (a2+a1+a0), (b2+b1), c2, (d2+d1+d0+d3).
- the parameter data in the four data blocks obtained by DEV3 are respectively denoted as: (a3+a2+a1+a0), (b3+b2+b1), (c3+c2), d3.
- each DEV finally has partially aggregated data, that is, the partially aggregated result corresponding to one of the four data blocks.
- the data block with the partially aggregated result can be represented by the thick-lined square in (d) of FIG. 4.
- each DEV contains all aggregated data and ends with complete aggregated data.
- the parameter data in the data block transmitted by DEV0 to DEV1 is: b0+b3+b2+b1.
- the parameter data in the data block transmitted from DEV1 to DEV2 is: c1+c0+c3+c2.
- the parameter data in the data block transmitted from DEV2 to DEV3 is: d2+d1+d0+d3.
- the parameter data in the data block transmitted by DEV3 to DEV0 is: a3+a2+a1+a0.
- the parameter data in the four data blocks obtained by DEV0 are respectively recorded as: (a3+a2+a1+a0), (b0+b3+b2+b1), (c0+c3 +c2), (d0+d3).
- the parameter data in the four data blocks obtained by DEV1 are respectively denoted as: (a1+a0), (b0+b3+b2+b1), (c1+c0+c3+c2), (d1+d0+d3).
- the parameter data in the four data blocks obtained by DEV2 are respectively denoted as: (a2+a1+a0), (b2+b1), (c1+c0+c3+c2), (d2+d1+d0+d3).
- the parameter data in the four data blocks obtained by DEV3 are respectively denoted as: (a3+a2+a1+a0), (b3+b2+b1), (c3+c2), (d2+d1+d0+d3).
- the parameter data in the four data blocks obtained by DEV0 are respectively recorded as: (a3+a2+a1+a0), (b0+b3+b2+b1), (c0+c3 +c2), (d2+d1+d0+d3).
- the parameter data in the four data blocks obtained by DEV1 are respectively recorded as: (a3+a2+a1+a0), (b0+b3+b2+b1), (c1+c0+c3+c2), (d1+d0+ d3).
- the parameter data in the four data blocks obtained by DEV2 are respectively recorded as: (a2+a1+a0), (b0+b3+b2+b1), (c1+c0+c3+c2), (d2+d1+d0+ d3).
- the parameter data in the four data blocks obtained by DEV3 are respectively recorded as: (a3+a2+a1+a0), (b3+b2+b1), (c1+c0+c3+c2), (d2+d1+d0+ d3).
- the parameter data in the data block transmitted by DEV0 to DEV1 is (d2+d1+d0+d3).
- the parameter data in the data block transmitted from DEV1 to DEV2 is (a3+a2+a1+a0).
- the parameter data in the data block transmitted from DEV2 to DEV3 is (b0+b3+b2+b1).
- the parameter data in the data block transmitted by DEV3 to DEV0 is (c1+c0+c3+c2).
- the parameter data in the four data blocks obtained by DEV0, DEV1, DEV2, and DEV3 are respectively denoted as: (a3+a2+a1+a0), (b0+b3+b2+b1 ), (c1+c0+c3+c2), (d2+d1+d0+d3).
- each DEV finally has all aggregated data, that is, the result of partial aggregation corresponding to different data blocks in the four data blocks, as shown in (d) in FIG. 5.
- the amount of data required to complete a step is M/p; if p DEVs complete a full ring protocol Processing, for each DEV in p DEVs, the amount of data to be transmitted is 2(p-1)M/p, that is, 2(p-1)/p times the amount of parameter data of the DNN model.
- the amount of data that needs to be transmitted is close to twice the amount of parameter data of the DNN model.
- the amount of data that DEV needs to transmit is always greater than the amount of parameter data of the DNN model.
- an extra amount of data is always transmitted in the communication network. Due to the huge amount of parameter data of the DNN model, often as high as hundreds of megabytes, the transmission of the parameter data of the DNN model is easily restricted by the network bandwidth of the communication network, and the communication delay is large.
- the embodiment of the present application provides a communication method.
- the communication system includes a network device and a plurality of terminal devices (only 4 terminal devices are shown in FIG. 6).
- each terminal device is connected to the network device in a wired or wireless manner, and each terminal device can communicate with the network device.
- Multiple terminal devices form a global logical ring network topology through network devices.
- parameter data can be transmitted in a clockwise direction or counterclockwise.
- each terminal device of a global logical ring network topology there is an upstream neighboring terminal device and a downstream neighboring terminal device in any transmission direction.
- the upstream neighboring terminal equipment of terminal equipment 0 is terminal equipment terminal equipment 3
- the downstream neighboring terminal equipment of terminal equipment terminal equipment 0 is The terminal device.
- the terminal device may be a terminal device in a distributed DNN training network.
- the terminal device can execute the training process of the DNN model on the training data based on the distribution.
- terminal device 700 shown in FIG. 7 the terminal device applicable to the embodiment of the present application will be described in detail.
- the terminal device 700 includes one or more computing devices, such as a computing device 701 and/or a computing device 707, at least one communication interface, such as a communication interface 704, a network card 708, and a bus 702.
- the terminal device 700 may further include a memory 703.
- the following description takes the computing device 701 as an example.
- the computing device 701 may be a general-purpose central processing unit (CPU), a graphics processing unit (GPU), a neural network processing unit (NPU), a microprocessor, and an application-specific integrated circuit ( Application-specific integrated circuit (ASIC), field programmable gate array (FPGA), or one or more integrated circuits that integrate multiple processing circuit functions (such as CPU+ASIC).
- CPU central processing unit
- GPU graphics processing unit
- NPU neural network processing unit
- microprocessor a microprocessor
- ASIC Application-specific integrated circuit
- FPGA field programmable gate array
- the bus 702 is used to connect different components.
- the communication interface 704 can be a transceiver circuit for communicating with other devices or communication networks, such as cloud computing network, Ethernet, radio access network (RAN), wireless local area networks (WLAN), etc. .
- the transceiver circuit may be a device such as a transceiver or a transceiver.
- the communication interface 704 may also be an input/output (I/O) circuit of the computing device 701 to implement signal input and signal output of the computing device 701.
- the memory 703 is used to store computer execution instructions for executing the solution of the present application, and the computing device 701 controls execution.
- the computing device 701 is used to read and execute computer instructions (for example, for a CPU) or configuration files (for example, for an FPGA) stored in the memory 703, so as to implement the communication method provided in the embodiment of the present application.
- the network card 708 is also called a network adapter or a network interface card (NIC), and is used to convert the data to be transmitted into a format that can be recognized by other devices on the network, so as to realize the networking function of the terminal device.
- NIC network interface card
- the computer-executable instructions in the embodiments of the present application may also be referred to as application program codes, which are not specifically limited in the embodiments of the present application.
- the terminal device 700 may also include multiple computing devices, such as the computing device 701 and the computing device 707 in FIG. 7. Each of these computing devices can be a single-core processor or a multi-core processor.
- the aforementioned terminal device 700 may be a desktop computer, a network server, a wireless terminal device, an embedded device, or a single device having a similar structure in FIG. 7.
- the foregoing terminal device 700 may also be a software and/or hardware entity provided in each of the foregoing single devices, such as a chip or a chip system for executing the communication method provided in the embodiments of the present application.
- the embodiment of the present application does not limit the type of the terminal device 700.
- a terminal device serves as a computing node.
- a terminal device may include one computing device or multiple computing devices.
- two terminal devices are taken as an example for description, and the two terminal devices are denoted as terminal device 1 and terminal device 2.
- different terminal devices in at least two terminal devices are allocated different training data.
- the DEV of one terminal device obtains the parameter data of the DNN model after one training based on the allocated training data.
- Different terminal equipment can obtain different DNN model parameter data based on different training data.
- the parameter data of different DNN models are aggregated and then distributed to different terminal devices among at least two terminal devices, so that the DEV on each terminal device performs the next training.
- parameter data at the same location of the same DNN model specifically refers to the parameter data of the DNN model obtained by performing the same number of training processes (for example, once) on the DEVs of different terminal devices based on different training data.
- each data in the parameter data of the DNN model is a weight, such as weight It is the weight from the kth neuron in the L-1th layer to the jth neuron in the Lth layer.
- the parameter data at the same position of the same DNN model refers to the weights determined based on the same values of L, k, and j among the parameter data of different DNN models obtained by different DEVs.
- the parameter data at the same position of the same DNN model may refer to the partial value of the weight vector of one layer, the weight vector of one layer, or the weight vector of multiple layers.
- the first terminal device trains the DNN model to obtain parameter data of the DNN model.
- the data packet when the message is divided into one data packet, the data packet includes the above-mentioned preset fields and parameter data.
- the first data packet in the divided data packet includes the above-mentioned preset field, and the different data packets after the division include different parts of parameter data.
- a message is (PMTU*N) bytes.
- the first terminal device performs segmentation according to PMTU, and segments the message into different data packets. For example, suppose that the size of the PMTU is 1024 bytes, and a message is 5120 bytes, as shown in (a) in FIG. 10 or (a) in FIG. 11. Here, the value of N is 5.
- the message is divided into 5 data packets, as shown in (b) in Fig. 10, or as shown in (b) or (c) in Fig. 11.
- the length of the payload of one data packet is PMTU. For another example, if the preset field and parameter data of a message are 1024 bytes, the message is divided into 1 data packet.
- the first terminal device encapsulates the split data packet into a message.
- the number of packets included in the message indicated by the third field of the message is 5.
- the encapsulated message is one, and the number of messages included in the message indicated by the third field of the message is one.
- the encapsulated message has two message structures, which are described as follows:
- the message includes parameter data, but does not include the first field, the second field, the third field, and the fourth field, as shown in (c) in FIG. 11.
- the non-first message of the message does not include the preset fields in the message except for parameter data.
- IP includes related fields of the network layer protocol in the OSI model, such as source IP address, destination IP address and other field information.
- UDP includes related fields of the transport layer protocol UDP in the OSI model, such as source port, destination port and other field information.
- IB BTH includes field information such as packet sequence number (PSN).
- ICRC is used to protect the integrity of the message. This is a mechanism that protects the integrity of messages through cyclic redundancy check (CRC). If a CRC error is found at the receiving end (such as the destination terminal device or the destination computing device), the message can be discarded.
- FCS is used to determine whether to retransmit a message. If an FCS error is found at the receiving end (such as the destination terminal device or the destination computing device), the data message can be discarded.
- S8000 can be executed by the DEV of the first terminal device
- S8001 can be executed by the DEV of the first terminal device, or can be executed by the network card of the first terminal device, or Executed by other components in the first terminal device, S8002 and S8003 may be executed by the network card of the first terminal device.
- the first terminal device divides the parameter data of the DNN model into messages, and then divides the messages into messages. Since the message includes preset fields and parameter data, when a message is encapsulated into one message, the first message is the first message of the message, and carries the preset fields and parameter data. In the case where a message is encapsulated into multiple packets, the first packet of the multiple packets carries the preset field, and the non-first packet of the multiple packets does not carry the preset field.
- each terminal of the at least two terminal devices In order for each terminal device to obtain the aggregation result after the aggregation of the parameter data of the DNN model on each of the above at least two terminal devices, each terminal of the at least two terminal devices The devices respectively send packets to the next terminal device adjacent to each other. Among them, a message sent by a terminal device sends a message to the next terminal device adjacent to the terminal device through the first network device.
- the parameter data in the messages sent by different terminal devices are the parameter data at the same position of the same DNN model.
- each of the at least two terminal devices executes S801:
- the terminal device when one terminal device transmits a message to the other terminal device, the terminal device first transmits the message to the first network device, and then the first network device aggregates the messages. , The first network device transmits the message to another terminal device. That is, after receiving the message, the first network device executes S802:
- the first network device aggregates at least two packets to obtain an aggregated packet.
- aggregation can be to perform arithmetic operations such as addition, subtraction, multiplication, and division, or to perform logical operations such as AND, OR, and NOT.
- the parameter data of each of the at least two messages is the data to be aggregated.
- the first network device aggregates parameter data of different messages in at least two messages, and obtains an aggregation result of the parameter data as the parameter data of the aggregated message.
- the first network device receives it through one channel, or the first network device receives it through z channels.
- z is a positive integer, and z>1.
- Scenario 1 The first network device receives a message from a terminal device through a channel, and the channel is not configured with a channel identifier.
- the channel is not configured with a channel identifier.
- at least two packets to be aggregated meet any one of the following two conditions:
- Condition 1 The message to which each of the at least two messages belongs has the same message index.
- Condition 2 Each of the at least two messages has the same sequence number in the messages with the same message index.
- a message refers to a message transmitted between two or more terminal devices, and a message includes one or more messages, and the message carries parameter data of the DNN model.
- the message may be a message transmitted in an RDMA connection.
- the message can also be a data slice, such as a data slice implemented at the application layer in the nvidia collective communication library (NCCL).
- At least two messages to be aggregated can satisfy condition one.
- the message index of the message to which each message belongs is the same, and the parameter data of the different messages are in the same position of the same DNN model (as in the first layer). The same part, or the same layer) parameter data.
- the at least two messages to be aggregated meet condition two, and the first network device performs the aggregation process.
- the parameter data of the different messages are in the same position of the same DNN model (as in the first layer).
- the same part, or the same layer) parameter data is in the same position of the same DNN model (as in the first layer).
- the first network device aggregates the parameter data at the same position of the same DNN model, avoids data aggregation errors, and helps improve the accuracy of DNN model training.
- the first message of each message includes the first field.
- the first field is used to indicate to perform aggregation processing on the parameter data in the message.
- Manner 1 In the case where the first network device determines that the received message is the first message of the message to which the message belongs, for ease of description, in the embodiment of the present application, the first message of any message is described It is the "first message”. Referring to FIG. 12, the specific implementation process for the first network device to determine the "message to which the first packet belongs" includes S80210:
- the first network device determines the message to which the first packet belongs based on the second field of the first packet.
- the first network device can index the message to which the first message belongs according to the message index in the second field. In this way, the terminal device can determine the message to which the first message belongs. Since the second field exists in the first message of each message, the first network device can index the message to which the corresponding message belongs based on the second field in the first message of different messages.
- the third field indicates the number of messages included in the message to which the first message belongs.
- the first network device can determine the number of packets included in the message to which the first packet belongs.
- the third field indicates that the number of packets included in the message to which the first packet belongs is equal to 1
- the first network device can aggregate different first packets that meet condition one to obtain an aggregated packet.
- the third field indicates that the number of messages included in the message to which the first message belongs is greater than 1, referring to Figure 12, based on the first message (ie, the first message) in a message, the first network device also performs the following step:
- the first network device determines a connection for transmitting the first packet.
- the first network device determines the "connection for transmitting the first message"
- ways for the first network device to determine the "connection for transmitting the first message such as but not limited to the following ways:
- the IB BTH includes a destination queue pair (DstQP) and a packet sequence number (PSN).
- the DstQP of a message is used to indicate a queue pair (QP) in the terminal device that receives the message.
- the QP in the terminal device that receives the message includes a send queue (send queue) and a receive queue (receive queue).
- the PSN of a message is used to indicate the transmission sequence of the message in the RDMA connection that transmits the message.
- the first network device can determine the RDMA connection for transmitting the first message based on the SrcIP, DstIP, and DstQP in the first message, and accordingly determine the connection for transmitting the first message.
- the first network device determines the first interval of the sequence number of the message included in the message to which the first message belongs according to the sequence number in the first message and the number of messages indicated by the third field in the first message. scope.
- the first network device stores the correspondence between the first interval range and the connection for transmitting the first packet.
- the first network device since the first network device stores the corresponding relationship between the first interval range and the connection, if the first network device receives a message from the stored connection again, and the received message is a non-compliance of the message to which the message belongs. For the first message, the first network device can determine the message to which the received message belongs based on the stored correspondence between the first interval range and the connection, and then determine whether to perform aggregation on the received message handle. Specifically, referring to FIG. 12, for the non-first message in a message, the first network device can also determine the "message to which the message belongs".
- the non-first message of any message The first message is described as the "second message", referring to Figure 12, the process of determining the "message to which the second message belongs" by the first network device is described below:
- the first network device determines a connection for transmitting the second packet.
- the first network device may also determine the RDMA connection for transmitting the second packet based on the SrcIP, DstIP, and DstQP in the second packet. For the specific implementation process, please refer to the relevant description of S80211, which will not be repeated here. In addition, the first network device may also use other methods to determine the connection for transmitting the second packet, which is not limited in the embodiment of the present application.
- the first network device determines that the serial number of the second packet is within the first interval range corresponding to the connection through which the second packet is transmitted, it will send the message corresponding to the first interval range where the serial number of the second packet is located Determine the message to which the second message belongs. If the first network device determines that the second packet is not within the range of any one of the first intervals corresponding to the connection through which the second packet is transmitted, the first network device does not need to perform processing on the second packet before forwarding the second packet. Polymerization process.
- the connection for transmitting the second packet corresponds to one or more first interval ranges
- the first network device has stored the correspondence between the connection for transmitting the second packet and the first interval range.
- the first network device determines which of the first interval ranges the PSN of the second packet is within one or more first interval ranges, and if the PSN of the second packet is within a certain first interval range, the second packet The message that belongs to the first interval range. In this way, the first network device also determines the message to which the second message belongs.
- the first network device can determine the message to which the second packet belongs based on the sequence number of the second packet and the pre-stored correspondence between the first interval range and the connection for transmitting the second packet. That is, the first network device can determine the message to which the non-first message in a message belongs.
- the first network device can also identify whether to perform aggregation processing on the second packet through the process of determining the first interval range in which the sequence number of the second packet is located. In the case that there is no need to perform aggregation processing, the first network device directly forwards the second message, which improves the efficiency of the first network device in processing the message.
- the first network device can determine the message to which each message in any message belongs, and can also determine the message index corresponding to each message in any message. In this way, the first network device can also determine which packets to perform aggregation processing.
- the first network device determines that the received message is the first message of the message to which the message belongs, the received message is described as the "first message", and the first network device still performs S80210 and S80211: Afterwards, the first network device stores the message index of the first message, the sequence number of the first message, the message length of the message to which the first message belongs, and the correspondence between the connection for transmitting the first message relation. In the case that the connection also transmits other messages, the first network device also performs the above-mentioned process. In this way, the first network device can store multiple correspondences. In the case where one or more messages are transmitted on other connections, the first network device also performs a similar process. In this way, the first network device can store the correspondences about multiple connections.
- the first network device determines the number of third packets.
- the first network device can determine the message to which each message to be aggregated belongs, the first network device can count the number of messages belonging to messages with the same message index. Further, since each message to be aggregated carries a PSN, the first network device can count the number of messages belonging to messages with the same message index and having the same sequence number among the messages with the same message index.
- the first network device determines whether the first quantity value is less than a first preset value. If the first quantity value is less than the first preset value, the first network device executes S80218, and if the first quantity value is equal to the first preset value, the first network device executes S80219.
- the first network device aggregates a third message that belongs to messages with the same message index and has the same sequence number among the messages with the same message index, to obtain an aggregated message.
- Scenario 2 The first network device receives a message from one terminal device through one or more channels, and the channel is configured with a channel identifier.
- the channel is configured with a channel identifier.
- at least two packets to be aggregated meet any one of the following two conditions:
- the first network device aggregates the parameter data at the same location of the same DNN model, avoids data aggregation errors, and helps ensure the accuracy of DNN model training.
- the first message of each message includes the first field, so that the first network device can quickly and effectively identify the messages to be aggregated and The packets that do not need to be aggregated are guaranteed to ensure the efficiency of aggregation processing, and the first network device also quickly forwards the packets that do not need to be aggregated.
- the preset fields in the first message of each message also include a second field, a third field, and a fourth field, as shown in (b) in FIG. 11.
- the non-first message of each message does not include the above-mentioned first field, second field, third field, and fourth field, as shown in (c) in FIG. 11.
- the message indexes of the messages to which the messages transmitted on different channels belong may be the same or different.
- Manner 3 For the convenience of description, in the embodiment of the present application, the first message of any message is described as the "first message". In the case where the first network device determines that the received message is the first message of the message to which the message belongs, referring to FIG. 14, the first network device determines "the channel identifier corresponding to the first message and the message to which it belongs"
- the specific implementation process includes S80220:
- the first network device determines the message to which the first packet belongs based on the second field of the first packet.
- the first network device determines the channel identifier corresponding to the first packet based on the fourth field of the first packet.
- the first network device can use the channel identifier carried in the fourth field as the channel identifier corresponding to the first message. Since the fourth field exists in the first message of each message, the first network device determines the channel identifier corresponding to the corresponding message based on the fourth field in the first message of different messages.
- the third field indicates the number of messages included in the message to which the first message belongs.
- the first network device can determine the number of packets included in the message to which the first packet belongs.
- the third field indicates that the number of packets included in the message to which the first packet belongs is equal to 1
- the first network device can aggregate different first packets that meet condition three to obtain an aggregated packet.
- the third field indicates that the number of messages included in the message to which the first message belongs is greater than 1, referring to Figure 14, based on the first message (ie, the first message) in a message, the first network device also performs the following step:
- the first network device determines the second interval of the sequence number of the message included in the message to which the first message belongs according to the sequence number in the first message and the number of messages indicated by the third field in the first message. scope.
- the first network device since the first network device stores the correspondence between the message index, the channel identifier, and the second interval range, if the first network device then receives the message through the channel identified by the stored channel identifier, and the received message If the message is not the first message of the message to which the message belongs, the first network device can determine the corresponding relationship between the received message based on the stored message index, channel identifier, and the second interval range. The channel ID and the message to which it belongs. Specifically, referring to FIG. 14, for the non-first message in a message, the first network device can also determine the "channel identifier corresponding to the message and the message to which it belongs".
- the non-first message of any message is described as the "second message", see Figure 14.
- the following describes the process of the first network device determining the "channel identifier corresponding to the second message and the message to which it belongs”.
- the process for the first network device to determine "the channel identifier corresponding to the second message and the message to which it belongs” includes the following steps:
- the first network device determines that the serial number of the second packet is within the second interval range corresponding to the channel identifier, it determines that the message corresponding to the second interval range where the serial number of the second packet is located is the second packet. The message to which the text belongs. If the first network device determines that the second packet is not within any second interval corresponding to the transmission channel identifier, the first network device does not need to perform aggregation processing on the second packet before forwarding the second packet.
- the first network device can determine the message to which the second message belongs and where the second message belongs based on the serial number of the second message and the correspondence between the pre-stored channel identifier and the second interval range. Corresponding channel ID. That is, the first network device can determine the message to which the non-first message in a message belongs and the channel identifier corresponding to the non-first message. In addition, the first network device can also identify whether to perform aggregation processing on the second packet through the process of determining the second interval range in which the sequence number of the second packet is located. For the second packet that does not need to perform aggregation processing, the first network device does not need to perform aggregation processing on the second packet before forwarding the second packet.
- the first network device can determine the message to which each message in any message belongs and the corresponding channel identifier, and it can also determine the message index corresponding to each message in any message. . In this way, the first network device can also determine which packets to perform aggregation processing.
- Manner 4 When the first network device determines that the received message is the non-first message of the message to which the message belongs, the non-first message of any message is still described as the "second message". The first network device uses the sequence number offset between the second message and the first message to determine the "message to which the second message belongs" and the "channel identifier corresponding to the second message", and its specific implementation process as follows:
- the first network device determines that the received message is the first message of the message to which the message belongs, the received message is described as the "first message", and the first network device still performs S80220 and S80221: Afterwards, the first network device stores the channel identifier corresponding to the first message, the message index of the first message, and the correspondence between the serial number of the first message and the message length of the first message . In the case that the connection also transmits other messages, the first network device also performs the above-mentioned process. In this way, the first network device can store multiple correspondences. In the case where one or more messages are transmitted on other connections, the first network device also performs a similar process. Since a channel is realized by a connection, the channel is configured with a channel identifier. In this way, the first network device can store the corresponding relationship between the multiple channel identifiers.
- the first network device determines whether the packets to be aggregated are all based on the pre-acquired preset value. When the packets to be aggregated are all, the first network device The network device performs aggregation processing on the packets to be aggregated.
- the message corresponding to the same channel identifier, belonging to the message with the same message index, and having the same sequence number among the messages with the same message index is described as the "fourth message".
- the four messages can be any message in any message. Referring to Figure 15, the following describes the aggregation processing process of the fourth packet by the first network device:
- the first network device determines the number of fourth packets.
- the quantity of the fourth message is recorded as the second quantity value.
- the first network device can determine the message to which each packet to be aggregated belongs and the corresponding channel identifier, the first network device can count the messages corresponding to the same channel identifier and belonging to messages with the same message index. Number of texts. Further, since each packet to be aggregated carries a PSN, the first network device can count the number of fourth packets.
- the first network device determines whether the second quantity value is less than a second preset value. If the second quantity value is less than the second preset value, the first network device executes S80228, and if the second quantity value is equal to the second preset value, the first network device executes S80229.
- the first network device waits to receive a fourth message corresponding to the same channel identifier, belonging to a message with the same message index, and having the same sequence number in the messages with the same message index.
- the first network device aggregates the fourth message corresponding to the same channel identifier, belonging to the message with the same message index, and having the same sequence number among the messages with the same message index, to obtain the aggregated message.
- the header of the "message before aggregation” is the same as the header of the "message after aggregation".
- the parameter data of the "message before aggregation” and the parameter data of the “message after aggregation” may be the same or different, depending on the specific operation used for aggregation and the value of the parameter data before aggregation. Specific examples are as follows:
- the value of the parameter data of two or more of the n messages is not zero.
- the parameter data of each of the n packets are the same as each other, and the parameter data after aggregation in each packet is different from the parameter data before aggregation of the packet.
- the terminal device may also determine which DEV the message belongs to based on the DstQP in the message header. Since the message header of each message is different, it is convenient for the first network device and the terminal device to perform corresponding processing on the message.
- the specific implementation process of "recombination of received messages into aggregated parameter data" will be described.
- one of the at least two terminal devices is described as a "second terminal device”
- the message received by the second terminal device is described as a "fifth message”.
- the specific implementation process of "recombination of received messages into aggregated parameter data of the DNN model” includes the following steps:
- the second terminal device determines the parameter data of the DNN model according to different messages.
- the preset field of the message includes a message index, and the message index is carried in the second field, as shown in (a) in FIG. 10.
- the message index of the preset field part of different messages is different.
- the second terminal device reassembles messages with different message indexes into parameter data of the DNN model.
- the first network device sends an aggregated message belonging to the k-th message to the third terminal device.
- the third terminal device receives the aggregated message belonging to the kth message from the first network device.
- the first network device sends the aggregated message belonging to the (k+1)th message to the third terminal device.
- the third terminal device receives the aggregated message belonging to the (k+1)th message from the first network device.
- each terminal device in the first group sends a message to the second network device.
- the second network device receives a message from each terminal device in the first group.
- Each terminal device in the second group sends a message to the third network device.
- the third network device receives the message from each terminal device in the second group.
- the second network device sends the globally aggregated packet to each terminal device in the first group.
- each terminal device in the first group receives the globally aggregated message from the second network device.
- the third network device sends the globally aggregated message to the terminal device 5 and the terminal device 6.
- the terminal device 5 receives the globally aggregated message from the third network device.
- the terminal device 6 receives the globally aggregated message from the third network device.
- the communication system architecture shown in Figure 18 there can be more network devices connected to more groups of terminal devices to perform parameter data on the corresponding groups of terminal devices.
- the aggregation processing obtains the locally aggregated packets of the corresponding group.
- the fourth network device performs aggregation processing on more groups of locally aggregated messages to obtain globally aggregated messages. In this way, the training process of the DNN model can be performed on more terminal devices, and the training efficiency of the DNN model can be improved.
- the i-th computing device in the fourth terminal device trains the DNN model to obtain n parts of parameter data.
- the i-th computing device sends the (x+i-j+1)-th part of the parameter data to the (i+1)-th computing device through (j-1). ) The aggregation processing result of the second iteration.
- i, j and x are all positive integers, and 1 ⁇ i ⁇ n, 1 ⁇ x ⁇ n; if i-1 ⁇ 1, replace (i-1) with (i-1+n); if i +1>n, replace (i+1) with (i+1-n). 1 ⁇ x ⁇ n. 1 ⁇ j ⁇ n-1; if x+ij ⁇ 1, replace (x+ij) with (x+i-j+n); if x+i-j+1>n, use (x+i -j+1-n) replace (x+i-j+1).
- the 4 parts of parameter data obtained by DEV0 can be denoted as a0, b0, c0, and d0, respectively.
- the 4 parts of parameter data acquired by DEV1 can be denoted as a1, b1, c1, and d1, respectively.
- the 4 parts of parameter data obtained by DEV2 can be denoted as a2, b2, c2, and d2, respectively.
- the 4 parts of parameter data obtained by DEV3 can be denoted as a3, b3, c3, and d3, respectively.
- (d0+d3) indicates that the processing result of the parameter data of this part is obtained by the aggregation of the parameter data denoted as "d0" and the parameter data denoted as "d3".
- the parameter data of the current 4 parts of DEV1 are respectively denoted as: (a1+a0), b1, c1, and d1.
- (a1+a0) indicates that the processing result of the parameter data of this part is obtained by the aggregation of the parameter data denoted as "a1” and the parameter data denoted as "a0”.
- the parameter data of the current 4 parts of DEV2 are respectively denoted as: a2, (b2+b1), c2, and d2.
- (b2+b1) indicates that the processing result of the parameter data of this part is obtained by the aggregation of the parameter data denoted as "b2” and the parameter data denoted as "b1".
- the parameter data of the current 4 parts of DEV3 are respectively denoted as: a3, b3, (c3+c2), d3.
- (c3+c2) indicates that the processing result of the parameter data of this part is obtained by the aggregation of the parameter data denoted as "c3” and the parameter data denoted as "b2".
- the parameter data of different parts can be a data block.
- the logical ring network topology formed by multiple terminal devices via the bus is described as a "local logical ring network topology”.
- the logical ring network topology formed by multiple terminal devices through the network devices is described as "global logical ring network topology”.
- the partial aggregation result of the x-th part of the parameter data in the n parts can be obtained.
- Other computing devices of the fourth terminal device also execute the foregoing S21001 and S21002, and the values of x corresponding to different computing devices are different. In this way, in the fourth terminal device, different computing devices obtain different parts of the local aggregation results.
- the fourth terminal device can also obtain the first aggregation result of n parts of parameter data.
- other terminal devices in the at least two terminal devices also execute the foregoing S21001 and S21002, so that the other terminal devices also obtain the first aggregation result of n parts of parameter data.
- the main computing device of each terminal device performs data aggregation processing.
- different computing devices can perform data aggregation processing, which can make full use of the resources of different computing devices to avoid one
- the problem of excessive calculation of a certain computing device on the terminal device can also make full use of the resources of different computing devices to improve the computing efficiency of aggregation processing.
- each of the at least two terminal devices respectively encapsulates the first aggregation result of the n parts of parameter data into a message.
- S2101 can refer to the relevant descriptions of S8000 to S8003, which will not be repeated here.
- each of the at least two terminal devices sends a message to the fifth network device.
- the fifth network device receives a message from each of the at least two terminal devices.
- the fifth network device aggregates at least two packets to obtain an aggregated packet.
- the parameter data of the aggregated message is the second aggregation result.
- the second aggregation result is obtained by aggregation of the first aggregation results of each of the at least two terminal devices.
- the first preset value is the number of computing devices that provide the first network device with parameter data of the same DNN model at the same location.
- the second preset value is the value of the number of computing devices that provide parameter data of the same DNN model at the same location to the first network device.
- a curve with arrows represents a channel between terminal devices.
- the channel IDs of the channels between two adjacent DEV0s are all channel 0
- the channel IDs of the channels between two adjacent DEV1s are all channel 1
- the channel IDs of the channels between two adjacent DEV2s are all channel 2.
- the channel identifiers of the channels between two adjacent DEV3s are all channel 3.
- the packets aggregated by the fifth network device correspond to the same channel identifier.
- packets are transmitted between terminal devices through two channels.
- a curve with an arrow indicates the communication between terminal devices.
- a channel There are two channels between two adjacent DEV0, and the channel identifiers of the two channels are channel 0 and channel 1.
- the channels of the two channels are identified as channel 2 and channel 3, which are not shown in FIG. 25.
- the channel identifications of the two channels are channel 4 and channel 5, which are not shown in FIG. 25.
- There are two channels between two adjacent DEV3s, and the channel identifiers of the two channels are channel 6 and channel 7.
- the packets aggregated by the fifth network device still correspond to the same channel identifier.
- Each of the at least two terminal devices respectively reassembles the received message into a second aggregation result of n parts of parameter data.
- a second terminal device includes multiple DEVs, and each DEV transmits parameter data through a channel, the second terminal device determines which packet the packet belongs to according to the DstQP of the IB BTH in each packet Which DEV the message belongs to. Among the multiple messages belonging to the same DEV, the second terminal device reorganizes the messages with different message indexes into the parameter data of the DNN model.
- the second aggregation result of the parameter data of the part (x+i-j+1) is the first aggregation result of the parameter data of the part (x+i-j+1) in the first local logical ring network topology and
- the first aggregation result of the parameter data of the (x+i-j+1) part is It is obtained by aggregation of the parameter data of the (x+i-j+1)th part in different processors in the first local logical ring network topology;
- i, j and x are all positive integers, and 1 ⁇ i ⁇ n, 1 ⁇ x ⁇ n; the (i-1)th computing device, the ith computing device, and the (i+1)th computing device Are distributed in the first partial logical ring network topology; n computing devices in the first partial logical ring network topology are connected sequentially, and the first computing device of the n computing devices is connected to the last computing device of the n computing devices; if i-1 ⁇ 1, replace (i-1) with (i-1+n); if i+1>n, replace (i+1) with (i+1-n); if x+ij ⁇ 1, replace (x+ij) with (x+i-j+n); if x+i-j+1>n, replace (x+i-j+1-n) with (x+i- j+1).
- a dashed box represents the fourth terminal device
- a circle represents one Computing equipment
- the curve indicates the transmission direction of the parameter data.
- the channel identifiers corresponding to the four computing devices of the fourth terminal device can be respectively recorded as: DEV0, DEV1, DEV2, and DEV3.
- data is transferred between different computing devices through the bus.
- the parameter data of part n obtained by DEV0 can be denoted as a0, b0+b3+b2+b1, c0+c3+c2, and d0+d3, respectively.
- the parameter data of part n obtained by DEV1 can be denoted as a1+a0, b1, c1+c0+c3+c2, and d1+d0+d3, respectively.
- the parameter data of part n obtained by DEV2 can be respectively denoted as a2+a1+a0, b2+b1, c2, and d2+d1+d0+d3.
- the parameter data of part n obtained by DEV3 can be denoted as a3+a2+a1+a0, b3+b2+b1, c3+c2, and d3, respectively.
- DEV0 sends part of the parameter data to DEV1, which can be recorded as b0+b3+b2+b1
- DEV1 sends part of the parameter data to DEV2, which can be recorded as c1+c0+c3+ c2
- DEV2 sends part of the parameter data to DEV3, which can be recorded as d2+d1+d0+d3
- DEV3 sends part of the parameter data to DEV0, which can be recorded as a3+a2+a1+a0.
- the current 4 parts of the parameter data of DEV0 are respectively denoted as: a3+a2+a1+a0, b0+b3+b2+b1, c0+c3+ c2 and d0+d3.
- the parameter data of the current 4 parts of DEV1 are respectively denoted as: a1+a0, b0+b3+b2+b1, c1+c0+c3+c2 and d1+d0+d3.
- the interface module 2701 is used to receive at least two messages.
- the messages to which at least two packets belong respectively have the same message index, and the message index is used to index the messages to which the at least two packets belong respectively.
- the processing module 2702 is configured to aggregate at least two messages to obtain an aggregated message.
- the processing module 2702 is also used to determine the connection for transmitting the first message.
- the processing module 2702 is further configured to, if the sequence number of the first message is within the first interval range corresponding to the connection through which the first message is transmitted, determine the message corresponding to the first interval range where the serial number of the first message is located as The message to which the first message belongs.
- the first message is any one of at least two messages.
- the first message also includes a sequence number, and the sequence number is used to indicate the transmission sequence of the first message in the connection for transmitting the first message.
- the first message is the non-first message of the message to which the first message belongs.
- the processing module 2702 is further configured to determine the first number value of the first packet belonging to the message with the same message index and having the same sequence number among the messages with the same message index.
- the interface module 2701 is further configured to, if the processing module 2702 determines that the first quantity value is less than the first preset value, wait to receive the first message that belongs to the message with the same message index and has the same sequence number among the messages with the same message index. .
- the processing module 2702 is also used to determine the connection for transmitting the first message.
- the processing module 2702 is further configured to use the channel identifier corresponding to the connection for transmitting the first message as the channel identifier corresponding to the first message.
- the processing module 2702 is further configured to, if the serial number of the first message is within the second interval range corresponding to the channel identifier, determine the message corresponding to the second interval range where the serial number of the first message is located as the first message to belong to News.
- the first message is any one of at least two messages.
- the first message also includes a sequence number, and the sequence number is used to indicate the transmission sequence of the first message in the connection for transmitting the first message.
- the first message is the non-first message of the message to which the first message belongs.
- the computer may be implemented in whole or in part by software, hardware, firmware, or any combination thereof.
- a software program it can be implemented in the form of a computer program product in whole or in part.
- the computer program product includes one or more computer instructions.
- the computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices.
- the computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium.
- the computer instructions may be transmitted from a website, computer, server, or data center.
- the computer-readable storage medium may be any available medium that can be accessed by a computer or includes one or more data storage devices such as servers, data centers, etc. that can be integrated with the medium.
- the usable medium may be a magnetic medium (for example, a floppy disk, a hard disk, and a magnetic tape), an optical medium (for example, a digital video disc/disk (DVD)), or a semiconductor medium (for example, a solid state disk (SSD)). ))Wait.
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- Data Mining & Analysis (AREA)
- Evolutionary Computation (AREA)
- Life Sciences & Earth Sciences (AREA)
- Artificial Intelligence (AREA)
- General Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- Computing Systems (AREA)
- General Health & Medical Sciences (AREA)
- Molecular Biology (AREA)
- Computational Linguistics (AREA)
- Biophysics (AREA)
- Biomedical Technology (AREA)
- Mathematical Physics (AREA)
- Software Systems (AREA)
- Health & Medical Sciences (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computer Security & Cryptography (AREA)
- Bioinformatics & Cheminformatics (AREA)
- Bioinformatics & Computational Biology (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Evolutionary Biology (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
本申请提供通信方法及装置,涉及通信技术领域,该方法包括:网络设备接收至少两个报文,对至少两个报文进行聚合,得到聚合后的报文。其中,至少两个报文分别所属的消息具有同一消息索引,消息索引用于索引至少两个报文分别所属的消息。在本申请提供的通信方法中,利用网络设备实现聚合处理,以降低通信时延和通信网络中的数据冗余度。
Description
本申请要求于2020年01月17日提交国家知识产权局、申请号为202010054022.1、发明名称为“通信方法及装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
本申请涉及通信技术领域,尤其涉及一种通信方法及装置。
目前,通常采用分布式深度神经网络(deep neural network,DNN)训练方法来训练DNN模型。在分布式DNN训练方法中,大多由服务器实现聚合处理,以得到训练后的DNN模型参数。在一种分布式DNN训练方法中,p个计算节点分别通过通信网络与同一个参数服务器交互DNN模型参数。其中,p为大于1的正整数。在p个计算节点分别与同一个参数服务器进行的一次DNN模型参数的交互过程中,对于一个计算节点而言,所需传输的数据量是DNN模型参数的数据量的2倍;对于参数服务器而言,所需传输的数据量是DNN模型参数的数据量的2p倍,数据量庞大。如此,参数服务器存在通信瓶颈问题。在另一种分布式DNN训练方法中,p个计算节点之间通过通信网络交互DNN模型参数。若p个计算节点完成一次环全规约(ring-all-reduce)处理,则对于p个计算节点中每个计算节点而言,所需传输的数据量是DNN模型参数的数据量的2(p-1)/p倍。在计算节点的数量庞大时,若p个计算节点完成一次环全规约处理,则对于p个计算节点中每个计算节点而言,所需传输的数据量接近DNN模型参数的数据量的2倍。也就是说,计算节点所需传输的数据量始终大于DNN模型参数的数据量。相对于DNN模型参数的数据量而言,通信网络中始终传输了额外的数据量,容易受到通信网络的网络带宽限制,通信时延大。
发明内容
本申请实施例提供一种通信方法及装置,能够降低通信时延和通信网络中的数据冗余度。
为达到上述目的,本申请实施例采用如下技术方案:
第一方面,本申请实施例提供一种通信方法,该方法包括:接收至少两个报文,再对至少两个报文进行聚合,得到聚合后的报文。其中,至少两个报文分别所属的消息具有同一消息索引,消息索引用于索引至少两个报文分别所属的消息。
也就是说,在终端设备通过网络设备向另一个终端设备发送报文的过程中,网络设备对接收的报文进行聚合处理,从而避免通信网络的网络带宽限制,降低通信时延和通信网络中的数据冗余度。由于相同的消息索引所标识的报文中的参数数据是同一DNN模型中相同位置的参数数据,也就使得网络设备能够准确地识别待聚合报文,以及保证网络设备聚合处理的准确性,从而提升DNN模型训练效率,也不影响网络设备对非聚合报文的转发功能。
在一种可能的设计中,至少两个报文分别在具有同一消息索引的消息中具有同一序列号。由于报文中的序列号也能够指示报文中的参数数据在DNN模型中的位置的参数数据。 在一条消息切分为多个报文的情况下,网络设备根据消息索引和序列号来确定待聚合的报文,以保证网络设备聚合处理的准确性。
在一种可能的设计中,若第一报文是第一报文所属消息的首个报文,则第一报文还包括第一字段,第一字段用于指示对第一报文所属消息中的参数数据执行聚合处理。其中,第一报文是至少两个报文中的任意一个报文。如此,网络设备即可根据第一字段,快速、有效地识别出待聚合处理的报文和无需聚合处理的报文,保证聚合处理效率,也使得网络设备快速转发无需聚合处理的报文。
在一种可能的设计中,若第一报文是第一报文所属消息的首个报文,则第一报文还包括第二字段,第二字段用于承载第一报文所属消息的消息索引。第一报文所属消息的消息索引用于索引第一报文所属的消息。其中,第一报文是至少两个报文中的任意一个报文。如此,网络设备即可根据第二字段,确定该第一报文所属的消息,以便于网络设备将属于同一消息索引的消息的报文进行聚合。
在一种可能的设计中,若第一报文是第一报文所属消息的首个报文,则第一报文还包括第三字段,第三字段用于承载第一报文所属消息所包括报文的报文数量。其中,第一报文是至少两个报文中的任意一个报文。如此,网络设备即可根据第三字段,确定该第一报文所属的消息所包括的报文数量。
在一种可能的设计中,第一报文还包括序列号,序列号用于指示第一报文在传输第一报文的连接中的传输顺序。本申请实施例通信方法还包括:确定传输第一报文的连接。根据第一报文中的序列号和第一报文中的第三字段所指示的报文数量,确定第一报文所属消息所包括报文的序列号的第一区间范围。存储第一区间范围与传输第一报文的连接之间的对应关系。其中,第一区间范围的第一端值为第一报文的序列号,第一区间范围的第二端值是基于第一报文的序列号和第一报文中的第三字段所指示的报文数量确定的数值。
如此,网络设备即可确定传输待聚合报文的连接,以及通过该连接传输的待聚合报文的序列号所在的区间范围。
在一种可能的设计中,第一报文还包括序列号,序列号用于指示第一报文在传输第一报文的连接中的传输顺序。若第一报文是第一报文所属消息的非首个报文,本申请实施例通信方法还包括:确定传输第一报文的连接。若第一报文的序列号在传输第一报文的连接对应的第一区间范围内,则将与第一报文的序列号所在的第一区间范围对应的消息确定为第一报文所属的消息。其中,第一报文是至少两个报文中的任意一个报文。也就是说,对于一条消息的非首个报文,网络设备通过已存储的连接与第一范围之间的对应关系,以及该第一报文的序列号,确定该第一报文所属的消息。
在一种可能的设计中,本申请实施例通信方法还包括:确定属于具有同一消息索引的消息且在具有同一消息索引的消息中具有同一序列号的第一报文的第一数量值。若第一数量值小于第一预设值,则等待接收属于具有同一消息索引的消息且在具有同一消息索引的消息中具有同一序列号的第一报文。也就是说,在网络设备确定属于具有同一消息索引的消息且在具有同一消息索引的消息中具有同一序列号的第一报文未到齐的情况下,网络设备继续等待接收属于具有同一消息索引的消息且在具有同一消息索引的消息中具有同一序列号的第一报文。
在一种可能的设计中,本申请实施例通信方法还包括:确定属于具有同一消息索引的 消息且在具有同一消息索引的消息中具有同一序列号的第一报文的第一数量值。对至少两个报文进行聚合,得到聚合后的报文,包括:若第一数量值等于第一预设值,则对属于具有同一消息索引的消息且在属于具有同一消息索引的消息中具有同一序列号的第一报文进行聚合,得到聚合后的报文。也就是说,在网络设备确定属于具有同一消息索引的消息且在具有同一消息索引的消息中具有同一序列号的第一报文到齐的情况下,网络设备才聚合处理具有同一消息索引的消息且在具有同一消息索引的消息中具有同一序列号的第一报文。
在一种可能的设计中,至少两个报文对应相同的通道标识,通道标识用于标识传输相应报文的通道。也就是说,在网络设备采用通道接收至少两个报文的情况下,通道配置了通道标识,网络设备对具有同一消息索引且对应相同的通道标识的报文进行聚合,既能够保障报文聚合处理的准确性,又能够提高数据传输效率。
在一种可能的设计中,若第一报文是第一报文所属消息的首个报文,则第一报文还包括第四字段,第四字段用于承载第一报文对应的通道标识。第一报文所对应的通道标识用于标识传输第一报文的通道。其中,第一报文是至少两个报文中的任意一个报文。如此,网络设备即可根据第四字段,确定该第一报文对应的通道标识。
在一种可能的设计中,第一报文还包括序列号和第三字段。序列号用于指示第一报文在传输第一报文的连接中的传输顺序。第三字段用于承载第一报文所属消息所包括报文的报文数量。本申请实施例通信方法还包括:确定第一报文对应的通道标识。根据第一报文中的序列号和第三字段所指示的报文数量,确定第一报文所属消息所包括报文的序列号的第二区间范围。存储第二区间范围与第一报文对应的通道标识之间的对应关系。其中,第二区间范围的第一端值为第一报文的序列号,第二区间范围的第二端值是基于第一报文的序列号和第一报文中的第三字段所指示的报文数量确定的数值。
在一种可能的设计中,第一报文还包括序列号,序列号用于指示第一报文在传输第一报文的连接中的传输顺序。若第一报文是第一报文所属消息的非首个报文,本申请实施例通信方法还包括:确定传输第一报文的连接。将传输第一报文的连接对应的通道标识,作为第一报文对应的通道标识。若第一报文的序列号在通道标识对应的第二区间范围内,则将与第一报文的序列号所在的第二区间范围对应的消息确定为第一报文所属的消息。其中,第一报文是至少两个报文中的任意一个报文。
如此,对于一条消息的非首个报文,网络设备通过确定第一报文的连接,进而恢复第一报文所属的消息和对应的通道标识。
在一种可能的设计中,本申请实施例通信方法还包括:确定对应同一通道标识、属于具有同一消息索引的消息且在具有同一消息索引的消息中具有同一序列号的第一报文的第二数量值。若第二数量值小于第二预设值,则等待接收对应同一通道标识、属于具有同一消息索引的消息且在具有同一消息索引的消息中具有同一序列号的第一报文。也就是说,在网络设备确定对应同一通道标识、属于具有同一消息索引的消息且在具有同一消息索引的消息中具有同一序列号的第一报文未到齐的情况下,网络设备继续等待接收对应同一通道标识、属于具有同一消息索引的消息且在具有同一消息索引的消息中具有同一序列号的第一报文。
在一种可能的设计中,本申请实施例通信方法还包括:确定对应同一通道标识、属于 具有同一消息索引的消息且在具有同一消息索引的消息中具有同一序列号的第一报文的第二数量值。对至少两个报文进行聚合,得到聚合后的报文,包括:若第二数量值等于第二预设值,则将对应同一通道标识、属于具有同一消息索引的消息且在属于具有同一消息索引的消息中具有同一序列号的第一报文进行聚合,得到聚合后的报文。也就是说,在网络设备确定对应同一通道标识、属于具有同一消息索引的消息且在具有同一消息索引的消息中具有同一序列号的第一报文到齐的情况下,网络设备才聚合处理对应同一通道标识、具有同一消息索引的消息且在具有同一消息索引的消息中具有同一序列号的第一报文。
在一种可能的设计中,第一报文与第二报文一一对应,且第一报文的报文头与第二报文的报文头相同,第二报文的参数数据是由至少两个报文中每个第一报文的参数数据聚合得到的。其中,第一报文是至少两个报文中的任意一个报文。第二报文属于聚合后的报文。也就是说,网络设备是采用聚合处理后的参数数据替换第一报文中的参数数据,即可得到聚合后的报文。
在一种可能的设计中,本申请实施例通信方法还包括:向终端设备发送聚合后的报文;或者,向目标网络设备发送聚合后的报文。也就是说,在终端设备通过当前网络设备向另一终端设备发送报文的过程中,当前网络设备得到聚合后的报文之后,当前网络设备即可向另一终端设备发送聚合后的报文,以使另一终端设备得到聚合后的报文。或者,在终端设备通过当前网络设备和目标网络设备向另一终端设备发送报文的过程中,当前网络设备得到聚合后的报文之后,当前网络设备即可向目标网络设备发送聚合后的报文。目标网络设备也能够对来自当前网络设备的聚合后的报文再执行聚合处理,再向另一终端设备发送再次聚合处理后的报文,以分担网络设备的聚合运算量,进一步提高聚合运算效率。
第二方面,本申请实施例提供一种通信方法,该方法包括:发送第一报文之后,接收第二报文。其中,第二报文是由属于具有同一消息索引的报文聚合得到的,且属于具有同一消息索引的报文分别来自当前网卡与其他网卡。消息索引用于索引属于具有同一消息索引的报文分别所属的消息。
在一种可能的设计中,属于具有同一消息索引的报文分别在具有同一消息索引的消息中具有同一序列号。
在一种可能的设计中,若第一报文是第一报文所属消息的首个报文,则第一报文还包括第一字段,第一字段用于指示对第一报文所属消息中的参数数据执行聚合处理。
在一种可能的设计中,若第一报文是第一报文所属消息的首个报文,则第一报文还包括第二字段,第二字段用于承载第一报文所属消息的消息索引。其中,第一报文所属消息的消息索引用于索引第一报文所属的消息。
在一种可能的设计中,若第一报文是第一报文所属消息的首个报文,则第一报文还包括第三字段,第三字段用于承载第一报文所属消息所包括报文的报文数量。
在一种可能的设计中,属于具有同一消息索引的报文对应相同的通道标识,通道标识用于标识传输具有同一消息索引的报文的通道。
在一种可能的设计中,若第一报文是第一报文所属消息的首个报文,则第一报文还包括第四字段,第四字段用于承载第一报文所对应的通道标识。第一报文所对应的通道标识用于标识传输第一报文的通道。
在一种可能的设计中,第一报文为多个。若第一报文的参数数据的参数数据来自同一 计算设备,且传输第一报文的通道为多个,则由不同的通道传输的第一报文分别所属消息的消息索引相同,或者,由不同的通道传输的第一报文分别所属消息的消息索引不同。也就是说,在多个第一报文通过不同的通道传输的情况下,不同的通道传输的第一报文中的参数数据在DNN模型中的位置不同。不同的通道上的第一报文所属消息的消息索引可以相同,也可以不同。
在一种可能的设计中,本申请实施例通信方法还包括:获取来自计算设备的消息之后,将来自计算设备的消息切分为数据包,再将切分后的数据包封装为第一报文。其中,来自计算设备的消息包括预设字段和参数数据,切分后的数据包中的首个数据包包括预设字段,切分后的不同数据包分别包括不同部分的参数数据。相应的,本申请实施例通信方法还包括:将对应同一消息索引的第二报文重组为同一消息索引所对应的消息,再向计算设备发送同一消息索引所对应的消息。这里,预设字段包括第一字段、第二字段和第三字段,或包括第一字段、第二字段、第三字段和第四字段。
也就是说,在当前网卡发送第一报文的情况下,当前网卡接收来自计算设备的消息。来自计算设备的消息中的预设字段承载于多个第一报文中的首个第一报文。来自计算设备的消息中不同部分的参数数据承载于多个第一报文中不同的第一报文。在当前网卡接收第二报文的情况下,当前网卡将对应同一消息索引的第二报文重组为同一消息,以向计算设备发送该条消息。
在一种可能的设计中,第一报文中的参数数据包括n部分的参数数据中第x部分的参数数据的第一聚合结果。n部分的参数数据是由计算设备训练DNN模型得到的。x为正整数,且1≤x≤n。n为正整数,且n≥2。其中,计算设备与其他计算设备构成第一局部逻辑环网拓扑,且其他计算设备的数量为(n-1),其他计算设备中每个计算设备分别训练DNN得到n部分的参数数据。第x部分的参数数据的第一聚合结果是由计算设备和其他计算设备中的第x部分的参数数据聚合得到的。
相应的,第二报文中的参数数据包括第x部分的参数数据的第二聚合结果,第x部分的参数数据的第二聚合结果是由第一局部逻辑环网拓扑中的第x部分的参数数据的第一聚合结果和其他局部逻辑环网拓扑中的第x部分的参数数据的第一聚合结果聚合得到的。其中,不同局部逻辑环网拓扑中用于训练DNN模型的计算设备的数量相同。
也就是说,在多个计算设备构成一个局部逻辑环网拓扑的情况下,网卡所发送的第一报文中的参数数据即为某一部分的参数数据的第一聚合结果,以使网络设备聚合不同局部逻辑环网拓扑的参数数据。网卡所接收的第二报文中的参数数据即为相应部分的参数数据的第二聚合结果,以得到不同局部逻辑环网拓扑的参数数据。
在一种可能的设计中,若第一报文为首次发送的报文,则第一报文属于N条消息中的任意一个报文,N为大于1的正整数。或者,若第一报文为非首次发送的报文,且已接收到的第三报文是由属于第k个消息索引的消息中的报文聚合得到的,第k个消息索引用于索引第k条消息,则第一报文属于第(N+k)条消息中的任意一个报文,k为正整数。也就是说,当前网卡采用滑窗机制向网络设备发送报文。网络设备中始终能够缓存N条消息的参数数据,也就使得网络设备能够持续性地进行聚合运算,保证聚合运算效率。
在一种可能的设计中,第一报文的报文头报文头与第二报文的报文头报文头相同,第二报文的参数数据是由属于具有同一消息索引的报文的参数数据聚合得到的。
第三方面,本申请实施例提供一种通信方法,该方法包括:第i个计算设备训练DNN模型,得到n部分的参数数据。在第j次迭代中,第i个计算设备向第(i+1)个计算设备发送第(x+i-j+1)部分的参数数据经过(j-1)次迭代的聚合处理结果;第i个计算设备接收来自第(i-1)个计算设备的第(x+i-j)部分的参数数据经过(j-1)次迭代的聚合处理结果,并与自身的第(x+i-j)部分的数据聚合,得到第(x+i-j)部分的参数数据经过j次迭代的聚合处理结果,以在第(j+1)次迭代中,第i个计算设备向第(i+1)个计算设备发送第(x+i-j)部分的参数数据经过j次迭代的聚合处理结果,直至j遍历1至(n-1),得到第(x+i+1)部分的第一聚合结果。
其中,i、j和x均为正整数,且1≤i≤n,1≤x≤n;第(i-1)个计算设备、第i个计算设备和第(i+1)个计算设备均分布于第一局部逻辑环网拓扑;第一局部逻辑环网拓扑中的n个计算设备顺次相连,且n个计算设备中首个计算设备和n个计算设备中尾个计算设备相连;若i-1<1,则用(i-1+n)替换(i-1);若i+1>n,则用(i+1-n)替换(i+1);若x+i-j<1,则用(x+i-j+n)替换(x+i-j);若x+i-j+1>n,则用(x+i-j+1-n)替换(x+i-j+1);n为正整数,且n≥2。这里,不同计算设备之间通过总线传输数据,n个计算设备通过总线构成第一局部逻辑环网拓扑。
本申请实施例提供的通信方法,不同计算设备之间也存在数据传输,且不同的计算设备均能够执行数据传输处理,以充分利用不同计算设备的资源,提高聚合处理的运算效率,避免现有技术中某一个计算设备的运算量过大的问题。
第四方面,本申请实施例提供一种通信方法,该方法包括:第i个计算设备接收来自网卡的第(x+i-j+1)部分的参数数据的第二聚合结果。其中,(x+i-j+1)部分的参数数据的第二聚合结果是由第一局部逻辑环网拓扑中的(x+i-j+1)部分的参数数据的第一聚合结果和其他局部逻辑环网拓扑中的(x+i-j+1)部分的参数数据的第一聚合结果聚合得到的;第(x+i-j+1)部分的参数数据的第一聚合结果是由第一局部逻辑环网拓扑中n个计算设备中的第(x+i-j+1)部分的参数数据聚合得到的。
在第j次迭代中,第i个计算设备向第(i+1)个计算设备发送第(x+i-j+1)部分的参数数据的第二聚合结果;第i个计算设备接收来自第(i-1)个计算设备的第(x+i-j)部分的参数数据的第二聚合结果,将第(x+i-j)部分的参数数据的第二聚合结果替换自身的第(x+i-j)部分的数据,以在第(j+1)次迭代中,第i个计算设备向第(i+1)个计算设备发送第(x+i-j)部分的参数数据的第二聚合结果,直至j遍历1至(n-1),得到第(x+i+1)部分的第二聚合结果。其中,i、j和x均为正整数,且1≤i≤n,1≤x≤n;第(i-1)个计算设备、第i个计算设备和第(i+1)个计算设备均分布于第一局部逻辑环网拓扑;第一局部逻辑环网拓扑中的n个计算设备顺次相连,且n个计算设备中首个计算设备和n个计算设备中尾个计算设备相连;若i-1<1,则用(i-1+n)替换(i-1);若i+1>n,则用(i+1-n)替换(i+1);若x+i-j<1,则用(x+i-j+n)替换(x+i-j);若x+i-j+1>n,则用(x+i-j+1-n)替换(x+i-j+1);n为正整数,且n≥2。
本申请实施例提供的通信方法,不同计算设备之间也存在数据传输,且不同的计算设备均能够执行数据替换处理,以充分利用不同计算设备的资源,提高聚合处理的运算效率,避免现有技术中某一个计算设备的运算量过大的问题。
第五方面,本申请实施例提供一种终端设备,该终端设备包括:网卡和n个计算设备。 网卡用于执行如上述第二方面或第二方面中任一项的通信方法。n个计算设备顺次相连,且n个计算设备中首个计算设备和n个计算设备中尾个计算设备相连,构成局部逻辑环网拓扑。n个计算设备中任意相邻的三个计算设备中的第二个计算设备用于执行如上述第三方面或第四方面的通信方法。n为正整数,且n≥2。
第六方面,本申请实施例提供一种通信装置,该通信装置包括:用于执行上述任一方面中各个步骤的单元。该通信装置可以为上述第一方面中的网络设备,或者包含上述网络设备的装置;或者,该通信装置可以为上述第二方面中的网卡,或者包含上述网卡的装置;或者,该通信装置可以为上述第三方面中的计算设备,或者包含上述计算设备的装置;或者,该通信装置可以为上述第四方面中的计算设备,或者包含上述计算设备的装置;或者,该通信装置可以为上述第五方面中的终端设备,或者包含上述终端设备的装置。
第七方面,本申请实施例提供一种通信装置,包括处理器和接口电路,处理器用于通过接口电路与其它装置通信,并执行以上任一方面提供的通信方法。该处理器包括一个或多个。该通信装置可以为上述第一方面中的网络设备,或者包含上述网络设备的装置;或者,该通信装置可以为上述第二方面中的网卡,或者包含上述网卡的装置;或者,该通信装置可以为上述第三方面中的计算设备,或者包含上述计算设备的装置;或者,该通信装置可以为上述第四方面中的计算设备,或者包含上述计算设备的装置;或者,该通信装置可以为上述第五方面中的终端设备,或者包含上述终端设备的装置。
第八方面,本申请实施例提供一种通信装置,包括处理器,用于与存储器相连,用于调用存储器中存储的程序,以执行任一方面提供的通信方法。该存储器可以位于该通信装置之内,也可以位于该通信装置之外。且该处理器包括一个或多个。该通信装置可以为上述第一方面中的网络设备,或者包含上述网络设备的装置;或者,该通信装置可以为上述第二方面中的网卡,或者包含上述网卡的装置;或者,该通信装置可以为上述第三方面中的计算设备,或者包含上述计算设备的装置;或者,该通信装置可以为上述第四方面中的计算设备,或者包含上述计算设备的装置;或者,该通信装置可以为上述第五方面中的终端设备,或者包含上述终端设备的装置。
第九方面,本申请实施例提供一种通信装置,包括至少一个处理器和至少一个存储器,所述至少一个处理器用于执行以上任一方面提供的通信方法。该通信装置可以为上述第一方面中的网络设备,或者包含上述网络设备的装置;或者,该通信装置可以为上述第二方面中的网卡,或者包含上述网卡的装置;或者,该通信装置可以为上述第三方面中的计算设备,或者包含上述计算设备的装置;或者,该通信装置可以为上述第四方面中的计算设备,或者包含上述计算设备的装置;或者,该通信装置可以为上述第五方面中的终端设备,或者包含上述终端设备的装置。
第十方面,本申请实施例提供一种计算机可读存储介质,该计算机可读存储介质中存储有指令,当其在计算机上运行时,使得计算机可以执行上述任一方面中任一项的通信方法。
第十一方面,本申请实施例提供一种包含指令的计算机程序产品,当其在计算机上运行时,使得计算机可以执行上述任一方面中任一项的通信方法。
第十二方面,本申请实施例提供一种电路系统,电路系统包括处理电路,处理电路被 配置为执行如上述任一方面中任一项的通信方法。
第十三方面,本申请实施例提供一种芯片,芯片包括处理器,处理器和存储器耦合,存储器存储有程序指令,当存储器存储的程序指令被处理器执行时实现上述任一方面任意一项的通信方法。
第十四方面,本申请实施例提供一种通信系统,通信系统包括上述各个方面中任一方面中的网络设备和任一方面中的终端设备,或者,通信系统包括上述各个方面中任一方面中的网络设备和网卡,或者,通信系统包括上述各个方面中任一方面中的网络设备、网卡和任一方面中的计算设备。
其中,第二方面至第十四方面中任一种设计方式所带来的技术效果可参见第一方面中不同设计方式所带来的技术效果,此处不再赘述。
图1为相关技术提供的一种深度神经网络的示意图;
图2为相关技术提供的一种分布式DNN训练方法的流程示意图;
图3为相关技术提供的又一种分布式DNN训练的系统架构示意图;
图4为相关技术提供的环全规约的第一阶段的的流程示意图;
图5为相关技术提供的环全规约的第二阶段的的流程示意图;
图6为本申请实施例提供的一种通信系统架构图;
图7为本申请实施例提供的一种终端设备的结构示意图;
图8为本申请实施例提供的一种通信方法的流程示意图;
图9为本申请实施例提供的再一种通信方法的流程示意图;
图10为本申请实施例提供的一种消息切分后的报文的结构示意图;
图11为本申请实施例提供的又一种消息切分后的报文的结构示意图;
图12为本申请实施例提供的再一种通信方法的流程示意图;
图13为本申请实施例提供的再一种通信方法的流程示意图;
图14为本申请实施例提供的再一种通信方法的流程示意图;
图15为本申请实施例提供的再一种通信方法的流程示意图;
图16为本申请实施例提供的再一种通信方法的流程示意图;
图17为本申请实施例提供的再一种通信方法的流程示意图;
图18为本申请实施例提供的又一种通信系统架构图;
图19为本申请实施例提供的又一种通信方法的流程示意图;
图20为相关技术提供的又一种分布式DNN训练方法的过程示意图;
图21为本申请实施例提供的又一种通信方法的流程示意图;
图22为本申请实施例提供的又一种通信方法的流程示意图;
图23为本申请实施例提供的又一种通信方法的过程示意图;
图24为本申请实施例提供的又一种通信方法的过程示意图;
图25为本申请实施例提供的又一种通信方法的过程示意图;
图26为本申请实施例提供的又一种通信方法的流程示意图;
图27为本申请实施例提供的一种通信装置的组成示意图;
图28为本申请实施例提供的一种通信装置的硬件结构示意图。
本申请的说明书以及附图中的术语“第一”和“第二”等是用于区别不同的对象,或者用于区别对同一对象的不同处理,而不是用于描述对象的特定顺序。此外,本申请的描述中所提到的术语“包括”和“具有”以及它们的任何变形,意图在于覆盖不排他的包含。例如包含了一系列步骤或单元的过程、方法、系统、产品或设备没有限定于已列出的步骤或单元,而是可选地还包括其他没有列出的步骤或单元,或可选地还包括对于这些过程、方法、产品或设备固有的其它步骤或单元。需要说明的是,本申请实施例中,“示例性地”或者“例如”等词用于表示作例子、例证或说明。本申请实施例中被描述为“示例性地”或者“例如”的任何实施例或设计方案不应被解释为比其它实施例或设计方案更优选或更具优势。确切而言,使用“示例性地”或者“例如”等词旨在以具体方式呈现相关概念。
为了使得本申请更加的清楚,首先对本申请提到的部分概念和处理流程作简单介绍。
1、神经网络
神经网络(neural network,NN)可以是由虚拟的神经元组成的,一个虚拟的神经元可以是一个运算单元。对于一个运算单元而言,其输入可以为:x
s+b,其输出可以为:
其中,s=1、2、......k,k为大于1的正整数;W
s是x
s的权重;b为该虚拟的神经元的偏置。f为该虚拟的神经元的激活函数(activation functions),用于将非线性特性引入神经网络中,以使虚拟的神经元中的输入信号转换为输出信号,例如,激活函数可以是sigmoid函数。激活函数的输出信号可以作为下一层的输入。
神经网络是将多个上述单一的虚拟的神经元联结在一起形成的网络,即一个虚拟的神经元的输出可以是另一个虚拟的神经元的输入。
2、深度神经网络(deep neural network,DNN)
深度神经网络,也称多层神经网络,可以理解为具有多层隐含层的神经网络。按照不同层的位置对DNN模型进行划分,DNN模型内部的神经网络可以分为三类:输入层,隐含层,输出层。一般来说,第一层是输入层,最后一层是输出层,中间的层数都是隐含层。不同层的虚拟的神经元之间存在连接。虚拟的神经元之间的连接分配随机数值或“权重(weights)”。示例性地,图1示出了一种DNN模型,在图1所示的DNN模型中,层(layer)与层之间的连接是全连接的。在图1中,一个圆圈表示一个虚拟的神经元。斜线填充的圆圈表示输入层的虚拟的神经元,无填充的圆圈表示隐含层的虚拟的神经元,竖线填充的圆圈表示输出层的虚拟的神经元,网格线填充的圆圈表示偏置节点。第x层的任意一个虚拟的神经元一定与第(x+1)层的每一个虚拟的神经元相连。
DNN模型中的参数数据定义如下:第L-1层的第k个虚拟的神经元到第L层的第j个虚拟的神经元的系数定义为
示例性地,在一个三层的DNN模型中,第二层的第4个虚拟的神经元到第三层的第2个虚拟的神经元的线性系数定义为
上标3代表系数W所在的层数,而下标对应的是输出的第三层索引2和输入的第二层索引4。
需要注意的是,输入层是没有W参数数据的。在深度神经网络中,更多的隐含层让深度神经网络更能够刻画现实世界中的复杂情形。理论上而言,参数数据越多的DNN模型复杂度越高,“容量”也就越大,也就意味着它能完成更复杂的学习任务。训练DNN模型的过程也就是学习权重矩阵的过程,其最终目的是得到最优的深度神经网络的所有层的权重矩阵。权重即为DNN模型的参数数据。
然而,通常DNN模型的训练过程耗时极长,其原因包括但不限于如下三项:
第一,典型DNN模型的参数数据量大(如包含近2亿个参数数据,参数数据量超过500MB),训练一个DNN模型可能需要几天时间。
第二,为了提高DNN模型的精确度,训练数据也很庞大。以常用的ImageNet训练集作为训练数据,且批尺寸(batch size)等于32为例,由于ImageNet训练集包括14,197,122张图片,则一个训练纪元(epoch)要执行443,661步训练迭代(step)。
第三,在DNN模型应用于实时性要求较高的应用(如自动驾驶)时,需周期性地再训练DNN模型的参数数据。
由于DNN模型的参数数据训练过程耗时长,通过高效的并行分布式DNN训练方法来缩短训练时间就显得十分重要。目前,常见的两种分布式DNN训练方法如下:
第一种,基于参数服务器(parameter server,PS)-计算节点(worker)架构的分布式DNN训练方法
参见图2,在图2中,一个粗线方框表示一个参数服务器。粗线方框内的一个方格表示一个数据块。基于PS-worker架构的分布式DNN训练方法的处理过程包括:首先,p个计算节点(图2中仅示出了3个计算节点,即计算节点1、计算节点2和计算节点3)分别将本地训练得到的参数梯度Δw上传回PS。其中,p为大于1的正整数。例如,在图2中,计算节点1基于训练数据1得到Δw
1,计算节点1向PS返回Δw
1;计算节点2基于训练数据2得到Δw
2,计算节点2向PS返回Δw
2;计算节点3基于训练数据3得到Δw
3,计算节点3向PS返回Δw
3。然后,在PS端进行参数聚合,得到新的参数数据w′。在实际应用中,w′、Δw和w之间可以满足如下关系:w′=w-μ·Δw=w-μ·(Δw
1+Δw
2+Δw
3)。其中,w′是更新后的参数数据,w是更新前的参数数,μ是系数。如此完成一轮的迭代。若进行新一轮的迭代,则PS再将新得到的参数w′下发给p个计算节点中的各个计算节点,以进行新一轮的迭代。上述整个通信过程可以主要分为两个步骤:步骤一:向上汇聚,所有计算节点向PS传输参数数据的梯度,如Δw
1、Δw
2或Δw
3,以使PS端进行参数数据聚合;步骤二:向下分发,PS向所有计算节点分发更新后的参数数据,如w′。
由此可知,在p个计算节点分别与同一个参数服务器进行的一次DNN模型的参数数据的交互过程中,对于一个计算节点而言,所需传输的数据量是DNN模型的参数数据量的2倍;对于参数服务器而言,所需传输的数据量是DNN模型的参数数据量的2p倍。进一步地,为了解决单个参数服务器的通信瓶颈问题,采用多个参数服务器实现上述单个参数服务器的功能。此种情况下,参数服务器和计算节点在数量上的比例难以确定。进一步地,若配置的参数服务器和计算节点的比例不合理,则出现资源闲置的情况,导致资源浪费。
第二种,环全规约
全规约(all-reduce)操作是对跨进程的数据进行约简,并将同样的结果写入每个进程。在全局逻辑环网拓扑上实现全规约操作,即可描述为环全规约。参见图3,在具体实现的过程中,一个计算节点的进程将数据块发送到全局逻辑环网拓扑上的下一个相邻计算节点的进程,与此同时,该计算节点接收来自全局逻辑环网拓扑上的上一个相邻计算节点的进程发送的另一数据块。在图3中,计算节点0、计算节点1、计算节点2和计算节点3构成全局逻辑环网拓扑。在图3中,带箭头的虚线表示一个数据块在逻辑流程上的传输方向。 例如,计算节点0与计算节点1之间的带箭头的虚线表示计算节点0向计算节点1传输数据块。该数据块由计算节点0传输至网络设备(如计算节点0与网络设备之间的带箭头的实线所示),再由网络设备传输至计算节点2(如网络设备与计算节点1之间的带箭头的点划线所示)。其他计算节点之间的传输状况可以此类推。这里,多个计算节点通过网络设备传输数据,多个计算节点通过网络设备构成一个全局逻辑环网拓扑。
参见图4中的(a),一个计算节点包括一个计算设备(device,DEV)。其中,计算设备可以是图形处理器(graphics processing unit,GPU)。
计算节点0上的计算设备记为DEV0,计算节点1上的计算设备记为DEV1,计算节点2上的计算设备记为DEV2,计算节点3上的计算设备记为DEV3。不同的计算节点基于不同的训练数据,分别进行一次训练,各自得到DNN模型的参数数据。在图4中的(a)中,DNN模型的相同部分(如同一层)的参数数据可以采用相同的字母标识,如DNN模型的参数数据包括不同层的权重向量。数据块a中的参数数据可以是第四层的权重向量,数据块b中的参数数据可以是第三层的权重向量,数据块c中的参数数据可以是第二层的权重向量,数据块d中的参数数据可以是第一层的权重向量。如此,DEV0得到的DNN模型的参数数据可以分为四个数据块,四个数据块中的参数数据分别记为:a0、b0、c0和d0。DEV1得到的DNN模型的参数数据可以分为四个数据块,四个数据块中的参数数据分别记为:a1、b1、c1和d1。DEV2得到的DNN模型的参数数据可以分为四个数据块,四个数据块中的参数数据分别记为:a2、b2、c2和d2。DEV3得到的DNN模型的参数数据可以分为四个数据块,四个数据块中的参数数据分别记为:a3、b3、c3和d3。DEV0向DEV1传输的数据块中的参数数据为:a0。DEV1向DEV2传输的数据块中的参数数据为:b1。DEV2向DEV3传输的数据块中的参数数据为:c2。DEV3向DEV0传输的数据块中的参数数据为:d3。
全规约的实现过程包括两个阶段:分散-规约(scatter-reduce)和全收集(all-gather)。假设共有p个计算节点,每个计算节点有一个计算设备DEV,一个DEV执行一个进程。
在分散-规约阶段,经过(p-1)个步骤,最终每个DEV最终都具有部分聚合的数据。在一个计算节点采用一个DEV进行DNN模型训练的情况下,p也表示计算设备的数量。
示例性地,在第一个步骤中,参见图4中的(a),DEV0向DEV1传输的数据块中的参数数据为:a0。DEV1向DEV2传输的数据块中的参数数据为:b1。DEV2向DEV3传输的数据块中的参数数据为:c2。DEV3向DEV0传输的数据块中的参数数据为:d3。如此,参见图4中的(b),DEV0得到的四个数据块中的参数数据分别记为:a0、b0、c0、(d0+d3)。其中,(d0+d3)表示一个数据块中的参数数据,且该数据块中的参数数据是由参数数据“d0”和参数数据“d3”聚合得到的。DEV1得到的四个数据块中的参数数据分别记为:(a1+a0)、b1、c1、d1。其中,(a1+a0)表示一个数据块中的参数数据,且该数据块中的参数数据是由参数数据“a1”和参数数据“a0”聚合得到的。DEV2得到的四个数据块中的参数数据分别记为:a2、(b2+b1)、c2、d2。其中,(b2+b1)表示一个数据块中的参数数据,且该数据块中的参数数据是由参数数据“b2”和参数数据“b1”聚合得到的。DEV3得到的四个数据块中的参数数据分别记为:a3、b3、(c3+c2)、d3。其中,(c3+c2)表示一个数据块中的参数数据,且该数据块中的参数数据是由参数数据“c3”和参数数据“c2”的聚合得到的。
在第二个步骤中,参见图4中的(b),DEV0向DEV1传输的数据块中的参数数据为 (d0+d3)。DEV1向DEV2传输的数据块中的参数数据为(a1+a0)。DEV2向DEV3传输的数据块中的参数数据为(b2+b1)。DEV3向DEV0传输的数据块中的参数数据为(c3+c2)。如此,参见图4中的(c),DEV0得到的四个数据块中的参数数据分别记为:a0、b0、(c0+c3+c2)、(d0+d3)。DEV1得到的四个数据块中的参数数据分别记为:(a1+a0)、b1、c1、(d1+d0+d3)。DEV2得到的四个数据块中的参数数据分别记为:(a2+a1+a0)、(b2+b1)、c2、d2。DEV3得到的四个数据块中的参数数据分别记为:a3、(b3+b2+b1)、(c3+c2)、d3。
在第三个步骤中,参见图4中的(c),DEV0向DEV1传输的数据块中的参数数据为(c0+c3+c2)。DEV1向DEV2传输的数据块中的参数数据为(d1+d0+d3)。DEV2向DEV3传输的数据块中的参数数据为(a2+a1+a0)。DEV3向DEV0传输的数据块中的参数数据为(b3+b2+b1)。如此,参见图4中的(d),DEV0得到的四个数据块中的参数数据分别记为:a0、(b0+b3+b2+b1)、(c0+c3+c2)、(d0+d3)。DEV1得到的四个数据块中的参数数据分别记为:(a1+a0)、b1、(c1+c0+c3+c2)、(d1+d0+d3)。DEV2得到的四个数据块中的参数数据分别记为:(a2+a1+a0)、(b2+b1)、c2、(d2+d1+d0+d3)。DEV3得到的四个数据块中的参数数据分别记为:(a3+a2+a1+a0)、(b3+b2+b1)、(c3+c2)、d3。
也就是说,经过三个步骤,每个DEV最终都具有部分聚合的数据,即四个数据块中某一个数据块所对应的部分聚合的结果。在图4中的(d)中,具有部分聚合的结果的数据块可以由图4中的(d)中的粗线方框表示。
在全收集阶段,经过(p-1)次迭代,每个DEV都包含所有聚合的数据,以完整的聚合的数据结束。
示例性地,在第一个步骤中,参见图5中的(a),DEV0向DEV1传输的数据块中的参数数据为:b0+b3+b2+b1。DEV1向DEV2传输的数据块中的参数数据为:c1+c0+c3+c2。DEV2向DEV3传输的数据块中的参数数据为:d2+d1+d0+d3。DEV3向DEV0传输的数据块中的参数数据为:a3+a2+a1+a0。如此,参见图5中的(b),DEV0得到的四个数据块中的参数数据分别记为:(a3+a2+a1+a0)、(b0+b3+b2+b1)、(c0+c3+c2)、(d0+d3)。DEV1得到的四个数据块中的参数数据分别记为:(a1+a0)、(b0+b3+b2+b1)、(c1+c0+c3+c2)、(d1+d0+d3)。DEV2得到的四个数据块中的参数数据分别记为:(a2+a1+a0)、(b2+b1)、(c1+c0+c3+c2)、(d2+d1+d0+d3)。DEV3得到的四个数据块中的参数数据分别记为:(a3+a2+a1+a0)、(b3+b2+b1)、(c3+c2)、(d2+d1+d0+d3)。
在第二个步骤中,参见图5中的(b),DEV0向DEV1传输的数据块中的参数数据为(a3+a2+a1+a0)。DEV1向DEV2传输的数据块中的参数数据为(b0+b3+b2+b1)。DEV2向DEV3传输的数据块中的参数数据为(c1+c0+c3+c2)。DEV3向DEV0传输的数据块中的参数数据为(d2+d1+d0+d3)。如此,参见图5中的(c),DEV0得到的四个数据块中的参数数据分别记为:(a3+a2+a1+a0)、(b0+b3+b2+b1)、(c0+c3+c2)、(d2+d1+d0+d3)。DEV1得到的四个数据块中的参数数据分别记为:(a3+a2+a1+a0)、(b0+b3+b2+b1)、(c1+c0+c3+c2)、(d1+d0+d3)。DEV2得到的四个数据块中的参数数据分别记为:(a2+a1+a0)、(b0+b3+b2+b1)、(c1+c0+c3+c2)、(d2+d1+d0+d3)。DEV3得到的四个数据块中的参数数据分别记为:(a3+a2+a1+a0)、(b3+b2+b1)、(c1+c0+c3+c2)、(d2+d1+d0+d3)。
在第三个步骤中,参见图5中的(c),DEV0向DEV1传输的数据块中的参数数据为(d2+d1+d0+d3)。DEV1向DEV2传输的数据块中的参数数据为(a3+a2+a1+a0)。DEV2 向DEV3传输的数据块中的参数数据为(b0+b3+b2+b1)。DEV3向DEV0传输的数据块中的参数数据为(c1+c0+c3+c2)。如此,参见图5中的(d),DEV0、DEV1、DEV2和DEV3得到的四个数据块中的参数数据分别记为:(a3+a2+a1+a0)、(b0+b3+b2+b1)、(c1+c0+c3+c2)、(d2+d1+d0+d3)。
也就是说,经过三个步骤,每个DEV最终都具有全部聚合的数据,即四个数据块中不同数据块所对应的部分聚合的结果,具体如图5中的(d)所示。
由此可知,假设DNN模型的参数数据的数据量大小为M,对于p个DEV中每个DEV而言,完成一个步骤所需传输的数据量M/p;若p个DEV完成一次环全规约处理,则对于p个DEV中每个DEV而言,所需传输的数据量2(p-1)M/p,即DNN模型的参数数据量的2(p-1)/p倍。在DEV的数量庞大时,若p个DEV完成一次环全规约处理,则对于p个DEV中每个DEV而言,所需传输的数据量接近DNN模型的参数数据量的2倍。
综上,DEV所需传输的数据量始终大于DNN模型的参数数据量。相对于DNN模型的参数数据量而言,通信网络中始终传输了额外的数据量。由于DNN模型的参数数据量庞大,往往高达数百兆,因此,DNN模型的参数数据的传输容易受到通信网络的网络带宽限制,通信时延大。
有鉴于此,本申请实施例提供了一种通信方法,首先对本申请实施例通信方法所适用的通信系统进行说明。参见图6,该通信系统包括网络设备和多个终端设备(图6中仅示出了4个终端设备)。其中,每个终端设备通过有线方式或无线方式与网络设备连接,每个终端设备均能够与网络设备通信。多个终端设备通过网络设备组成一个全局逻辑环网拓扑。在多个终端设备组成的全局逻辑环网拓扑上,参数数据可以沿顺时针方向传输,也可以沿逆时针方向传输。
需要说明的是,对于一个全局逻辑环网拓扑的每个终端设备,在任何一个传输方向上均存在一个上游相邻终端设备和一个下游相邻终端设备。例如,在图6所示的全局逻辑环网拓扑中,在顺时针方向上,终端设备0的上游相邻终端设备终端设备为终端设备终端设备3,终端设备终端设备0的下游相邻终端设备终端设备为终端设备终端设备1。
其中,网络设备可以为具有报文转发功能、缓存资源和针对存储的数据执行写、读、删除和加法等功能的网络节点,如交换机,路由器等。这里,在本申请实施例通信方法应用于数据中心网络时,交换机可以是柜上(top on rack,TOR)交换机,也可以是核心(spine)交换机。
其中,终端设备可以为分布式DNN训练网络中的终端设备。终端设备能够对基于分配的训练数据,执行DNN模型的训练过程。
以图7中示出的终端设备700为例,详细说明适用于本申请实施例提供的终端设备。
如图7所示,终端设备700包括一个或多个计算设备,如计算设备701和/或计算设备707,至少一个通信接口,如通信接口704,网卡708,以及总线702。可选的,终端设备700还可以包括存储器703。下面以计算设备701为例进行说明。
计算设备701可以是一个通用中央处理器(central processing unit,CPU),图形处理器(graphic processing unit,GPU)、神经网络处理单元(neural network processing unit,NPU),微处理器,专用集成电路(application-specific integrated circuit,ASIC),现场可编程门阵列(field programmable gate array,FPGA),或一个或多个集成了多种处理电路功能(如 CPU+ASIC)的集成电路。
总线702用于连接不同组件。
通信接口704,可以是收发电路,用于与其他设备或通信网络通信,如云计算网络、以太网,无线接入网(radio access network,RAN),无线局域网(wireless local area networks,WLAN)等。例如,所述收发电路可以是收发器、收发机一类的装置。可选的,所述通信接口704也可以是计算设备701的输入/输出(input/output,I/O)电路,用以实现计算设备701的信号输入和信号输出。
存储器703可以是具有存储功能的装置。例如可以是只读存储器(read-only memory,ROM)或可存储静态信息和指令的其他类型的静态存储设备,随机存取存储器(random access memory,RAM)或者可存储信息和指令的其他类型的动态存储设备,也可以是电可擦可编程只读存储器(electrically erasable programmable read-only memory,EEPROM)、只读光盘(compact disc read-only memory,CD-ROM)或其他光盘存储、光碟存储(包括压缩光碟、激光碟、光碟、数字通用光碟、蓝光光碟等)、磁盘存储介质或者其他磁存储设备、或者能够用于携带或存储具有指令或数据结构形式的期望的程序代码并能够由计算机存取的任何其他介质,但不限于此。存储器703可以是独立存在,并通过总线702与计算设备701相连接。当然,存储器703也可以和计算设备701集成在一起。
其中,存储器703用于存储执行本申请方案的计算机执行指令,并由计算设备701来控制执行。计算设备701用于读取并执行存储器703中存储的计算机指令(如用于CPU)或者配置文件(如用于FPGA),从而实现本申请实施例提供的通信方法。
网卡708又称为网络适配器或网络接口卡(network interface card,NIC),用于将待传递的数据转换为网络上其它设备能够识别的格式,以实现终端设备的联网功能。
或者,可选的,本申请实施例中,也可以是计算设备701执行本申请下述实施例提供的通信方法中的相关处理功能,通信接口704负责与其他设备或通信网络通信,本申请实施例对此不作具体限定。
可选的,本申请实施例中的计算机执行指令也可以称之为应用程序代码,本申请实施例对此不作具体限定。
在具体实现中,作为一种实施例,终端设备700也可以包括多个计算设备,例如图7中的计算设备701和计算设备707。这些计算设备中的每一个可以是一个单核(single-core)处理器,也可以是一个多核(multi-core)处理器。
在具体实现中,作为一种实施例,终端设备700还可以包括输出设备705和输入设备706。输出设备705和计算设备701通信,可以以多种方式来输出信息。例如,输出设备705可以是触摸屏,液晶显示器(liquid crystal display,LCD),发光二级管(light emitting diode,LED)显示设备,阴极射线管(cathode ray tube,CRT)显示设备,投影仪(projector),或打印机(printer)等。输入设备706和计算设备701通信,可以以多种方式接收用户的输入。例如,输入设备706可以是鼠标、键盘、触摸屏设备或传感设备等。
上述终端设备700可以是台式机、网络服务器、无线终端设备、嵌入式设备、或具有图7中类似结构的单一设备。当然,上述终端设备700也可以是设置于上述各单一设备内部的软件和/或硬件实体,如用于执行本申请实施例提供的通信方法的芯片或芯片系统。本申请实施例不限定终端设备700的类型。
应理解,图7仅为便于理解而示例的简化示意图,终端设备中还可以包括其他组件、电路或装置,图7中均未予以画出。
需要说明的是,一个终端设备作为一个计算节点。一个终端设备可以包括一个计算设备,也可以包括多个计算设备。
本申请实施例描述的通信系统以及业务场景是为了更加清楚的说明本申请实施例的技术方案,并不构成对于本申请实施例提供的技术方案的限定。
下面对本申请实施例提供的通信方法进行具体阐述。
本申请实施例提供一种通信方法,该通信方法应用在分布式DNN训练过程中。参见图8,该通信方法包括如下步骤:
S800、至少两个终端设备中每个终端设备分别将相同DNN模型的相同位置的参数数据封装为报文。
示例性地,在图8中,以两个终端设备为例进行说明,两个终端设备记为终端设备1和终端设备2。
其中,关于“相同DNN模型的相同位置的参数数据”的具体说明如下:
在DNN训练过程中,终端设备的DEV基于分配的训练数据和DNN模型的参数数据,得到当前DNN模型的预测值。因为希望DNN模型的预测值尽可能的接近真正想要的目标值,所以终端设备的DEV通过比较当前DNN模型的预测值和真正想要的目标值,再根据两者之间的差异情况来更新每一层的权重向量。例如,如果当前DNN模型的预测值偏高,就调整每一层的权重向量,以使调整后的DNN模型的预测值降低。如此,通过不断地调整DNN模型的每一层的权重向量,直到DNN模型能够预测出真正想要的目标值或与真正想要的目标值非常接近的值。
进一步地,在分布式DNN训练过程中,为了缩短训练时间,至少两个终端设备中不同的终端设备分配不同的训练数据。对于至少两个终端设备中的每个终端设备而言,一个终端设备的DEV基于分配的训练数据,经过一次训练,得到DNN模型的参数数据。不同终端设备基于不同的训练数据即可得到不同的DNN模型的参数数据。将不同的DNN模型的参数数据聚合处理,再分配给至少两个终端设备中的不同的终端设备,以使各个终端设备上的DEV执行下一次训练。
这里,“相同DNN模型的相同位置的参数数据”具体是指:不同的终端设备的DEV基于不同的训练数据,执行相同次数(如1次)的训练过程,得到的DNN模型的参数数据。并且,由于DNN模型的参数数据中的每个数据即为一个权重,如权重
即为第L-1层的第k个神经元到第L层的第j个神经元的权重。相同DNN模型的相同位置的参数数据是指:在不同DEV得到的不同的DNN模型的参数数据中,基于相同的L、k和j的取值所确定的权重。如此,相同DNN模型的相同位置的参数数据可以是指一层的权重向量的部分取值,也可以是指一层的权重向量,还可以是指多层的权重向量。
对于至少两个终端设备的每个终端设备而言,都将DNN模型的参数数据封装为报文。下面,以至少两个终端设备中的任意一个终端设备为例,对“DNN模型的参数数据封装为报文”的具体实现过程进行说明。为了方便描述,将至少两个终端设备中的任意一个终端设备描述为“第一终端设备”,参见图9,“DNN模型的参数数据封装为报文”的具体实现过程包括如下步骤:
S8000、第一终端设备训练DNN模型,得到DNN模型的参数数据。
具体地,第一终端设备基于分配的训练数据,执行一次训练,得到DNN模型的参数数据。
S8001、第一终端设备按照消息的大小,将DNN模型的参数数据切分为消息。
其中,消息是指两个及以上终端设备之间互相传输的消息,且一条消息包括一个或多个报文,报文中携带DNN模型的参数数据。示例性地,消息可以是RDMA连接中所传输的消息。消息也可以是数据切片(slice),如英伟达集合通信库(nvidia collective communication library,NCCL)中在应用层实施的数据切片。
其中,切分后的消息的数量至少为一条。一条消息包括预设字段和参数数据。参数数据是DNN模型的参数数据。预设字段包括第一字段、第二字段和第三字段,如图10中的(a)所示,或预设字段包括第一字段、第二字段、第三字段和第四字段,如图11中的(a)所示。其中,关于四个字段的介绍说明如下:
第一字段用于指示对该消息中的参数数据执行聚合处理。例如,在第一字段的取值为默认的某一数值的情况下,第一字段指示第一网络设备对该消息的参数数据执行聚合处理;在第一字段的取值不是默认的数值的情况下,第一字段指示第一网络设备无需对该消息的参数数据执行聚合处理。又例如,在第一字段存在的情况下,第一字段指示第一网络设备对该消息的参数数据执行聚合处理;在第一字段不存在的情况下,第一字段指示第一网络设备无需对该消息的参数数据执行聚合处理。如此,第一网络设备能够快速、有效地识别出待聚合处理的报文和无需聚合处理的报文,保证聚合处理效率,也使得第一网络设备快速转发无需聚合处理的报文。示例性地,第一字段可以记为InetTag。
第二字段用于承载该消息的消息索引。示例性地,第二字段可以记为MsgID。这里,在第一终端设备与其他终端设备通过一个通道传输数据的情况下,在第一终端设备中,不同的消息所对应的消息索引不同。在至少两个终端设备中,具有同一消息索引的消息分布于至少两个终端设备中的每个终端设备中。在第一终端设备与其他终端设备通过z个通道传输数据的情况下,在第一终端设备中,通过同一通道所传输的不同的消息所对应的消息索引不同且通道标识相同;通过不同通道所传输的不同的消息所对应的通道标识不同。通过不同通道所传输的不同的消息所对应的消息索引可以相同,也可以不同。其中,z为正整数,且z>1。在至少两个终端设备中,对应同一通道标识的消息分布于至少两个终端设备中的每个终端设备中。其中,关于通道标识可以参见第四字段的解释说明。
第三字段用于承载该消息所包括报文的报文数量。示例性地,第三字段可以记为MsgLen。
第四字段用于承载通道标识。其中,通道标识用于标识传输第四字段所在报文的通道。在第一网络设备执行聚合处理时,第一网络设备即可通过通道标识来判断报文所对应的通道。在待聚合报文分别所对应的通道标识相同的情况下,第一网络设备执行聚合处理,以保障聚合处理的准确性,避免将对应不同通道标识的报文进行聚合。这里,关于通道的介绍说明如下:在多个终端设备通过网络设备组成的一个全局逻辑环网拓扑中,相邻终端设备之间通过通道来传输报文。两个终端设备之间的通道的数量可以是一个。每个通道对应一个通道标识,且通道标识相同。进一步地,为了提高两个终端设备之间的数据传输效率,两个终端设备之间的通道的数量也可以是多个。对于两个终端设备之间的通道而言,不同的通道对应不同的通道标识。同一通道标识所标识的传输通过能够组成一个环。一个通道 是通过一条连接实现的。通道分布于全局环网拓扑中。本申请实施例中,连接可以例如但不限于RDMA连接。
其中,消息的大小可以设置为路径最大传输单元(path maximum transfer unit,PMTU)的整数倍。例如,PMTU的大小为1024字节。那么,消息的大小可以为1024字节、2048字节、3072字节、4096字节或5120字节等。这里,一个DNN模型的参数数据以一个或多个张量(tensor)形式进行传输。例如,当张量的大小为10240字节时,假设每条消息的大小为5120字节,此张量被分成两条消息。又例如,当张量大小为11264字节时,由于不能被5120整除,该张量被分成3条消息,前两条消息均为5120字节。但最后一条消息为1024字节。
S8002、第一终端设备将消息切分为数据包。
其中,在消息切分为一个数据包的情况下,该数据包包括上述预设字段和参数数据。在消息切分为多个数据包的情况下,切分后的数据包中的首个数据包包括上述预设字段,切分后的不同数据包包括不同部分的参数数据。
示例性地,一条消息为(PMTU*N)字节。第一终端设备根据PMTU进行切分,将消息切分为不同的数据包。例如,假设PMTU的大小为1024字节,一条消息为5120字节,如图10中的(a)或图11中的(a)所示。这里,N的取值即为5。该条消息被分为5个数据包,如图10中的(b)所示,或如图11中的(b)或(c)所示,一个数据包的净荷的长度即为PMTU。又例如,一条消息的预设字段和参数数据为1024字节,则该条消息被切分为1个数据包。
S8003、第一终端设备将切分后的数据包封装为报文。
其中,不同的数据包承载于不同的报文。
示例性地,一条消息被分为5个数据包的情况下,封装后的报文为5个。此种情况下,该条消息的第三字段所指示的该消息所包括的报文数量为5。又例如,一条消息被分为1个数据包的情况下,封装后的报文为1个该条消息的第三字段所指示的该消息所包括的报文数量为1。
这里,封装后的报文有两种报文结构,具体说明如下:
第一种、报文包括第一字段、第二字段、第三字段和参数数据,具体如图10中的(b)所示。或者,报文包括第一字段、第二字段、第三字段、第四字段和参数数据,具体如图11中的(b)所示。在一条消息包括一个报文的情况下,该报文的报文结构如图10中的(b)所示,或者,如图11中的(b)所示。其中,该报文的参数数据即为该条消息的参数数据。在一条消息包括多个报文的情况下,该条消息的首个报文的报文结构具体如图10中的(b)所示,或者,如图11中的(b)所示。
第二种、报文包括参数数据,不包括第一字段、第二字段、第三字段和第四字段,具体如图11中的(c)所示。在一条消息包括多个报文的情况下,该条消息的非首个报文中除了参数数据之外,不包括该条消息中的预设字段。
需要说明的是,对于一条消息中的每个报文而言,还包含其它字段。示例性地,以融合以太网的远程直接内存访问(RDMA over converged ethernet,RoCE)版本2的网络协议为例,如图10中的(b)和图11中的(b)所示,其它字段包括以太网报文头(ethernet linker header,ETH)、互联网协议(internet protocol,IP)的报文头、用户数据协议(user datagram protocol,UDP)的报文头、无限带宽基础传输头(infiniband base transport header,IB BTH)、不变循环冗余校验(invariant cyclic redundancy check,ICRC)、侦校验(frame check sequence,FCS)等。其中,ETH包括开放式通信系统互联参考模型(open system interconnection,OSI)中链路层协议的相关字段。IP包括OSI模型中网络层协议的相关字段,例如源IP地址、目的IP地址等字段信息。UDP包括OSI模型中传输层协议UDP的相关字段,例如源端口、目的端口等字段信息。IB BTH包括报文序列号(packet sequence number,PSN)等字段信息。ICRC用于保护报文的完整性。这是一种通过循环冗余校验(cyclic redundancy check,CRC)对报文的完整性提供保护的机制。在接收端(如目的终端设备,或目的计算设备)发现CRC错误,则可丢弃该报文。FCS用于判定是否重传报文。在接收端(如目的终端设备,或目的计算设备)发现FCS错误,则可丢弃该数据报文。
另外,在第一终端设备包括DEV和网卡的情况下,S8000可以由第一终端设备的DEV执行,S8001可以由第一终端设备的DEV执行,也可以由第一终端设备的网卡执行,还可以由第一终端设备中的其他组件执行,S8002和S8003可以由第一终端设备的网卡执行。
如此,第一终端设备通过将DNN模型的参数数据划分为消息,再将消息切分为报文。由于消息中包括预设字段和参数数据,在一条消息封装为一个报文的情况下,第一个报文即为该条消息的首个报文,携带预设字段和参数数据。在一条消息封装为多个报文的情况下,多个报文中的首个报文携带预设字段,多个报文中的非首个报文不携带预设字段。
在一个全局逻辑环网拓扑中,为了使得每个终端设备得到由上述至少两个终端设备中每个终端设备上的DNN模型的参数数据聚合后的聚合结果,至少两个终端设备中每个终端设备分别向各自相邻的下一个终端设备发送报文。其中,一个终端设备所发送的报文通过第一网络设备向该终端设备相邻的下一个终端设备发送报文。并且,不同终端设备所发送的报文中的参数数据是相同DNN模型的相同位置的参数数据。也就是说,至少两个终端设备中每个终端设备执行S801:
S801、至少两个终端设备中每个终端设备分别向第一网络设备发送报文。相应的,第一网络设备接收来自至少两个终端设备中每个终端设备的报文。
这里,在相邻的两个终端设备中,一个终端设备向另一个终端设备传输报文时,该终端设备先向第一网络设备传输报文,由第一网络设备对报文进行聚合处理之后,第一网络设备再向另一个终端设备传输报文。也就是说,第一网络设备接收报文之后,执行S802:
S802、第一网络设备对至少两个报文进行聚合,得到聚合后的报文。
其中,聚合可以是执行加、减、乘、除等算术运算,也可以是执行与、或、非等逻辑运算。至少两个报文中每个报文的参数数据即为待聚合数据。第一网络设备对至少两个报文中不同报文的参数数据进行聚合,得到参数数据的聚合结果,作为聚合后的报文的参数数据。
这里,对于一个终端设备的报文而言,第一网络设备通过一条通道来接收,或者,第一网络设备通过z条通道来接收。其中,z为正整数,且z>1。下面,针对这两种场景下的聚合处理进行详细说明。
场景一,第一网络设备通过一个通道接收来自一个终端设备的报文,且通道未配置通道标识。在此场景下,待聚合处理的至少两个报文满足如下两个条件中的任意一个条件:
条件一、至少两个报文中每个报文分别所属的消息具有同一消息索引。
条件二、至少两个报文中每个报文分别在具有同一消息索引的消息中具有同一序列号。
其中,消息是指两个及以上终端设备之间互相传输的消息,且一条消息包括一个或多个报文,报文中携带DNN模型的参数数据。示例性地,消息可以是RDMA连接中所传输的消息。消息也可以是数据切片(slice),如英伟达集合通信库(nvidia collective communication library,NCCL)中在应用层实施的数据切片。
其中,一个报文的序列号用于指示该报文在传输该报文的连接(如RDMA连接)中的传输顺序。
需要说明的是,在至少两个报文的每个报文分别所属的消息中,每条消息只包括一个报文,则待聚合处理的至少两个报文满足条件一即可。此种情况下,对于属于具有同一消息索引的消息的不同报文而言,每个报文所属消息的消息索引相同,则不同报文的参数数据是相同DNN模型的相同位置(如同一层的相同部分,或同一层)的参数数据。在至少两个报文的每个报文分别所属的消息中,每条消息包括多个报文,则待聚合处理的至少两个报文满足条件二,第一网络设备才执行聚合处理。此种情况下,不同的报文所属的消息具有同一消息索引,且在具有同一消息索引的消息中具有同一序列号,则不同报文的参数数据是相同DNN模型的相同位置(如同一层的相同部分,或同一层)的参数数据。
如此,即可保障第一网络设备对相同DNN模型的相同位置的参数数据进行聚合,避免数据聚合发生错误,有助于提高DNN模型训练的准确性。
这里,在至少两个报文的每个报文分别所属消息中,每条消息的首个报文包括第一字段。其中,第一字段用于指示对该消息中的参数数据执行聚合处理。如此,第一网络设备能够快速、有效识别出待聚合处理的报文和无需聚合处理的报文,保证聚合处理效率,也使得第一网络设备快速转发无需聚合处理的报文。
进一步地,每条消息的首个报文中的预设字段还包括第二字段和第三字段,如图10中的(b)所示。其中,第二字段用于承载上述消息的消息索引。消息索引用于索引首个报文所属的消息。第三字段用于承载上述消息所包括报文的报文数量。每条消息的非首个报文不包括上述第一字段、第二字段和第三字段,如图11中的(c)所示。此种情况下,为了有效地确定每个报文所属的消息,本申请实施例通信方法可以采用不同的方式来确定“报文所属的消息”,可以例如但不限于如下两种方式:
方式一,在第一网络设备确定接收到的报文为该报文所属消息的首个报文的情况下,为了描述方便,在本申请实施例中,将任意一条消息的首个报文描述为“第一报文”。参见图12,第一网络设备确定“第一报文所属的消息”的具体实现过程包括S80210:
S80210、第一网络设备基于第一报文的第二字段确定第一报文所属的消息。这里,由于第二字段承载了该第一报文所属消息的消息索引,第一网络设备即可根据第二字段中的消息索引,索引到该第一报文所属的消息。如此,终端设备即可确定该第一报文所属的消息。由于每条消息的首个报文中均存在第二字段,第一网络设备基于不同消息的首个报文中的第二字段即可索引到相应报文所属的消息。
另外,由于该第一报文中还包括第三字段,第三字段指示了该第一报文所属消息所包括报文的报文数量。第一网络设备即可确定上述第一报文所属消息所包括的报文数量。在第三字段指示该第一报文所属消息所包括的报文数量等于1时,第一网络设备即可对满足条件一的不同第一报文进行聚合,以得到聚合后的报文。在第三字段指示该第一报文所属 消息所包括的报文数量大于1时,参见图12,基于一条消息中的第一报文(即首个报文),第一网络设备还执行如下步骤:
S80211、第一网络设备确定传输第一报文的连接。
其中,第一网络设备确定“传输第一报文的连接”的方式有多种,可以例如但不限于如下方式:
第一网络设备基于第一报文中的已有协议的报文头,来确定传输第一报文的连接。例如,在连接实现为RDMA连接的情况下,第一报文中的已有协议包括互联网协议(internet protocol,IP)和无限带宽(infiniband,IB)协议。其中,IP协议的报文头包括源互联网协议(source internet protocol,SrcIP)地址和目的互联网协议(destination internet protocol,DstIP)地址。一个报文的SrcIP地址用于指示发送该报文的终端设备的IP地址,一个报文的DstIP地址用于指示接收该报文的终端设备的IP地址。IB BTH包括目的队列对(destination queue pair,DstQP)和报文序列号(packet sequence number,PSN)。一个报文的DstQP用于指示接收该报文的终端设备中的队列对(queue pair,QP)。这里,接收该报文的终端设备中的QP包括发送队列(send queue)和接收队列(receive queue)。一个报文的PSN用于指示该报文在传输该报文的RDMA连接中的传输顺序。第一网络设备即可基于第一报文中的SrcIP、DstIP和DstQP,确定传输第一报文的RDMA连接,也就相应确定了传输第一报文的连接。
S80212、第一网络设备根据第一报文中的序列号和第一报文中的第三字段所指示的报文数量,确定第一报文所属消息所包括报文的序列号的第一区间范围。
其中,第一区间范围的第一端值为上述第一报文中的序列号,第一区间范围的第二端值是基于第一报文中的序列号和第一报文中的第三字段所指示的报文数量确定的数值。第一报文的序列号的取值可以等于第一报文的PSN的取值,也可以是基于其他参照标准所确定的取值,本申请实施例对此不作限定。
示例性地,第一报文的序列号的取值为99,第一报文的第三字段所指示的报文数量的取值为100,则网络设备确定的第一区间范围为(99,198]。
S80213、第一网络设备存储第一区间范围与传输第一报文的连接之间的对应关系。
需要说明的是,一条连接可以传输一条或多条消息的第一报文。如此,对于一条连接而言,若该连接传输了一条消息的情况下,该连接对应一个第一区间范围。在该连接传输了多条消息的情况下,第一网络设备重复执行上述S80211至S80213。如此,该连接对应多个第一区间范围,且第一区间范围的数量与消息的数量一致。对于不同的连接而言,第一网络设备重复执行上述S80211至S80213,也就相应得到了不同的连接所对应的第一区间范围。
如此,由于第一网络设备存储了第一区间范围与连接的对应关系,若第一网络设备再接收到来自已存储的连接的报文,且接收到的报文为该报文所属消息的非首个报文,则第一网络设备基于已存储的第一区间范围与连接之间的对应关系,也就能够确定接收到的报文所属的消息,进而确定是否对接收到的报文执行聚合处理。具体地,参见图12,对于一条消息中的非首个报文,第一网络设备也能够确定“报文所属的消息”,为了描述方便,在本申请实施例中,将任意一条消息的非首个报文描述为“第二报文”,参见图12,下面对第一网络设备确定“第二报文所属的消息”的过程进行说明:
S80214、第一网络设备确定传输第二报文的连接。
其中,第一网络设备也可以基于第二报文中的SrcIP、DstIP和DstQP,确定传输第二报文的RDMA连接,具体实现过程可以参见S80211的相关说明,此处不再赘述。另外,第一网络设备也同样可以采用其他方式来确定传输第二报文的连接,本申请实施例对此不作限定。
S80215、若第一网络设备确定第二报文的序列号在传输第二报文的连接对应的第一区间范围内,则将与第二报文的序列号所在的第一区间范围对应的消息确定为第二报文所属的消息。若第一网络设备确定第二报文不在传输该第二报文的连接对应的任意一个第一区间范围内,则第一网络设备转发该第二报文之前,无需对该第二报文进行聚合处理。
示例性地,传输第二报文的连接对应一个或多个第一区间范围,第一网络设备已存储了传输第二报文的连接与第一区间范围之间的对应关系。第一网络设备确定第二报文的PSN在一个或多个第一区间范围的哪一个第一区间范围内,若第二报文的PSN在某一个第一区间范围内,则第二报文属于该第一区间范围所对应的消息。如此,第一网络设备也就确定了该第二报文所属的消息。
如此,第一网络设备基于第二报文的序列号,以及预存储的第一区间范围与传输该第二报文的连接之间的对应关系,即可确定该第二报文所属的消息。也就是说,第一网络设备能够确定一条消息中的非首个报文所属的消息。并且,第一网络设备通过确定第二报文的序列号所在的第一区间范围的过程,也就能够识别出是否对该第二报文进行聚合处理。在无需执行聚合处理的情况下,第一网络设备直接转发该第二报文,提高第一网络设备处理报文的效率。
综上,基于上述S80210至S80215,第一网络设备能够确定任意一条消息中每个报文所属的消息,也就能够确定任意一条消息中每个报文所对应的消息索引。如此,第一网络设备也就能够确定对哪些报文进行聚合处理。
方式二,在第一网络设备确定接收到的报文为该报文所属消息的非首个报文的情况下,仍将任意一条消息的非首个报文描述为“第二报文”。第一网络设备利用第二报文与第一报文之间的序列号偏移量,来确定“第二报文所属的消息”,其具体实现过程如下:
首先,介绍第一网络设备存储“消息索引、序列号、消息长度和连接之间的对应关系”的相关说明:
在第一网络设备确定接收到的报文为该报文所属消息的首个报文的情况下,将接收到的该报文描述为“第一报文”,第一网络设备仍执行S80210和S80211,之后,第一网络设备存储该第一报文的消息索引、该第一报文的序列号、该第一报文所属消息的消息长度和传输该第一报文的连接之间的对应关系。在该连接也传输了其他消息的情况下,第一网络设备同样执行上述过程。如此,第一网络设备即可存储多个对应关系。在其他连接传输一条或多条消息的情况下,第一网络设备也执行类似的过程。如此,第一网络设备即可存储关于多个连接的对应关系。
在接收到一条消息的非首个报文的情况下,将接收到的该报文描述为“第二报文”,第一网络设备仍执行S80214。若第一网络设备确定传输第二报文的连接存在记录,即已存储了“消息索引、序列号、消息长度和连接之间的对应关系”,则第一网络设备确定经过同一连接传输的第一报文和第二报文之间的序列号偏移量。若经过同一连接传输的第一报文和第二报文之间的序列号偏移量小于或等于该第一报文所对应的消息长度,则将第一报文所 对应的消息索引,确定为该第二报文的消息索引。也就是说,第一报文和第二报文属于同一消息。
为了保障聚合处理的准确率,在进行聚合时,第一网络设备基于预获取的预设值,来确定待聚合的报文是否到齐,在待聚合的报文到齐的情况下,第一网络设备对待聚合的报文进行聚合处理。为了描述方便,在本申请实施例中,将属于具有同一消息索引的消息且在具有同一消息索引的消息中具有同一序列号的报文描述为“第三报文”,第三报文可以是任意一条消息中的任意一个报文。参见图13,下面对第一网络设备对第三报文的聚合处理过程进行说明:
S80216、第一网络设备确定第三报文的数量。
这里,将第三报文的数量,记为第一数量值。
第一网络设备确定属于具有同一消息索引的消息且在具有同一消息索引的消息中具有同一序列号的第三报文的第一数量值。
这里,由于第一网络设备能够确定每个待聚合处理的报文所属的消息,如此,第一网络设备即可统计属于具有同一消息索引的消息的报文数量。进一步地,由于每个待聚合处理的报文携带一个PSN,如此,第一网络设备即可统计属于具有同一消息索引的消息且在具有同一消息索引的消息中具有同一序列号的报文数量。
示例性地,每个终端设备的报文的报文特征(如报文的标识,或报文的SrcIP、DstIP和DstQP中的任意一个)不同。第一网络设备在接收到报文之后,根据该报文的消息索引和序列号,确定该报文为第三报文,再根据报文特征,统计第三报文的数量。
S80217、第一网络设备判断第一数量值是否小于第一预设值。若第一数量值小于第一预设值,则第一网络设备执行S80218,若第一数量值等于第一预设值,则第一网络设备执行S80219。
其中,第一预设值是向第一网络设备提供相同DNN模型的相同位置的参数数据的终端设备的数量值。示例性地,以图6为例,在一个终端设备中具有一个DEV的情况下,针对相同DNN模型的同一位置的参数数据,四个终端设备均向第一网络设备发送报文,相应的,第一网络设备接收来自四个终端设备的报文。此种情况下,第一预设值的取值为4。
其中,S80218和S80219的具体说明如下:
S80218、第一网络设备等待接收属于具有同一消息索引的消息且在具有同一消息索引的消息中具有同一序列号的第三报文。
S80219、第一网络设备对属于具有同一消息索引的消息且在属于具有同一消息索引的消息中具有同一序列号的第三报文进行聚合,得到聚合后的报文。
也就是说,第一网络设备统计第三报文的数量,在第三报文到齐之后,再做聚合,以得到聚合后的报文,避免聚合处理时遗漏终端设备的参数数据,有助于保障聚合运算的准确性。
需要说明的是,第一网络设备还可以通过如下过程来确定“待聚合的第三报文是否到齐”,也就是说,第一网络设备执行S80218或S80219之前,不执行S80216和S80217,而执行如下过程:
每个终端设备的报文的报文特征(如报文的标识,或报文的SrcIP、DstIP和DstQP中 的任意一个)不同。第一网络设备基于第一预设值设置相应状态位,且每个状态位与一个终端设备对应。在第一网络设备在接收到报文之后,第一网络设备基于该报文的报文特征确定提供该报文的终端设备,更新提供该报文的终端设备所对应的状态位的取值。例如,第一网络设备接收来自终端设备0的报文之后,设置终端设备0所对应的状态位的取值为1(或0)。若各个状态位的取值不均为1(或0),则表明待聚合的第三报文未到齐,无法执行聚合处理,第一网络设备执行S80218。若各个状态位的取值均为1(或0),则表明待聚合的第三报文到齐,第一网络设备执行S80219。
场景二,第一网络设备通过一个或多个通道接收来自一个终端设备的报文,且通道配置通道标识。在此场景下,待聚合处理的至少两个报文满足如下两个条件中的任意一个条件:
条件三、至少两个报文中每个报文分别对应同一通道标识,且每个报文分别所属的消息具有同一消息索引。
条件四、至少两个报文中每个报文分别对应同一通道标识。并且,至少两个报文中每个报文分别在具有同一消息索引的消息中具有同一序列号。
需要说明的是,在至少两个报文的每个报文分别所属的消息中,每条消息只包括一个报文,则待聚合处理的至少两个报文满足条件三即可。此种情况下,对于对应同一通道标识且属于具有同一消息索引的消息的不同报文而言,不同报文的参数数据是相同DNN模型的相同位置(如同一层的相同部分,或同一层)的参数数据。在至少两个报文的每个报文分别所属的消息中,每条消息包括多个报文,则待聚合处理的至少两个报文满足条件四,第一网络设备才执行聚合处理。此种情况下,不同的报文对应同一通道标识,并且,不同的报文所属的消息具有同一消息索引,且在具有同一消息索引的消息中具有同一序列号,则不同报文的参数数据是相同DNN模型的相同位置(如同一层的相同部分,或同一层)的参数数据。
如此,即可保障第一网络设备对相同DNN模型的相同位置的参数数据进行聚合,避免数据聚合发生错误,有助于保障DNN模型训练的准确性。
这里,在至少两个报文的每个报文分别所属消息中,每条消息的首个报文包括第一字段,以使第一网络设备能够快速、有效识别出待聚合处理的报文和无需聚合处理的报文,保证聚合处理效率,也使得第一网络设备快速转发无需聚合处理的报文。
进一步地,每条消息的首个报文中的预设字段还包括第二字段、第三字段和第四字段,如图11中的(b)所示。每条消息的非首个报文不包括上述第一字段、第二字段、第三字段和第四字段,如图11中的(c)所示。在第一终端设备通过z个通道传输报文的情况下,不同通道上传输的报文所属的消息的消息索引可以相同,也可以不同。
第一网络设备基于报文所对应的通道标识和报文所属消息的消息索引,来确定待聚合的报文。为了有效地确定每个报文对应的通道标识和所属的消息,本申请实施例通信方法可以采用不同的方式来确定“报文所对应的通道标识”和“报文所属的消息”,可以例如但不限于如下方式三和方式四:
方式三,为了描述方便,在本申请实施例中,将任意一条消息的首个报文描述为“第一报文”。在第一网络设备确定接收到的报文为该报文所属消息的首个报文的情况下,参见图14,第一网络设备确定“第一报文所对应的通道标识和所属的消息”的具体实现过程包括 S80220:
S80220、第一网络设备基于第一报文的第二字段确定第一报文所属的消息。
这里,由于第二字段承载了该第一报文所属消息的消息索引,第一网络设备即可根据第二字段中的消息索引,索引到该第一报文所属的消息。由于每条消息的首个报文中均存在第二字段,第一网络设备基于不同消息的首个报文中的第二字段即可索引到相应报文所属的消息。
S80221、第一网络设备基于第一报文的第四字段确定第一报文对应的通道标识。
这里,由于第四字段承载了通道标识,第一网络设备即可将第四字段所承载的通道标识作为该第一报文所对应的通道标识。由于每条消息的首个报文中均存在第四字段,第一网络设备基于不同消息的首个报文中的第四字段确定相应报文所对应的通道标识。
另外,由于该第一报文中还包括第三字段,第三字段指示了该第一报文所属消息所包括报文的报文数量。第一网络设备即可确定上述第一报文所属消息所包括的报文数量。在第三字段指示该第一报文所属消息所包括的报文数量等于1时,第一网络设备即可对满足条件三的不同第一报文进行聚合,以得到聚合后的报文。在第三字段指示该第一报文所属消息所包括的报文数量大于1时,参见图14,基于一条消息中的第一报文(即首个报文),第一网络设备还执行如下步骤:
S80222、第一网络设备根据第一报文中的序列号和第一报文中的第三字段所指示的报文数量,确定第一报文所属消息所包括报文的序列号的第二区间范围。
这里,S80222的具体实现过程可以参见S80212的相关说明,此处不再赘述。
S80223、第一网络设备存储消息索引、通道标识与第二区间范围之间的对应关系。
如此,由于第一网络设备存储了消息索引、通道标识与第二区间范围之间的对应关系,若第一网络设备再通过已存储的通道标识所标识的通道接收报文,且接收到的报文为该报文所属消息的非首个报文,则第一网络设备基于已存储的消息索引、通道标识与第二区间范围之间的对应关系,也就能够确定接收到的报文对应的通道标识和所属的消息。具体地,参见图14,对于一条消息中的非首个报文,第一网络设备也能够确定“报文对应的通道标识和所属的消息”,为了描述方便,在本申请实施例中,将任意一条消息的非首个报文描述为“第二报文”,参见图14,下面,对第一网络设备确定“第二报文所对应的通道标识和所属的消息”的过程进行说明,第一网络设备确定“第二报文所对应的通道标识和所属的消息”的过程包括如下步骤:
S80224、第一网络设备确定第二报文对应的连接,将传输第二报文的连接对应的通道标识作为第二报文对应的通道标识。
其中,第一网络设备“确定传输第二报文的连接”的过程可以参见S80211的相关说明,此处不再赘述。由于通道是通过连接实现的,且通道配置了通道标识,如此,第一网络设备将传输第二报文的连接对应的通道标识作为第二报文对应的通道标识。
S80225、若第一网络设备确定第二报文的序列号在通道标识对应的第二区间范围内,则将与第二报文的序列号所在的第二区间范围对应的消息确定为第二报文所属的消息。若第一网络设备确定第二报文不在传输该通道标识对应的任意一个第二区间范围内,则第一网络设备转发该第二报文之前,无需对该第二报文进行聚合处理。
示例性地,传输第二报文的连接对应一个或多个第二区间范围,由于一个连接对应一 个通道标识,第一网络设备已存储了通道标识与第二区间范围之间的对应关系。第一网络设备确定第二报文的PSN在一个或多个第二区间范围的哪一个第二区间范围内,若第二报文的PSN在某一个第二区间范围内,则第二报文属于该第二区间范围所对应的消息。如此,第一网络设备也就确定了该第二报文所属的消息和该第二报文所对应的通道标识。
如此,第一网络设备基于第二报文的序列号,以及预存储的通道标识与第二区间范围之间的对应关系,即可确定该第二报文所属的消息和该第二报文所对应的通道标识。也就是说,第一网络设备能够确定一条消息中的非首个报文所属的消息和非首个报文所对应的通道标识。并且,第一网络设备通过确定第二报文的序列号所在的第二区间范围的过程,也就能够识别出是否对该第二报文进行聚合处理。对于无需执行聚合处理的第二报文,第一网络设备转发第二报文之前,无需对该第二报文进行聚合处理。
综上,基于上述S80220至S80225,第一网络设备能够确定任意一条消息中每个报文所属的消息和所对应的通道标识,也就能够确定任意一条消息中每个报文所对应的消息索引。如此,第一网络设备也就能够确定对哪些报文进行聚合处理。
方式四,在第一网络设备确定接收到的报文为该报文所属消息的非首个报文的情况下,仍将任意一条消息的非首个报文描述为“第二报文”。第一网络设备利用第二报文与第一报文之间的序列号偏移量,来确定“第二报文所属的消息”和“第二报文对应的通道标识”,其具体实现过程如下:
首先,介绍第一网络设备存储“消息索引、序列号、消息长度和通道标识之间的对应关系”的相关说明:
在第一网络设备确定接收到的报文为该报文所属消息的首个报文的情况下,将接收到的该报文描述为“第一报文”,第一网络设备仍执行S80220和S80221,之后,第一网络设备存储该第一报文对应的通道标识、该第一报文的消息索引、该第一报文的序列号与该第一报文的消息长度之间的对应关系。在该连接也传输了其他消息的情况下,第一网络设备同样执行上述过程。如此,第一网络设备即可存储多个对应关系。在其他连接传输一条或多条消息的情况下,第一网络设备也执行类似的过程。由于一个通道是采用一条连接实现的,通道配置了通道标识。如此,第一网络设备即可存储关于多个通道标识的对应关系。
在接收到一条消息的非首个报文的情况下,将接收到的该报文描述为“第二报文”,第一网络设备仍执行S80224。若第一网络设备确定传输第二报文的通道标识存在记录,即已存储了“通道标识、消息索引、序列号和消息长度之间的对应关系”,则第一网络设备确定对应同一通道标识的第一报文和第二报文之间的序列号偏移量。若对应同一通道标识的第一报文和第二报文之间的序列号偏移量小于或等于该第一报文所对应的消息长度,则将第一报文所对应的消息索引,确定为该第二报文的消息索引。也就是说,第一报文和第二报文属于同一消息。
为了提高聚合处理的准确率,在进行聚合时,第一网络设备基于预获取的预设值,来确定待聚合的报文是否到齐,在待聚合的报文到齐的情况下,第一网络设备对待聚合的报文进行聚合处理。为了描述方便,在本申请实施例中,将对应同一通道标识、属于具有同一消息索引的消息且在具有同一消息索引的消息中具有同一序列号的报文描述为“第四报文”,第四报文可以是任意一条消息中的任意一个报文。参见图15,下面对第一网络设备对第四报文的聚合处理过程进行说明:
S80226、第一网络设备确定第四报文的数量。
这里,将第四报文的数量记为第二数量值。
这里,由于第一网络设备能够确定每个待聚合处理的报文所属的消息和所对应的通道标识,如此,第一网络设备即可统计对应同一通道标识且属于具有同一消息索引的消息的报文数量。进一步地,由于每个待聚合处理的报文携带一个PSN,如此,第一网络设备即可统计第四报文的数量。
S80227、第一网络设备判断第二数量值是否小于第二预设值。若第二数量值小于第二预设值,则第一网络设备执行S80228,若第二数量值等于第二预设值,则第一网络设备执行S80229。
其中,第二预设值是向第一网络设备提供相同DNN模型的相同位置的参数数据的终端设备的数量值。这里,在同一个全局逻辑环网拓扑中,第二预设值与第一预设值相同。
其中,S80228和S80229的具体说明如下:
S80228、第一网络设备等待接收对应同一通道标识、属于具有同一消息索引的消息且在具有同一消息索引的消息中具有同一序列号的第四报文。
S80229、第一网络设备将对应同一通道标识、属于具有同一消息索引的消息且在属于具有同一消息索引的消息中具有同一序列号的第四报文进行聚合,得到聚合后的报文。
也就是说,第一网络设备统计第四报文的数量,在第四报文到齐之后,再做聚合,以得到聚合后的报文,避免聚合处理时遗漏终端设备的参数数据,有助于保障聚合运算的准确性。
需要说明的是,第一网络设备还可以通过如下过程来确定“待聚合的第四报文是否到齐”,也就是说,第一网络设备执行S80228或S80229之前,不执行S80226和S80227,而执行如下过程:
每个终端设备的报文的报文特征(如报文的SrcIP、DstIP和DstQP)不同。第一网络设备基于第二预设值设置相应状态位,且每个状态位与一个终端设备对应。在第一网络设备在接收到报文之后,第一网络设备基于该报文的报文特征确定提供该报文的终端设备,更新提供该报文的终端设备所对应的状态位的取值。例如,第一接入网设备接收来自终端设备0的报文之后,设置终端设备0所对应的状态位的取值为1(或0)。若各个状态位的取值不均为1(或0),则表明第一网络设备未获取到第二预设值所对应的各个终端设备的报文,第四报文未到齐,无法执行聚合处理,第一网络设备执行S80228。若各个状态位的取值均为1(或0),则表明待聚合的第三报文到齐,第一网络设备执行S80229。
需要说明的是,在一个全局逻辑环网拓扑中,每相邻两个终端设备之间的通道的数量是一条的情况下,该全局逻辑环网拓扑中的各个通道对应同一通道标识。也就是说,待聚合的第四报文对应同一通道标识。在每条消息的首个报文包括第四字段的情况下,第四字段所承载的通道标识相同。在一个全局逻辑环网拓扑中,每相邻两个终端设备之间的通道的数量是多条的情况下,每相邻两个终端设备之间不同的通道对应不同的通道标识。并且,同一通道标识对应每相邻两个终端设备之间的一个通道。
S803、第一网络设备分别向至少两个终端设备发送聚合后的报文。相应的,至少两个终端设备中每个终端设备接收来自第一网络设备的聚合后的报文。
这里,第一网络设备将待聚合报文中的参数数据替换为聚合后的数据。如此,“聚合前 的报文”与“聚合后的报文”之间具有如下关联关系:
第一,“聚合前的报文”的数量与“聚合后的报文”的数量一致。
例如,“聚合前的报文”的数量为第一预设值,“聚合后的报文”的数量也为第一预设值。
第二,“聚合前的报文”的报文头与“聚合后的报文”的报文头相同。并且,“聚合前的报文”的参数数据与“聚合后的报文”的参数数据可以相同,也可以不同,以聚合所采用的具体操作和聚合前的参数数据的取值而定,其具体示例如下:
示例一,聚合的具体操作为“加和”,“聚合前的报文”的数量为n个。第一网络设备聚合n个报文中的参数数据,得到聚合后的报文。聚合后的报文的数量也为n个。n个报文中的参数数据在聚合前后存在如下情况:
在x个报文中,每个报文的聚合后的参数数据与该报文的聚合前的参数数据不同。在(n-x)个报文中,每个报文的聚合后的参数数据与该报文的聚合前的参数数据相同。其中,x为正整数,且0≤x≤n。
例如,在聚合前,n个报文中两个或两个以上报文的参数数据的取值不为零。在聚合后,n个报文中每个报文的参数数据彼此相同,且每个报文中的聚合后的参数数据与该报文的聚合前的参数数据不同。
又例如,在聚合前,n个报文中仅一个报文的参数数据取值不为零,其他报文的参数数据取值为零。在聚合后,n个报文中一个报文的参数数据与该报文聚合前的参数数据相同,对于聚合前参数数据取值为零的(n-1)个报文而言,每个报文的聚合后的参数数据与该报文的聚合前的参数数据不同。
再例如,在聚合前,n个报文中的参数数据均为零。在聚合后,n个报文中的参数数据仍为零。也就是说,每个报文中的聚合后的参数数据与该报文的聚合前的参数数据相同。
示例二,聚合的具体操作为“取最大值”,“聚合前的报文”的数量为n个。第一网络设备聚合n个报文中的参数数据,得到聚合后的报文。聚合后的报文的数量也为n个。在聚合后的n个报文中,至少一个报文的聚合后的参数数据与该报文聚合前的参数数据一致,其他报文的聚合后的参数数据与相应报文聚合前的参数数据不同。
如此,第一网络设备分别向至少两个终端设备中每个终端设备发送了不同的报文。在这些不同的报文中,每个报文的参数数据是相同的,即均是由来自预设数量的终端设备的相同DNN模型的相同位置的参数数据聚合得到的参数数据。如此,至少两个终端设备中每个终端设备即可获取到聚合后的参数数据,以进行下一次DNN模型训练。在这些不同的报文中,每个报文的报文头是不同的。如此,第一网络设备即可基于报文头中的DstIP确定向哪一终端设备发送该报文。相应的,终端设备也可以基于接收到的报文头中的DstIP确定该报文是否为自己需要接收的报文。在一个终端设备具有多个DEV的情况下,终端设备也可以基于该报文头中的DstQP确定该报文是属于哪一DEV的报文。由于每个报文的报文头不同,所以,也就方便第一网络设备和终端设备对报文执行相应的处理。
示例性地,参见图6,图6中以带箭头的粗点划线表示第一网络设备向各个终端设备发送聚合后的报文,且在同一次下发的报文中,各个聚合后的报文中的参数数据是相同的。
S804、至少两个终端设备中每个终端设备分别将接收的报文重组为聚合后的参数数据。
其中,至少两个终端设备中不同终端设备所得到的聚合后的参数数据是同一DNN模型的同一位置上的参数数据。
下面,以至少两个终端设备中的一个终端设备为例,对“接收的报文重组为聚合后的参数数据”的具体实现过程进行说明。为了方便描述,将至少两个终端设备中的一个终端设备描述为“第二终端设备”,将第二终端设备接收的报文描述为“第五报文”。参见图16,“接收的报文重组为DNN模型的聚合后的参数数据”的具体实现过程包括如下步骤:
S8041、第二终端设备将对应同一消息索引的第五报文重组为所述同一消息索引所对应的消息。
其中,所述同一消息索引所对应的消息包括预设字段和参数数据,具体如图10或图11中的(a)所示。
示例性地,第二终端设备接收到的报文均包括IP的报文头和IB BTH。第二终端设备即可根据接收到的报文中的IB BTH确定该报文所对应的消息索引。第二终端设备根据IB BTH将对应同一消息索引的第五报文重组为该消息索引所对应的消息。
S8042、第二终端设备根据不同的消息确定DNN模型的参数数据。
其中,消息的预设字段包括消息索引,消息索引承载于第二字段,如图10中的(a)所示。不同消息的预设字段部分的消息索引不同。在一个第二终端设备包括一个DEV,且通过一个连接传输参数数据的情况下,第二终端设备将具有不同消息索引的消息重组为DNN模型的参数数据。
其中,消息的预设字段还包括通道标识,通道标识承载于第四字段,如图11中的(a)所示。不同消息的预设字段部分的通道标识可以相同,也可以不同。在一个第二终端设备包括一个DEV,且通过z个通道传输参数数据的情况下,第二终端设备根据消息中的第四字段,来确定通过不同通道所传输的消息。进而,在同一通道所传输的消息中,第二终端设备将具有不同消息索引的消息重组为DNN模型的某一部分的参数数据。最后,第二终端设备再将DNN模型的不同部分的参数数据进行重组。
需要说明的是,S8041可以由第二终端设备的网卡执行,S8042可以由第二终端设备的DEV执行。第二终端设备中的网卡即可根据DstQP,确定向哪一DEV发送消息,以使相应的DEV执行S8042。
如此,在第二终端设备接收的聚合后的报文之后,第二终端设备即可将对应同一消息索引的报文重组为一条消息,或者,将对应同一通道标识和同一消息索引的报文重组为一条消息,再基于不同的消息确定DNN模型的聚合后的参数数据,以进行下一次DNN模型的训练。至少两个终端设备中除了上述第二终端设备之外的其他终端设备均执行上述S8041至S8042。如此,至少两个终端设备的不同终端设备均可获取到聚合后的数据,以使至少两个终端设备的不同终端设备基于相同的聚合后的数据,进行下一次DNN模型的训练,以缩短DNN模型训练的时间。
本申请实施例提供的通信方法,采用消息索引来标识待聚合的报文。相同的消息索引所标识的报文中的参数数据是同一DNN模型中相同位置的参数数据。在申请实施例中,将现有技术中终端设备所实现的聚合功能卸载至第一网络设备,由第一网络设备实现聚合处理,即利用第一网络设备的高吞吐量和缓存能力,由第一网络设备对具有相同消息索引的报文执行聚合处理,以使不同的终端设备得到聚合后的数据。如此,相对于DNN模型的参数数据的数据量而言,终端设备无需传输额外的数据量,避免通信网络的网络带宽限制,降低通信时延和通信网络中的数据冗余度,有助于提升DNN模型训练效率,也不影 响第一网络设备对非聚合报文的转发功能。另外,由于本申请实施例通信方法能够利用已有的传输协议,所以,本申请实施例通信方也可以适用于已有的通信网络架构。
在一些实施例中,为了提高网络设备的运算效率,每个终端设备采用滑窗机制向第一网络设备发送消息。为了方便描述,以“一个终端设备与第一网络设备之间的交互过程”为例对滑窗机制的实现过程进行说明。将至少两个终端设备中的任意一个终端设备描述为“第三终端设备”,参见图17,滑窗机制的具体实现过程包括如下步骤:
S1701、第三终端设备向第一网络设备发送属于N条消息的报文。相应的,第一网络设备接收来自第三终端设备的属于N条消息的报文。
其中,N为大于1的正整数。也就是说,第三终端设备将N条消息分别封装为不同的报文,向第一网络设备发送N条消息所封装的报文。
S1702、第一网络设备向第三终端设备发送属于第k条消息的聚合后的报文。相应的,第三终端设备接收来自第一网络设备的属于第k条消息的聚合后的报文。
其中,第k条消息的聚合后的报文是由属于第k个消息索引的消息中的报文聚合得到的,第k个消息索引所索引到的第k条消息为第三终端设备所发送的第k条消息。其中,k为正整数。
S1703、第三终端设备向第一网络设备发送属于第(N+k)条消息的报文。相应的,第一网络设备接收来自第三终端设备的属于(N+k)条消息的报文。
S1704、第一网络设备向第三终端设备发送属于第(k+1)条消息的聚合后的报文。相应的,第三终端设备接收来自第一网络设备的属于第(k+1)条消息的聚合后的报文。
其中,第(k+1)条消息的聚合后的报文是由属于第(k+1)个消息索引的消息中的报文聚合得到的,第(k+1)个消息索引所索引到的第(k+1)条消息为第三终端设备所发送的第(k+1)条消息。如此,第一网络设备中始终能够缓存N条消息的参数数据。另外,至少两个终端设备中除了第三终端设备之外的其他终端设备也执行上述S1701至S1704,也就使得第一网络设备能够持续性地进行聚合运算,保证聚合运算效率。
上述均是以“一个网络设备执行聚合处理”场景为例的相关说明。在终端设备数量庞大的情况下,或为了分担网络设备的聚合运算量,进一步提高聚合运算效率,下面对“多个网络设备执行聚合处理”场景进行说明。
首先,参见图18,图18示出了一种多个终端设备与多个网络设备连接的系统架构。在图18中,第一组的每个终端设备与第二网络设备通过有线或无线的方式连接。第二组的每个终端设备与第三网络设备通过有线或无线的方式连接。第二网络设备与第三网络设备均与第四网络设备存在连接。每组中的终端设备的数量至少为两个。在图18中,仅示例性地示出了每组包括四个终端设备的系统架构,每组中的终端设备的数量可以有其他的取值,本申请实施例对此不作限定。在每个组中,多个终端设备通过网络设备组成一个全局逻辑环网拓扑。在多个终端设备组成的全局逻辑环网拓扑上,各个终端设备可以沿顺时针方向传输数据,也可以沿逆时针方向传输数据。不同全局逻辑环网拓扑上的数据传输方向可以相同,也可以不同。在图18中,带箭头的实线示出了组内的网络设备(即第二网络设备或第三网络设备)聚合处理前的报文传输过程。带箭头的细虚线示出了组内的网络设备(即第二网络设备或第三网络设备)聚合处理后且第四网络设备聚合处理前的报文传输过程。带箭头的粗虚线示出了第四网络设备聚合处理后的报文传输过程。这里,第二网 络设备和第三网络设备可以是TOR交换机。第四网络设备可以是核心交换机。
然后,基于图18所示的通信系统架构,参见图19,本申请实施例通信方法的具体实现过程包括如下步骤:
S1901、第一组中的每个终端设备向第二网络设备发送报文。相应的,第二网络设备接收来自第一组中的每个终端设备的报文。
这里,第一组中的终端设备的数量为至少两个。示例性地,第一组的终端设备为两个,分别记为终端设备3和终端设备4。至少两个终端设备中每个终端设备至少发送一个报文。S1901的具体实现过程可以参见S801的相关说明,此处不再赘述。
S1902、第二网络设备对来自第一组中的每个终端设备的报文进行聚合,得到第一组的局部聚合后的报文。
其中,第一组的局部聚合后的报文是由来自第一组的终端设备的报文聚合得到的。
这里,S1902的具体实现过程可以参见S802的相关说明,此处不再赘述。
S1903、第二组中的每个终端设备向第三网络设备发送报文。相应的,第三网络设备接收来自第二组中的每个终端设备的报文。
这里,第二组中的终端设备的数量为至少两个。示例性地,第一组的终端设备为两个,分别记为终端设备5和终端设备6。至少两个终端设备中每个终端设备至少发送一个报文。不同组的终端设备的数量可以相同,也可以不同。S1903的具体实现过程可以参见S801的相关说明,此处不再赘述。
S1904、第三网络设备对来自第二组中的每个终端设备的报文进行聚合,得到第二组的局部聚合后的报文。
其中,第二组的局部聚合后的报文是由来自第二组的终端设备的报文聚合得到的。
这里,S1904的具体实现过程可以参见S802的相关说明,此处不再赘述。
S1905、第二网络设备向第四网络设备发送第一组的局部聚合后的报文。相应的,第四网络设备接收来自第二网络设备的第一组的局部聚合后的报文。
S1906、第三网络设备向第四网络设备发送第二组的局部聚合后的报文。相应的,第四网络设备接收来自第三网络设备的第二组的局部聚合后的报文。
S1907、第四网络设备对第一组的局部聚合后的报文和第二组的局部聚合后的报文进行聚合,得到全局聚合后的报文。
这里,S1907的具体实现过程可以参见S802的相关说明,此处不再赘述。
S1908、第四网络设备向第二网络设备和第三网络设备发送全局聚合后的报文。相应的,第二网络设备接收来自第四网络设备的全局聚合后的报文,第三网络设备接收来自第四网络设备的全局聚合后的报文。
S1909、第二网络设备向第一组的每个终端设备发送全局聚合后的报文。相应的,第一组的每个终端设备接收来自第二网络设备的全局聚合后的报文。
示例性地,第二网络设备向终端设备3和终端设备4发送全局聚合后的报文。相应的,终端设备3接收来自第二网络设备的全局聚合后的报文。终端设备4接收来自第二网络设备的全局聚合后的报文。
S1910、第三网络设备向第二组中的每个终端设备发送全局聚合后的报文。相应的,第二组中的每个终端设备接收来自第三网络设备的全局聚合后的报文。
示例性地,第三网络设备向终端设备5和终端设备6发送全局聚合后的报文。相应的,终端设备5接收来自第三网络设备的全局聚合后的报文。终端设备6接收来自第三网络设备的全局聚合后的报文。
如此,在终端设备的数量庞大时,可以采用三个网络设备来实现聚合处理,以降低每个网络设备的运算量,提高聚合运算效率。另外,为了进一步提高聚合运算效率,在图18所示的通信系统架构中,可以有更多的网络设备,分别与更多组的终端设备连接,以对相应组的终端设备上的参数数据进行聚合处理,得到相应组的局部聚合后的报文。第四网络设备对更多组的局部聚合后的报文进行聚合处理,得到全局聚合后的报文。如此,即可在更多的终端设备上进行DNN模型的训练过程,提高DNN模型的训练效率。
上述均是以“一个终端设备包括一个计算设备”场景为例的相关说明,即在一个终端设备上,通过一个计算设备执行DNN模型的训练过程。为了进一步提高DNN模型的运算效率,一个终端设备包括多个计算设备,每个计算设备分配不同的训练数据。每个计算设备基于分配的训练数据,对同一DNN模型进行训练,得到DNN模型的参数数据。也就是说,对于一个终端设备而言,执行多次训练过程。
下面,以“一个终端设备包括多个计算设备”场景进行说明。参见图20,图20示出了一种相关技术中的DNN训练方法。在图20中,一个虚线方框表示一个终端设备,一个圆圈表示一个计算设备。每个终端设备有n个计算设备,且n个计算设备中有一个主(master)计算设备,如图20中网格填充的圆圈所示。
参见图20中的(a),在第一阶段,在一个终端设备中,其他计算设备均通过总线将各自得到的DNN模型的参数数据发送到主计算设备,由主计算设备进行聚合,得到本地聚合结果。其他终端设备的计算设备也执行相同的过程。最终,每个终端设备的主计算设备得到相应终端设备的本地聚合结果。
参见图20中的(b),在第二阶段,由各个终端设备的主计算设备通过网络设备执行全规约操作。如此,每个终端设备的主计算设备得到了全局聚合结果。
参见图20中的(c),在第三阶段,在一个终端设备中,主计算设备通过总线向其他计算设备传输全局聚合结果,以使该终端设备的其他计算设备也得到全局聚合结果。其他终端设备的计算设备也执行相同的过程。最终,每个终端设备的各个计算设备得到全局聚合结果。
由此可知,每个终端设备的主计算设备的运算量大,且其他计算设备的资源并且得到充分利用。
有鉴于此,参见图21,本申请实施例通信方法的具体实现过程包括如下步骤:
S2100、至少两个终端设备中每个终端设备分别确定n部分的参数数据的第一聚合结果。
其中,每个终端设备上的计算设备的数量为n。每个终端设备上的n个计算设备分别执行DNN模型的训练过程。n≥2。
可选地,在每个终端设备上有n个计算设备,且分布于不同终端设备上的计算设备之间通过一条通道来传输报文的情况下,在每个终端设备上,一个计算设备对应一个通道标识。并且,对应同一通道标识的计算设备分布于至少两个终端设备中的每个终端设备上。进一步地,为了提高数据传输效率,在每个终端设备上有n个计算设备,且分布于不同终 端设备上的计算设备之间通过z条通道来传输报文的情况下,在每个终端设备上,一个计算设备对应z个不同的通道标识。并且,对应同一通道标识的计算设备分布于至少两个终端设备的每个终端设备上。
这里,至少两个终端设备可以四个终端设备为例,四个终端设备可以为终端设备7、终端设备8、终端设备9和终端设备10。以至少两个终端设备中的一个终端设备为例,对“确定第一聚合结果”的具体实现过程进行说明。为了方便描述,将至少两个终端设备中的一个终端设备描述为“第四终端设备”,参见图22,“确定第一聚合结果”的具体实现过程包括如下步骤:
S21001、第四终端设备中的第i个计算设备训练DNN模型,得到n部分的参数数据。
其中,i为正整数,且1≤i≤n。也就是说,第四终端设备中任意一个计算设备均训练相同的DNN模型,得到n部分的参数数据。
S21002、在第四终端设备中的第j次迭代中,第i个计算设备向第(i+1)个计算设备发送第(x+i-j+1)部分的参数数据经过(j-1)次迭代的聚合处理结果。第i个计算设备接收来自第(i-1)个计算设备的第(x+i-j)部分的参数数据经过(j-1)次迭代的聚合,并与自身的第(x+i-j)部分的数据聚合,得到第(x+i-j)部分的参数数据经过j次迭代的聚合处理结果,以在第(j+1)次迭代中,第i个计算设备向第(i+1)个计算设备发送第(x+i-j)部分的参数数据经过j次迭代的聚合处理结果,直至j遍历1至(n-1),得到第(x+i+1)部分的第一聚合结果。
其中,i、j和x均为正整数,且1≤i≤n,1≤x≤n;若i-1<1,则用(i-1+n)替换(i-1);若i+1>n,则用(i+1-n)替换(i+1)。1≤x≤n。1≤j≤n-1;若x+i-j<1,则用(x+i-j+n)替换(x+i-j);若x+i-j+1>n,则用(x+i-j+1-n)替换(x+i-j+1)。
示例性地,参见图23中的(a),以第四终端设备包括四个计算设备为例,在图23中的(a)中,一个虚线方框表示一个终端设备,一个圆形表示一个计算设备,标识“0”的圆形表示该计算设备可以记为DEV0,标识“1”的圆形表示该计算设备可以记为DEV1,标识“2”的圆形表示该计算设备可以记为DEV2,标识“3”的圆形表示该计算设备可以记为DEV3。曲线表示参数数据的传输方向。在第四终端设备中,不同计算设备之间通过总线传输数据。
再结合图4中的(a),DEV0所获取的4部分的参数数据可以分别记为a0、b0、c0和d0。DEV1所获取的4部分的参数数据可以分别记为a1、b1、c1和d1。DEV2所获取的4部分的参数数据可以分别记为a2、b2、c2和d2。DEV3所获取的4部分的参数数据可以分别记为a3、b3、c3和d3。在第四终端设备实现“分散-规约阶段”的第一次迭代的过程中,DEV0向DEV1发送一部分的参数数据,可以记为a0;DEV1向DEV2发送一部分的参数数据,可以记为b1;DEV2向DEV3发送一部分的参数数据,可以记为c2;DEV3向DEV0发送一部分的参数数据,可以记为d3。如此,参见图4中的(b),在第四终端设备中,DEV0当前的4部分的参数数据分别记为:a0、b0、c0、(d0+d3)。其中,(d0+d3)表示该部分的参数数据的处理结果是由记为“d0”的参数数据和记为“d3”的参数数据聚合得到的。DEV1当前的4部分的参数数据分别记为:(a1+a0)、b1、c1、d1。其中,(a1+a0)表示该部分的参数数据的处理结果是由记为“a1”的参数数据和记为“a0”的参数数据聚合得到的。DEV2当前的4部分的参数数据分别记为:a2、(b2+b1)、c2、d2。其中,(b2+b1)表示该部分的参数数据的处理结果是由记为“b2”的参数数据和记为“b1”的参数数据聚合得到的。DEV3 当前的4部分的参数数据分别记为:a3、b3、(c3+c2)、d3。其中,(c3+c2)表示该部分的参数数据的处理结果是由记为“c3”的参数数据和记为“b2”的参数数据聚合得到的。其中,不同部分的参数数据可以是一个数据块。经过“分散-规约阶段”的三次迭代之后,第四终端设备的各个计算设备均得到一部分经过3次聚合处理的局部处理结果,具体如图4中的(d)中的粗线方框所示。
需要说明的是,在本申请实施例中,不同终端设备之间通过总线传输数据,则多个终端设备通过总线所构成的逻辑环网拓扑描述为“局部逻辑环网拓扑”。不同终端设备之间通过网络设备传输数据,则多个终端设备通过网络设备所构成的逻辑环网拓扑描述为“全局逻辑环网拓扑”。
如此,对于第四终端设备中的第i个计算设备而言,即可得到n部分的参数数据中第x部分的参数数据的局部聚合结果。第四终端设备的其他计算设备也执行上述S21001和S21002,且不同计算设备对应的x的取值不同。如此,在第四终端设备中,不同的计算设备得到不同部分的局部聚合结果。第四终端设备也就能够得到n部分的参数数据的第一聚合结果。另外,至少两个终端设备中的其他终端设备也执行上述S21001和S21002,以使其他终端设备也得到n部分的参数数据的第一聚合结果。在现有技术中,由各个终端设备的主计算设备执行数据聚合处理,而本申请实施例中,不同的计算设备均能够执行数据聚合处理,也就能够充分利用不同计算设备的资源,避免一个终端设备上的某一个计算设备的运算量过大的问题,也能够充分利用不同计算设备的资源,提高聚合处理的运算效率。
S2101、至少两个终端设备中每个终端设备分别将n部分的参数数据的第一聚合结果封装为报文。
其中,S2101的具体实现过程可以参见S8000至S8003的相关说明,此处不再赘述。
S2102、至少两个终端设备中每个终端设备向第五网络设备发送报文。相应的,第五网络设备接收来自至少两个终端设备中每个终端设备的报文。
其中,S2102的具体实现过程可以参见S801的相关说明,此处不再赘述。
S2103、第五网络设备对至少两个报文进行聚合,得到聚合后的报文。
其中,聚合后的报文的参数数据是第二聚合结果。第二聚合结果是由至少两个终端设备的每个终端设备的第一聚合结果聚合得到的。
S2103的具体实现过程可以参见S802的相关说明。在一个终端设备包括多个计算设备的场景下,第一预设值是向第一网络设备提供相同DNN模型的相同位置的参数数据的计算设备的数量值。第二预设值是向第一网络设备提供相同DNN模型的相同位置的参数数据的计算设备的数量值。
示例性地,参见图23中的(b),第五网络设备对第1部分的参数数据进行聚合时,待聚合报文均源于不同终端设备上的DEV0,具体如图23中的(b)中DEV0之间的曲线所示。第五网络设备对第2部分的参数数据进行聚合时,待聚合报文均源于不同终端设备上的DEV1,具体如图23中的(b)中DEV1之间的曲线所示。第五网络设备对第3部分的参数数据进行聚合时,待聚合报文均源于不同终端设备上的DEV2,具体如图23中的(b)中DEV2之间的曲线所示。第五网络设备对第4部分的参数数据进行聚合时,待聚合报文均源于不同终端设备上的DEV3,具体如图23中的(b)中DEV3之间的曲线所示。
示例性地,参见图24,在通过第五网络设备构成的全局逻辑环网拓扑中,终端设备之 间通过一个通道传输报文。在图24中,一条带箭头的曲线表示终端设备之间的一条通道。相邻两个DEV0之间的通道的通道标识均为通道0,相邻两个DEV1之间的通道的通道标识均为通道1,相邻两个DEV2之间的通道的通道标识均为通道2,相邻两个DEV3之间的通道的通道标识均为通道3。此种情况下,第五网络设备所聚合的报文对应同一通道标识。
示例性地,参见图25,在通过第五网络设备构成的全局逻辑环网拓扑中,终端设备之间通过两个通道传输报文,在图25中,一条带箭头的曲线表示终端设备之间的一条通道。相邻两个DEV0之间的通道为两个,且两个通道的通道标识为通道0和通道1。相邻两个DEV1之间的通道为两个,且两个通道的通道标识为通道2和通道3,图25未示出。相邻两个DEV2之间的通道为两个,且两个通道的通道标识为通道4和通道5,图25未示出。相邻两个DEV3之间的通道为两个,且两个通道的通道标识为通道6和通道7。此种情况下,第五网络设备所聚合的报文仍对应同一通道标识。
S2104、第五网络设备分别向至少两个终端设备发送聚合后的报文。相应的,至少两个终端设备中每个终端设备接收来自第五网络设备的聚合后的报文。
其中,S2104的具体实现过程可以参见S803的相关说明,此处不再赘述。
S2105、至少两个终端设备中每个终端设备分别将接收的报文重组为n部分的参数数据的第二聚合结果。
这里,在一个第二终端设备包括多个DEV,且每个DEV通过一个通道传输参数数据的情况下,第二终端设备根据每个报文中的IB BTH的DstQP,来确定该报文所属的消息属于哪一DEV。在属于同一DEV的多条消息中,第二终端设备将具有不同消息索引的消息重组为DNN模型的参数数据。
在一个第二终端设备包括多个DEV,且每个DEV通过z个通道传输参数数据的情况下,第二终端设备根据每个报文中的IB BTH的DstQP,来确定该报文所属的消息属于哪一DEV。在属于同一DEV的多条消息中,第二终端设备根据消息中的第四字段,来确定通过不同通道所传输的消息。进而,在对应同一DEV且由同一通道所传输的消息中,第二终端设备将具有不同消息索引的消息重组为DNN模型的某一部分的参数数据。最后,第二终端设备再将DNN模型的不同部分的参数数据进行重组,以使一个DEV得到DNN模型的参数数据。
如此,对于每个终端设备的每个计算设备而言,即可获取到一部分的参数数据的第二聚合结果。其中,第二聚合结果是由至少两个终端设备上的每个计算设备上的相应部分的参数数据聚合得到的聚合结果。
S2106、在至少两个终端设备中,每个终端设备的n个计算设备分别得到n部分的参数数据的第二聚合结果。
这里,将至少两个终端设备中的任意一个终端设备描述为“第四终端设备”,参见图26,第四终端设备上的n个计算设备分别得到n部分的参数数据第二聚合结果的过程如下:
S21061、第四终端设备中的第i个处理器接收来自网卡的第(x+i-j+1)部分的参数数据的第二聚合结果。这里,第四终端设备中的不同计算设备从网卡中获取到不同部分的参数数据的第二聚合结果。
其中,(x+i-j+1)部分的参数数据的第二聚合结果是由第一局部逻辑环网拓扑中的 (x+i-j+1)部分的参数数据的第一聚合结果和其他局部逻辑环网拓扑中的(x+i-j+1)部分的参数数据的第一聚合结果聚合得到的;第(x+i-j+1)部分的参数数据的第一聚合结果是由第一局部逻辑环网拓扑中不同处理器中的第(x+i-j+1)部分的参数数据聚合得到的;
S21062、在第四终端设备中的第j次迭代中,第i个计算设备向第(i+1)个计算设备发送第(x+i-j+1)部分的参数数据的第二聚合结果。第i个计算设备接收来自第(i-1)个计算设备的第(x+i-j)部分的参数数据的第二聚合结果,将第(x+i-j)部分的参数数据的第二聚合结果替换自身的第(x+i-j)部分的数据,以在第(j+1)次迭代中,第i个计算设备向第(i+1)个计算设备发送第(x+i-j)部分的参数数据的第二聚合结果,直至j遍历1至(n-1),得到第(x+i+1)部分的第二聚合结果。
其中,i、j和x均为正整数,且1≤i≤n,1≤x≤n;第(i-1)个计算设备、第i个计算设备和第(i+1)个计算设备均分布于第一局部逻辑环网拓扑;第一局部逻辑环网拓扑中的n个计算设备顺次相连,且n个计算设备中首个计算设备和n个计算设备中尾个计算设备相连;若i-1<1,则用(i-1+n)替换(i-1);若i+1>n,则用(i+1-n)替换(i+1);若x+i-j<1,则用(x+i-j+n)替换(x+i-j);若x+i-j+1>n,则用(x+i-j+1-n)替换(x+i-j+1)。
示例性地,参见图23中的(c),以第四终端设备包括四个计算设备为例,在图23的(c)中,一个虚线方框表示第四终端设备,一个圆形表示一个计算设备,曲线表示参数数据的传输方向。第四终端设备的四个计算设备分别对应的通道标识可以分别记为:DEV0、DEV1、DEV2和DEV3。在第四终端设备中,不同计算设备之间通过总线传输数据。
再结合图5中的(a),DEV0所获取的n部分的参数数据可以分别记为a0、b0+b3+b2+b1、c0+c3+c2和d0+d3。DEV1所获取的n部分的参数数据可以分别记为a1+a0、b1、c1+c0+c3+c2和d1+d0+d3。DEV2所获取的n部分的参数数据可以分别记为a2+a1+a0、b2+b1、c2和d2+d1+d0+d3。DEV3所获取的n部分的参数数据可以分别记为a3+a2+a1+a0、b3+b2+b1、c3+c2和d3。在第四终端设备实现一次迭代的过程中,DEV0向DEV1发送一部分的参数数据,可以记为b0+b3+b2+b1;DEV1向DEV2发送一部分的参数数据,可以记为c1+c0+c3+c2;DEV2向DEV3发送一部分的参数数据,可以记为d2+d1+d0+d3;DEV3向DEV0发送一部分的参数数据,可以记为a3+a2+a1+a0。如此,参见图5中的(b),在第四终端设备中,DEV0当前的4部分的参数数据分别记为:a3+a2+a1+a0、b0+b3+b2+b1、c0+c3+c2和d0+d3。DEV1当前的4部分的参数数据分别记为:a1+a0、b0+b3+b2+b1、c1+c0+c3+c2和d1+d0+d3。DEV2当前的4部分的参数数据分别记为:a2+a1+a0、b2+b1、c1+c0+c3+c2和d2+d1+d0+d3。DEV3当前的4部分的参数数据分别记为:a3+a2+a1+a0、b3+b2+b1、c3+c2和d2+d1+d0+d3。经过3次迭代之后,第四终端设备的各个计算设备均得到n部分的参数数据的每个部分的参数数据的第二聚合结果,具体如图5中的(d)所示。
如此,对于第四终端设备中的第i个计算设备而言,即可获取到n部分的参数数据的第二聚合结果。第四终端设备的其他计算设备也执行上述S2106。如此,在第四终端设备中,不同的计算设备也得到n部分的参数数据的第二聚合结果,以便于第四终端设备中不同的计算设备执行下一次训练。
本申请实施例提供的通信方法,在一个终端设备包括多个计算设备的情况下,不同计算设备之间也存在数据传输,以充分利用不同计算设备的资源,提高聚合处理的运算效率。 在现有技术中,由各个终端设备的主计算设备执行数据传输处理,如汇聚本地端的其他计算设备的DNN模型的参数数据,或向本地端的其他计算设备分发DNN模型的参数数据的第二聚合结果,而本申请实施例中,不同的计算设备均能够执行数据传输处理,也就能够充分利用不同计算设备的资源,避免一个终端设备上的某一个计算设备的运算量过大的问题。
需要说明的是,在多个计算设备分布于同一个终端设备的情况下,多个计算设备之间通过总线传输交互信息。在多个计算设备分布于不同终端设备的情况下,多个计算设备之间通过网络设备传输交互信息。不同的计算设备之间通过交互信息,来实现场景识别,即一个终端设备包括一个计算设备,或一个终端设备包括多个计算设备。
上述主要从各个设备之间交互的角度对本申请实施例提供的方案进行了介绍。相应的,本申请实施例还提供了通信装置,该通信装置可以为上述方法实施例中的设备,或者包含上述设备的装置,或者为可用于设备的部件。可以理解的是,该通信装置为了实现上述功能,其包含了执行各个功能相应的硬件结构和/或软件模块。本领域技术人员应该很容易意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,本申请能够以硬件或硬件和计算机软件的结合形式来实现。某个功能究竟以硬件还是计算机软件驱动硬件的方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。
图27示出了一种通信装置2700的结构示意图。该通信装置2700包括接口模块2701和处理模块2702。接口模块2701是一种该装置的接口电路,用于从其它装置接收或发送信号。例如,当该装置以芯片的方式实现时,该接口模块2701是该芯片用于从其它芯片或装置接收信号的接口电路。或者,该接口模块2701是该芯片用于向其它芯片或装置发送信号的接口电路。
比如,以通信装置2700为上述方法实施例中的网络设备为例,
则接口模块2701用于接收至少两个报文。其中,至少两个报文分别所属的消息具有同一消息索引,消息索引用于索引至少两个报文分别所属的消息。处理模块2702用于对至少两个报文进行聚合,得到聚合后的报文。
在一种可能的设计中,该通信装置还包括存储模块2703。处理模块2702还用于确定传输第一报文的连接。处理模块2702还用于根据第一报文中的序列号和第一报文中的第三字段所指示的报文数量,确定第一报文所属消息所包括报文的序列号的第一区间范围。其中,第一区间范围的第一端值为第一报文的序列号,第一区间范围的第二端值是基于第一报文的序列号和第一报文中的第三字段所指示的报文数量确定的数值。存储模块2703用于存储第一区间范围与传输第一报文的连接之间的对应关系。其中,第一报文还包括序列号,序列号用于指示第一报文在传输第一报文的连接中的传输顺序。
在一种可能的设计中,处理模块2702还用于确定传输第一报文的连接。处理模块2702还用于若第一报文的序列号在传输第一报文的连接对应的第一区间范围内,将与第一报文的序列号所在的第一区间范围对应的消息确定为第一报文所属的消息。其中,第一报文是至少两个报文中的任意一个报文。第一报文还包括序列号,序列号用于指示第一报文在传输第一报文的连接中的传输顺序。第一报文是第一报文所属消息的非首个报文。
在一种可能的设计中,处理模块2702还用于确定属于具有同一消息索引的消息且在 具有同一消息索引的消息中具有同一序列号的第一报文的第一数量值。接口模块2701还用于若处理模块2702确定第一数量值小于第一预设值时,等待接收属于具有同一消息索引的消息且在具有同一消息索引的消息中具有同一序列号的第一报文。
在一种可能的设计中,处理模块2702还用于确定属于具有同一消息索引的消息且在具有同一消息索引的消息中具有同一序列号的第一报文的第一数量值。处理模块2702具体用于若第一数量值等于第一预设值,对属于具有同一消息索引的消息且在属于具有同一消息索引的消息中具有同一序列号的第一报文进行聚合,得到聚合后的报文。
在一种可能的设计中,处理模块2702还用于确定第一报文对应的通道标识。处理模块2702还用于根据第一报文中的序列号和第三字段所指示的报文数量,确定第一报文所属消息所包括报文的序列号的第二区间范围;其中,第二区间范围的第一端值为第一报文的序列号,第二区间范围的第二端值是基于第一报文的序列号和第一报文中的第三字段所指示的报文数量确定的数值。存储模块2703还用于存储第二区间范围与第一报文对应的通道标识之间的对应关系。其中,第一报文还包括序列号和第三字段,序列号用于指示第一报文在传输第一报文的连接中的传输顺序。第三字段用于承载第一报文所属消息所包括报文的报文数量。
在一种可能的设计中,处理模块2702还用于确定传输第一报文的连接。处理模块2702还用于将传输第一报文的连接对应的通道标识,作为第一报文对应的通道标识。处理模块2702还用于若第一报文的序列号在通道标识对应的第二区间范围内,将与第一报文的序列号所在的第二区间范围对应的消息确定为第一报文所属的消息。其中,第一报文是至少两个报文中的任意一个报文。第一报文还包括序列号,序列号用于指示第一报文在传输第一报文的连接中的传输顺序。第一报文是第一报文所属消息的非首个报文。
在一种可能的设计中,处理模块2702还用于确定对应同一通道标识、属于具有同一消息索引的消息且在具有同一消息索引的消息中具有同一序列号的第一报文的第二数量值。接口模块2701还用于在处理模块2702确定第二数量值小于第二预设值时,等待接收对应同一通道标识、属于具有同一消息索引的消息且在具有同一消息索引的消息中具有同一序列号的第一报文。
在一种可能的设计中,处理模块2702还用于确定对应同一通道标识、属于具有同一消息索引的消息且在具有同一消息索引的消息中具有同一序列号的第一报文的第二数量值。处理模块2702具体用于若第二数量值等于第二预设值,则将对应同一通道标识、属于具有同一消息索引的消息且在属于具有同一消息索引的消息中具有同一序列号的第一报文进行聚合,得到聚合后的报文。
在一种可能的设计中,接口模块2701还用于向终端设备发送聚合后的报文;或者,接口模块2701还用于向目标网络设备发送聚合后的报文。
比如,以通信装置2700为上述方法实施例中的网卡为例,
则接口模块2701用于发送第一报文。接口模块2701还用于接收第二报文。其中,第二报文是由属于具有同一消息索引的报文聚合得到的,且属于具有同一消息索引的报文分别来自当前网卡与其他网卡。消息索引用于索引属于具有同一消息索引的报文分别所属的消息。
在一种可能的设计中,接口模块2701还用于获取来自计算设备的消息。处理模块2702 还用于将来自计算设备的消息切分为数据包。处理模块2702还用于将切分后的数据包封装为第一报文。其中,来自计算设备的消息包括预设字段和参数数据。切分后的数据包中的首个数据包包括预设字段,切分后的不同数据包分别包括不同部分的参数数据。
相应的,处理模块2702还用于将对应同一消息索引的第二报文重组为同一消息索引所对应的消息。接口模块2701还用于向计算设备发送同一消息索引所对应的消息。
比如,以通信装置2700为上述方法实施例中的计算设备为例,
则处理模块2702用于训练DNN模型,得到n部分的参数数据。接口模块2701用于在第j次迭代中向第(i+1)个计算设备发送第(x+i-j+1)部分的参数数据经过(j-1)次迭代的聚合处理结果,还用于在第j次迭代中接收来自第(i-1)个计算设备的第(x+i-j)部分的参数数据经过(j-1)次迭代的聚合处理结果,直至j遍历1至(n-1)。处理模块2702还用于在第j次迭代中,接口模块2701接收来自第(i-1)个计算设备的第(x+i-j)部分的参数数据经过(j-1)次迭代的聚合处理结果后,与自身的第(x+i-j)部分的数据聚合,得到第(x+i-j)部分的参数数据经过j次迭代的聚合处理结果。处理模块2702还用于在第(j+1)次迭代中,使得接口模块2701向第(i+1)个计算设备发送第(x+i-j)部分的参数数据经过j次迭代的聚合处理结果,直至j遍历1至(n-1),得到第(x+i+1)部分的第一聚合结果。
其中,i、j和x均为正整数,且1≤i≤n,1≤x≤n;第(i-1)个计算设备、当前计算设备和第(i+1)个计算设备均分布于第一局部逻辑环网拓扑;第一局部逻辑环网拓扑中的n个计算设备顺次相连,且n个计算设备中首个计算设备和n个计算设备中尾个计算设备相连;若i-1<1,则用(i-1+n)替换(i-1);若i+1>n,则用(i+1-n)替换(i+1);若x+i-j<1,则用(x+i-j+n)替换(x+i-j);若x+i-j+1>n,则用(x+i-j+1-n)替换(x+i-j+1);n为正整数,且n≥2。
比如,以通信装置2700为上述方法实施例中的计算设备为例,
则接口模块2701用于接收来自网卡的第(x+i-j+1)部分的参数数据的第二聚合结果。其中,(x+i-j+1)部分的参数数据的第二聚合结果是由第一局部逻辑环网拓扑中的(x+i-j+1)部分的参数数据的第一聚合结果和其他局部逻辑环网拓扑中的(x+i-j+1)部分的参数数据的第一聚合结果聚合得到的;第(x+i-j+1)部分的参数数据的第一聚合结果是由第一局部逻辑环网拓扑中n个计算设备中的第(x+i-j+1)部分的参数数据聚合得到的。接口模块2701还用于在第j次迭代中向第(i+1)个计算设备发送第(x+i-j+1)部分的参数数据的第二聚合结果。接口模块2701还用于在第j次迭代中接收来自第(i-1)个计算设备的第(x+i-j)部分的参数数据的第二聚合结果。
处理模块2702用于将第(x+i-j)部分的参数数据的第二聚合结果替换自身的第(x+i-j)部分的数据。处理模块2702还用于在第(j+1)次迭代中,使得接口模块2701向第(i+1)个计算设备发送第(x+i-j)部分的参数数据的第二聚合结果,直至j遍历1至(n-1),得到第(x+i+1)部分的第二聚合结果。
其中,i、j和x均为正整数,且1≤i≤n,1≤x≤n;第(i-1)个计算设备、第i个计算设备和第(i+1)个计算设备均分布于第一局部逻辑环网拓扑;第一局部逻辑环网拓扑中的n个计算设备顺次相连,且n个计算设备中首个计算设备和n个计算设备中尾个计算设备相连;若i-1<1,则用(i-1+n)替换(i-1);若i+1>n,则用(i+1-n)替换(i+1);若x+i-j <1,则用(x+i-j+n)替换(x+i-j);若x+i-j+1>n,则用(x+i-j+1-n)替换(x+i-j+1);n为正整数,且n≥2。
其中,上述方法实施例涉及的各步骤的所有相关内容均可以援引到对应功能模块的功能描述,在此不再赘述。
在本实施例中,该通信装置2700以采用集成的方式划分各个功能模块的形式来呈现。这里的“模块”可以指特定ASIC,电路,执行一个或多个软件或固件程序的处理器和存储器,集成逻辑电路,和/或其他可以提供上述功能的器件。在一个简单的实施例中,本领域的技术人员可以想到该通信装置2700可以采用图28所示的通信装置2800的形式。
比如,图28所示的通信装置2800中的处理器2801可以通过调用存储器2803中存储的计算机执行指令,使得通信装置2800执行上述方法实施例中的通信方法。
具体的,图27中的接口模块2701和处理模块2702的功能/实现过程可以通过图28所示的通信装置2800中的处理器2801调用存储器2803中存储的计算机执行指令来实现。或者,图27中的处理模块2702的功能/实现过程可以通过图28所示的通信装置2800中的处理器2801调用存储器2803中存储的计算机执行指令来实现,图27中的接口模块2701的功能/实现过程可以通过图28中所示的通信装置2800中的通信接口2804来实现。处理器2801、存储器2803和通信接口2804通过总线2802相连接。
由于本实施例提供的通信装置2700可执行上述的通信方法,因此其所能获得的技术效果可参考上述方法实施例,在此不再赘述。
需要说明的是,以上模块或单元的一个或多个可以软件、硬件或二者结合来实现。当以上任一模块或单元以软件实现的时候,所述软件以计算机程序指令的方式存在,并被存储在存储器中,处理器可以用于执行所述程序指令并实现以上方法流程。该处理器可以内置于SoC(片上系统)或专用集成电路(application specific integrated circuit,ASIC),也可是一个独立的半导体芯片。该处理器内处理用于执行软件指令以进行运算或处理的核外,还可进一步包括必要的硬件加速器,如现场可编程门阵列(field programmable gate array,FPGA)、可编程逻辑器件(programmable logic device,PLD)、或者实现专用逻辑运算的逻辑电路。
当以上模块或单元以硬件实现的时候,该硬件可以是CPU、微处理器、数字信号处理(digital signal processing,DSP)芯片、微控制单元(microcontroller unit,MCU)、人工智能处理器、ASIC、系统级芯片(system on chip,SoC)、FPGA、PLD、专用数字电路、硬件加速器或非集成的分立器件中的任一个或任一组合,其可以运行必要的软件或不依赖于软件以执行以上方法流程。
可选的,本申请实施例还提供了一种通信装置(例如,该通信装置可以是芯片或芯片系统),该通信装置包括处理器,用于实现上述任一方法实施例中的方法。在一种可能的设计中,该通信装置还包括存储器。该存储器,用于保存必要的程序指令和数据,处理器可以调用存储器中存储的程序代码以指令该通信装置执行上述任一方法实施例中的方法。当然,存储器也可以不在该通信装置中。该通信装置是芯片系统时,可以由芯片构成,也可以包含芯片和其他分立器件,本申请实施例对此不作具体限定。
在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件程序实现时,可以全部或部分地以计算机程序产品的形式来实现。该计算机程 序产品包括一个或多个计算机指令。在计算机上加载和执行计算机程序指令时,全部或部分地产生按照本申请实施例所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、服务器或者数据中心通过有线(例如同轴电缆、光纤、数字用户线(digital subscriber line,DSL))或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可以用介质集成的服务器、数据中心等数据存储设备。所述可用介质可以是磁性介质(例如,软盘、硬盘、磁带),光介质(例如,数字化视频光盘(digital video disc/disk,DVD))、或者半导体介质(例如固态硬盘(solid state disk,SSD))等。
本申请以上实施例中,“多个”是指两个或两个以上。“和/或”描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。此外,对于单数形式“a”,“an”和“the”出现的元素(element),除非上下文另有明确规定,否则其不意味着“一个或仅一个”,而是意味着“一个或多于一个”。例如,“a device”意味着对一个或多个这样的device。再者,至少一个(at least one of).......”意味着后续关联对象中的一个或任意组合,例如“A,B和C中的至少一个”包括A,B,C,AB,AC,BC,或ABC。根据X确定Y并不意味着仅仅根据X确定Y,还可以根据X和其它信息确定Y。
尽管在此结合各实施例对本申请进行了描述,然而,在实施所要求保护的本申请过程中,本领域技术人员通过查看所述附图、公开内容、以及所附权利要求书,可理解并实现所述公开实施例的其他变化。在权利要求中,“包括”(comprising)一词不排除其他组成部分或步骤,“一”或“一个”不排除多个的情况。单个处理器或其他单元可以实现权利要求中列举的若干项功能。相互不同的从属权利要求中记载了某些措施,但这并不表示这些措施不能组合起来产生良好的效果。
尽管结合具体特征及其实施例对本申请进行了描述,显而易见的,在不脱离本申请的精神和范围的情况下,可对其进行各种修改和组合。相应地,本说明书和附图仅仅是所附权利要求所界定的本申请的示例性说明,且视为已覆盖本申请范围内的任意和所有修改、变化、组合或等同物。显然,本领域的技术人员可以对本申请进行各种改动和变型而不脱离本申请的精神和范围。这样,倘若本申请的这些修改和变型属于本申请权利要求及其等同技术的范围之内,则本申请也意图包含这些改动和变型在内。
Claims (67)
- 一种通信方法,其特征在于,包括:接收至少两个报文;所述至少两个报文分别所属的消息具有同一消息索引;所述消息索引用于索引所述至少两个报文分别所属的消息;对所述至少两个报文进行聚合,得到聚合后的报文。
- 根据权利要求1所述的通信方法,其特征在于,所述至少两个报文分别在所述具有同一消息索引的消息中具有同一序列号。
- 根据权利要求1或2所述的通信方法,其特征在于,若第一报文是所述第一报文所属消息的首个报文,则所述第一报文还包括第一字段,所述第一字段用于指示对所述第一报文所属消息中的参数数据执行聚合处理;其中,所述第一报文是所述至少两个报文中的任意一个报文。
- 根据权利要求1至3任一项所述的通信方法,其特征在于,若第一报文是所述第一报文所属消息的首个报文,则所述第一报文还包括第二字段,所述第二字段用于承载所述第一报文所属消息的消息索引;所述第一报文所属消息的消息索引用于索引所述第一报文所属的消息;其中,所述第一报文是所述至少两个报文中的任意一个报文。
- 根据权利要求1至4任一项所述的通信方法,其特征在于,若第一报文是所述第一报文所属消息的首个报文,则所述第一报文还包括第三字段,所述第三字段用于承载所述第一报文所属消息所包括报文的报文数量;其中,所述第一报文是所述至少两个报文中的任意一个报文。
- 根据权利要求5所述的通信方法,其特征在于,所述第一报文还包括序列号,所述序列号用于指示所述第一报文在传输所述第一报文的连接中的传输顺序;所述方法还包括:确定传输所述第一报文的连接;根据所述第一报文中的所述序列号和所述第一报文中的所述第三字段所指示的报文数量,确定所述第一报文所属消息所包括报文的序列号的第一区间范围;其中,所述第一区间范围的第一端值为所述第一报文的序列号,所述第一区间范围的第二端值是基于所述第一报文的序列号和所述第一报文中的所述第三字段所指示的报文数量确定的数值;存储所述第一区间范围与传输所述第一报文的连接之间的对应关系。
- 根据权利要求1或2所述的通信方法,其特征在于,第一报文还包括序列号,所述序列号用于指示所述第一报文在传输所述第一报文的连接中的传输顺序;若所述第一报文是所述第一报文所属消息的非首个报文;所述方法还包括:确定传输所述第一报文的连接;若所述第一报文的序列号在传输所述第一报文的连接对应的第一区间范围内,则将与所述第一报文的序列号所在的第一区间范围对应的消息确定为所述第一报文所属的消息;其中,所述第一报文是所述至少两个报文中的任意一个报文。
- 根据权利要求4或7所述的通信方法,其特征在于,所述方法还包括:确定属于具有同一消息索引的消息且在具有所述同一消息索引的消息中具有同一序列号的所述第一报文的第一数量值;若所述第一数量值小于第一预设值,则等待接收属于具有所述同一消息索引的消息且在具有所述同一消息索引的消息中具有所述同一序列号的所述第一报文。
- 根据权利要求4或7所述的通信方法,其特征在于,所述方法还包括:确定属于具有同一消息索引的消息且在具有所述同一消息索引的消息中具有同一序列号的所述第一报文的第一数量值;所述对所述至少两个报文进行聚合,得到聚合后的报文,包括:若所述第一数量值等于第一预设值,则对属于具有所述同一消息索引的消息且在属于具有所述同一消息索引的消息中具有同一序列号的所述第一报文进行聚合,得到所述聚合后的报文。
- 根据权利要求1或2所述的通信方法,其特征在于,所述至少两个报文对应相同的通道标识,所述通道标识用于标识传输相应报文的通道。
- 根据权利要求10所述的通信方法,其特征在于,若第一报文是所述第一报文所属消息的首个报文,则所述第一报文还包括第四字段,所述第四字段用于承载所述第一报文对应的通道标识;所述第一报文所对应的通道标识用于标识传输所述第一报文的通道;其中,所述第一报文是所述至少两个报文中的任意一个报文。
- 根据权利要求11所述的通信方法,其特征在于,所述第一报文还包括序列号和第三字段,所述序列号用于指示所述第一报文在传输所述第一报文的连接中的传输顺序;所述第三字段用于承载所述第一报文所属消息所包括报文的报文数量;所述方法还包括:确定所述第一报文对应的通道标识;根据所述第一报文中的所述序列号和所述第三字段所指示的报文数量,确定所述第一报文所属消息所包括报文的序列号的第二区间范围;其中,所述第二区间范围的第一端值为所述第一报文的序列号,所述第二区间范围的第二端值是基于所述第一报文的序列号和所述第一报文中的所述第三字段所指示的报文数量确定的数值;存储所述第二区间范围与所述第一报文对应的通道标识之间的对应关系。
- 根据权利要求10所述的通信方法,其特征在于,第一报文还包括序列号,所述序列号用于指示所述第一报文在传输所述第一报文的连接中的传输顺序;若所述第一报文是所述第一报文所属消息的非首个报文;所述方法还包括:确定传输所述第一报文的连接;将传输所述第一报文的连接对应的通道标识,作为所述第一报文对应的通道标识;若所述第一报文的序列号在所述通道标识对应的第二区间范围内,则将与所述第一报文的序列号所在的第二区间范围对应的消息确定为所述第一报文所属的消息;其中,所述第一报文是所述至少两个报文中的任意一个报文。
- 根据权利要求11或13所述的通信方法,其特征在于,所述方法还包括:确定对应同一通道标识、属于具有同一消息索引的消息且在具有所述同一消息索引的消息中具有同一序列号的所述第一报文的第二数量值;若所述第二数量值小于第二预设值,则等待接收对应同一通道标识、属于具有所述同一消息索引的消息且在具有所述同一消息索引的消息中具有所述同一序列号的所述第一报文。
- 根据权利要求11或13所述的通信方法,其特征在于,所述方法还包括:确定对应同一通道标识、属于具有同一消息索引的消息且在具有所述同一消息索引的消息中具有同一序列号的所述第一报文的第二数量值;所述对所述至少两个报文进行聚合,得到聚合后的报文,包括:若所述第二数量值等于第二预设值,则将对应同一通道标识、属于具有所述同一消息索引的消息且在属于具有所述同一消息索引的消息中具有同一序列号的第一报文进行聚合,得到所述聚合后的报文。
- 根据权利要求1至15任一项所述的通信方法,其特征在于,第一报文与第二报文一一对应,且所述第一报文的报文头与所述第二报文的报文头相同,所述第二报文的参数数据是由所述至少两个报文中每个第一报文的参数数据聚合得到的;其中,所述第一报文是所述至少两个报文中的任意一个报文;所述第二报文属于所述聚合后的报文。
- 根据权利要求1至16任一项所述的通信方法,其特征在于,所述方法还包括:向终端设备发送所述聚合后的报文;或者,向目标网络设备发送所述聚合后的报文。
- 一种通信方法,其特征在于,包括:发送第一报文;接收第二报文;所述第二报文是由属于具有同一消息索引的报文聚合得到的,且所述属于具有同一消息索引的报文分别来自当前网卡与其他网卡;所述消息索引用于索引所述属于具有同一消息索引的报文分别所属的消息。
- 根据权利要求18所述的通信方法,其特征在于,所述属于具有同一消息索引的报文分别在所述具有同一消息索引的消息中具有同一序列号。
- 根据权利要求18或19所述的通信方法,其特征在于,若所述第一报文是所述第一报文所属消息的首个报文,则所述第一报文还包括第一字段,所述第一字段用于指示对所述第一报文所属消息中的参数数据执行聚合处理。
- 根据权利要求18至20任一项所述的通信方法,其特征在于,若所述第一报文是所述第一报文所属消息的首个报文,则所述第一报文还包括第二字段,所述第二字段用于承载所述第一报文所属消息的消息索引;其中,所述第一报文所属消息的消息索引用于索引所述第一报文所属的消息。
- 根据权利要求18至21任一项所述的通信方法,其特征在于,若所述第一报文是所述第一报文所属消息的首个报文,则所述第一报文还包括第三字段,所述第三字段用于承载所述第一报文所属消息所包括报文的报文数量。
- 根据权利要求18至22任一项所述的通信方法,其特征在于,所述属于具有同一消息索引的报文对应相同的通道标识,所述通道标识用于标识传输所述具有同一消息索引的报文的通道。
- 根据权利要求23所述的通信方法,其特征在于,若所述第一报文是所述第一报文所属消息的首个报文,则所述第一报文还包括第四字段,所述第四字段用于承载所述第一报文所对应的通道标识;所述第一报文所对应的通道标识用于标识传输所述第一报文的通道。
- 根据权利要求24所述的通信方法,其特征在于,所述第一报文为多个;若所述第一报文的参数数据的参数数据来自同一计算设备,且传输所述第一报文的通道为多个,则由不同的通道传输的第一报文分别所属消息的消息索引相同,或者,由不同的通道传输的第一报文分别所属消息的消息索引不同。
- 根据权利要求18至25任一项所述的通信方法,其特征在于,所述方法还包括:获取来自计算设备的消息;所述来自计算设备的消息包括预设字段和参数数据;将所述来自计算设备的消息切分为数据包;其中,切分后的数据包中的首个数据包包括所述预设字段,切分后的不同数据包分别包括不同部分的参数数据;将切分后的数据包封装为所述第一报文;相应的,所述方法还包括:将对应同一消息索引的第二报文重组为所述同一消息索引所对应的消息;向所述计算设备发送所述同一消息索引所对应的消息。
- 根据权利要求26所述的通信方法,其特征在于,所述第一报文中的参数数据包括n部分的参数数据中第x部分的参数数据的第一聚合结果;所述n部分的参数数据是由所述计算设备训练深度神经网络DNN模型得到的;所述x为正整数,且1≤x≤n;所述n为正整数,且n≥2;其中,所述计算设备与其他计算设备构成第一局部逻辑环网拓扑,且所述其他计算设备的数量为(n-1),所述其他计算设备中每个计算设备分别训练所述DNN得到n部分的参数数据;所述第x部分的参数数据的第一聚合结果是由所述计算设备和所述其他计算设备中的所述第x部分的参数数据聚合得到的;相应的,所述第二报文中的参数数据包括所述第x部分的参数数据的第二聚合结果,所述第x部分的参数数据的第二聚合结果是由所述第一局部逻辑环网拓扑中的所述第x部分的参数数据的第一聚合结果和其他局部逻辑环网拓扑中的所述第x部分的参数数据的第一聚合结果聚合得到的;其中,不同局部逻辑环网拓扑中用于训练DNN模型的计算设备的数量相同。
- 根据权利要求18至27任一项所述的通信方法,其特征在于,若所述第一报文为首次发送的报文,则所述第一报文属于N条消息中的任意一个报文,所述N为大于1的正整数;或者,若所述第一报文为非首次发送的报文,且已接收到的第三报文是由属于第k个消息索引的消息中的报文聚合得到的,所述第k个消息索引用于索引第k条消息,则所述第一报文属于第(N+k)条消息中的任意一个报文,所述k为正整数。
- 根据权利要求18至28任一项所述的通信方法,其特征在于,所述第一报文的报文头与所述第二报文的报文头相同,所述第二报文的参数数据是由属于具有同一消息索引的报文的参数数据聚合得到的。
- 一种通信方法,其特征在于,包括:第i个计算设备训练DNN模型,得到n部分的参数数据;在第j次迭代中,所述第i个计算设备向第(i+1)个计算设备发送第(x+i-j+1)部分的参数数据经过(j-1)次迭代的聚合处理结果;所述第i个计算设备接收来自第(i-1)个计算设备的第(x+i-j)部分的参数数据经过(j-1)次迭代的聚合处理结果,并与自身的第(x+i-j)部分的数据聚合,得到所述第(x+i-j)部分的参数数据经过j次迭代的聚合处理 结果,以在第(j+1)次迭代中,所述第i个计算设备向第(i+1)个计算设备发送第(x+i-j)部分的参数数据经过j次迭代的聚合处理结果,直至j遍历1至(n-1),得到第(x+i+1)部分的第一聚合结果;其中,i、j和x均为正整数,且1≤i≤n,1≤x≤n;所述第(i-1)个计算设备、所述第i个计算设备和所述第(i+1)个计算设备均分布于第一局部逻辑环网拓扑;所述第一局部逻辑环网拓扑中的n个计算设备顺次相连,且所述n个计算设备中首个计算设备和所述n个计算设备中尾个计算设备相连;若i-1<1,则用(i-1+n)替换(i-1);若i+1>n,则用(i+1-n)替换(i+1);若x+i-j<1,则用(x+i-j+n)替换(x+i-j);若x+i-j+1>n,则用(x+i-j+1-n)替换(x+i-j+1);n为正整数,且n≥2。
- 一种通信方法,其特征在于,包括:第i个计算设备接收来自网卡的第(x+i-j+1)部分的参数数据的第二聚合结果;所述(x+i-j+1)部分的参数数据的第二聚合结果是由第一局部逻辑环网拓扑中的(x+i-j+1)部分的参数数据的第一聚合结果和其他局部逻辑环网拓扑中的(x+i-j+1)部分的参数数据的第一聚合结果聚合得到的;所述第(x+i-j+1)部分的参数数据的第一聚合结果是由所述第一局部逻辑环网拓扑中n个计算设备中的第(x+i-j+1)部分的参数数据聚合得到的;在第j次迭代中,所述第i个计算设备向第(i+1)个计算设备发送所述第(x+i-j+1)部分的参数数据的第二聚合结果;所述第i个计算设备接收来自第(i-1)个计算设备的第(x+i-j)部分的参数数据的第二聚合结果,将所述第(x+i-j)部分的参数数据的第二聚合结果替换自身的第(x+i-j)部分的数据,以在第(j+1)次迭代中,所述第i个计算设备向第(i+1)个计算设备发送所述第(x+i-j)部分的参数数据的第二聚合结果,直至j遍历1至(n-1),得到第(x+i+1)部分的第二聚合结果;其中,i、j和x均为正整数,且1≤i≤n,1≤x≤n;所述第(i-1)个计算设备、所述第i个计算设备和所述第(i+1)个计算设备均分布于所述第一局部逻辑环网拓扑;所述第一局部逻辑环网拓扑中的n个计算设备顺次相连,且所述n个计算设备中首个计算设备和所述n个计算设备中尾个计算设备相连;若i-1<1,则用(i-1+n)替换(i-1);若i+1>n,则用(i+1-n)替换(i+1);若x+i-j<1,则用(x+i-j+n)替换(x+i-j);若x+i-j+1>n,则用(x+i-j+1-n)替换(x+i-j+1);n为正整数,且n≥2。
- 一种终端设备,其特征在于,包括:网卡和n个计算设备;所述网卡用于执行权利要求18至29任一项所述的通信方法;所述n个计算设备顺次相连,且所述n个计算设备中首个计算设备和所述n个计算设备中尾个计算设备相连,构成局部逻辑环网拓扑;所述n个计算设备中任意相邻的三个计算设备中的第二个计算设备用于执行如权利要求30或31所述的通信方法;n为正整数,且n≥2。
- 一种通信装置,其特征在于,包括:接口模块,用于接收至少两个报文;所述至少两个报文分别所属的消息具有同一消息索引;所述消息索引用于索引所述至少两个报文分别所属的消息;处理模块,用于对所述至少两个报文进行聚合,得到聚合后的报文。
- 根据权利要求33所述的通信装置,其特征在于,所述至少两个报文分别在所述具有同一消息索引的消息中具有同一序列号。
- 根据权利要求33或34所述的通信装置,其特征在于,若第一报文是所述第一报文所属消息的首个报文,则所述第一报文还包括第一字段,所述第一字段用于指示对所述第一报文所属消息中的参数数据执行聚合处理;其中,所述第一报文是所述至少两个报文中的任意一个报文。
- 根据权利要求33至35任一项所述的通信装置,其特征在于,若第一报文是所述第一报文所属消息的首个报文,则所述第一报文还包括第二字段,所述第二字段用于承载所述第一报文所属消息的消息索引;所述第一报文所属消息的消息索引用于索引所述第一报文所属的消息;其中,所述第一报文是所述至少两个报文中的任意一个报文。
- 根据权利要求33至36任一项所述的通信装置,其特征在于,若第一报文是所述第一报文所属消息的首个报文,则所述第一报文还包括第三字段,所述第三字段用于承载所述第一报文所属消息所包括报文的报文数量;其中,所述第一报文是所述至少两个报文中的任意一个报文。
- 根据权利要求37所述的通信装置,其特征在于,所述第一报文还包括序列号,所述序列号用于指示所述第一报文在传输所述第一报文的连接中的传输顺序;所述处理模块,还用于:确定传输所述第一报文的连接;根据所述第一报文中的所述序列号和所述第一报文中的所述第三字段所指示的报文数量,确定所述第一报文所属消息所包括报文的序列号的第一区间范围;其中,所述第一区间范围的第一端值为所述第一报文的序列号,所述第一区间范围的第二端值是基于所述第一报文的序列号和所述第一报文中的所述第三字段所指示的报文数量确定的数值;存储模块,用于存储所述第一区间范围与传输所述第一报文的连接之间的对应关系,所述通信装置还包括所述存储模块。
- 根据权利要求33或34所述的通信装置,其特征在于,第一报文还包括序列号,所述序列号用于指示所述第一报文在传输所述第一报文的连接中的传输顺序;若所述第一报文是所述第一报文所属消息的非首个报文;所述处理模块还用于:确定传输所述第一报文的连接;若所述第一报文的序列号在传输所述第一报文的连接对应的第一区间范围内,则将与所述第一报文的序列号所在的第一区间范围对应的消息确定为所述第一报文所属的消息;其中,所述第一报文是所述至少两个报文中的任意一个报文。
- 根据权利要求36或39所述的通信装置,其特征在于,所述处理模块,还用于:确定属于具有同一消息索引的消息且在具有所述同一消息索引的消息中具有同一序列号的所述第一报文的第一数量值;若所述第一数量值小于第一预设值,则使所述接口模块等待接收属于具有所述同一消息索引的消息且在具有所述同一消息索引的消息中具有所述同一序列号的所述第一报文。
- 根据权利要求36或39所述的通信装置,其特征在于,所述处理模块还用于:确定属于具有同一消息索引的消息且在具有所述同一消息索引的消息中具有同一序列号的所述第一报文的第一数量值;所述处理模块用于对所述至少两个报文进行聚合,得到聚合后的报文,具体包括:若所述第一数量值等于第一预设值,则对属于具有所述同一消息索引的消息且在属于具有所述同一消息索引的消息中具有同一序列号的所述第一报文进行聚合,得到所述聚合后的报文。
- 根据权利要求33或34所述的通信装置,其特征在于,所述至少两个报文对应相同的通道标识,所述通道标识用于标识传输相应报文的通道。
- 根据权利要求42所述的通信装置,其特征在于,若第一报文是所述第一报文所属消息的首个报文,则所述第一报文还包括第四字段,所述第四字段用于承载所述第一报文对应的通道标识;所述第一报文所对应的通道标识用于标识传输所述第一报文的通道;其中,所述第一报文是所述至少两个报文中的任意一个报文。
- 根据权利要求43所述的通信装置,其特征在于,所述第一报文还包括序列号和第三字段,所述序列号用于指示所述第一报文在传输所述第一报文的连接中的传输顺序;所述第三字段用于承载所述第一报文所属消息所包括报文的报文数量;所述处理模块还用于:确定所述第一报文对应的通道标识;根据所述第一报文中的所述序列号和所述第三字段所指示的报文数量,确定所述第一报文所属消息所包括报文的序列号的第二区间范围;其中,所述第二区间范围的第一端值为所述第一报文的序列号,所述第二区间范围的第二端值是基于所述第一报文的序列号和所述第一报文中的所述第三字段所指示的报文数量确定的数值;存储模块,用于存储所述第二区间范围与所述第一报文对应的通道标识之间的对应关系,其中,所述通信装置包括所述存储模块。
- 根据权利要求42所述的通信装置,其特征在于,第一报文还包括序列号,所述序列号用于指示所述第一报文在传输所述第一报文的连接中的传输顺序;若所述第一报文是所述第一报文所属消息的非首个报文;所述处理模块,还用于:确定传输所述第一报文的连接;将传输所述第一报文的连接对应的通道标识,作为所述第一报文对应的通道标识;若所述第一报文的序列号在所述通道标识对应的第二区间范围内,则将与所述第一报文的序列号所在的第二区间范围对应的消息确定为所述第一报文所属的消息;其中,所述第一报文是所述至少两个报文中的任意一个报文。
- 根据权利要求43或45所述的通信装置,其特征在于,所述处理模块,还用于:确定对应同一通道标识、属于具有同一消息索引的消息且在具有所述同一消息索引的消息中具有同一序列号的所述第一报文的第二数量值;若所述第二数量值小于第二预设值,则等待接收对应同一通道标识、属于具有所述同一消息索引的消息且在具有所述同一消息索引的消息中具有所述同一序列号的所述第一报文。
- 根据权利要求43或45所述的通信装置,其特征在于,所述处理模块,还用于:确定对应同一通道标识、属于具有同一消息索引的消息且在具有所述同一消息索引的消息中具有同一序列号的所述第一报文的第二数量值;所述处理模块,用于对所述至少两个报文进行聚合,得到聚合后的报文,包括:若所述第二数量值等于第二预设值,则将对应同一通道标识、属于具有所述同一消息 索引的消息且在属于具有所述同一消息索引的消息中具有同一序列号的第一报文进行聚合,得到所述聚合后的报文。
- 根据权利要求33至47任一项所述的通信装置,其特征在于,第一报文与第二报文一一对应,且所述第一报文的报文头与所述第二报文的报文头相同,所述第二报文的参数数据是由所述至少两个报文中每个第一报文的参数数据聚合得到的;其中,所述第一报文是所述至少两个报文中的任意一个报文;所述第二报文属于所述聚合后的报文。
- 根据权利要求33至48任一项所述的通信装置,其特征在于,所述接口模块,还用于:向终端设备发送所述聚合后的报文;或者,向目标网络设备发送所述聚合后的报文。
- 一种通信装置,其特征在于,包括:接口模块,用于发送第一报文;所述接口模块,还用于接收第二报文;所述第二报文是由属于具有同一消息索引的报文聚合得到的,且所述属于具有同一消息索引的报文分别来自当前网卡与其他网卡;所述消息索引用于索引所述属于具有同一消息索引的报文分别所属的消息。
- 根据权利要求50所述的通信装置,其特征在于,所述属于具有同一消息索引的报文分别在所述具有同一消息索引的消息中具有同一序列号。
- 根据权利要求50或51所述的通信装置,其特征在于,若所述第一报文是所述第一报文所属消息的首个报文,则所述第一报文还包括第一字段,所述第一字段用于指示对所述第一报文所属消息中的参数数据执行聚合处理。
- 根据权利要求50至52任一项所述的通信装置,其特征在于,若所述第一报文是所述第一报文所属消息的首个报文,则所述第一报文还包括第二字段,所述第二字段用于承载所述第一报文所属消息的消息索引;其中,所述第一报文所属消息的消息索引用于索引所述第一报文所属的消息。
- 根据权利要求50至53任一项所述的通信装置,其特征在于,若所述第一报文是所述第一报文所属消息的首个报文,则所述第一报文还包括第三字段,所述第三字段用于承载所述第一报文所属消息所包括报文的报文数量。
- 根据权利要求50至54任一项所述的通信装置,其特征在于,所述属于具有同一消息索引的报文对应相同的通道标识,所述通道标识用于标识传输所述具有同一消息索引的报文的通道。
- 根据权利要求55所述的通信装置,其特征在于,若所述第一报文是所述第一报文所属消息的首个报文,则所述第一报文还包括第四字段,所述第四字段用于承载所述第一报文所对应的通道标识;所述第一报文所对应的通道标识用于标识传输所述第一报文的通道。
- 根据权利要求56所述的通信装置,其特征在于,所述第一报文为多个;若所述第一报文的参数数据的参数数据来自同一计算设备,且传输所述第一报文的通道为多个,则由不同的通道传输的第一报文分别所属消息的消息索引相同,或者,由不同的通道传输的第一报文分别所属消息的消息索引不同。
- 根据权利要求50至57任一项所述的通信装置,其特征在于,所述通信装置还包 括处理模块,所述处理模块,用于:获取来自计算设备的消息;所述来自计算设备的消息包括预设字段和参数数据;将所述来自计算设备的消息切分为数据包;其中,切分后的数据包中的首个数据包包括所述预设字段,切分后的不同数据包分别包括不同部分的参数数据;将切分后的数据包封装为所述第一报文;相应的,所述处理模块,还用于:将对应同一消息索引的第二报文重组为所述同一消息索引所对应的消息;向所述计算设备发送所述同一消息索引所对应的消息。
- 根据权利要求58所述的通信装置,其特征在于,所述第一报文中的参数数据包括n部分的参数数据中第x部分的参数数据的第一聚合结果;所述n部分的参数数据是由所述计算设备训练深度神经网络DNN模型得到的;所述x为正整数,且1≤x≤n;所述n为正整数,且n≥2;其中,所述计算设备与其他计算设备构成第一局部逻辑环网拓扑,且所述其他计算设备的数量为(n-1),所述其他计算设备中每个计算设备分别训练所述DNN得到n部分的参数数据;所述第x部分的参数数据的第一聚合结果是由所述计算设备和所述其他计算设备中的所述第x部分的参数数据聚合得到的;相应的,所述第二报文中的参数数据包括所述第x部分的参数数据的第二聚合结果,所述第x部分的参数数据的第二聚合结果是由所述第一局部逻辑环网拓扑中的所述第x部分的参数数据的第一聚合结果和其他局部逻辑环网拓扑中的所述第x部分的参数数据的第一聚合结果聚合得到的;其中,不同局部逻辑环网拓扑中用于训练DNN模型的计算设备的数量相同。
- 根据权利要求50至59任一项所述的通信装置,其特征在于,若所述第一报文为首次发送的报文,则所述第一报文属于N条消息中的任意一个报文,所述N为大于1的正整数;或者,若所述第一报文为非首次发送的报文,且已接收到的第三报文是由属于第k个消息索引的消息中的报文聚合得到的,所述第k个消息索引用于索引第k条消息,则所述第一报文属于第(N+k)条消息中的任意一个报文,所述k为正整数。
- 根据权利要求50至60任一项所述的通信装置,其特征在于,所述第一报文的报文头与所述第二报文的报文头相同,所述第二报文的参数数据是由属于具有同一消息索引的报文的参数数据聚合得到的。
- 一种通信装置,其特征在于,应用于第i个计算设备,所述通信装置包括:处理模块,用于训练DNN模型,得到n部分的参数数据;接口模块,用于在第j次迭代中,向第(i+1)个计算设备发送第(x+i-j+1)部分的参数数据经过(j-1)次迭代的聚合处理结果;接收来自第(i-1)个计算设备的第(x+i-j)部分的参数数据经过(j-1)次迭代的聚合处理结果;所述处理模块,还用于将来自所述第(i-1)个计算设备的所述第(x+i-j)部分的参数数据经过(j-1)次迭代的聚合处理结果与自身的第(x+i-j)部分的数据聚合,得到所述第(x+i-j)部分的参数数据经过j次迭代的聚合处理结果,以在第(j+1)次迭代中,使所述接口模块向第(i+1)个计算设备发送第(x+i-j)部分的参数数据经过j次迭代的聚合处理 结果,直至j遍历1至(n-1),得到第(x+i+1)部分的第一聚合结果;其中,i、j和x均为正整数,且1≤i≤n,1≤x≤n;所述第(i-1)个计算设备、所述第i个计算设备和所述第(i+1)个计算设备均分布于第一局部逻辑环网拓扑;所述第一局部逻辑环网拓扑中的n个计算设备顺次相连,且所述n个计算设备中首个计算设备和所述n个计算设备中尾个计算设备相连;若i-1<1,则用(i-1+n)替换(i-1);若i+1>n,则用(i+1-n)替换(i+1);若x+i-j<1,则用(x+i-j+n)替换(x+i-j);若x+i-j+1>n,则用(x+i-j+1-n)替换(x+i-j+1);n为正整数,且n≥2。
- 一种通信装置,其特征在于,应用于第i个计算设备,所述通信装置包括:接口模块,用于接收来自网卡的第(x+i-j+1)部分的参数数据的第二聚合结果;所述(x+i-j+1)部分的参数数据的第二聚合结果是由第一局部逻辑环网拓扑中的(x+i-j+1)部分的参数数据的第一聚合结果和其他局部逻辑环网拓扑中的(x+i-j+1)部分的参数数据的第一聚合结果聚合得到的;所述第(x+i-j+1)部分的参数数据的第一聚合结果是由所述第一局部逻辑环网拓扑中n个计算设备中的第(x+i-j+1)部分的参数数据聚合得到的;所述接口模块,还用于在第j次迭代中,向第(i+1)个计算设备发送所述第(x+i-j+1)部分的参数数据的第二聚合结果;接收来自第(i-1)个计算设备的第(x+i-j)部分的参数数据的第二聚合结果;处理模块,用于将所述第(x+i-j)部分的参数数据的第二聚合结果替换自身的第(x+i-j)部分的数据,以在第(j+1)次迭代中,使所述接口模块向第(i+1)个计算设备发送所述第(x+i-j)部分的参数数据的第二聚合结果,直至j遍历1至(n-1),得到第(x+i+1)部分的第二聚合结果;其中,i、j和x均为正整数,且1≤i≤n,1≤x≤n;所述第(i-1)个计算设备、所述第i个计算设备和所述第(i+1)个计算设备均分布于所述第一局部逻辑环网拓扑;所述第一局部逻辑环网拓扑中的n个计算设备顺次相连,且所述n个计算设备中首个计算设备和所述n个计算设备中尾个计算设备相连;若i-1<1,则用(i-1+n)替换(i-1);若i+1>n,则用(i+1-n)替换(i+1);若x+i-j<1,则用(x+i-j+n)替换(x+i-j);若x+i-j+1>n,则用(x+i-j+1-n)替换(x+i-j+1);n为正整数,且n≥2。
- 一种通信装置,其特征在于,包括:处理器,用于调用存储器中的程序,以执行权利要求1至17任一项所述的通信方法,或执行如权利要求18至29任一项所述的通信方法,或执行如权利要求30所述的通信方法,或执行如权利要求31所述的通信方法。
- 一种通信装置,其特征在于,包括:逻辑电路和输入输出接口,所述输入输出接口用于与所述装置之外的模块通信,所述逻辑电路用于运行计算机程序或指令,以控制装置执行如权利要求1至17任一项所述的通信方法,或执行如权利要求18至29任一项所述的通信方法,或执行如权利要求30所述的通信方法,或执行如权利要求31所述的通信方法。
- 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质存储程序,所述程序被处理器调用时,权利要求1至17任一项所述的通信方法被执行,或者权利要求18至29任一项所述的通信方法被执行,或者权利要求30所述的通信方法被执行,或者权利要求31所述的通信方法被执行。
- 一种计算机程序,其特征在于,当所述程序被处理器调用时,权利要求1至17 任一项所述的通信方法被执行,或者权利要求18至29任一项所述的通信方法被执行,或者权利要求30所述的通信方法被执行,或者权利要求31所述的通信方法被执行。
Priority Applications (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| EP21741424.2A EP4084433B1 (en) | 2020-01-17 | 2021-01-18 | Communication method and apparatus |
| US17/865,845 US12568158B2 (en) | 2020-01-17 | 2022-07-15 | Communication method and apparatus |
Applications Claiming Priority (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202010054022.1A CN113141330A (zh) | 2020-01-17 | 2020-01-17 | 通信方法及装置 |
| CN202010054022.1 | 2020-01-17 |
Related Child Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| US17/865,845 Continuation US12568158B2 (en) | 2020-01-17 | 2022-07-15 | Communication method and apparatus |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2021143911A1 true WO2021143911A1 (zh) | 2021-07-22 |
Family
ID=76808409
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/CN2021/072543 Ceased WO2021143911A1 (zh) | 2020-01-17 | 2021-01-18 | 通信方法及装置 |
Country Status (4)
| Country | Link |
|---|---|
| US (1) | US12568158B2 (zh) |
| EP (1) | EP4084433B1 (zh) |
| CN (1) | CN113141330A (zh) |
| WO (1) | WO2021143911A1 (zh) |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN113556403A (zh) * | 2021-07-30 | 2021-10-26 | 中科计算技术西部研究院 | 一种用于分布式训练的通信方法及系统 |
Families Citing this family (7)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN113553279B (zh) * | 2021-07-30 | 2023-04-07 | 中科计算技术西部研究院 | 一种rdma通信加速集合通信的方法及系统 |
| CN115733897A (zh) * | 2021-08-27 | 2023-03-03 | 华为技术有限公司 | 数据处理的方法和装置 |
| CN116668459B (zh) * | 2022-02-17 | 2026-03-27 | 清华大学 | 一种数据处理方法、装置及设备 |
| CN114697158A (zh) * | 2022-03-30 | 2022-07-01 | 润芯微科技(江苏)有限公司 | 一种车载多处理器间spi总线通信协议及其工作方法 |
| CN115334174B (zh) * | 2022-08-22 | 2024-02-06 | 卡斯柯信号有限公司 | 一种基于Subset-037协议的多通道匹配方法及通信方法 |
| CN118368230A (zh) * | 2023-01-19 | 2024-07-19 | 华为技术有限公司 | 转发网内计算报文的方法、转发节点及计算机存储介质 |
| CN120979952A (zh) * | 2024-05-17 | 2025-11-18 | 华为技术有限公司 | 数据归约方法、装置、设备及计算机可读存储介质 |
Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20090201898A1 (en) * | 2008-02-13 | 2009-08-13 | Cisco Technology, Inc. | End-to-End Packet Aggregation in Mesh Networks |
| CN109819524A (zh) * | 2017-11-22 | 2019-05-28 | 华为技术有限公司 | 报文处理方法及装置 |
| CN110033078A (zh) * | 2018-01-12 | 2019-07-19 | 华为技术有限公司 | 一种基于树状拓扑的计算系统及方法 |
| CN110119760A (zh) * | 2019-04-11 | 2019-08-13 | 华南理工大学 | 一种基于层次化多尺度循环神经网络的序列分类方法 |
Family Cites Families (7)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US8244810B1 (en) * | 2003-01-23 | 2012-08-14 | Sprint Spectrum L.P. | System and method for merging instant messages |
| EP1808994A1 (fr) * | 2006-01-12 | 2007-07-18 | Alcatel Lucent | Dispositif de commutation à transport universel de trames de paquets de données |
| WO2008141169A1 (en) * | 2007-05-09 | 2008-11-20 | Entropic Communications, Inc. | Aggregating network packets for transmission to a destination node |
| JP5143295B1 (ja) * | 2012-01-27 | 2013-02-13 | 株式会社東芝 | 電子機器及びインデックス生成方法 |
| CN108063985B (zh) * | 2016-11-07 | 2020-11-17 | 中兴通讯股份有限公司 | 一种数据收发方法和装置 |
| US11044589B2 (en) * | 2018-10-11 | 2021-06-22 | Qualcomm Incorporated | V2X network based relaying |
| US11477820B2 (en) * | 2019-07-10 | 2022-10-18 | Ofinno, Llc | Cell resource status information |
-
2020
- 2020-01-17 CN CN202010054022.1A patent/CN113141330A/zh active Pending
-
2021
- 2021-01-18 WO PCT/CN2021/072543 patent/WO2021143911A1/zh not_active Ceased
- 2021-01-18 EP EP21741424.2A patent/EP4084433B1/en active Active
-
2022
- 2022-07-15 US US17/865,845 patent/US12568158B2/en active Active
Patent Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20090201898A1 (en) * | 2008-02-13 | 2009-08-13 | Cisco Technology, Inc. | End-to-End Packet Aggregation in Mesh Networks |
| CN109819524A (zh) * | 2017-11-22 | 2019-05-28 | 华为技术有限公司 | 报文处理方法及装置 |
| CN110033078A (zh) * | 2018-01-12 | 2019-07-19 | 华为技术有限公司 | 一种基于树状拓扑的计算系统及方法 |
| CN110119760A (zh) * | 2019-04-11 | 2019-08-13 | 华南理工大学 | 一种基于层次化多尺度循环神经网络的序列分类方法 |
Non-Patent Citations (1)
| Title |
|---|
| See also references of EP4084433A4 |
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN113556403A (zh) * | 2021-07-30 | 2021-10-26 | 中科计算技术西部研究院 | 一种用于分布式训练的通信方法及系统 |
| CN113556403B (zh) * | 2021-07-30 | 2023-06-09 | 中科计算技术西部研究院 | 一种用于分布式训练的通信方法及系统 |
Also Published As
| Publication number | Publication date |
|---|---|
| CN113141330A (zh) | 2021-07-20 |
| US20220353207A1 (en) | 2022-11-03 |
| EP4084433B1 (en) | 2025-03-12 |
| EP4084433A1 (en) | 2022-11-02 |
| EP4084433A4 (en) | 2023-01-04 |
| US12568158B2 (en) | 2026-03-03 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| WO2021143911A1 (zh) | 通信方法及装置 | |
| US12074808B1 (en) | Distributed artificial intelligence extension modules for network switches | |
| US12236323B1 (en) | Network switch with integrated gradient aggregation for distributed machine learning | |
| US11863458B1 (en) | Reflected packets | |
| CN113098773B (zh) | 数据处理方法、装置及系统 | |
| US12353921B2 (en) | Massively parallel in-network compute | |
| TWI745034B (zh) | 封包聚合及解聚合方法 | |
| Zafar et al. | On implementation of DCTCP on three-tier and fat-tree data center network topologies | |
| CN104935524A (zh) | 一种多径网络基于链路时延控制的软负载均衡方法 | |
| WO2024152938A1 (zh) | 转发网内计算报文的方法、转发节点及计算机存储介质 | |
| CN111404815B (zh) | 一种基于深度学习的有约束路由选择方法 | |
| WO2024248874A1 (en) | Packet header optimization in ethernet internet protocol networks | |
| CN121283977A (zh) | 实现传输中计算的PCIe交换芯片及具有其的交换机、通信系统 | |
| WO2023019889A1 (zh) | 报文处理方法、装置、设备及计算机可读存储介质 | |
| CN118869600B (zh) | 拥塞控制方法、装置、电子设备及介质 | |
| US12452149B2 (en) | Application specific network telemetry and diagnostics | |
| CN115002038B (zh) | 一种基于云端分布式协调服务的智能调峰方法和系统 | |
| CN118590429A (zh) | 一种基于sdn架构的无线移动网络切换管理方法及系统 | |
| CN117725973A (zh) | 一种基于可编程网络设计的加速多神经网络训练方法 | |
| CN118075221A (zh) | 数据处理方法、装置、设备、系统及可读存储介质 | |
| CN116074253A (zh) | 一种报文链式转发方法及装置 | |
| US9046941B1 (en) | System and method for sharing logic in a network device | |
| CN115914103A (zh) | 报文处理方法、装置、设备及计算机可读存储介质 | |
| CN117527731B (zh) | 一种用于硬件卸载的包编辑方法、计算机设备及介质 | |
| Li et al. | IB-APC: InfiniBand-Ethernet Protocol Conversion for Scalable Long-Distance RDMA Communication |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| 121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 21741424 Country of ref document: EP Kind code of ref document: A1 |
|
| ENP | Entry into the national phase |
Ref document number: 2021741424 Country of ref document: EP Effective date: 20220726 |
|
| NENP | Non-entry into the national phase |
Ref country code: DE |