Method, apparatus, and storage medium for processing data
By adjusting the data type and data dimension in the All-Reduce operation, redundant processing of the same reduction result by the computing unit is avoided, the problem of redundant computing in distributed computing is solved, and the computing efficiency is optimized.
Patent Information
- Application Number
- CN202510666597.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-21
- Publication Date
- 2026-11-24
AI Technical Summary
In existing technologies, the All-Reduce operation involves redundant computations in distributed computing, resulting in unnecessary computational overhead.
In the All-Reduce operation, target processing is performed between the reduction operation and the AllGather phase to avoid redundant processing of the same reduction result by the computing unit. The amount of data is reduced by adjusting the data type and data dimension.
It effectively avoids redundant calculations between computing units, reduces unnecessary computing overhead, and optimizes communication volume and latency.
Smart Images

Figure CN123157402A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computing, and in particular to a method, apparatus and storage medium for processing data. Background Technology
[0002] The All-Reduce operation is a collective communication operation in distributed and parallel computing. It reduces the data of all participating computing units to obtain the reduction result, and then broadcasts the reduction result to all computing units.
[0003] In related technologies, All-Reduce operations can be applied to data processing in the training and / or inference of large language models, data processing in distributed machine learning training, large-scale data processing, and / or cloud computing data processing. However, data processing using All-Reduce operations in related technologies involves a large amount of redundant computation, generating unnecessary computational overhead. Summary of the Invention
[0004] This application provides a method, apparatus, and storage medium for processing data, which can avoid redundant calculations between computing units and prevent unnecessary computational overhead. The technical solution is as follows:
[0005] In a first aspect, this application provides a method for processing data. The method is applied to the i-th computing unit among M computing units in a computing cluster, where M is an integer greater than 1 and i is a positive integer less than or equal to M. Each of the M computing units includes M data items to be processed. In the method, a reduction operation is performed on the i-th data set to obtain the i-th reduction result, where the i-th data set includes the i-th data item from each computing unit. The i-th reduction result is then subjected to target processing to obtain the i-th target result. The i-th target result is sent to the computing units other than the i-th computing unit among the M computing units. Furthermore, the j-th target result sent by the j-th computing unit is received. The j-th target result is obtained by the j-th computing unit performing a reduction operation on the j-th data set to obtain the j-th reduction result and then performing target processing on the j-th reduction result. The j-th data set includes the j-th data item from each computing unit, where j is a positive integer less than or equal to M and i is not equal to j.
[0006] Since the i-th computational unit obtains the i-th reduction result and the j-th computational unit obtains the j-th reduction result, the i-th computational unit performs target processing on the i-th reduction result to obtain the i-th target result, and the j-th computational unit performs target processing on the j-th reduction result to obtain the j-th target result. The i-th computational unit sends the i-th target result to other computational units, and the j-th computational unit sends the j-th target result to other computational units, ensuring that each computational unit in the computation cluster obtains the target result from each computational unit. Therefore, the i-th and j-th computational units perform target processing on different reduction results, i.e., they do not perform target processing on the same reduction results, avoiding redundant computation between the i-th and j-th computational units and preventing unnecessary computational overhead.
[0007] In one possible implementation, the i-th data from the j-th computing unit is received, and the i-th data set includes the i-th data from the i-th computing unit and the i-th data from the j-th computing unit. This allows the i-th computing unit to obtain the i-th data from the other computing units, thereby successfully obtaining all the data in the i-th data set.
[0008] In another possible implementation, the j-th data from the i-th computing unit is sent to the j-th computing unit. The j-th data set includes the j-th data from both the i-th and j-th computing units. This allows the j-th computing unit to obtain the j-th data from the other computing units, thus successfully obtaining all the data in the j-th data set.
[0009] In another possible implementation, the target processing includes one or more of the following operations: normalization, activation, routing, data type adjustment, or data dimension adjustment.
[0010] In another possible implementation, the target processing includes the operation of adjusting the data type, where the data type of the i-th reduction result is a first data type, and the data type of the i-th target result is a second data type, with the data length of the first data type being greater than the data length of the second data type. This reduces the amount of data that needs to be sent when sending the i-th target result to other computing units.
[0011] In another possible implementation, the target processing includes adjusting the data dimensions. The data dimension of the i-th reduction result is the first data dimension, and the data dimension of the i-th target result is the second data dimension, where the first data dimension is greater than the second data dimension. This reduces the amount of data that needs to be sent when sending the i-th target result to other computing units.
[0012] In another possible implementation, the M data in the i-th computation unit are M sub-matrices in the matrix to be processed included in the i-th computation unit, each sub-matrix including one or more rows of data in the matrix; or, the M data in the i-th computation unit are M sub-tensors included in the tensor to be processed in the i-th computation unit.
[0013] Secondly, this application provides a data processing apparatus, wherein the apparatus is the i-th computing unit among M computing units in a computing cluster, where M is an integer greater than 1 and i is a positive integer less than or equal to M, and each of the M computing units includes M data to be processed, the apparatus comprising:
[0014] The processing unit is used to perform a reduction operation on the i-th data set to obtain the i-th reduction result. The i-th data set includes the i-th data in each computing unit.
[0015] The processing unit is also used to perform target processing on the i-th reduction result to obtain the i-th target result;
[0016] A sending unit is configured to send the i-th target result to one of the M computing units other than the aforementioned device; and,
[0017] The receiving unit is used to receive the j-th target result sent by the j-th computing unit. The j-th target result is obtained by the j-th computing unit performing a reduction operation on the j-th data set to obtain the j-th reduction result and then performing target processing on the j-th reduction result. The j-th data set includes the j-th data in each computing unit, where j is a positive integer less than or equal to M and i is not equal to j.
[0018] Since the processing unit obtains the i-th reduction result and the j-th computation unit obtains the j-th reduction result, the processing unit performs target processing on the i-th reduction result to obtain the i-th target result, and the j-th computation unit performs target processing on the j-th reduction result to obtain the j-th target result. The processing unit then sends the i-th target result to other computation units, and the j-th computation unit sends the j-th target result to other computation units. This ensures that each computation unit in the computation cluster obtains the target result from its respective computation unit. Therefore, the processing unit and the j-th computation unit perform target processing on different reduction results, meaning they do not perform target processing on the same reduction results. This avoids redundant computation between the processing unit and the j-th computation unit and prevents unnecessary computational overhead.
[0019] In one possible implementation, the receiving unit is further configured to receive the i-th data from the j-th computing unit, which is transmitted by the j-th computing unit. The i-th data set includes the i-th data in the device and the i-th data from the j-th computing unit. This allows the processing unit to obtain the i-th data from the other computing units, thereby successfully obtaining all the data in the i-th data set.
[0020] In another possible implementation, the sending unit is further configured to send the j-th data from the device to the j-th computing unit, wherein the j-th data set includes the j-th data from the device and the j-th data from the j-th computing unit. This allows the j-th computing unit to obtain the j-th data from the other computing units, thereby successfully obtaining all the data in the j-th data set.
[0021] In another possible implementation, the target processing includes one or more of the following operations: normalization, activation, routing, data type adjustment, or data dimension adjustment.
[0022] In another possible implementation, the target processing includes the operation of adjusting the data type, where the data type of the i-th reduction result is a first data type, and the data type of the i-th target result is a second data type, with the data length of the first data type being greater than the data length of the second data type. This reduces the amount of data that needs to be sent when sending the i-th target result to other computing units.
[0023] In another possible implementation, the target processing includes adjusting the data dimensions. The data dimension of the i-th reduction result is the first data dimension, and the data dimension of the i-th target result is the second data dimension, where the first data dimension is greater than the second data dimension. This reduces the amount of data that needs to be sent when sending the i-th target result to other computing units.
[0024] In another possible implementation, the M data on the device are M sub-matrices in the matrix to be processed included in the device, each sub-matrix including one or more rows of data of the matrix; or, the M data on the device are M sub-tensors included in the tensor to be processed in the device.
[0025] Thirdly, this application provides a computing device cluster, the computing device cluster including at least one computing device, each computing device including a processor and a memory;
[0026] The processor of the at least one computing device is configured to execute instructions stored in the memory of the at least one computing device to cause the cluster of computing devices to perform the method of the first aspect or any possible implementation thereof.
[0027] Fourthly, this application provides a computer program product containing instructions that, when executed by a cluster of computing devices, cause the cluster of computing devices to perform the method of the first aspect or any possible implementation thereof.
[0028] Fifthly, this application provides a computer-readable storage medium including computer program instructions that, when executed by a cluster of computing devices, perform the method of the first aspect or any possible implementation thereof.
[0029] In a sixth aspect, this application provides a chip including a memory and a processor, wherein the memory is used to store computer instructions, and the processor is used to retrieve and execute the computer instructions from the memory to perform the method in the first aspect or any possible implementation of the first aspect. Attached Figure Description
[0030] Figure 1 This is a schematic diagram illustrating a data processing embodiment provided in this application;
[0031] Figure 2 This is a schematic diagram illustrating another data processing method provided in an embodiment of this application;
[0032] Figure 3 This is a flowchart of a data processing method provided in an embodiment of this application;
[0033] Figure 4 This is a schematic diagram illustrating another data processing method provided in an embodiment of this application;
[0034] Figure 5 This is a schematic diagram illustrating another data processing method provided in an embodiment of this application;
[0035] Figure 6 This is a schematic diagram of a data processing device provided in an embodiment of this application;
[0036] Figure 7 This is a schematic diagram of a computing device structure provided in an embodiment of this application;
[0037] Figure 8 This is a schematic diagram of a cluster structure for processing data provided in an embodiment of this application;
[0038] Figure 9 This is a schematic diagram of another data processing cluster structure provided in an embodiment of this application. Detailed Implementation
[0039] A computing cluster typically comprises multiple computing units, which can be used to perform one or more of the following processes: model training, model inference, distributed machine learning data processing, large-scale data processing, or cloud computing data processing. For each of these processes, the process includes an All-Reduce operation and target processing.
[0040] Alternatively, computing clusters can be applied to distributed computing systems, such as those within deep learning inference frameworks. These systems consist of multiple computing nodes, each running part or all of a deep learning model. Data is exchanged and synchronized between the nodes via a network to enable parallel training of the model.
[0041] The computing cluster uses multiple computing units to perform any of the above processing steps, which include All-Reduce operations and target processing. All-Reduce operations can include a ReduceScatter phase, a reduce operation, and an AllGather phase. The ReduceScatter phase reduces distributed data and distributes it across the nodes of the computing cluster, applicable to scenarios requiring local result distribution. The AllGather phase aggregates distributed data across all nodes, applicable to scenarios requiring global data synchronization.
[0042] For example, see Figure 1 Assume the computing cluster includes a first computing unit, a second computing unit, and a third computing unit; the first computing unit includes three data to be processed, namely data a1, data b1, and data c1; the second computing unit includes three data to be processed, namely data a2, data b2, and data c2; the third computing unit includes three data to be processed, namely data a3, data b3, and data c3.
[0043] In the ReduceScatter phase, the first computing unit sends data b1 to the second computing unit and data c1 to the third computing unit; the second computing unit sends data a2 to the first computing unit and data c2 to the third computing unit; the third computing unit sends data a3 to the first computing unit and data b3 to the second computing unit. The first computing unit receives data a2 and data a3, the second computing unit receives data b1 and data b3, and the third computing unit receives data c1 and data c2. This distributes the distributed data a1, b1, and c1 across the first, second, and third computing units; it also distributes the distributed data a2, b2, and c2 across the first, second, and third computing units; and it distributes the distributed data a3, b3, and c3 across the first, second, and third computing units.
[0044] Assuming the reduction operation in the All-Reduce operation can be an addition operation, such as... Figure 1 As shown, the first calculation unit performs a reduction operation on data a1, a2, and a3 to obtain a first reduction result, which includes the cumulative value 'a' of data a1, a2, and a3. The second calculation unit performs a reduction operation on data b1, b2, and b3 to obtain a second reduction result, which includes the cumulative value 'b' of data b1, b2, and b3. The third calculation unit performs a reduction operation on data c1, c2, and c3 to obtain a third reduction result, which includes the cumulative value 'c' of data c1, c2, and c3.
[0045] In the AllGather phase, the first computation unit sends the first reduction result 'a' to the second and third computation units; the second computation unit sends the second reduction result 'b' to the first and third computation units; and the third computation unit sends the third reduction result 'c' to the first and second computation units. Therefore, the first computation unit includes the first reduction result 'a', the second reduction result 'b', and the third reduction result 'c'; similarly, the second and third computation units also include the first reduction result 'a', the second reduction result 'b', and the third reduction result 'c'.
[0046] Then, the first calculation unit performs target processing on the first reduction result a to obtain the first target result D(a), performs target processing on the second reduction result b to obtain the second target result D(b), and performs target processing on the third reduction result c to obtain the third target result D(c). The second calculation unit performs target processing on the first reduction result a to obtain the first target result D(a), performs target processing on the second reduction result b to obtain the second target result D(b), and performs target processing on the third reduction result c to obtain the third target result D(c). The third calculation unit performs target processing on the first reduction result a to obtain the first target result D(a), performs target processing on the second reduction result b to obtain the second target result D(b), and performs target processing on the third reduction result c to obtain the third target result D(c). This ensures that the first, second, and third calculation units all include the same target result.
[0047] In the above processing, the first calculation unit performs target processing on the first reduction result a, the second reduction result b, and the third reduction result c, respectively. The second calculation unit also performs target processing on the first reduction result a, the second reduction result b, and the third reduction result c, respectively. In other words, the first, second, and third calculation units all perform the same target processing on the same reduction result, including a large amount of redundant calculations, generating unnecessary computational overhead.
[0048] like Figure 1 As shown, since the target processing is executed after the All-Reduce operation, each computational unit includes the same multiple reduction results after the All-Reduce operation. Each computational unit then performs target processing on these multiple reduction results, resulting in a large amount of redundant computation. To solve this problem, this embodiment places the target processing between the reduction operation and the AllGather phase in the All-Reduce operation, as follows: Figure 2 As shown, the processing procedure is as follows.
[0049] In the ReduceScatter phase, the first computing unit sends data b1 to the second computing unit and data c1 to the third computing unit; the second computing unit sends data a2 to the first computing unit and data c2 to the third computing unit; the third computing unit sends data a3 to the first computing unit and data b3 to the second computing unit. The first computing unit receives data a2 and data a3, the second computing unit receives data b1 and data b3, and the third computing unit receives data c1 and data c2. This distributes the distributed data a1, b1, and c1 across the first, second, and third computing units; it also distributes the distributed data a2, b2, and c2 across the first, second, and third computing units; and it distributes the distributed data a3, b3, and c3 across the first, second, and third computing units.
[0050] Next, each computational unit performs the reduction operation in the All-Reduce operation, such as... Figure 2 As shown, the first calculation unit performs a reduction operation on data a1, data a2, and data a3 to obtain a first reduction result a. The second calculation unit performs a reduction operation on data b1, data b2, and data b3 to obtain a second reduction result b. The third calculation unit performs a reduction operation on data c1, data c2, and data c3 to obtain a third reduction result c.
[0051] Then each computational unit performs target processing on its respective reduction result. That is, the first computational unit performs target processing on the first reduction result a to obtain the first target result D(a), the second computational unit performs target processing on the second reduction result b to obtain the second target result D(b), and the third computational unit performs target processing on the third reduction result c to obtain the third target result D(c).
[0052] Next, in the AllGather phase, the first computing unit sends the first target result D(a) to the second and third computing units, the second computing unit sends the second target result D(b) to the first and third computing units, and the third computing unit sends the third target result D(c) to the first and second computing units. This ensures that the first, second, and third computing units all contain the same target result.
[0053] See Figure 2For each computational unit, after performing the reduction operation, it performs target processing on the reduction result and sends the target result to each of the other computational units. Since each computational unit obtains a different reduction result after performing the reduction operation, each computational unit performs target processing on different reduction results, thereby preventing redundant computations and unnecessary computational overhead.
[0054] The following will describe in detail the process of a computing cluster using multiple computing units to process data through any of the following embodiments.
[0055] See Figure 3 This application provides a data processing method 300, which is applied to a computing cluster. The computing cluster includes M computing units, where M is an integer greater than 1, and each of the M computing units includes M data items to be processed. The method 300 includes the following process.
[0056] Step 301: The i-th computing unit in the computing cluster sends the j-th data of the i-th computing unit to the j-th computing unit in the computing cluster, where i and j are both positive integers less than or equal to M, and i is not equal to j.
[0057] In some embodiments, the M computing units in the computing cluster may include one or more of the following: computing cards, processors, processes or threads, etc. The processor may be a central processing unit (CPU), a graphics processing unit (GPU), a neural processing unit (NPU) and / or a tensor processing unit (TPU), etc.
[0058] In some embodiments, the M data included in the i-th computing unit are M sub-matrices in the matrix to be processed included in the i-th computing unit, and each sub-matrix includes one or more rows of data from the matrix.
[0059] In some embodiments, the M data points in the i-th computation unit are the M sub-tensors included in the tensor to be processed in the i-th computation unit. Optionally, the tensor to be processed can be divided into M sub-tensors by splitting the tensor to be processed, and the data volume of each sub-tensor can be equal or unequal.
[0060] For example, such as Figure 2 As shown, M equals 3, and the computing cluster consists of three computing units: the first, second, and third computing units are respectively... Figure 2The first calculation unit, the second calculation unit, and the third calculation unit in the process.
[0061] When i=1 and j=2, the first computing unit sends the second data b1 included in the first computing unit to the second computing unit; when j=3, the first computing unit sends the third data c1 included in the first computing unit to the third computing unit.
[0062] When i=2 and j=1, the second computing unit sends the first data a2 included in the second computing unit to the first computing unit; when j=3, the second computing unit sends the third data c2 included in the second computing unit to the third computing unit.
[0063] When i=3 and j=1, the third computing unit sends the first data a3 included in the third computing unit to the first computing unit; when j=2, the third computing unit sends the second data b3 included in the third computing unit to the second computing unit.
[0064] Step 302: The i-th computing unit in the computing cluster receives the i-th data sent by the j-th computing unit in the computing cluster.
[0065] For example, such as Figure 2 As shown, i=1, j=2, the first computing unit receives the first data a2 sent by the second computing unit, which is included in the second computing unit; j=3, the first computing unit receives the first data a3 sent by the third computing unit, which is included in the third computing unit.
[0066] When i=2 and j=1, the second computing unit receives the second data b1 sent by the first computing unit, which is included in the first computing unit; when j=3, the second computing unit receives the second data b3 sent by the third computing unit, which is included in the third computing unit.
[0067] When i=3 and j=1, the third computing unit receives the third data c1 from the first computing unit; when j=2, the third computing unit receives the third data c2 from the second computing unit.
[0068] Step 303: The i-th computing unit in the computing cluster performs a reduction operation on the i-th data set to obtain the i-th reduction result. The i-th data set includes the i-th data in each computing unit.
[0069] The i-th data set includes the i-th data in the i-th computation unit and the i-th data in the j-th computation unit.
[0070] Similarly, the j-th computing unit in the computing cluster will also receive the j-th data from the i-th computing unit sent by the i-th computing unit in the computing cluster. The j-th computing unit performs a reduction operation on the j-th data set to obtain the j-th reduction result. The j-th data set includes the j-th data from each computing unit, that is, the j-th data set includes the j-th data from the j-th computing unit and the j-th data from the i-th computing unit.
[0071] For example, such as Figure 2 As shown, i=1, the first data set of the first computing unit includes the first data a1 in the first computing unit, the first data a2 received in the second computing unit and the first data a3 received in the third computing unit. The first computing unit performs a reduction operation on the first data set including data a1, data a2 and data a3 to obtain the first reduction result a.
[0072] i=2, the second data set of the second computing unit includes the second data b2 in the second computing unit, the second data b1 received from the first computing unit and the second data b3 received from the third data unit. The second computing unit performs a reduction operation on the second data set including data b1, data b2 and data b3 to obtain the second reduction result b.
[0073] i=3, the third data set of the third computing unit includes the third data c3 in the third computing unit, the third data c1 received from the first computing unit and the third data c2 received from the second data unit. The third computing unit performs a reduction operation on the third data set including data c1, data c2 and data c3 to obtain the third reduction result c.
[0074] Optionally, the reduction operation may include one or more of the following: summation operation, product operation, maximum value operation, or minimum value operation.
[0075] Step 304: The i-th computing unit in the computing cluster performs target processing on the i-th reduction result to obtain the i-th target result.
[0076] In some embodiments, target processing includes one or more of the following operations: normalization operation, activation operation, routing operation, data type adjustment operation, or data dimension adjustment operation.
[0077] Optionally, the data type adjustment operation is used to adjust the data type of the i-th reduction result.
[0078] Optionally, the operation of adjusting data dimensions is used to adjust the data dimensions of the i-th reduction result.
[0079] Optionally, the normalization operation is used to normalize the i-th reduction result.
[0080] Optionally, the activation operation is used to perform nonlinear activation on the i-th reduction result.
[0081] Optionally, the routing operation is used to perform expert routing selection in a multi-expert network on the i-th reduction result. For example, expert routing selection can be performed as a previous route calculation, etc.
[0082] Optionally, the target processing includes adjusting the data type. The data type of the i-th reduction result is a first data type, and the data type of the i-th target result is a second data type. The data length of the first data type is greater than the data length of the second data type. In other words, the data type of the i-th reduction result changes from the first data type to the second data type.
[0083] For example, the first data type can be fp16 or bf16 (representing a 16-bit floating-point number), and its data length is 16 bits. The second data type can be int8 (representing an 8-bit integer) or fp8 (representing an 8-bit floating-point number), and its data length is 8 bits. In this way, after performing target processing on the i-th reduction result to obtain the i-th target result, the data size of the i-th target result can be less than the data size of the i-th reduction result. Compared to related technologies that send the i-th reduction result, this embodiment of the application sends the i-th target result, reducing the total communication data size by at least 25%.
[0084] Optionally, the target processing includes adjusting the data dimensions. The data dimension of the i-th reduction result is the first data dimension, and the data dimension of the i-th target result is the second data dimension, where the first data dimension is greater than the second data dimension. In other words, changing the data dimension of the i-th reduction result from the first data dimension to the second data dimension can make the data size of the i-th target result smaller than the data size of the i-th reduction result.
[0085] For example, assuming the first data dimension (feature dimension) has 7168 features and the second data dimension (feature dimension) has 2112 features, the data dimension of the i-th reduction result is reduced from 7168 features to the i-th target result with a data dimension of 2112 features. Compared to related technologies that send the i-th reduction result, this embodiment of the application sends the i-th target result, reducing the total amount of data communicated by at least 34%.
[0086] Other computing units within the computing cluster also perform target processing on the obtained reduction results to obtain the target result. For example, the j-th computing unit in the computing cluster performs target processing on the j-th reduction result to obtain the j-th target result.
[0087] For example, such as Figure 2 As shown, when i=1, the first computational unit performs objective processing on the first reduction result a to obtain the first objective result D(a). When i=2, the second computational unit performs objective processing on the second reduction result b to obtain the second objective result D(b). When i=3, the third computational unit performs objective processing on the third reduction result c to obtain the third objective result D(c).
[0088] Step 305: The i-th computing unit in the computing cluster sends the i-th target result to the computing units other than the i-th computing unit among the M computing units.
[0089] Similarly, the j-th computing unit in the computing cluster sends the j-th target result to the other computing units in the M computing units besides the j-th computing unit.
[0090] For example, such as Figure 2 As shown, the first computing unit sends the first target result D(a) to the second computing unit and the third computing unit, the second computing unit sends the second target result D(b) to the first computing unit and the third computing unit, and the third computing unit sends the third target result D(c) to the first computing unit and the second computing unit.
[0091] Step 306: The i-th computing unit in the computing cluster receives the j-th target result sent by the j-th computing unit, so that the i-th computing unit can obtain M target results, which include the i-th target result and the j-th target result.
[0092] Similarly, the j-th computing unit in the computing cluster receives the i-th target result sent by the i-th computing unit, so that the j-th computing unit can obtain M target results, which include the i-th target result and the j-th target result.
[0093] For example, see Figure 2 The first calculation unit receives the second target result D(b) and the third target result D(c), thus obtaining the first target result D(a), the second target result D(b), and the third target result D(c). The second calculation unit receives the first target result D(a) and the third target result D(c), thus obtaining the first target result D(a), the second target result D(b), and the third target result D(c). The third calculation unit receives the first target result D(a) and the second target result D(b), thus obtaining the first target result D(a), the second target result D(b), and the third target result D(c).
[0094] The method 300 can be applied to computational frameworks or algorithms for deep learning scenario optimization, such as in large-scale distributed training, and can be provided as a software service (SaaS) or as open-source software.
[0095] In this embodiment, the i-th computing unit in the computing cluster sends the j-th data from the i-th computing unit to the j-th computing unit in the computing cluster, and receives the i-th data from the j-th computing unit sent by the j-th computing unit. This results in the i-th computing unit obtaining an i-th data set, which includes the i-th data from each of the M computing units, and performing a reduction operation on the i-th data set to obtain an i-th reduction result; and the j-th computing unit obtaining a j-th data set, which includes the j-th data from each of the M computing units, and performing a reduction operation on the j-th data set to obtain a j-th reduction result. The i-th computing unit will not send the i-th reduction result to any computing unit in the computing cluster other than the i-th computing unit, and the j-th computing unit will not send the j-th reduction result to any computing unit in the computing cluster other than the j-th computing unit. In other words, the i-th computation unit performs target processing on the i-th reduction result, and the j-th computation unit performs target processing on the j-th reduction result. The i-th and j-th computation units will not include the same reduction result, nor will they perform target processing on the same reduction result. This avoids redundant computation among the M computation units and prevents unnecessary computational overhead. Since target processing can include operations to adjust data types and / or data dimensions, making the data volume of the target result smaller than the energy of the reduction result, the i-th computation unit sends the i-th target result to all computation units in the computation cluster except for the i-th computation unit, and the j-th computation unit sends the j-th target result to all computation units in the computation cluster except for the j-th computation unit. This reduces communication volume, communication overhead, and latency, which is beneficial for optimizing the inference latency of large models and / or the training latency of large models.
[0096] This refers to the processing of model training, model inference, distributed machine learning data processing, large-scale data processing, or cloud computing data processing. In these processes, Figure 3 The data processing method 300 shown is a sub-process within this processing procedure, which may be executed once or multiple times. Figure 3 The data processing method 300 shown is illustrated.
[0097] See Figure 4The model inference process shown includes a first matrix multiplication operation MatMul1, a self-attention calculation operation Attention, a second matrix multiplication operation MatMul2, a first data processing operation, a third matrix multiplication operation MatMul3, an activation processing MLP, a fourth matrix multiplication operation MatMul4, and a second data processing operation.
[0098] The implementation processes for both the first and second data processing operations are as described above. Figure 3 The data processing method 300 shown. The first data processing operation includes a first ReduceScatter stage and a first reduction operation ( Figure 4 (Not shown in the diagram), the first target processing and the first AllGather stage, the second data processing operations include the second ReduceScatter stage and the second reduction operation ( Figure 4 (Not shown in the diagram), second objective processing, and the second AllGather phase.
[0099] The computing cluster comprises M computing units. The i-th computing unit of the cluster comprises M first matrices, first weight matrices, second weight matrices, third weight matrices, fourth weight matrices, first vector operators, and second vector operators. Both the first and second vector operators are used for non-matrix multiplication. M is an integer greater than 1, and i is a positive integer less than or equal to M.
[0100] During the first matrix multiplication operation MatMul1, the i-th computation unit performs column partitioning on the first weight matrix to obtain M first sub-weight matrices. The M first sub-weight matrices correspond one-to-one with the M first matrices. Each first sub-weight matrix is multiplied by the first matrix corresponding to each first sub-weight matrix to obtain M second matrices.
[0101] During the Attention process, the i-th computation unit performs self-attention computation on the M second matrices to couple the elements included in each of the M second matrices, thereby obtaining M third matrices.
[0102] During the second matrix multiplication operation MatMul2, the i-th computation unit performs row partitioning on the second weight matrix to obtain M second sub-weight matrices. The M second sub-weight matrices correspond one-to-one with the M third matrices. Each second sub-weight matrix is multiplied by the row of the third matrix corresponding to each second sub-weight matrix to obtain M fourth matrices.
[0103] M fourth matrices represent the M data to be processed in the first data processing operation. In the first ReduceScatter stage of the first data processing operation, the i-th computing unit sends the j-th fourth matrix of the i-th computing unit to the j-th computing unit in the computing cluster, where j is a positive integer less than or equal to M and i is not equal to j, and receives the i-th fourth matrix of the j-th computing unit sent by the j-th computing unit.
[0104] The i-th computational unit performs a first reduction operation on the i-th first matrix set to obtain the i-th first reduction result. The i-th first matrix set includes the i-th fourth matrix in each computational unit. Based on the first Vector operator, the i-th first reduction result is processed by the first objective to obtain the i-th first objective result.
[0105] In the first AllGather stage of the first data processing operation, the i-th computing unit sends the i-th first target result to the computing units other than the i-th computing unit among the M computing units, and receives the j-th first target result sent by the j-th computing unit, thus obtaining a total of M first target results. The first target results are also data in matrix form.
[0106] The j-th first objective result is the result obtained by the j-th computing unit performing a first reduction operation on the j-th first matrix set to obtain the j-th first reduction result, and then performing a first objective processing on the j-th first reduction result based on the first Vector operator. The j-th first matrix set includes the j-th fourth matrix in each computing unit.
[0107] During the third matrix multiplication operation MatMul3, the i-th computation unit performs column partitioning on the third weight matrix to obtain M third sub-weight matrices. The M third sub-weight matrices correspond one-to-one with the M first target results. Each third sub-weight matrix is multiplied by the first target result corresponding to each third sub-weight matrix to obtain M fifth matrices.
[0108] During the activation process of MLP, the i-th computational unit activates the M fifth matrices to obtain the M sixth matrices.
[0109] During the fourth matrix multiplication operation MatMul4, the i-th computation unit performs row partitioning on the fourth weight matrix to obtain M fourth sub-weight matrices. The M fourth sub-weight matrices correspond one-to-one with the M sixth matrices. Each fourth sub-weight matrix is multiplied by the corresponding row of the sixth matrix to obtain M seventh matrices.
[0110] The M seventh matrices represent the M data to be processed in the second data processing operation. In the second ReduceScatter stage included in the second data processing operation, the i-th computing unit sends the j-th seventh matrix included in the i-th computing unit to the j-th computing unit included in the computing cluster, and receives the i-th seventh matrix included in the j-th computing unit sent by the j-th computing unit.
[0111] The i-th computational unit performs a second reduction operation on the i-th set of second matrices to obtain the i-th second reduction result. The i-th set of second matrices includes the i-th seventh matrix in each computational unit. Based on the second Vector operator, the i-th second reduction result is then subjected to a second objective processing to obtain the i-th second objective result.
[0112] In the second AllGather stage included in the second data processing operation, the i-th computing unit sends the i-th second target result to the computing units other than the i-th computing unit among the M computing units, and receives the j-th second target result sent by the j-th computing unit, thus obtaining a total of M second target results. The second target results are also data in matrix form.
[0113] The j-th second objective result is the result obtained by the j-th computational unit performing a second reduction operation on the j-th second matrix set to obtain the j-th second reduction result, and then performing a second objective processing on the j-th second reduction result based on the second Vector operator. The j-th second matrix set includes the j-th seventh matrix in each computational unit.
[0114] Then, the i-th computation unit takes the M second target results as M first matrices and returns to start the execution from the process of the first matrix multiplication operation MatMul1.
[0115] See Figure 5 The following is another model inference process, which includes a first data processing operation, a dimension-up operation (MLA), a self-attention calculation operation (Attention), a first matrix multiplication operation (MLA-O), a second data processing operation, a second matrix multiplication operation (MOE-up and Gate), activation processing, a third matrix multiplication operation (MOE-down), and post-routing calculation.
[0116] The implementation processes for both the first and second data processing operations are as described above. Figure 3 The data processing method 300 shown. The first data processing operation includes a first ReduceScatter stage and a first reduction operation ( Figure 5 (Not shown in the diagram), dimensionality reduction and the first AllGather stage, the second data processing operations include the second ReduceScatter stage and the second reduction operation ( Figure 5 (Not shown in the diagram), pre-routing computation, and the second AllGather stage. Dimensionality reduction is the target processing in the first data processing operation, and pre-routing computation is the target processing in the second data processing operation.
[0117] The computing cluster consists of M computing units. The i-th computing unit of the computing cluster consists of M first matrices, first weight matrices, second weight matrices, third weight matrices, and fourth weight matrices, where M is an integer greater than 1 and i is a positive integer less than or equal to M.
[0118] In the first ReduceScatter phase included in the first data processing operation, the i-th computing unit sends the j-th first matrix included in the i-th computing unit to the j-th computing unit included in the computing cluster, where j is a positive integer less than or equal to M and i is not equal to j, and receives the i-th first matrix included in the j-th computing unit sent by the j-th computing unit.
[0119] The i-th computational unit performs a first reduction operation on the i-th first matrix set to obtain the i-th first reduction result. The i-th first matrix set includes the i-th first matrix in each computational unit. The i-th first reduction result is then subjected to dimensionality reduction to obtain the i-th first target result. The data dimension of the i-th first target result is smaller than the data dimension of the i-th first matrix.
[0120] In the first AllGather stage of the first data processing operation, the i-th computing unit sends the i-th first target result to the computing units other than the i-th computing unit among the M computing units, and receives the j-th first target result sent by the j-th computing unit, thus obtaining a total of M first target results. The first target results are also data in matrix form.
[0121] The j-th first objective result is the result obtained by the j-th computing unit performing a first reduction operation on the j-th first matrix set to obtain the j-th first reduction result, and then performing dimensionality reduction on the j-th first reduction result. The j-th first matrix set includes the j-th first matrix in each computing unit.
[0122] In the process of dimensionality upscaling operation MLA, the i-th computational unit performs column partitioning on the first weight matrix to obtain M first sub-weight matrices. The M first sub-weight matrices correspond one-to-one with the M first target results. The data dimension of each first sub-weight matrix is greater than the data dimension of the first target result corresponding to each first sub-weight matrix. Each first sub-weight matrix is multiplied by the first target result corresponding to each first sub-weight matrix to obtain M second matrices.
[0123] During the Attention process, the i-th computation unit performs self-attention computation on the M second matrices to couple the elements included in each of the M second matrices, thereby obtaining M third matrices.
[0124] During the first matrix multiplication operation MLA-O, the i-th computational unit performs row partitioning on the second weight matrix to obtain M second sub-weight matrices. The M second sub-weight matrices correspond one-to-one with the M third matrices. Each second sub-weight matrix is multiplied by the row of the third matrix corresponding to each second sub-weight matrix to obtain M fourth matrices.
[0125] The M fourth matrices represent the M data to be processed in the second data processing operation. In the second ReduceScatter stage included in the second data processing operation, the i-th computing unit sends the j-th fourth matrix included in the i-th computing unit to the j-th computing unit included in the computing cluster, and receives the i-th fourth matrix included in the j-th computing unit sent by the j-th computing unit.
[0126] The i-th computational unit performs a second reduction operation on the i-th second matrix set to obtain the i-th second reduction result. The i-th second matrix set includes the i-th fourth matrix in each computational unit. The i-th second reduction result is then processed by a pre-routing computation to obtain the i-th second target result.
[0127] In the second AllGather stage included in the second data processing operation, the i-th computing unit sends the i-th second target result to the computing units other than the i-th computing unit among the M computing units, and receives the j-th second target result sent by the j-th computing unit, thus obtaining a total of M second target results. The second target results are also data in matrix form.
[0128] The j-th second objective result is the result of the j-th computational unit performing a second reduction operation on the j-th second matrix set to obtain the j-th second reduction result, and performing a forward routing computation on the j-th second reduction result. The j-th second matrix set includes the j-th fourth matrix in each computational unit.
[0129] During the second matrix multiplication operation MOE-up and Gate, the i-th computational unit performs column partitioning on the third weight matrix to obtain M third sub-weight matrices. The M third sub-weight matrices correspond one-to-one with the M second objective results. Each third sub-weight matrix is multiplied by the corresponding second objective result to obtain M fifth matrices.
[0130] During the activation process of MLP, the i-th computational unit activates the M fifth matrices to obtain the M sixth matrices.
[0131] During the MOE-down operation of the third matrix multiplication, the i-th computational unit performs row partitioning on the fourth weight matrix to obtain M fourth sub-weight matrices. The M fourth sub-weight matrices correspond one-to-one with the M sixth matrices. Each fourth sub-weight matrix is multiplied by the row of the sixth matrix corresponding to each fourth sub-weight matrix to obtain M seventh matrices.
[0132] Then, the i-th computation unit performs a post-routing calculation on the M seventh matrices, uses the M seventh matrices obtained from the post-routing calculation as the M first matrices, and returns to start execution from the first data processing operation.
[0133] See Figure 6 This application provides a data processing apparatus 600, which is the i-th computing unit among M computing units in a computing cluster, where M is an integer greater than 1 and i is a positive integer less than or equal to M. Each of the M computing units includes M data to be processed. The apparatus 600 includes:
[0134] Processing unit 601 is used to perform a reduction operation on the i-th data set to obtain the i-th reduction result. The i-th data set includes the i-th data in each computing unit.
[0135] The processing unit 601 is also used to perform target processing on the i-th reduction result to obtain the i-th target result;
[0136] The sending unit 602 is configured to send the i-th target result to the computing units other than the device 600 among the M computing units; and,
[0137] The receiving unit 603 is used to receive the j-th target result sent by the j-th computing unit. The j-th target result is obtained by the j-th computing unit performing a reduction operation on the j-th data set to obtain the j-th reduction result and then performing target processing on the j-th reduction result. The j-th data set includes the j-th data in each computing unit, where j is a positive integer less than or equal to M and i is not equal to j.
[0138] Optionally, for details of the reduction operation performed by processing unit 601 on the i-th data set, please refer to [link to relevant documentation]. Figure 3 The details of step 303 in method 300 shown will not be explained in detail here.
[0139] Optionally, for details of the target processing of the i-th reduction result by the processing unit 601, please refer to [link to relevant documentation]. Figure 3 The details of step 304 in method 300 shown will not be explained in detail here.
[0140] Optionally, for details on how the sending unit 602 sends the i-th target result to the computing units other than the device 600 among the M computing units, see [link to relevant documentation]. Figure 3 The details of step 305 of method 300 shown will not be explained in detail here.
[0141] Optionally, for details on how the receiving unit 603 receives the j-th target result sent by the j-th computing unit, please refer to [link to relevant documentation]. Figure 3 The details of step 306 in method 300 shown will not be explained in detail here.
[0142] Optionally, the receiving unit 603 is further configured to receive the i-th data from the j-th computing unit sent by the j-th computing unit, wherein the i-th data set includes the i-th data in the device 600 and the i-th data in the j-th computing unit.
[0143] Optionally, for details on how receiving unit 603 receives the i-th data from the j-th computing unit sent by the j-th computing unit, please refer to [link to relevant documentation]. Figure 3 The details of step 302 in method 300 shown will not be explained in detail here.
[0144] Optionally, the sending unit 602 is further configured to send the j-th data in the device 600 to the j-th computing unit, wherein the j-th data set includes the j-th data in the device 600 and the j-th data in the j-th computing unit.
[0145] Optionally, for details of how the sending unit 602 sends the j-th data from the device 600 to the j-th computing unit, see [link to relevant documentation]. Figure 3 The details of step 301 of method 300 shown will not be explained in detail here.
[0146] Optionally, target processing includes one or more of the following operations: normalization, activation, routing, data type adjustment, or data dimension adjustment.
[0147] Optionally, the target processing includes the operation of adjusting the data type, where the data type of the i-th reduction result is a first data type, and the data type of the i-th target result is a second data type, with the data length of the first data type being greater than the data length of the second data type. This reduces the amount of data that needs to be sent when sending the i-th target result to other computing units.
[0148] Optionally, the target processing includes adjusting the data dimensions, where the data dimension of the i-th reduction result is the first data dimension, and the data dimension of the i-th target result is the second data dimension, with the first data dimension being larger than the second data dimension. This reduces the amount of data that needs to be sent when sending the i-th target result to other computing units.
[0149] Optionally, the M data on the device 600 are M sub-matrices in the matrix to be processed included in the device 600, each sub-matrix including one or more rows of data of the matrix; or, the M data on the device 600 are M sub-tensors included in the tensor to be processed in the device 600.
[0150] The processing unit 601, the transmitting unit 602, and the receiving unit 603 can all be implemented in software or in hardware. For example, the implementation of the processing unit 601 will be described below. Similarly, the implementation of the transmitting unit 602 and the receiving unit 603 can refer to the implementation of the processing unit 601.
[0151] As an example of a software functional unit, processing unit 601 may include code running on a computing instance. The computing instance may include at least one of a physical host (computing device), a virtual machine, and a container. Further, the aforementioned computing instance may be one or more. For example, processing unit 601 may include code running on multiple hosts / virtual machines / containers. The multiple hosts / virtual machines / containers used to run the code may be distributed in the same region or in different regions. Further, the multiple hosts / virtual machines / containers used to run the code may be distributed in the same availability zone (AZ) or in different AZs, each AZ including one or more geographically proximate data centers. Typically, a region may include multiple AZs.
[0152] Similarly, multiple hosts / virtual machines / containers used to run this code can be distributed within the same Virtual Private Cloud (VPC) or across multiple VPCs. Typically, a VPC is set up within a region. Communication between two VPCs within the same region, as well as between VPCs in different regions, requires a communication gateway to be set up within each VPC to enable interconnection between VPCs.
[0153] As an example of a hardware functional unit, processing unit 601 may include at least one computing device, such as a server. Alternatively, processing unit 601 may also be a device implemented using an application-specific integrated circuit (ASIC) or a programmable logic device (PLD). The PLD may be implemented using a complex programmable logical device (CPLD), a field-programmable gate array (FPGA), generic array logic (GAL), or any combination thereof.
[0154] The processing unit 601 includes multiple computing devices that can be distributed in the same region or in different regions. Similarly, the processing unit 601 includes multiple computing devices that can be distributed in the same Availability Zone (AZ) or in different AZs. Likewise, the processing unit 601 includes multiple computing devices that can be distributed in the same Virtual Private Cloud (VPC) or in multiple VPCs. These multiple computing devices can be any combination of computing devices such as servers, ASICs, PLDs, CPLDs, FPGAs, and GALs.
[0155] It should be noted that, in other embodiments, the processing unit 601 can be used to execute any step in the data processing method, the receiving unit 603 can be used to execute any step in the data processing method, and the sending unit 602 can be used to execute any step in the data processing method. The steps implemented by the receiving unit 603, the sending unit 602, and the processing unit 601 can be specified as needed. By implementing different steps in the data processing method through the receiving unit 603, the sending unit 602, and the processing unit 601, all functions of the data processing device 600 can be achieved.
[0156] In this embodiment, after the processing unit obtains the i-th reduction result and the j-th computation unit obtains the j-th reduction result, the processing unit performs target processing on the i-th reduction result to obtain the i-th target result, and the j-th computation unit performs target processing on the j-th reduction result to obtain the j-th target result. The processing unit then sends the i-th target result to other computation units, and the j-th computation unit sends the j-th target result to other computation units, ensuring that each computation unit in the computation cluster obtains the target result from its respective computation unit. Therefore, the processing unit and the j-th computation unit perform target processing on different reduction results, i.e., they do not perform target processing on the same reduction results, avoiding redundant computation between the processing unit and the j-th computation unit and preventing unnecessary computational overhead.
[0157] See Figure 7 This application provides a computing device 700. For example, the computing device 700 may be a computing unit in a computing cluster. The computing device can be... Figure 3 The computational unit in method 300 shown.
[0158] like Figure 7 As shown, the computing device 700 includes a bus 702, a processor 704, a memory 706, and a communication interface 708. The processor 704, the memory 706, and the communication interface 708 communicate with each other via the bus 702. The computing device 700 can be a server or a terminal device. It should be understood that this application does not limit the number of processors and memories in the computing device 700.
[0159] The 702 bus can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of representation, Figure 7 The bus 702 may be represented by a single line, but this does not mean that there is only one bus or one type of bus. The bus 702 may include a path for transmitting information between various components of the computing device 700 (e.g., processor 704, memory 706, communication interface 708).
[0160] Processor 704 may include any one or more processors such as a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).
[0161] Memory 706 may include volatile memory, such as random access memory (RAM). Memory 706 may also include non-volatile memory, such as read-only memory (ROM), flash memory, hard disk drive (HDD), or solid state drive (SSD).
[0162] See Figure 7 The memory 706 stores executable program code, and the processor 704 executes the executable program code to implement the following respectively. Figure 6 The processing unit 601, transmitting unit 602, and receiving unit 603 in the illustrated device 600 perform their functions to implement the method provided in any of the above embodiments. That is, the memory 706 stores instructions for executing the method provided in any of the above embodiments. Alternatively,
[0163] The communication interface 708 uses transceiver modules, such as, but not limited to, network interface cards and transceivers, to enable communication between the computing device 700 and other devices or communication networks.
[0164] This application also provides a data processing cluster. The data processing cluster includes at least one computing device. The computing device can be a server, such as a central server, an edge server, or a local server in a local data center. In some embodiments, the computing device can also be a terminal device such as a desktop computer, a laptop computer, or a smartphone.
[0165] like Figure 8 As shown, the data processing cluster includes at least one computing device 700. The memory 706 of one or more computing devices 700 in the data processing cluster may store the same instructions for performing the data processing methods provided in any of the above embodiments.
[0166] In some possible implementations, the memory 706 of one or more computing devices 700 in the data processing cluster may also store partial instructions for executing the aforementioned data processing method. In other words, a combination of one or more computing devices 700 can jointly execute instructions for performing the method provided in any of the above embodiments.
[0167] The memory 706 in different computing devices 700 within a computing device cluster can store different instructions, each used for execution such as... Figure 6This describes some of the functions of the data processing device 600 shown. That is, the instructions stored in the memory 706 of different computing devices 700 can implement the functions of one or more of the processing unit 601, the sending unit 602, and the receiving unit 603.
[0168] In some possible implementations, one or more computing devices in the data processing cluster can be connected via a network. This network can be a wide area network (WAN) or a local area network (LAN), etc. Figure 9 One possible implementation is shown. For example... Figure 9 As shown, the two computing devices 700A and 700B are connected via a network. Specifically, they are connected to the network through the communication interfaces in each computing device.
[0169] In this type of possible implementation, the memory 706 in the computing device 700A stores the execution of, for example... Figure 6 Instructions for the function of the processing unit 601 in the illustrated embodiment. Meanwhile, the memory 706 in the computing device 700B stores instructions for executing such... Figure 6 Instructions for the functions of the transmitting unit 602 and the receiving unit 603 in the illustrated embodiment.
[0170] Figure 9 The connection method between the computing device clusters shown may take into account the data processing method provided in this application (e.g., large-scale data storage and / or data transmission and reception), and therefore consider delegating the functions implemented by the sending unit 602 and the receiving unit 603 to the computing device 700B.
[0171] It should be understood that Figure 9 The functions of the computing device 700A shown can also be performed by multiple computing devices 700. Similarly, the functions of the computing device 700B can also be performed by multiple computing devices 700.
[0172] This application also provides another data processing cluster. The connection relationships between the computing devices in this data processing cluster can be similarly referenced. Figure 9 The connection method of the data processing cluster is different in that the memory 706 of one or more computing devices 700 in the data processing cluster can store the same instructions for executing the data processing method provided in any of the above embodiments.
[0173] In some possible implementations, the memory 706 of one or more computing devices 700 in the data processing cluster may also store partial instructions for executing the methods provided in any of the above embodiments. In other words, a combination of one or more computing devices 700 can jointly execute instructions for performing the methods provided in any of the above embodiments.
[0174] This application also provides a computer program product containing instructions. The computer program product may be a software or program product containing instructions, capable of running on a computing device or stored on any usable medium. When the computer program product is run on at least one computing device, it causes the at least one computing device to perform the methods provided in any of the above embodiments.
[0175] This application also provides a computer-readable storage medium. The computer-readable storage medium can be any available medium capable of being stored by a computing device, or a data storage device such as a data center containing one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid-state drive). The computer-readable storage medium includes instructions that instruct a computing device to perform the method provided in any of the above embodiments.
[0176] Those skilled in the art will recognize that the method steps and units described in the embodiments disclosed in this application can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the steps and components of each embodiment have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0177] In the embodiments provided in this application, it should be understood that the disclosed system architecture, apparatus, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For instance, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules or components may be combined or integrated into another system, or some features may be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed may be indirect coupling or communication connection through some interfaces, devices, or modules, or may be electrical, mechanical, or other forms of connection.
[0178] The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical modules; that is, they may be located in one place or distributed across multiple network modules. Some or all of the modules can be selected to achieve the purpose of the embodiments of this application, depending on actual needs.
[0179] Furthermore, the modules in the various embodiments of this application can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The integrated modules described above can be implemented in hardware or in software.
[0180] If the integrated module is implemented as a software functional module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, ROM, RAM, magnetic disks, or optical disks.
[0181] In this application, the terms "first" and "second," etc., are used to distinguish identical or similar items that have substantially the same function and purpose. It should be understood that there is no logical or temporal dependency between "first" and "second," nor does it limit the quantity or execution order. It should also be understood that although the following description uses the terms "first" and "second," etc., to describe various elements, these elements should not be limited by the terms. These terms are merely used to distinguish one element from another. For example, without departing from the scope of various examples, a first computational unit may be referred to as a second computational unit, and similarly, a second computational unit may be referred to as a first computational unit. Both the first and second computational units can be computational units, and in some cases, they can be separate and distinct computational units.
[0182] The above description is merely an optional embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the principles of this application should be included within the protection scope of this application.
Claims
1. A method for processing data, characterized in that, The method is applied to the i-th computing unit among M computing units in a computing cluster, where M is an integer greater than 1 and i is a positive integer less than or equal to M. Each of the M computing units includes M pieces of data to be processed. The method includes: A reduction operation is performed on the i-th data set to obtain the i-th reduction result, wherein the i-th data set includes the i-th data in each computing unit; The i-th reduction result is subjected to target processing to obtain the i-th target result; Send the i-th target result to all computing units except the i-th computing unit among the M computing units; and, The j-th target result is received from the j-th computing unit. The j-th target result is obtained by the j-th computing unit performing a reduction operation on the j-th data set to obtain the j-th reduction result and then performing the target processing on the j-th reduction result. The j-th data set includes the j-th data in each computing unit, where j is a positive integer less than or equal to M and i is not equal to j.
2. The method as described in claim 1, characterized in that, The method further includes: Receive the i-th data from the j-th computing unit, where the i-th data set includes the i-th data from the i-th computing unit and the i-th data from the j-th computing unit.
3. The method as described in claim 1 or 2, characterized in that, The method further includes: Send the j-th data from the i-th computing unit to the j-th computing unit. The j-th data set includes the j-th data from the i-th computing unit and the j-th data from the j-th computing unit.
4. The method according to any one of claims 1-3, characterized in that, The target processing includes one or more of the following operations: normalization, activation, routing, data type adjustment, or data dimension adjustment.
5. The method as described in claim 4, characterized in that, The target processing includes the operation of adjusting the data type, wherein the data type of the i-th reduction result is a first data type, the data type of the i-th target result is a second data type, and the data length of the first data type is greater than the data length of the second data type.
6. The method as described in claim 4, characterized in that, The target processing includes the operation of adjusting the data dimensions, wherein the data dimension of the i-th reduction result is the first data dimension, the data dimension of the i-th target result is the second data dimension, and the first data dimension is greater than the second data dimension.
7. The method according to any one of claims 1-6, characterized in that, The M data points on the i-th computation unit are M sub-matrices in the matrix to be processed included in the i-th computation unit, each sub-matrix including one or more rows of data from the matrix; or, the M data points on the i-th computation unit are M sub-tensors in the tensor to be processed in the i-th computation unit.
8. A data processing apparatus, characterized in that, The device is the i-th computing unit among M computing units in a computing cluster, where M is an integer greater than 1 and i is a positive integer less than or equal to M. Each of the M computing units includes M data items to be processed. The device includes: A processing unit is used to perform a reduction operation on the i-th data set to obtain the i-th reduction result, wherein the i-th data set includes the i-th data in each computing unit; The processing unit is further configured to perform target processing on the i-th reduction result to obtain the i-th target result; A sending unit is configured to send the i-th target result to the computing units other than the device among the M computing units; and, A receiving unit is configured to receive the j-th target result sent by the j-th computing unit. The j-th target result is obtained by the j-th computing unit performing a reduction operation on the j-th data set to obtain the j-th reduction result and then performing the target processing on the j-th reduction result. The j-th data set includes the j-th data in each computing unit, where j is a positive integer less than or equal to M and i is not equal to j.
9. A computing device cluster, characterized in that, It includes at least one computing device, each computing device including a processor and memory; The processor of the at least one computing device is configured to execute instructions stored in the memory of the at least one computing device to cause the cluster of computing devices to perform the method as described in any one of claims 1-7.
10. A computer-readable storage medium having a computer program or instructions stored thereon, characterized in that, When the computer program or instructions are executed by the processor, they implement the method described in any one of claims 1-7.
11. A computer program product having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method described in any one of claims 1-7.
