Data transmission method and device, electronic equipment and storage medium
By determining the bandwidth coefficient of the transmission path in the data transmission between modules and allocating data blocks, the problems of limited transmission efficiency and limited application scenarios in the prior art are solved, and efficient data transmission and wide application applicability are achieved.
Patent Information
- Application Number
- CN202411981270.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-30
- Publication Date
- 2025-04-15
AI Technical Summary
When improving the efficiency of data transmission between modules, the prior art is limited by the bandwidth limitation of the transmission protocol, and has limited application scenarios and poor practicality.
By determining the bandwidth coefficient of each transmission path, the data blocks to be transmitted are allocated to multiple transmission paths in sequence according to the bandwidth coefficient. Each transmission path is assigned at least one continuous data block at a time, and multiple data transmission requests are generated for each data block.
It improves the efficiency of data transmission between modules, is suitable for more application scenarios, is more practical, and ensures that the number of data blocks responsible for transmission of each transmission path matches the bandwidth.
Smart Images

Figure CN119835207A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of chip technology, and in particular to a data transmission method, device, electronic device and storage medium. Background Art
[0002] Modern chips or electronic devices or systems generally contain multiple modules, and data communication is inevitable between the modules. When the amount of data to be transmitted is large and frequent, the transmission capacity of the data transmission medium (i.e., the transmission path) will become the performance bottleneck of the entire chip or electronic device or system.
[0003] The data to be transmitted is usually large, so it is usually divided into smaller data blocks, loaded into the data transmission request generated by the thread, and then sent through the transmission path between modules. In order to improve the transmission efficiency between two modules, the prior art proposes a variety of data transmission methods, but they are either limited by the bandwidth limitation of the transmission protocol and have limited improvement in transmission efficiency, or have limited application scenarios and poor practicality. Summary of the invention
[0004] In view of this, the present disclosure proposes a data transmission method, device, electronic device and storage medium. The data transmission method of the embodiment of the present disclosure improves the data transmission efficiency between modules and is also applicable to more application scenarios and has stronger practicality.
[0005] According to one aspect of the present disclosure, a data transmission method is provided, the method being applied to a first module, wherein a plurality of transmission paths are included between the first module and a second module, the method comprising: determining a bandwidth coefficient of each transmission path according to the bandwidths of the plurality of transmission paths, wherein a proportional relationship of the bandwidth coefficients indicates a proportional relationship of the bandwidths of the transmission paths; dividing first data to be transmitted into a plurality of data blocks; allocating the plurality of data blocks to the plurality of transmission paths in sequence according to the bandwidth coefficient of each transmission path, wherein each transmission path allocates at least one continuous data block each time, and the number of data blocks allocated each time is equal to the smaller one of the bandwidth coefficient of the transmission path and the number of unallocated data blocks; generating a plurality of data transmission requests corresponding to each data block, each data transmission request including a portion of the corresponding data block, and outputting each data transmission request to the second module through the transmission path to which the data block corresponding to each data transmission request is allocated.
[0006] In one possible implementation, a single data transmission request is allowed to include data of amount R, R>0, and dividing the first data to be transmitted into multiple data blocks includes: dividing the first data into W data blocks, the data amount of the 1st to W-1th data blocks is equal to N, the data amount of the Wth data block is less than or equal to N, N is an integer multiple of R, and W is an integer greater than 1.
[0007] In one possible implementation, the first module includes multiple threads, and the method further includes: allocating the multiple data blocks to the multiple threads in sequence according to the total number of threads, allocating one data block to each thread at a time, and the data blocks allocated to adjacent threads each time are continuous; generating multiple data transmission requests corresponding to each data block includes: causing each thread to generate multiple data transmission requests corresponding to each data block according to the allocation order of the data blocks.
[0008] In a possible implementation, when the bandwidth of each transmission path is an integer multiple of the minimum bandwidth of the multiple transmission paths, determining the bandwidth coefficient of each transmission path based on the bandwidth of the multiple transmission paths includes: calculating the ratio of the bandwidth of each transmission path to the minimum bandwidth as the bandwidth coefficient of the transmission path.
[0009] In a possible implementation, when the bandwidth of any transmission path is not an integer multiple of the minimum bandwidth of the multiple transmission paths, determining the bandwidth coefficient of each transmission path according to the bandwidth of the multiple transmission paths includes: calculating the ratio of the bandwidth of each transmission path to the minimum bandwidth as the initial coefficient of the transmission path; starting from the smallest weight in the preset weight group, obtaining multiple integer coefficients corresponding to the weight according to the weight and the initial coefficients of the multiple transmission paths; for each weight, when the weight meets the preset conditions, calculating the multiple integer coefficients corresponding to the weight as the bandwidth coefficient according to the multiple integer coefficients corresponding to the weight, the maximum number of data transmission requests allowed to be generated simultaneously by the first module, and the bandwidth of each transmission path, the transmission time consumption index of the data transmission request generated by the first module, the smaller the transmission time consumption index, the smaller the maximum transmission time consumption of the data transmission request on each transmission path; and determining the multiple integer coefficients corresponding to the weight with the smallest transmission time consumption index as the bandwidth coefficient.
[0010] In a possible implementation, obtaining a plurality of integer coefficients corresponding to the weight according to the weight and the initial coefficients of the plurality of transmission paths includes: multiplying the weight by the initial coefficients of the plurality of transmission paths respectively to obtain a plurality of products corresponding to the weight; rounding the plurality of products corresponding to the weight respectively to obtain a plurality of integer coefficients corresponding to the weight; the preset condition is that the weight is less than or equal to the minimum bandwidth and the sum of the plurality of integer coefficients corresponding to the weight is less than or equal to the maximum quantity.
[0011] In a possible implementation, when calculating the transmission time-consuming index of the data transmission requests generated by the first module by using the plurality of integer coefficients corresponding to the weight, the maximum quantity of data transmission requests that the first module allows to be generated simultaneously, and the bandwidth of each transmission path, it includes: calculating the data block allocation index of each transmission path when the plurality of integer coefficients corresponding to the weight are used as the bandwidth coefficients according to the plurality of integer coefficients corresponding to the weight and the maximum quantity, the sum of the data block allocation indexes of the plurality of transmission paths is equal to the maximum quantity, and the larger the data block allocation index is, the more data blocks are allocated to the transmission path; calculating the ratio of the data block allocation index of each transmission path to the bandwidth to obtain the utilization index of each transmission path when the plurality of integer coefficients corresponding to the weight are used as the bandwidth coefficients, and the smaller the utilization index is, the more idle the transmission path is; using the maximum value of the utilization indexes of the plurality of transmission paths as the transmission time-consuming index of the data transmission requests generated by the first module when the plurality of integer coefficients corresponding to the weight are used as the bandwidth coefficients.
[0012] In a possible implementation, the total number of the transmission paths is Q, where Q is an integer greater than 1; the sum of the bandwidth coefficients of the plurality of transmission paths is Z, where Z is a positive integer; allocating the plurality of data blocks to the plurality of transmission paths in sequence according to the bandwidth coefficient of each transmission path includes: for the s-th data block among the W data blocks, calculating the remainder P of s divided by Z, where 0 < s ≤ W and s is an integer, P ≥ 0 and P is an integer; when P = 0, allocating the s-th data block to the Q-th transmission path; when P > 0 and P is less than or equal to the bandwidth coefficient of the first transmission path, allocating the s-th data block to the first transmission path; when P is greater than the sum of the bandwidth coefficients of the first to the (i - 1)-th transmission paths and less than or equal to the sum of the bandwidth coefficients of the first to the i-th transmission paths, allocating the s-th data block to the i-th transmission path, where 0 < i ≤ Q and i is an integer.
[0013] In a possible implementation, the total number of the threads is A, where A is a positive integer; allocating the multiple data blocks to the multiple threads in sequence according to the total number of the threads includes: for the s-th data block, calculating the remainder F of A divided by s, where s is a positive integer, F≥0 and F is an integer; when F = 0, allocating the s-th data block to the A-th thread; when F>0, allocating the s-th data block to the F-th thread.
[0014] In a possible implementation, the amount of data allowed to be included in a single data transfer request is R, where R>0. Making each thread generate multiple data transfer requests corresponding to each data block in the allocation order of the data blocks includes: when any one thread is to generate multiple data transfer requests corresponding to a data block with a data amount of N and N is an integer multiple of R, determining that the data block corresponds to a total of N / R data transfer requests, and the amount of data included in each data transfer request is R; determining the starting storage address of the data included in each data transfer request according to the starting storage address of the data block, where the starting storage address of the data included in the j-th data transfer request is the sum of the starting storage address of the data block and (j - 1)×R, 1≤j≤N / R, and j is an integer; making the thread generate N / R data transfer requests corresponding to the data block.
[0015] In a possible implementation, the amount of data allowed to be included in a single data transfer request is R, where R>0. Making each thread generate multiple data transfer requests corresponding to each data block in the allocation order of the data blocks includes: when any one thread is to generate multiple data transfer requests corresponding to a data block with a data amount of B and 0<B<N, determining that the data block corresponds to a total of Y data transfer requests, the amount of data included in the 1st to the (Y - 1)-th data transfer requests is equal to R, and the amount of data included in the Y-th data transfer request is less than or equal to R, where Y is the result of rounding up B / R; determining the starting storage address of the data included in each data transfer request according to the starting storage address of the data block, where the starting storage address of the data included in the v-th data transfer request is the sum of the starting storage address of the data block and (v - 1)×R, 1≤v≤Y, and v is an integer; making the thread generate v data transfer requests corresponding to the data block.
[0016] According to another aspect of the present disclosure, a data transmission device is provided, the device is applied to a first module, and a plurality of transmission paths are included between the first module and the second module, the device comprising: a first determination module, used to determine a bandwidth coefficient of each transmission path according to the bandwidth of the plurality of transmission paths, the proportional relationship of the bandwidth coefficients indicating the proportional relationship of the bandwidth of the transmission paths; a segmentation module, used to segment the first data to be transmitted into a plurality of data blocks; a first allocation module, used to allocate the plurality of data blocks to the plurality of transmission paths in sequence according to the bandwidth coefficient of each transmission path, each transmission path allocates at least one continuous data block each time, and the number of data blocks allocated each time is equal to the smaller one of the bandwidth coefficient of the transmission path and the number of unallocated data blocks; a first transmission module, used to generate a plurality of data transmission requests corresponding to each data block, each data transmission request including a portion of the corresponding data block, and output each data transmission request to the second module through the transmission path to which the data block corresponding to each data transmission request is allocated.
[0017] In one possible implementation, a single data transmission request is allowed to include data of amount R, R>0, and dividing the first data to be transmitted into multiple data blocks includes: dividing the first data into W data blocks, the data amount of the 1st to W-1th data blocks is equal to N, the data amount of the Wth data block is less than or equal to N, N is an integer multiple of R, and W is an integer greater than 1.
[0018] In a possible implementation, the first module includes multiple threads, and the device also includes: a second allocation module, used to allocate the multiple data blocks to multiple threads in sequence according to the total number of threads, each thread is allocated one data block at a time, and the data blocks allocated to adjacent threads each time are continuous; generating multiple data transmission requests corresponding to each data block includes: making each thread generate multiple data transmission requests corresponding to each data block according to the allocation order of the data blocks.
[0019] In a possible implementation, when the bandwidth of each transmission path is an integer multiple of the minimum bandwidth of the multiple transmission paths, determining the bandwidth coefficient of each transmission path based on the bandwidth of the multiple transmission paths includes: calculating the ratio of the bandwidth of each transmission path to the minimum bandwidth as the bandwidth coefficient of the transmission path.
[0020] In a possible implementation, when the bandwidth of any transmission path is not an integer multiple of the minimum bandwidth of the multiple transmission paths, determining the bandwidth coefficient of each transmission path according to the bandwidth of the multiple transmission paths includes: calculating the ratio of the bandwidth of each transmission path to the minimum bandwidth as the initial coefficient of the transmission path; starting from the smallest weight in the preset weight group, obtaining multiple integer coefficients corresponding to the weight according to the weight and the initial coefficients of the multiple transmission paths; for each weight, when the weight meets the preset conditions, calculating the multiple integer coefficients corresponding to the weight as the bandwidth coefficient according to the multiple integer coefficients corresponding to the weight, the maximum number of data transmission requests allowed to be generated simultaneously by the first module, and the bandwidth of each transmission path, the transmission time consumption index of the data transmission request generated by the first module, the smaller the transmission time consumption index, the smaller the maximum transmission time consumption of the data transmission request on each transmission path; and determining the multiple integer coefficients corresponding to the weight with the smallest transmission time consumption index as the bandwidth coefficient.
[0021] In a possible implementation, the method of obtaining multiple integer coefficients corresponding to the weight based on the weight and the initial coefficients of the multiple transmission paths includes: using the weight to multiply the initial coefficients of the multiple transmission paths respectively to obtain multiple products corresponding to the weight; rounding the multiple products corresponding to the weight respectively to obtain multiple integer coefficients corresponding to the weight; the preset condition is that the weight is less than or equal to the minimum bandwidth and the sum of the multiple integer coefficients corresponding to the weight is less than or equal to the maximum number.
[0022] In a possible implementation, when the multiple integer coefficients corresponding to the weight are calculated as the bandwidth coefficient according to the multiple integer coefficients corresponding to the weight, the maximum number of data transmission requests allowed to be generated simultaneously by the first module, and the bandwidth of each transmission path, the transmission time consumption index of the data transmission request generated by the first module includes: when the multiple integer coefficients corresponding to the weight are calculated as the bandwidth coefficient according to the multiple integer coefficients corresponding to the weight and the maximum number, the data block allocation index of each transmission path is equal to the maximum number, and the larger the data block allocation index is, the more data blocks are allocated to the transmission path; when the ratio of the data block allocation index of each transmission path is calculated to the bandwidth, the usage degree index of each transmission path is obtained, the smaller the usage degree index is, the more idle the transmission path is; and when the maximum value of the usage degree index of the multiple transmission paths is used as the transmission time consumption index of the data transmission request generated by the first module, when the multiple integer coefficients corresponding to the weight are used as the bandwidth coefficient.
[0023] In a possible implementation, the total number of the transmission paths is Q, where Q is an integer greater than 1; the sum of the bandwidth coefficients of the multiple transmission paths is Z, where Z is a positive integer; the step of sequentially allocating the multiple data blocks to the multiple transmission paths according to the bandwidth coefficient of each transmission path includes: for the s-th data block among the W data blocks, calculating the remainder P of Z divided by s, where 0 < s ≤ W and s is an integer, P ≥ 0 and P is an integer; when P = 0, allocating the s-th data block to the Q-th transmission path; when P > 0 and P is less than or equal to the bandwidth coefficient of the first transmission path, allocating the s-th data block to the first transmission path; when P is greater than the sum of the bandwidth coefficients of the first to the (i - 1)-th transmission paths and less than or equal to the sum of the bandwidth coefficients of the first to the i-th transmission paths, allocating the s-th data block to the i-th transmission path, where 0 < i ≤ Q and i is an integer.
[0024] In a possible implementation, the total number of the threads is A, where A is a positive integer; the step of sequentially allocating the multiple data blocks to the multiple threads according to the total number of the threads includes: for the s-th data block, calculating the remainder F of s divided by A, where s is a positive integer, F ≥ 0 and F is an integer; when F = 0, allocating the s-th data block to the A-th thread; when F > 0, allocating the s-th data block to the F-th thread.
[0025] In a possible implementation, the data volume allowed to be included in a single data transmission request is R, where R > 0; the step of enabling each thread to generate multiple data transmission requests corresponding to the respective data blocks in the allocation order of the data blocks includes: when any one thread is to generate multiple data transmission requests corresponding to a data block with a data volume of N and N is an integer multiple of R, determining that the data block corresponds to N / R data transmission requests in total, and the data volume included in each data transmission request is R; according to the starting storage address of the data block, determining the starting storage address of the data included in each data transmission request, where the starting storage address of the data included in the j-th data transmission request is the sum of the starting storage address of the data block and (j - 1) × R, where 1 ≤ j ≤ N / R and j is an integer; enabling the thread to generate N / R data transmission requests corresponding to the data block.
[0026] In a possible implementation, the amount of data allowed to be included in a single data transfer request is R, where R > 0. The step of making each thread generate a plurality of data transfer requests corresponding to each data block according to the allocation order of the data blocks includes: when any one thread is to generate a plurality of data transfer requests corresponding to a data block with an amount of data B and 0 < B < N, determining that the data block corresponds to a total of Y data transfer requests, the amount of data included in the 1st to the (Y - 1)th data transfer requests is equal to R, and the amount of data included in the Yth data transfer request is less than or equal to R, where Y is the result of rounding up B / R; determining the starting storage address of the data included in each data transfer request according to the starting storage address of the data block, where the starting storage address of the data included in the vth data transfer request is the sum of the starting storage address of the data block and (v - 1) × R, 1 ≤ v ≤ Y, and v is an integer; and making the thread generate v data transfer requests corresponding to the data block.
[0027] According to another aspect of the present disclosure, there is provided an electronic device, including: a processor; a memory for storing processor-executable instructions; wherein, the processor is configured to implement the above method when executing the instructions stored in the memory.
[0028] According to another aspect of the present disclosure, there is provided a non-volatile computer-readable storage medium, on which computer program instructions are stored, wherein, the computer program instructions implement the above method when executed by a processor.
[0029] According to another aspect of the present disclosure, there is provided a computer program product, including computer-readable code, or a non-volatile computer-readable storage medium carrying the computer-readable code, when the computer-readable code runs in a processor of an electronic device, the processor in the electronic device executes the above method.
[0030] According to the data transmission method of the embodiment of the present disclosure, on the first module, the first data to be transmitted is divided into multiple data blocks; the bandwidth coefficient of each transmission path is determined according to the bandwidth of the multiple transmission paths, and the proportional relationship of the bandwidth coefficients indicates the proportional relationship of the bandwidth of the transmission path; according to the bandwidth coefficient of each transmission path, the multiple data blocks are sequentially allocated to the multiple transmission paths, each transmission path allocates at least one continuous data block each time, and the number of data blocks allocated each time is equal to the smaller one of the bandwidth coefficient of the transmission path and the number of unallocated data blocks, so that it can be determined which data of the first data each transmission path is responsible for transmitting; for each data block, multiple data transmission requests corresponding to the data block are generated, each data transmission request includes a part of the corresponding data block, and each data transmission request is output to the second module through the transmission path to which the data block corresponding to each data transmission request is allocated, so that the first data is transmitted to the second module through the data transmission request. Since each transmission path allocates at least one continuous data block each time, the number of data blocks allocated each time is equal to the smaller one of the bandwidth coefficient of the transmission path and the number of unallocated data blocks. The proportional relationship of the bandwidth coefficient indicates the proportional relationship of the bandwidth of the transmission path, so that the number of data blocks that each transmission path is responsible for transmitting is more matched with the bandwidth of each transmission path. Therefore, regardless of whether the bandwidths of multiple data transmission paths are consistent, there will not be a situation where a large number of data blocks are concentratedly allocated to a transmission path with a very small bandwidth and other transmission paths with a large bandwidth are allocated very few data blocks. This can ensure higher data transmission efficiency, is suitable for more application scenarios, and has stronger practicality.
[0031] Further features and aspects of the present disclosure will become apparent from the following detailed description of exemplary embodiments with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate exemplary embodiments, features, and aspects of the disclosure and, together with the description, serve to explain the principles of the disclosure.
[0033] Figure 1 An exemplary application scenario of the data transmission method according to an embodiment of the present disclosure is shown.
[0034] Figure 2 A schematic diagram showing the process of a data transmission method according to an embodiment of the present disclosure.
[0035] Figure 3 An example of allocating multiple data blocks to multiple transmission paths in sequence according to an embodiment of the present disclosure is shown.
[0036] Figure 4a An example is shown in which the first module generates a data transmission request according to an embodiment of the present disclosure.
[0037] Figure 4b An example is shown in which the first module generates a data transmission request according to an embodiment of the present disclosure.
[0038] Figure 5 An example of allocating multiple data blocks to multiple threads in sequence according to an embodiment of the present disclosure is shown.
[0039] Figure 6 A schematic diagram showing the structure of a data transmission device according to an embodiment of the present disclosure.
[0040] Figure 7 A block diagram of an electronic device 1900 according to an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0041] Various exemplary embodiments, features and aspects of the present disclosure will be described in detail below with reference to the accompanying drawings. The same reference numerals in the accompanying drawings represent elements with the same or similar functions. Although various aspects of the embodiments are shown in the accompanying drawings, the drawings are not necessarily drawn to scale unless otherwise specified.
[0042] The word “exemplary” is used exclusively herein to mean “serving as an example, example, or illustration.” Any embodiment described herein as “exemplary” is not necessarily to be construed as preferred or advantageous over other embodiments.
[0043] In addition, in order to better illustrate the present disclosure, numerous specific details are given in the following specific embodiments. It should be understood by those skilled in the art that the present disclosure can also be implemented without certain specific details. In some examples, methods, means, components and circuits well known to those skilled in the art are not described in detail in order to highlight the subject matter of the present disclosure.
[0044] The following introduces a data transmission method proposed in the prior art to improve data transmission efficiency.
[0045] One data transmission method proposed in the prior art is to keep the only transmission path between modules unchanged and increase the bandwidth of the transmission path. However, the transmission protocol usually has some restrictions on the bandwidth of the transmission path. For example, the maximum transmission path bandwidth of the transmission protocol PCIE 5.0x16 is 128GB / s in both directions. In this case, the bandwidth of the transmission path is limited and the improvement of data transmission efficiency is low.
[0046] Another data transmission method proposed in the prior art is to increase the number of transmission paths between modules and evenly distribute data transmission requests to multiple transmission paths for transmission. It should be understood that if the bandwidths of multiple transmission paths are inconsistent, and data transmission requests are still evenly distributed to multiple transmission paths, some transmission paths may be idle and some transmission paths may be blocked, thereby reducing data transmission efficiency. Therefore, this method is only applicable to scenarios where the bandwidths of multiple transmission paths between modules are consistent, and has poor practicality.
[0047] In view of this, the present disclosure proposes a data transmission method, device, electronic device and storage medium. The data transmission method of the embodiment of the present disclosure improves the data transmission efficiency between modules and is also applicable to more application scenarios and has stronger practicality.
[0048] Figure 1 An exemplary application scenario of the data transmission method according to an embodiment of the present disclosure is shown.
[0049] like Figure 1 As shown, in an exemplary application scenario, the data transmission method of the embodiment of the present disclosure can be applied to the first module in the first device. The first device also includes a second module, and there are multiple transmission paths between the first module and the second module. The bandwidths of the multiple transmission paths can be consistent or inconsistent, and the embodiment of the present disclosure does not limit this.
[0050] The memory (not shown) of the first module may store first data to be transmitted (not shown). The first module executes the data transmission method of the embodiment of the present disclosure, may generate multiple data transmission requests according to the first data, and then transmit the data transmission requests to the second module through the transmission path.
[0051] Those skilled in the art should understand that the first device can be an electronic device such as a terminal device or a server, or a chip or a system, etc. The embodiments of the present disclosure do not limit the specific implementation of the first device. The first data can also be stored in other modules other than the first module, and the embodiments of the present disclosure do not limit the specific storage location of the first data. The first module and the second module can be any physical modules for data communication, and the embodiments of the present disclosure do not limit the specific types of the first module and the second module.
[0052] Figure 2 A schematic diagram showing the process of a data transmission method according to an embodiment of the present disclosure.
[0053] In a possible implementation, the method is applied to a first module, and a plurality of transmission paths are provided between the first module and the second module. The method includes:
[0054] Step S21, determining a bandwidth coefficient of each transmission path according to the bandwidths of the plurality of transmission paths, wherein a proportional relationship of the bandwidth coefficients indicates a proportional relationship of the bandwidths of the transmission paths;
[0055] Step S22, dividing the first data to be transmitted into a plurality of data blocks;
[0056] Step S23, allocating the multiple data blocks to the multiple transmission paths in sequence according to the bandwidth coefficient of each transmission path, allocating at least one continuous data block to each transmission path each time, and the number of data blocks allocated each time is equal to the smaller one of the bandwidth coefficient of the transmission path and the number of unallocated data blocks;
[0057] Step S24, generating multiple data transmission requests corresponding to each data block, each data transmission request includes a portion of the corresponding data block, and outputting each data transmission request to the second module through the transmission path allocated to the data block corresponding to each data transmission request.
[0058] For example, since the bandwidths of the multiple transmission paths may be different, in step S21, the bandwidth coefficient of each transmission path may be determined according to the bandwidths of the multiple transmission paths. The bandwidth coefficient may be an integer, and the proportional relationship of the bandwidth coefficient may indicate the proportional relationship of the bandwidths of the transmission paths.
[0059] The proportional relationship of the bandwidth coefficient may be the same as the proportional relationship of the bandwidth of the transmission path, or may be similar to the proportional relationship of the bandwidth of the transmission path. The embodiments of the present disclosure do not limit the specific determination method of the bandwidth coefficient, and an exemplary determination method of the bandwidth coefficient is given below.
[0060] For example, assuming that there are three transmission paths between the first module and the second module, and the bandwidths are 40, 80, and 80 respectively, the bandwidth coefficient of the first transmission path may be 1, the bandwidth coefficient of the second transmission path may be 2, and the bandwidth coefficient of the third transmission path may be 2.
[0061] For another example, assuming that there are three transmission paths between the first module and the second module, and the bandwidths are 23, 60, and 60 respectively, the bandwidth coefficient of the first transmission path may be 1, the bandwidth coefficient of the second transmission path may be 3, and the bandwidth coefficient of the third transmission path may be 3.
[0062] The first data is usually stored continuously, and the data volume is usually relatively large, so the first data can be segmented and transmitted to the second module in multiple times. The first module can generate a data transmission request, and the data transmission request can carry the data to be transmitted. By sending the data transmission request to the second module, the data transmission from the first module to the second module is realized. The amount of data that can be carried by the data transmission request is usually relatively small, and may be less than the minimum data segmentation granularity of the first data. Therefore, in step S22, the data segmentation granularity can be pre-set according to the amount of data allowed to be included in a single data transmission request, and then the first data can be segmented into multiple data blocks according to the preset data segmentation granularity, and the data amount of each data block is equal to the smaller one of the data segmentation granularity and the remaining data amount of the first data.
[0063] An example of segmenting the first data according to a preset data segmentation granularity is given below.
[0064] In a possible implementation, the amount of data allowed to be included in a single data transmission request is R, R>0,
[0065] Step S22 includes:
[0066] The first data is divided into W data blocks, the data amount of the 1st to W-1th data blocks is equal to N, the data amount of the Wth data block is less than or equal to N, N is an integer multiple of R, and W is an integer greater than 1.
[0067] For example, a single data transmission request is allowed to include data of amount R, that is, a single data transmission request can carry data of amount R at most. The data segmentation granularity may be determined to be N, such that N is an integer multiple of R. The specific multiple relationship between N and R is not limited in the embodiments of the present disclosure.
[0068] In this case, dividing the first data may be dividing the first data into W data blocks, the data amount of the 1st to W-1th data blocks is equal to N, the data amount of the Wth data block is less than or equal to N, and W is an integer greater than 1.
[0069] For example, assuming that the data size of the first data is 126K Byte (1K Byte=1024 Byte), and N is 4K Byte, then W may be 32, the data size of the 1st to 31st data blocks is 4K Byte, and the data size of the 32nd data block is 2K Byte.
[0070] Those skilled in the art should understand that there are more ways to split the first data. For example, the first data may be split into multiple data blocks of equal size. The embodiments of the present disclosure do not limit the specific method of splitting the first data.
[0071] After determining the bandwidth coefficient of each transmission path and dividing the data blocks, step S23 can be executed to sequentially allocate multiple data blocks to multiple transmission paths according to the bandwidth coefficient of each transmission path, and each transmission path allocates at least one continuous data block each time (the storage addresses of continuous data blocks are also continuous), and the number of data blocks allocated each time is equal to the smaller one of the bandwidth coefficient of the transmission path and the number of unallocated data blocks. After a data block is allocated to a transmission path, the path can be responsible for transmitting the data transmission request obtained by the data block. Among them, the storage address of each data block is different. When allocating, the data block with a smaller storage address can be allocated first. In this way, the data blocks can be more evenly allocated to multiple transmission paths.
[0072] In one example, the allocation method of data blocks can be determined by counting the number of unallocated data blocks and comparing the bandwidth coefficient of the transmission path and the number of unallocated data blocks. For example, data blocks can be allocated to multiple transmission paths in turn, wherein when allocating data blocks to a certain transmission path, if the number of unallocated data blocks is greater than the bandwidth coefficient of the transmission path, multiple data blocks with smaller storage addresses among the unallocated data blocks and a number equal to the bandwidth coefficient of the transmission path are allocated to the transmission path, and the number of unallocated data blocks is updated before continuing to allocate data blocks to the next transmission path.
[0073] Figure 3 An example of allocating multiple data blocks to multiple transmission paths in sequence according to an embodiment of the present disclosure is shown.
[0074] like Figure 3 As shown, assuming that there are 32 data blocks in total, the data volume of the 1st to 31st data blocks is equal to 4K Byte, and the data volume of the 32nd data block is equal to 2K Byte. The storage addresses of the 1st to 32nd data blocks can be: 0-4K, 4K-8K, 8K-12K, ..., 120K-124K, 124K-126K respectively.
[0075] Assume that there are three transmission paths, and the bandwidth coefficients of the three transmission paths are 1, 2, and 3 respectively. When the data block is allocated to the first transmission path for the first time, the number of unallocated data blocks is 32, which is greater than the bandwidth coefficient of the first transmission path. It can be determined that the number of data blocks allocated this time is 1, that is, the first data block can be allocated to the first transmission path; when the data block is allocated to the second transmission path for the first time, the number of unallocated data blocks is 31, which is greater than the bandwidth coefficient of the second transmission path. It can be determined that the number of data blocks allocated this time is 2, that is, the second and third data blocks can be allocated to the second transmission path; when the data block is allocated to the third transmission path for the first time, , the number of unallocated data blocks is 29, which is greater than the bandwidth coefficient of the third transmission path. It can be determined that the number of data blocks allocated this time is 3, that is, the 4th, 5th, and 6th data blocks can be allocated to the 3rd transmission path; ...; and so on, the second time data blocks are allocated to the 1st transmission path, the second time data blocks are allocated to the 2nd transmission path, the second time data blocks are allocated to the 3rd transmission path, ..., when the data blocks are allocated to the 2nd transmission path for the sixth time, the 32nd data block is allocated to the 2nd transmission path. At this point, all data blocks have been allocated transmission paths.
[0076] The allocation of data blocks to transmission paths may also be implemented in other ways. Another example of allocating data blocks to transmission paths is given below.
[0077] In a possible implementation, the total number of transmission paths is Q, where Q is an integer greater than 1; the sum of the bandwidth coefficients of multiple transmission paths is Z, where Z is a positive integer;
[0078] According to the bandwidth coefficient of each transmission path, multiple data blocks are sequentially allocated to multiple transmission paths, including:
[0079] For the s-th data block among W data blocks, calculate the remainder P when s is divided by Z, where 0 < s ≤ W and s is an integer, and P ≥ 0 and P is an integer;
[0080] When P = 0, allocate the s-th data block to the Q-th transmission path;
[0081] When P > 0 and P is less than or equal to the bandwidth coefficient of the first transmission path, allocate the s-th data block to the first transmission path;
[0082] When P is greater than the sum of the bandwidth coefficients of the first to the (i - 1)-th transmission paths and less than or equal to the sum of the bandwidth coefficients of the first to the i-th transmission paths, allocate the s-th data block to the i-th transmission path, where 0 < i ≤ Q and i is an integer.
[0083] For example, when the sum of the bandwidth coefficients of multiple transmission paths is Z, Z data blocks are allocated to multiple transmission paths according to the bandwidth coefficients of each transmission path. When each transmission path is allocated the same number of data blocks as its bandwidth coefficient, the load levels of multiple transmission paths are consistent. Therefore, data blocks can be allocated to multiple transmission paths in multiple rounds. When there are sufficient unallocated data blocks, Z data blocks can be allocated to multiple transmission paths in each round.
[0084] Assume that the total number of transmission paths is Q. In this case, when allocating data blocks to multiple transmission paths, it can be that when allocating the s-th data block among W data blocks, calculate the remainder P when s is divided by Z, and determine the allocation method of the data block according to the value of P.
[0085] If P is 0, it means that the current data block is exactly the last data block allocated to the last transmission path (the Q-th transmission path) in a certain round. That is, when P = 0, allocate the s-th data block to the Q-th transmission path. For Figure 3 example, when Q = 3, Z = 6, when s = 6, P = 0, and the 6th data block can be allocated to the 3rd transmission path.
[0086] If P is greater than 0 and less than or equal to the bandwidth coefficient of the first transmission path, it means that the number of data blocks allocated to the first transmission path in this round has not reached the bandwidth coefficient of the first transmission path, and data blocks can continue to be allocated to the first transmission path. That is, when P > 0 and P is less than or equal to the bandwidth coefficient of the first transmission path, the s-th data block is allocated to the first transmission path. Taking Figure 3 as an example, Q = 3, Z = 6, the bandwidth coefficient of the first transmission path is 1. When s = 7, P = 1, and the 7th data block can be allocated to the first transmission path.
[0087] If P is greater than the sum of the bandwidth coefficients of the first to the (i - 1)-th transmission paths (0 < i ≤ Q, i is an integer), and P is less than or equal to the sum of the bandwidth coefficients of the first to the i-th transmission paths, it means that the number of data blocks allocated to the first to the (i - 1)-th transmission paths in this round has reached the corresponding bandwidth coefficients, and the number of data blocks allocated to the i-th transmission path in this round has not reached the bandwidth coefficient of the i-th transmission path, and data blocks can continue to be allocated to the i-th transmission path. That is, when P is greater than the sum of the bandwidth coefficients of the first to the (i - 1)-th transmission paths and less than or equal to the sum of the bandwidth coefficients of the first to the i-th transmission paths, the s-th data block is allocated to the i-th transmission path. Taking Figure 3 as an example, Q = 3, Z = 6, the bandwidth coefficients of the 3 transmission paths are 1, 2, and 3 respectively. The sum of the bandwidth coefficients of the first to the second transmission paths is equal to 3, and the sum of the bandwidth coefficients of the first to the third transmission paths is equal to 6. When s = 5, P = 5, and the 5th data block can be allocated to the third transmission path.
[0088] In this case, the number of data blocks allocated to each transmission path each time is also equal to the smaller one of the bandwidth coefficient of the transmission path and the number of unallocated data blocks.
[0089] Those skilled in the art should understand that there can be more ways to allocate data blocks to transmission paths. As long as each transmission path is allocated at least one continuous data block each time, and the number of data blocks allocated each time is equal to the smaller one of the bandwidth coefficient of the transmission path and the number of unallocated data blocks, the specific implementation manner of allocating data blocks to transmission paths in the embodiments of the present disclosure is not limited.
[0090] After completing the allocation of data blocks to transmission paths, step S24 can be executed to generate multiple data transmission requests corresponding to each data block. Taking Figure 3For example, since data blocks are sequentially allocated to multiple transmission paths, and the data blocks allocated to each transmission path each time are also continuous, the method for generating data transmission requests can be determined according to the maximum number of data transmission requests allowed to be generated simultaneously by the first module. For example, when the first module generates a maximum of 8 data transmission requests simultaneously, the first module can generate data transmission requests for the 1st to 8th data blocks simultaneously, and after the data transmission requests corresponding to the 1st to 8th data blocks are generated, the first module can generate data transmission requests for the 9th to 16th data blocks simultaneously, and so on, until the data transmission requests for all data blocks are generated.
[0091] When the first module generates a data transmission request corresponding to a data block, at least one data transmission request may be generated, and each data transmission request includes a portion of the corresponding data block. Exemplarily, when the amount of data in the data block is N, the amount of data allowed to be included in a single data transmission request is R, and N is an integer multiple of R (e.g., T times, T is a positive integer), T data transmission requests corresponding to the data block may be generated, and the storage addresses of the data included in adjacent data transmission requests may be continuous.
[0092] Figure 4a and Figure 4b An example is shown in which the first module generates a data transmission request according to an embodiment of the present disclosure.
[0093] like Figure 4a As shown, assuming that the amount of data in the data block is N and N=4K Byte (for example Figure 3 The storage address of the data block is 28K-32K, and the amount of data allowed to be included in a single data transfer request is R, and R=1K Byte. Then the first module can generate 4 data transfer requests corresponding to the data block, wherein the storage address of the data included in the data transfer request 1 can be 28K-29K, the storage address of the data included in the data transfer request 2 can be 29K-30K, the storage address of the data included in the data transfer request 3 can be 30K-31K, and the storage address of the data included in the data transfer request 4 can be 31K-32K.
[0094] like Figure 4b As shown, assuming that the amount of data in the data block is B and B = 2K Byte (for example Figure 3 The storage address of the data block is 124K-126K, and the amount of data allowed to be included in a single data transmission request is R, and R=1K Byte. Then the first module can generate two data transmission requests corresponding to the data block, wherein the storage address of the data included in the data transmission request 11 can be 124K-125K, and the storage address of the data included in the data transmission request 12 can be 125K-126K.
[0095] Finally, the first module can output each data transmission request to the second module through the transmission path assigned to the data block corresponding to each data transmission request. Figure 4b In the example, data transfer request 11 corresponds to the 32nd data block, combined with Figure 3 It can be seen that the 32nd data block is allocated to the second transmission path, and the first module can output a data transmission request 11 to the second module via the second transmission path. In this way, the first data can be transmitted to the second module.
[0096] According to the data transmission method of the embodiment of the present disclosure, on the first module, the first data to be transmitted is divided into multiple data blocks; the bandwidth coefficient of each transmission path is determined according to the bandwidth of the multiple transmission paths, and the proportional relationship of the bandwidth coefficients indicates the proportional relationship of the bandwidth of the transmission path; according to the bandwidth coefficient of each transmission path, the multiple data blocks are sequentially allocated to the multiple transmission paths, each transmission path allocates at least one continuous data block each time, and the number of data blocks allocated each time is equal to the smaller one of the bandwidth coefficient of the transmission path and the number of unallocated data blocks, so that it can be determined which data of the first data each transmission path is responsible for transmitting; for each data block, multiple data transmission requests corresponding to the data block are generated, each data transmission request includes a part of the corresponding data block, and each data transmission request is output to the second module through the transmission path to which the data block corresponding to each data transmission request is allocated, so that the first data is transmitted to the second module through the data transmission request. Since each transmission path allocates at least one continuous data block each time, the number of data blocks allocated each time is equal to the smaller one of the bandwidth coefficient of the transmission path and the number of unallocated data blocks. The proportional relationship of the bandwidth coefficient indicates the proportional relationship of the bandwidth of the transmission path, so that the number of data blocks that each transmission path is responsible for transmitting is more matched with the bandwidth of each transmission path. Therefore, regardless of whether the bandwidths of multiple data transmission paths are consistent, there will not be a situation where a large number of data blocks are concentratedly allocated to a transmission path with a very small bandwidth and other transmission paths with a large bandwidth are allocated very few data blocks. This can ensure higher data transmission efficiency, is suitable for more application scenarios, and has stronger practicality.
[0097] In a possible implementation, the first module includes multiple threads, and the method further includes:
[0098] According to the total number of threads, multiple data blocks are allocated to multiple threads in sequence, each thread is allocated one data block at a time, and the data blocks allocated to adjacent threads each time are continuous;
[0099] For each data block, a plurality of data transmission requests corresponding to the data block are generated, including:
[0100] Each thread generates a plurality of data transfer requests corresponding to each data block according to the allocation order of the data blocks.
[0101] For example, the first module may include multiple threads, each of which can generate a data transmission request. The maximum number of data transmission requests that the first module allows to be generated simultaneously is equal to the total number of threads included in the first module. Therefore, after the data blocks are divided, the multiple data blocks can be allocated to the multiple threads in sequence according to the total number of threads, and each thread is allocated one data block at a time, and the data blocks allocated to adjacent threads each time are continuous (the storage addresses of continuous data blocks are also continuous). After a data block is allocated to a thread, the thread can be responsible for generating a data transmission request including the data in the data block according to the data block. The storage address of each data block is different. When allocating, the data block with a smaller storage address can be allocated first.
[0102] In one example, the next thread to which the current data block is allocated may be determined based on the thread to which the previous data block is allocated.
[0103] Figure 5 An example of allocating multiple data blocks to multiple threads in sequence according to an embodiment of the present disclosure is shown.
[0104] like Figure 5 As shown, assuming that there are 8 threads and 32 data blocks in total, the storage addresses of the 1st to 32nd data blocks may be: 0-4K, 4K-8K, 8K-12K, ..., 120K-124K, 124K-126K respectively.
[0105] Then when allocating data blocks to the first thread for the first time, the first data block can be allocated to the first thread, when allocating data blocks to the second thread for the first time, the second data block can be allocated to the second thread, ..., when allocating data blocks to the eighth thread for the fourth time, the 32nd data block can be allocated to the eighth thread.
[0106] because Figure 5 In the example, the total number of data blocks is an integer multiple of the total number of threads, so the number of data blocks allocated to each thread is the same. In some scenarios, the total number of data blocks may not be an integer multiple of the total number of threads. In this case, different threads may be allocated different numbers of data blocks. The embodiments of the present disclosure do not limit how many data blocks are allocated to each thread.
[0107] In another example, the allocation method of the current data block may be determined according to the sequence number of the current data block and the total number of threads.
[0108] In a possible implementation, the total number of threads is A, where A is a positive integer;
[0109] According to the total number of the threads, the plurality of data blocks are sequentially allocated to the plurality of threads, including:
[0110] For the s-th data block, calculate the remainder F when s is divided by A, where s is a positive integer, F ≥ 0 and F is an integer;
[0111] When F=0, the sth data block is assigned to the Ath thread;
[0112] When F>0, the sth data block is allocated to the Fth thread.
[0113] For example, since multiple data blocks are sequentially allocated to multiple threads, the total number of threads is A, data blocks can be allocated to multiple threads in multiple rounds. When there are sufficient unallocated data blocks, a total of A data blocks can be allocated to multiple transmission paths in each round.
[0114] In this case, the data blocks are allocated to multiple threads by calculating the remainder F of s divided by A when allocating the sth data block among the W data blocks, and determining the allocation method of the data blocks according to the value of F.
[0115] If F is 0, it means that after the current data block is allocated, the current round of data block allocation ends, and the current data block can be the data block allocated to the last thread (the Ath thread). That is, when F=0, the sth data block is allocated to the Ath thread. Figure 5 For example, when A=8, s=8, F=0, the 8th data block is allocated to the 8th thread.
[0116] If F is greater than 0, it means that after the current data block is allocated, the current round of data block allocation has not yet ended, and each thread allocates one data block each time, so the value of F is the sequence number of the thread to be allocated. That is, when F>0, the sth data block is allocated to the Fth thread. Figure 5 For example, when A=8, s=10, F=2, the 10th data block is allocated to the second thread.
[0117] After the data blocks are assigned to the transmission paths and threads, each thread can generate multiple data transmission requests corresponding to each data block according to the order in which the data blocks are assigned. Figure 5 Taking thread 1 in as an example, the data blocks allocated to thread 1 include the 1st, 9th, 17th, and 25th data blocks, and the allocation order can be the 1st data block → the 9th data block → the 17th data block → the 25th data block. Therefore, thread 1 can first generate a data transmission request corresponding to the 1st data block, then generate a data transmission request corresponding to the 9th data block, then generate a data transmission request corresponding to the 17th data block, and finally generate a data transmission request corresponding to the 25th data block.
[0118] Each thread can generate data transfer requests synchronously, and combine Figure 3 and Figure 5 As can be seen from the example, the data blocks allocated to multiple threads at the same time are also allocated to different transmission paths according to the bandwidth coefficient, so that the data transmission requests generated by subsequent threads can be transmitted through different transmission paths respectively, thereby improving the parallelism of each transmission path.
[0119] The generation of a data transfer request corresponding to a data block by a thread can be regarded as the execution of a data transfer task by the thread. In this case, each thread executes multiple data transfer tasks in a loop (outer loop), and each time a data transfer task is executed, the loop generates at least one data transfer request (inner loop).
[0120] Those skilled in the art should understand that there are more ways to allocate data blocks to threads, as long as each thread is allocated one data block at a time and the data blocks allocated to adjacent threads each time are continuous. The embodiments of the present disclosure do not limit the specific implementation method of allocating data blocks to threads.
[0121] Those skilled in the art should understand that when allocating data blocks to transmission paths, data blocks with larger storage addresses may be allocated first. In this case, when allocating data blocks to threads, data blocks with larger storage addresses are also allocated first. As long as when allocating data blocks to transmission paths and threads, data blocks with smaller storage addresses are allocated first or data blocks with larger storage addresses are allocated first, the embodiments of the present disclosure do not limit the specific allocation order of data blocks.
[0122] An exemplary method for determining the bandwidth coefficient in an embodiment of the present disclosure is described below.
[0123] In a possible implementation, when the bandwidth of each transmission path is an integer multiple of the minimum bandwidth of multiple transmission paths, the bandwidth coefficient of each transmission path is determined according to the bandwidths of the multiple transmission paths, including:
[0124] The ratio of the bandwidth of each transmission path to the minimum bandwidth is calculated as the bandwidth coefficient of the transmission path.
[0125] For example, the bandwidth coefficient is used to determine the number of data blocks allocated to the transmission path each time, so the bandwidth coefficient is an integer. The proportional relationship of the bandwidth coefficient indicates the proportional relationship of the bandwidth of the transmission path, so the minimum bandwidth of multiple transmission paths can be determined according to the bandwidth of multiple transmission paths. When the bandwidth of each transmission path is an integer multiple of the minimum bandwidth, the ratio of the bandwidth of each transmission path to the minimum bandwidth can be directly calculated as the bandwidth coefficient of the transmission path.
[0126] For example, suppose there are Q transmission paths, and the bandwidths of the transmission paths are B_1, B_2, ..., B_Q. The minimum bandwidth of the multiple transmission paths is B_1. B_2, ..., B_Q are all integer multiples of B_1. Then the bandwidth coefficients of the transmission paths can be 1 (B_1 / B_1), B_2 / B_1, ..., B_Q / B_1.
[0127] When the bandwidth of any transmission path is not an integer multiple of the minimum bandwidth, the bandwidth coefficient of each transmission path may be further calculated according to the ratio of the bandwidth of each transmission path to the minimum bandwidth.
[0128] In a possible implementation, when the bandwidth of any transmission path is not an integer multiple of the minimum bandwidth of multiple transmission paths, a bandwidth coefficient of each transmission path is determined according to the bandwidths of the multiple transmission paths, including:
[0129] Calculate the ratio of the bandwidth of each transmission path to the minimum bandwidth as the initial coefficient of the transmission path;
[0130] Starting from the smallest weight in the preset weight group, a plurality of integer coefficients corresponding to the weight are obtained according to the weight and initial coefficients of the plurality of transmission paths;
[0131] For each weight, when the weight satisfies a preset condition, a transmission time consumption index of the data transmission request generated by the first module is calculated as a bandwidth coefficient based on a plurality of integer coefficients corresponding to the weight, a maximum number of data transmission requests allowed to be generated simultaneously by the first module, and the bandwidth of each transmission path. The smaller the transmission time consumption index, the smaller the maximum transmission time consumption of the data transmission request on each transmission path.
[0132] A plurality of integer coefficients corresponding to the weight of the minimum transmission time consumption index are determined as bandwidth coefficients.
[0133] For example, assume that there are Q transmission paths, and the bandwidths of each transmission path are B_1, B_2, ..., B_Q. The minimum bandwidth of each transmission path is B_1, and B_2, ..., B_Q are not integer multiples of B_1. The ratio of the bandwidth of each transmission path to the minimum bandwidth can be calculated as the initial coefficient of the transmission path. Then the initial coefficients of each transmission path can be 1 (B_1 / B_1), B_2 / B_1, ..., B_Q / B_1.
[0134] A weight group may be pre-set, and the weight group may include multiple positive integer weights. The embodiment of the present disclosure does not limit the total number of weights in the weight group and the specific values of the weights.
[0135] Starting from the smallest weight in the preset weight group, multiple integer coefficients corresponding to the weight can be obtained according to the weight and the initial coefficients of multiple transmission paths. The proportional relationship of the multiple integer coefficients is close to the proportional relationship of the bandwidths of the multiple transmission paths. The embodiments of the present disclosure do not limit the specific calculation method of the integer system. An exemplary calculation method of the integer coefficients is given later.
[0136] When the weights meet the preset conditions, it can be considered that when the multiple integer coefficients corresponding to the weights are used as bandwidth coefficients, the number of data blocks allocated to multiple transmission paths is uniform. The embodiments of the present disclosure do not limit the specific setting method of the preset conditions, and examples of the preset conditions are given below.
[0137] It is possible to judge whether the weight satisfies the preset conditions. For each weight, when the weight satisfies the preset conditions, the multiple integer coefficients corresponding to the weight are calculated as bandwidth coefficients based on the multiple integer coefficients corresponding to the weight, the maximum number of data transmission requests allowed to be generated simultaneously by the first module, and the bandwidth of each transmission path. The transmission time consumption index of the data transmission request generated by the first module is as follows: the smaller the transmission time consumption index is, the smaller the maximum transmission time consumption of the data transmission request on each transmission path is.
[0138] If a certain weight no longer meets the preset conditions, the calculation of the integer coefficients corresponding to the subsequent weights can be stopped to reduce the data processing cost.
[0139] The maximum transmission time of the data transmission request on each transmission path refers to the transmission time of the longest transmission path after comparing the time taken for each transmission path to transmit all the data transmission requests to be transmitted by itself to the second module.
[0140] The present disclosure does not limit the specific calculation method of the transmission time consumption index, as long as the smaller the transmission time consumption index is, the smaller the maximum transmission time consumption of the data transmission request on each transmission path is. An exemplary calculation method of the transmission time consumption index is given below.
[0141] Since a smaller transmission time consumption index indicates a smaller maximum transmission time consumption of a data transmission request on each transmission path, multiple integer coefficients corresponding to the weight of the smallest transmission time consumption index can be determined as bandwidth coefficients. In this case, when the determined bandwidth coefficient is used to allocate data blocks, the transmission efficiency of the data transmission request can be higher.
[0142] The following describes an exemplary calculation method for multiple integer coefficients corresponding to weights and an example of preset conditions.
[0143] In a possible implementation, a plurality of integer coefficients corresponding to the weight are obtained according to the weight and initial coefficients of the plurality of transmission paths, including:
[0144] The weight is used to multiply the initial coefficients of the plurality of transmission paths respectively to obtain products corresponding to the weight;
[0145] The multiple products corresponding to the weight are rounded to integers respectively to obtain multiple integer coefficients corresponding to the weight;
[0146] The preset condition is that the weight is less than or equal to the minimum bandwidth and the sum of multiple integer coefficients corresponding to the weight is less than or equal to the maximum number.
[0147] For example, to calculate multiple integer coefficients corresponding to any weight, the weight can be multiplied by the initial coefficients of multiple transmission paths to obtain multiple products corresponding to the weight, and the multiple products corresponding to the weight are rounded to obtain multiple integer coefficients corresponding to the weight.
[0148] The preset condition may be set as that the weight is less than or equal to the minimum bandwidth value and the sum of the multiple integer coefficients corresponding to the weight is less than or equal to the maximum number.
[0149] Assume that the weight group is a positive integer set, Q=4, and the bandwidths of the transmission paths are 23, 60, 60, and 80. Table 1 shows an example of integer coefficients corresponding to each weight and the sum of the integer coefficients calculated according to an embodiment of the present disclosure.
[0150] Table 1
[0151]
[0152] Referring to Table 1, x represents the value of weight x, and x is a positive integer. x, x×B_2 / B_1, ..., x×B_Q / B_1 represent multiple products corresponding to weight x. C_1_x, C_2_x, ..., C_Q_x represent multiple integer coefficients corresponding to weight x. C_SUM_x represents the sum of multiple integer coefficients corresponding to weight x.
[0153] The smallest weight in the weight group may be weight 1. Then the initial coefficients of each transmission path may be 1, 2.608696, 2.608696, and 3.478261. The weight 1 is used to multiply each initial coefficient to obtain multiple products corresponding to the weight 1, which are 1, 2.608696, 2.608696, and 3.478261.
[0154] The multiple products corresponding to the weight 1 are rounded respectively. Assuming that a rounding function is used, the multiple integer coefficients corresponding to the weight 1 are 1, 3, 3, and 3. The sum of the multiple integer coefficients corresponding to the weight 1 can be calculated to be 1+3+3+3=10.
[0155] Those skilled in the art should understand that other functions may be used to round multiple products corresponding to weights, such as a rounding-up function, a rounding-down function, etc. The embodiments of the present disclosure do not limit which function is used when rounding multiple products corresponding to weights.
[0156] The minimum bandwidth of multiple transmission paths is 23. Assuming that the maximum number of data transmission requests (i.e., the total number of threads) allowed to be generated simultaneously by the first module is 128, then weight 1 is less than the minimum bandwidth, and the sum of the multiple integer coefficients corresponding to weight 1 is also less than the maximum number (weight 1 meets the preset conditions), and the multiple integer coefficients and the sum of the multiple integer coefficients corresponding to the next weight can be calculated. Referring to Table 1, the next weight can be weight 2. By analogy, weights 2-weights 13 also meet the preset conditions, until the sum of the multiple integer coefficients corresponding to weight 14 is calculated to be equal to 137, which is greater than the maximum number (weight 14 does not meet the preset conditions), then the calculation of the multiple integer coefficients and the sum of the multiple integer coefficients corresponding to the subsequent weights can be stopped. The calculation method of the multiple integer coefficients and the sum of the multiple integer coefficients corresponding to weights 2 to 14 can be the same as that of weight 1, which will not be repeated here.
[0157] The following is an exemplary calculation method for the transmission time consumption indicator.
[0158] In a possible implementation, for each weight, when calculating the multiple integer coefficients corresponding to the weight as bandwidth coefficients according to the multiple integer coefficients corresponding to the weight, the maximum number of data transmission requests allowed to be generated simultaneously by the first module, and the bandwidth of each transmission path, the transmission time consumption index of the data transmission request generated by the first module includes:
[0159] According to the multiple integer coefficients corresponding to the weight and the maximum number, when calculating the multiple integer coefficients corresponding to the weight as the bandwidth coefficient, the data block allocation index of each transmission path, the sum of the data block allocation indexes of the multiple transmission paths is equal to the maximum number, and the larger the data block allocation index is, the more data blocks are allocated to the transmission path;
[0160] Calculate the ratio of the data block allocation index to the bandwidth of each transmission path, and obtain multiple integer coefficients corresponding to the weight as the bandwidth coefficient, and the utilization index of each transmission path. The smaller the utilization index, the more idle the transmission path is.
[0161] When the maximum value of the usage degree indicators of multiple transmission paths is used as the multiple integer coefficients corresponding to the weight as the bandwidth coefficient, the first module generates the transmission time consumption indicator of the data transmission request.
[0162] For example, referring to Table 1, since each weight from weight 1 to weight 13 meets the preset conditions, the transmission time consumption indicator of the data transmission request generated by the first module can be generated when multiple integer coefficients corresponding to the weight are calculated as bandwidth coefficients for each weight from weight 1 to weight 13.
[0163] For example, for each weight from weight 1 to weight 13, the data block allocation index of each transmission path can be calculated based on the multiple integer coefficients and the maximum number corresponding to the weight when the multiple integer coefficients corresponding to the weight are used as the bandwidth coefficient. The larger the data block allocation index, the more data blocks are allocated to the transmission path. Then, the ratio of the data block allocation index to the bandwidth of each transmission path is calculated to obtain the usage index of each transmission path when the multiple integer coefficients corresponding to the weight are used as the bandwidth coefficient. The smaller the usage index, the more idle the transmission path is. The maximum value of the usage index of multiple transmission paths is used as the transmission time consumption index of the data transmission request generated by the first module when the multiple integer coefficients corresponding to the weight are used as the bandwidth coefficient. Among them, the sum of the data block allocation indexes of multiple transmission paths is equal to the maximum number.
[0164] The following describes an example of a transmission time consumption indicator of a data transmission request generated by the first module when calculating multiple integer coefficients corresponding to the weight x as bandwidth coefficients.
[0165] For example, the maximum number and the sum of multiple integer coefficients corresponding to the weight x can be divided to obtain the quotient loop_x and remainder remain_x. Then, based on loop_x, remain_x and multiple integer coefficients C_1_x, C_2_x, ..., C_Q_x corresponding to the weight x, the initial values of the data block allocation indicators thread_num_x_1, thread_num_x_2, ..., thread_num_x_Q of each transmission path are calculated when multiple integer coefficients corresponding to the weight x are used as bandwidth coefficients.
[0166] The first value remain_e and the second value last_remain may be preset such that an initial value of remain_e is 1, and an initial value of last_remain is remain_x.
[0167] When the value of remain_x is greater than 0, the following steps (1) and (2) are executed repeatedly to update the values of remain_e and last_remain until the value of remain_x is less than or equal to 0, at which time the values of remain_e and last_remain are no longer updated.
[0168] (1) If remain_x>C_y_x, where y is equal to remain_e, then subtract C_y_x from the value of remain_x to make last_remain equal to the updated remain_x, and then add 1 to the value of remain_e.
[0169] (2) If remain_x≤C_y_x, then set last_remain equal to remain_x and set remain_x equal to 0.
[0170] For each transmission path, the sequence number of the transmission path is compared with remain_e. If the sequence number of the transmission path is less than remain_e, the initial value of the data block allocation index corresponding to the transmission path and the integer coefficient corresponding to the transmission path can be summed to obtain the data block allocation index corresponding to the transmission path. If the sequence number of the transmission path is equal to remain_e, the initial value of the data block allocation index corresponding to the transmission path and last_remain can be summed to obtain the data block allocation index corresponding to the transmission path. If the sequence number of the transmission path is greater than remain_e, the initial value of the data block allocation index corresponding to the transmission path can be directly used as the data block allocation index corresponding to the transmission path. In this case, the sum of the data block allocation indexes of multiple transmission paths can be equal to the maximum number of data transmission requests allowed to be generated simultaneously by the first module.
[0171] Taking weight 1 as an example, the following provides examples of the data block allocation index of each transmission path, the utilization index of each transmission path, and the transmission time consumption index of the data transmission request generated by the first module when calculating multiple integer coefficients corresponding to weight 1 as the bandwidth coefficient.
[0172] Combining Table 1 and related descriptions, it can be seen that the maximum number of data transmission requests allowed to be generated simultaneously by the first module is the total number of threads A=128, the total number of transmission paths Q=4, and the multiple integer coefficients C_1_1, C_2_1, C_3_1, and C_4_1 corresponding to weight 1 are 1, 3, 3, and 3 respectively, where C_1_1 corresponds to the first transmission path, C_2_1 corresponds to the second transmission path, C_3_1 corresponds to the third transmission path, and C_4_1 corresponds to the fourth transmission path. The sum of the multiple integer coefficients corresponding to weight 1 C_SUM_1 is 10. Calculate the quotient loop_1=12 and remainder remain_1=8 of A divided by C_SUM_1.
[0173] When calculating multiple integer coefficients corresponding to weight 1 as bandwidth coefficients, the initial value of the data block allocation index of each transmission path, where the initial value of the data block allocation index of the first transmission path is equal to loop_1×C_1_1, which is equal to 12; the initial value of the data block allocation index of the second transmission path is equal to loop_1×C_2_1, which is equal to 36; the initial value of the data block allocation index of the third transmission path is equal to loop_1×C_3_1, which is equal to 36; and the initial value of the data block allocation index of the fourth transmission path is equal to loop_1×C_4_1, which is equal to 36.
[0174] The first value remain_e and the second value last_remain may be preset such that an initial value of remain_e is 1, and an initial value of last_remain is equal to remain_1 or 8.
[0175] Since the value of remain_1 is greater than 0, the above steps (1) and (2) are executed in a loop to update the values of remain_e and last_remain until the value of remain_1 is less than or equal to 0, at which time the values of remain_e and last_remain are no longer updated.
[0176] Among them, the initial value of C_y_1 is equal to C_1_1, which is equal to 1, and remain_1>C_1_1. Therefore, step (1) is executed to subtract C_y_1 from the value of remain_1 so that remain_1 is equal to 7, and last_remain is equal to the updated remain_1, which is equal to 7; then the value of remain_e is increased by 1 so that remain_e is equal to 2.
[0177] The value of remain_1 is still greater than 0, so continue to update the values of remain_e and last_remain. At this time, C_y_1 is equal to C_2_1, which is equal to 3, and remain_1>C_2_1. Therefore, step (1) is executed, and the value of remain_1 is subtracted from C_y_1 so that remain_1 is equal to 7-3=4, and last_remain is equal to the updated remain_1, which is equal to 4. The value of remain_e is increased by 1 so that remain_e is equal to 3.
[0178] The value of remain_1 is still greater than 0, so continue to update the values of remain_e and last_remain. At this time, C_y_1 is equal to C_3_1 which is equal to 3, and remain_1 > C_3_1. Therefore, execute step (1), subtract the value of C_y_1 from remain_1 so that remain_1 is equal to 4 - 3 = 1, last_remain is equal to the updated remain_1 which is 1, and add 1 to the value of remain_e so that remain_e is equal to 4.
[0179] The value of remain_1 is still greater than 0, so continue to update the values of remain_e and last_remain. At this time, C_y_1 is equal to C_4_1 which is equal to 3, and remain_1 < C_4_1. Therefore, execute step (2), make last_remain equal to remain_1 which is 1, and make remain_1 equal to 0.
[0180] The value of remain_1 is equal to 0, so stop updating the values of remain_e and last_remain. Finally, remain_e is equal to 4 and last_remain is equal to 1.
[0181] The sequence number "1" of the first transmission path is less than remain_e. The initial value of the data block allocation index corresponding to the first transmission path and the integer coefficient C_1_1 corresponding to the first transmission path can be summed up to obtain the data block allocation index thread_num_1_1 corresponding to the first transmission path, which is equal to 13.
[0182] The sequence number "2" of the second transmission path is less than remain_e. The initial value of the data block allocation index corresponding to the second transmission path and the integer coefficient C_2_1 corresponding to the second transmission path can be summed up to obtain the data block allocation index thread_num_1_2 corresponding to the second transmission path, which is equal to 39.
[0183] The sequence number "3" of the third transmission path is less than remain_e. The initial value of the data block allocation index corresponding to the third transmission path and the integer coefficient C_3_1 corresponding to the third transmission path can be summed up to obtain the data block allocation index thread_num_1_3 corresponding to the third transmission path, which is equal to 39.
[0184] The sequence number "4" of the fourth transmission path is equal to remain_e. The initial value of the data block allocation index corresponding to the fourth transmission path and last_remain can be summed up to obtain the data block allocation index thread_num_1_4 corresponding to the fourth transmission path, which is equal to 37.
[0185] thread_num_1_1+thread_num_1_2+thread_num_1_3+thread_num_1_4=13+39+39+37=A=128. That is, the sum of the data block allocation indicators corresponding to the four transmission paths is equal to the maximum number of data transmission requests allowed to be generated simultaneously by the first module.
[0186] When multiple integer coefficients corresponding to weight 1 are used as bandwidth coefficients, the utilization index T_1_1 of the first transmission path is equal to the ratio of the data block allocation index thread_num_1_1 of the first transmission path to the bandwidth of the first transmission path, that is, T_1_1=13 / 23=0.565217.
[0187] When the multiple integer coefficients corresponding to the weight 1 are used as bandwidth coefficients, the usage index T_2_1 of the second transmission path is equal to the ratio of the data block allocation index thread_num_1_2 of the second transmission path to the bandwidth of the second transmission path, that is, T_2_1=39 / 60=0.65.
[0188] When the multiple integer coefficients corresponding to the weight 1 are used as bandwidth coefficients, the usage index T_3_1 of the third transmission path is equal to the ratio of the data block allocation index thread_num_1_3 of the third transmission path to the bandwidth of the third transmission path, that is, T_3_1=39 / 60=0.65.
[0189] When the multiple integer coefficients corresponding to the weight 1 are used as bandwidth coefficients, the usage index T_4_1 of the 4th transmission path is equal to the ratio of the data block allocation index thread_num_1_4 of the 4th transmission path to the bandwidth of the 4th transmission path, that is, T_4_1=37 / 60=0.4625.
[0190] When multiple integer coefficients corresponding to weight 1 are used as bandwidth coefficients, the transmission time consumption index W(1) of the data transmission request generated by the first module is equal to the maximum value of the utilization degree indicators of multiple transmission paths, among which T_2_1 and T_3_1 are the largest, therefore, W(1)=T_2_1==T_3_1=0.65.
[0191] When multiple integer coefficients corresponding to other weights are used as bandwidth coefficients, the calculation method of the data block allocation index of each transmission path, the utilization index of each transmission path, and the transmission time consumption index of the data transmission request generated by the first module can be the same as that of weight 1, and will not be repeated here. Finally, the utilization index of each transmission path when multiple integer coefficients corresponding to each weight are used as bandwidth coefficients, and the transmission time consumption index of the data transmission request generated by the first module are shown in Table 2.
[0192] Table 2
[0193]
[0194] See Table 2, where x represents the value of the weight, and x is a positive integer. T_1_x, T_2_x, ..., T_Q_x represent the usage index of each transmission path when multiple integer coefficients corresponding to the weight x are used as bandwidth coefficients. W(x) represents the transmission time consumption index of the data transmission request generated by the first module when multiple integer coefficients corresponding to the weight x are used as bandwidth coefficients.
[0195] The present disclosure does not impose any limitation on the specific calculation method of the data block allocation index, as long as a larger data block allocation index indicates more data blocks are allocated to the transmission path.
[0196] The present disclosure does not impose any limitation on the specific calculation method of the usage level index, as long as the smaller the usage level index is, the more idle the transmission path is.
[0197] Referring to Table 2, when x=1, 2, ..., 13, the minimum value of W(x) is W(2) and W(7), so the multiple integer coefficients corresponding to the weight 2 (C_1_2, C_2_2, ..., C_Q_2) or the multiple integer coefficients corresponding to the weight 7 (C_1_7, C_2_7, ..., C_Q_7) can be used as the bandwidth coefficients of the 1st, 2nd, ..., Qth transmission paths, respectively.
[0198] In this case, when data blocks are allocated according to the determined bandwidth coefficient, the degree of parallel transmission of multiple transmission paths is higher, and the time taken by each transmission path to complete its own data transmission request is closer, so that the total transmission time of the first data is lower and the transmission efficiency is higher.
[0199] The following describes an exemplary manner in which each thread generates a data transmission request.
[0200] In a possible implementation, a single data transfer request is allowed to include a data volume R, R>0, so that each thread generates multiple data transfer requests corresponding to each data block according to the allocation order of the data blocks, including:
[0201] When any thread is to generate multiple data transfer requests corresponding to a data block with a data volume of N and N is an integer multiple of R, it is determined that the data block corresponds to N / R data transfer requests in total, and the data volume of each data transfer request is R;
[0202] Determine the starting storage address of the data included in each data transmission request according to the starting storage address of the data block, wherein the starting storage address of the data included in the j-th data transmission request is the sum of the starting storage address of the data block and (j-1)×R, 1≤j≤N / R, and j is an integer;
[0203] Cause the thread to generate N / R data transfer requests corresponding to the data block.
[0204] For example, as described above, since the data segmentation granularity N is an integer multiple of the data volume R that a single data transfer request is allowed to include, for any data block with a data volume of N, the number of data transfer requests generated by the thread corresponding to the data block can be N / R. At this time, the data volume of data included in each data transfer request is R.
[0205] In this case, the starting storage address of each data transfer request can be determined according to the starting storage address of the data block. Among them, the starting storage address of the data included in the jth data transfer request is the sum of the starting storage address of the data block and (j - 1)×R, where 1 ≤ j ≤ N / R and j is an integer.
[0206] For example, referring to Figure 4a the example of, the data volume of the 8th data block is 4K (N = 4K). The starting storage address of the 8th data block is 28K, and R = 1K Byte. Then the 8th data block can correspond to 4 data transfer requests, namely data transfer requests 1, 2, 3, and 4.
[0207] Then the starting storage address of data transfer request 1 can be 28K, the starting storage address of data transfer request 2 can be 28K+(2 - 1)×1K = 29K, the starting storage address of data transfer request 3 can be 28K+(3 - 1)×K = 30K, and the starting storage address of data transfer request 4 can be 28K+(4 - 1)×1K = 31K.
[0208] In this way, the starting storage address of each data transfer request corresponding to a data block with a data volume of N can be determined. Since the data volume of each data transfer request is also known and is R, when generating a data transfer request, read data with a data volume of R at the starting storage address and obtain the data transfer request according to the read data.
[0209] In a possible implementation manner, the data volume of data that a single data transfer request is allowed to include is R, where R > 0. Cause each thread to generate multiple data transfer requests corresponding to each data block in the allocation order of the data blocks, including:
[0210] When any one thread wants to generate multiple data transfer requests corresponding to a data block with a data volume of B and 0 < B < N, determine that the data block corresponds to Y data transfer requests in total. The data volume of data included in the 1st to the (Y - 1)th data transfer requests is equal to R, and the data volume of data included in the Yth data transfer request is less than or equal to R. Y is the result of rounding up B / R.
[0211] Determine the starting storage address of the data included in each data transmission request according to the starting storage address of the data block, wherein the starting storage address of the data included in the v-th data transmission request is the sum of the starting storage address of the data block and (v-1)×R, 1≤v≤Y, and v is an integer;
[0212] Make the thread generate v data transfer requests corresponding to the data block.
[0213] For example, referring to the above description, the first data may not be an integer multiple of the data segmentation granularity N. Therefore, the data amount of the last data block obtained by segmenting the first data may be equal to B, 0 <B<N。
[0214] Therefore, for any data block with a data volume of B, under the premise that the data volume allowed to be included in a single data transfer request is R, the number of data transfer requests corresponding to the data block generated by the thread can be equal to Y, where Y is the result of rounding up B / R, and Y is less than or equal to N / R. It can be determined that the data block corresponds to a total of Y data transfer requests, the data volume included in the 1st to Y-1th data transfer requests is equal to R, and the data volume included in the Yth data transfer request is less than or equal to R.
[0215] In this case, the starting storage address of each data transmission request can be determined according to the starting storage address of the data block. The starting storage address of the data included in the vth data transmission request is the sum of the starting storage address of the data block and (v-1)×R, 1≤v≤Y, and v is an integer.
[0216] For example, see Figure 4b and Figure 5 In the example, the 32nd data block is the last data block to which the first data is segmented, and the data volume of the 32nd data block is 2K (B=2K). The starting storage address of the 32nd data block is 124K, R=1KByte, and the 32nd data block can correspond to 2 data transmission requests, namely, data transmission request 11 and data transmission request 12.
[0217] The starting storage address of the data transfer request 11 may be 124K, the starting storage address of the data transfer request 12 may be 124K+(2-1)×1K=125K, and the ending storage address of the data transfer request 12 may be 124K+2K=126K.
[0218] In this way, the starting storage address of each data transmission request corresponding to the data block with a data volume of B can be determined. Since the data volume of the 1st to Y-1st data transmission requests is also known and is R, when generating the 1st to Y-1st data transmission requests, it is sufficient to read data with a data volume of R from the starting storage address of the corresponding data transmission request and obtain the data transmission request based on the read data. When generating the Yth data transmission request, it is sufficient to read data from the starting storage address of the Yth data transmission request until the position of the sum of the starting address of the 1st data transmission request and the data block of the data block is read.
[0219] In this case, no matter what data amount of the data block is, the thread can generate corresponding data transmission requests in order, thereby improving the transmission efficiency of the data transmission requests.
[0220] The present disclosure also provides a data transmission device. Figure 6 A schematic diagram showing the structure of a data transmission device according to an embodiment of the present disclosure.
[0221] like Figure 6 As shown, in a possible implementation, the device is applied to a first module, a plurality of transmission paths are included between the first module and the second module, and the device includes:
[0222] A first determining module 61 is used to determine a bandwidth coefficient of each transmission path according to the bandwidths of the multiple transmission paths, wherein a proportional relationship of the bandwidth coefficients indicates a proportional relationship of the bandwidths of the transmission paths;
[0223] A segmentation module 62, configured to segment the first data to be transmitted into a plurality of data blocks;
[0224] A first allocation module 63 is used to allocate the multiple data blocks to the multiple transmission paths in sequence according to the bandwidth coefficient of each transmission path, each transmission path allocates at least one continuous data block each time, and the number of data blocks allocated each time is equal to the smaller one of the bandwidth coefficient of the transmission path and the number of unallocated data blocks;
[0225] The first transmission module 64 is used to generate multiple data transmission requests corresponding to each data block, each data transmission request includes a part of the corresponding data block, and output each data transmission request to the second module through the transmission path allocated to the data block corresponding to each data transmission request.
[0226] In one possible implementation, a single data transmission request is allowed to include data of amount R, R>0, and dividing the first data to be transmitted into multiple data blocks includes: dividing the first data into W data blocks, the data amount of the 1st to W-1th data blocks is equal to N, the data amount of the Wth data block is less than or equal to N, N is an integer multiple of R, and W is an integer greater than 1.
[0227] In a possible implementation, the first module includes multiple threads, and the device also includes: a second allocation module, used to allocate the multiple data blocks to multiple threads in sequence according to the total number of threads, each thread is allocated one data block at a time, and the data blocks allocated to adjacent threads each time are continuous; generating multiple data transmission requests corresponding to each data block includes: making each thread generate multiple data transmission requests corresponding to each data block according to the allocation order of the data blocks.
[0228] In a possible implementation, when the bandwidth of each transmission path is an integer multiple of the minimum bandwidth of the multiple transmission paths, determining the bandwidth coefficient of each transmission path based on the bandwidth of the multiple transmission paths includes: calculating the ratio of the bandwidth of each transmission path to the minimum bandwidth as the bandwidth coefficient of the transmission path.
[0229] In a possible implementation, when the bandwidth of any transmission path is not an integer multiple of the minimum bandwidth of the multiple transmission paths, determining the bandwidth coefficient of each transmission path according to the bandwidth of the multiple transmission paths includes: calculating the ratio of the bandwidth of each transmission path to the minimum bandwidth as the initial coefficient of the transmission path; starting from the smallest weight in the preset weight group, obtaining multiple integer coefficients corresponding to the weight according to the weight and the initial coefficients of the multiple transmission paths; for each weight, when the weight meets the preset conditions, calculating the multiple integer coefficients corresponding to the weight as the bandwidth coefficient according to the multiple integer coefficients corresponding to the weight, the maximum number of data transmission requests allowed to be generated simultaneously by the first module, and the bandwidth of each transmission path, the transmission time consumption index of the data transmission request generated by the first module, the smaller the transmission time consumption index, the smaller the maximum transmission time consumption of the data transmission request on each transmission path; and determining the multiple integer coefficients corresponding to the weight with the smallest transmission time consumption index as the bandwidth coefficient.
[0230] In a possible implementation, obtaining, according to the weight and the initial coefficients of the multiple transmission paths, multiple integer coefficients corresponding to the weight includes: multiplying the weight by the initial coefficients of the multiple transmission paths respectively to obtain multiple products corresponding to the weight; rounding the multiple products corresponding to the weight respectively to obtain multiple integer coefficients corresponding to the weight; the preset condition is that the weight is less than or equal to the minimum bandwidth value and the sum of the multiple integer coefficients corresponding to the weight is less than or equal to the maximum quantity.
[0231] In a possible implementation, when calculating, according to the multiple integer coefficients corresponding to the weight, the maximum quantity of data transmission requests that the first module allows to be generated simultaneously, and the bandwidth of each transmission path, the transmission time-consuming index of the data transmission requests generated by the first module when the multiple integer coefficients corresponding to the weight are used as the bandwidth coefficients includes: calculating, according to the multiple integer coefficients corresponding to the weight and the maximum quantity, the data block allocation index of each transmission path when the multiple integer coefficients corresponding to the weight are used as the bandwidth coefficients, the sum of the data block allocation indexes of the multiple transmission paths being equal to the maximum quantity, and the larger the data block allocation index, the more data blocks are allocated to the transmission path; calculating the ratio of the data block allocation index of each transmission path to the bandwidth to obtain the usage degree index of each transmission path when the multiple integer coefficients corresponding to the weight are used as the bandwidth coefficients, and the smaller the usage degree index, the more idle the transmission path; using the maximum value of the usage degree indexes of the multiple transmission paths as the transmission time-consuming index of the data transmission requests generated by the first module when the multiple integer coefficients corresponding to the weight are used as the bandwidth coefficients.
[0232] In a possible implementation, the total number of the transmission paths is Q, where Q is an integer greater than 1; the sum of the bandwidth coefficients of the multiple transmission paths is Z, where Z is a positive integer; allocating the multiple data blocks to the multiple transmission paths in sequence according to the bandwidth coefficient of each transmission path includes: for the s-th data block among the W data blocks, calculating the remainder P of s divided by Z, where 0 < s ≤ W and s is an integer, P ≥ 0 and P is an integer; when P = 0, allocating the s-th data block to the Q-th transmission path; when P > 0 and P is less than or equal to the bandwidth coefficient of the first transmission path, allocating the s-th data block to the first transmission path; when P is greater than the sum of the bandwidth coefficients of the first to the (i - 1)-th transmission paths and less than or equal to the sum of the bandwidth coefficients of the first to the i-th transmission paths, allocating the s-th data block to the i-th transmission path, where 0 < i ≤ Q and i is an integer.
[0233] In a possible implementation, the total number of the threads is A, where A is a positive integer; distributing the multiple data blocks to the multiple threads in sequence according to the total number of the threads includes: for the s-th data block, calculating the remainder F of A divided by s, where s is a positive integer, F≥0 and F is an integer; when F = 0, allocating the s-th data block to the A-th thread; when F>0, allocating the s-th data block to the F-th thread.
[0234] In a possible implementation, the amount of data that a single data transmission request is allowed to include is R, where R>0. Making each thread generate multiple data transmission requests corresponding to each data block in the allocation order of the data blocks includes: when any one thread is to generate multiple data transmission requests corresponding to a data block with an amount of data N and N is an integer multiple of R, determining that the data block corresponds to a total of N / R data transmission requests, and the amount of data included in each data transmission request is R; determining the starting storage address of the data included in each data transmission request according to the starting storage address of the data block, where the starting storage address of the data included in the j-th data transmission request is the sum of the starting storage address of the data block and (j - 1)×R, 1≤j≤N / R, and j is an integer; making the thread generate N / R data transmission requests corresponding to the data block.
[0235] In a possible implementation, the amount of data that a single data transmission request is allowed to include is R, where R>0. Making each thread generate multiple data transmission requests corresponding to each data block in the allocation order of the data blocks includes: when any one thread is to generate multiple data transmission requests corresponding to a data block with an amount of data B and 0<B<N, determining that the data block corresponds to a total of Y data transmission requests, the amount of data included in the 1st to the (Y - 1)-th data transmission requests is equal to R, and the amount of data included in the Y-th data transmission request is less than or equal to R, where Y is the result of rounding up B / R; determining the starting storage address of the data included in each data transmission request according to the starting storage address of the data block, where the starting storage address of the data included in the v-th data transmission request is the sum of the starting storage address of the data block and (v - 1)×R, 1≤v≤Y, and v is an integer; making the thread generate v data transmission requests corresponding to the data block.
[0236] In some embodiments, the functions or modules included in the device provided by the embodiments of the present disclosure can be used to execute the methods described in the above method embodiments, and the specific implementation can refer to the description of the above method embodiments. For the sake of brevity, it will not be repeated here.
[0237] The embodiment of the present disclosure also provides a computer-readable storage medium on which computer program instructions are stored, and the computer program instructions implement the above method when executed by a processor. The computer-readable storage medium can be a volatile or non-volatile computer-readable storage medium.
[0238] An embodiment of the present disclosure further proposes an electronic device, comprising: a processor; and a memory for storing instructions executable by the processor; wherein the processor is configured to implement the above method when executing the instructions stored in the memory.
[0239] The embodiments of the present disclosure also provide a computer program product, including a computer-readable code, or a non-volatile computer-readable storage medium carrying the computer-readable code. When the computer-readable code runs in a processor of an electronic device, the processor in the electronic device executes the above method.
[0240] Figure 7 1 is a block diagram of an electronic device 1900 according to an embodiment of the present disclosure. For example, the electronic device 1900 may be provided as a server or a terminal device. Figure 7 , the electronic device 1900 includes a processing component 1922, which further includes one or more processors, and a memory resource represented by a memory 1932 for storing instructions executable by the processing component 1922, such as an application. The application stored in the memory 1932 may include one or more modules, each corresponding to a set of instructions. In addition, the processing component 1922 is configured to execute instructions to perform the above method.
[0241] The electronic device 1900 may also include a power supply component 1926 configured to perform power management of the electronic device 1900, a wired or wireless network interface 1950 configured to connect the electronic device 1900 to a network, and an input / output interface 1958 (I / O interface). The electronic device 1900 may operate based on an operating system stored in the memory 1932, such as Windows Server 2003. TM , Mac OS X TM , Unix TM ,Linux TM , FreeBSD TM or similar.
[0242] In an exemplary embodiment, a non-volatile computer-readable storage medium is also provided, such as a memory 1932 including computer program instructions, which can be executed by the processing component 1922 of the electronic device 1900 to perform the above method.
[0243] The present disclosure may be a system, a method and / or a computer program product. The computer program product may include a computer-readable storage medium carrying computer-readable program instructions for causing a processor to implement various aspects of the present disclosure.
[0244] A computer-readable storage medium may be a tangible device that can hold and store instructions used by an instruction execution device. A computer-readable storage medium may be, for example, but not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing. More specific examples of computer-readable storage media (a non-exhaustive list) include: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a static random access memory (SRAM), a portable compact disk read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanical encoding device, such as a punch card or a raised structure in a groove on which instructions are stored, and any suitable combination of the foregoing. As used herein, a computer-readable storage medium is not to be interpreted as a transient signal per se, such as a radio wave or other freely propagating electromagnetic wave, an electromagnetic wave propagating through a waveguide or other transmission medium (e.g., a light pulse through a fiber optic cable), or an electrical signal transmitted through a wire.
[0245] The computer-readable program instructions described herein can be downloaded from a computer-readable storage medium to each computing / processing device, or downloaded to an external computer or external storage device via a network, such as the Internet, a local area network, a wide area network, and / or a wireless network. The network can include copper transmission cables, optical fiber transmissions, wireless transmissions, routers, firewalls, switches, gateway computers, and / or edge servers. The network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in the computer-readable storage medium in each computing / processing device.
[0246] The computer program instructions for performing the operation of the present disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-related instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages, such as Smalltalk, C++, etc., and conventional procedural programming languages, such as "C" language or similar programming languages. Computer-readable program instructions may be executed completely on a user's computer, partially on a user's computer, as an independent software package, partially on a user's computer, partially on a remote computer, or completely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., using an Internet service provider to connect via the Internet). In some embodiments, an electronic circuit, such as a programmable logic circuit, a field programmable gate array (FPGA), or a programmable logic array (PLA), may be customized by utilizing the state information of the computer-readable program instructions, and the electronic circuit may execute the computer-readable program instructions, thereby realizing various aspects of the present disclosure.
[0247] Various aspects of the present disclosure are described herein with reference to the flowcharts and / or block diagrams of the methods, devices (systems) and computer program products according to the embodiments of the present disclosure. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer-readable program instructions.
[0248] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine, so that when these instructions are executed by the processor of the computer or other programmable data processing device, a device that implements the functions / actions specified in one or more boxes in the flowchart and / or block diagram is generated. These computer-readable program instructions can also be stored in a computer-readable storage medium, and these instructions cause the computer, programmable data processing device, and / or other equipment to work in a specific manner, so that the computer-readable medium storing the instructions includes a manufactured product, which includes instructions for implementing various aspects of the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0249] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operating steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to implement the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0250] The flow chart and block diagram in the accompanying drawings show the possible architecture, function and operation of the system, method and computer program product according to multiple embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a part of a module, program segment or instruction, and a part of the module, program segment or instruction includes one or more executable instructions for realizing the specified logical function. In some alternative implementations, the function marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two continuous square boxes can actually be executed substantially in parallel, and they can sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs the specified function or action, or can be implemented with a combination of special hardware and computer instructions.
[0251] The embodiments of the present disclosure have been described above, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and changes will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The selection of terms used herein is intended to best explain the principles of the embodiments, practical applications, or technical improvements in the market, or to enable other persons of ordinary skill in the art to understand the embodiments disclosed herein.
Claims
1. A data transmission method, characterized in that: The method is applied to a first module, and a plurality of transmission paths are provided between the first module and a second module. The method comprises: Determining a bandwidth coefficient of each transmission path according to the bandwidths of the plurality of transmission paths, wherein a proportional relationship of the bandwidth coefficients indicates a proportional relationship of the bandwidths of the transmission paths; Dividing the first data to be transmitted into a plurality of data blocks; Allocate the plurality of data blocks to the plurality of transmission paths in sequence according to the bandwidth coefficient of each transmission path, allocating at least one continuous data block to each transmission path each time, and the number of data blocks allocated each time is equal to the smaller one of the bandwidth coefficient of the transmission path and the number of unallocated data blocks; For each data block, multiple data transmission requests corresponding to the data block are generated, each data transmission request includes a part of the corresponding data block, and each data transmission request is output to the second module through the transmission path allocated to the data block corresponding to each data transmission request.
2. The method according to claim 1, characterized in that The amount of data allowed to be included in a single data transfer request is R, R>0, The step of dividing the first data to be transmitted into a plurality of data blocks comprises: The first data is divided into W data blocks, the data volume of the 1st to W-1th data blocks is equal to N, the data volume of the Wth data block is less than or equal to N, N is an integer multiple of R, and W is an integer greater than 1.
3. The method according to claim 1, characterized in that The first module includes a plurality of threads, and the method further includes: Allocating the multiple data blocks to multiple threads in sequence according to the total number of the threads, allocating one data block to each thread at a time, and the data blocks allocated to adjacent threads each time are continuous; The step of generating, for each data block, a plurality of data transmission requests corresponding to the data block comprises: Each thread generates a plurality of data transfer requests corresponding to each data block according to the allocation order of the data blocks.
4. The method according to claim 1, characterized in that When the bandwidth of each transmission path is an integer multiple of the minimum bandwidth of the multiple transmission paths, determining the bandwidth coefficient of each transmission path according to the bandwidths of the multiple transmission paths includes: The ratio of the bandwidth of each transmission path to the minimum bandwidth is calculated as the bandwidth coefficient of the transmission path.
5. The method according to claim 1, characterized in that When the bandwidth of any transmission path is not an integer multiple of the minimum bandwidth of the multiple transmission paths, determining the bandwidth coefficient of each transmission path according to the bandwidths of the multiple transmission paths includes: Calculating a ratio of the bandwidth of each transmission path to the minimum bandwidth as an initial coefficient of the transmission path; Starting from the smallest weight in the preset weight group, a plurality of integer coefficients corresponding to the weight are obtained according to the weight and the initial coefficients of the plurality of transmission paths; For each weight, when the weight satisfies a preset condition, a transmission time consumption index of the data transmission request generated by the first module is calculated as the bandwidth coefficient according to a plurality of integer coefficients corresponding to the weight, a maximum number of data transmission requests allowed to be generated simultaneously by the first module, and the bandwidth of each transmission path. The smaller the transmission time consumption index, the smaller the maximum transmission time consumption of the data transmission request on each transmission path. A plurality of integer coefficients corresponding to the weight of the minimum transmission time consumption index are determined as the bandwidth coefficients.
6. The method according to claim 5, characterized in that Obtaining a plurality of integer coefficients corresponding to the weight according to the weight and the initial coefficients of the plurality of transmission paths includes: Multiplying the weight by the initial coefficients of the plurality of transmission paths respectively to obtain a plurality of products corresponding to the weight; Rounding the plurality of products corresponding to the weight respectively to obtain a plurality of integer coefficients corresponding to the weight; The preset condition is that the weight is less than or equal to the minimum bandwidth value and the sum of the plurality of integer coefficients corresponding to the weight is less than or equal to the maximum quantity.
7. The method according to claim 6, characterized in that When calculating the transmission time-consuming index of the data transmission requests generated by the first module with the plurality of integer coefficients corresponding to the weight, the maximum quantity of data transmission requests that the first module allows to generate simultaneously, and the bandwidth of each transmission path, it includes: Calculating the data block allocation index of each transmission path when the plurality of integer coefficients corresponding to the weight are used as the bandwidth coefficients according to the plurality of integer coefficients corresponding to the weight and the maximum quantity, the sum of the data block allocation indexes of the plurality of transmission paths is equal to the maximum quantity, and the larger the data block allocation index, the more data blocks are allocated to the transmission path; Calculating the ratio of the data block allocation index of each transmission path to the bandwidth to obtain the usage degree index of each transmission path when the plurality of integer coefficients corresponding to the weight are used as the bandwidth coefficients, and the smaller the usage degree index, the more idle the transmission path; Taking the maximum value of the usage degree indexes of the plurality of transmission paths as the transmission time-consuming index of the data transmission requests generated by the first module when the plurality of integer coefficients corresponding to the weight are used as the bandwidth coefficients.
8. The method according to claim 2, characterized in that: The total number of the transmission paths is Q, Q is an integer greater than 1; the sum of the bandwidth coefficients of the plurality of transmission paths is Z, Z is a positive integer; Allocating the plurality of data blocks to the plurality of transmission paths in sequence according to the bandwidth coefficient of each transmission path includes: For the s-th data block among the W data blocks, calculating the remainder P of s divided by Z, 0 < s ≤ W and s is an integer, P ≥ 0 and P is an integer; When P = 0, allocating the s-th data block to the Q-th transmission path; When P > 0 and P is less than or equal to the bandwidth coefficient of the first transmission path, allocating the s-th data block to the first transmission path; When P is greater than the sum of the bandwidth coefficients of the first to the i - 1-th transmission paths and less than or equal to the sum of the bandwidth coefficients of the first to the i-th transmission paths, allocating the s-th data block to the i-th transmission path, 0 < i ≤ Q, i is an integer.
9. The method according to claim 3, characterized in that: The total number of the threads is A, A is a positive integer; Allocating the plurality of data blocks to a plurality of threads in sequence according to the total number of the threads includes: For the s-th data block, calculating the remainder F of s divided by A, s is a positive integer, F ≥ 0 and F is an integer; When F = 0, allocating the s-th data block to the A-th thread; When F > 0, allocating the s-th data block to the F-th thread.
10. The method according to claim 3, characterized in that: The data volume of data that a single data transmission request is allowed to include is R, R > 0, Making each thread generate a plurality of data transmission requests corresponding to each data block according to the allocation order of the data blocks includes: When any thread is to generate multiple data transfer requests corresponding to a data block with a data volume of N and N is an integer multiple of R, it is determined that the data block corresponds to a total of N / R data transfer requests, and the data volume of the data included in each data transfer request is R; According to the starting storage address of the data block, the starting storage address of the data included in each data transfer request is determined, where the starting storage address of the data included in the j-th data transfer request is the sum of the starting storage address of the data block and (j - 1)×R, 1 ≤ j ≤ N / R, and j is an integer; Cause the thread to generate N / R data transfer requests corresponding to the data block.
11. The method according to claim 3, characterized in that The data volume of the data allowed to be included in a single data transfer request is R, R > 0, The causing each thread to generate multiple data transfer requests corresponding to each data block in the allocation order of the data blocks includes: When any thread is to generate multiple data transfer requests corresponding to a data block with a data volume of B and 0 < B < N, it is determined that the data block corresponds to a total of Y data transfer requests. The data volume of the data included in the 1st to the (Y - 1)th data transfer requests is equal to R, and the data volume of the data included in the Y-th data transfer request is less than or equal to R. Y is the result of rounding up B / R; According to the starting storage address of the data block, the starting storage address of the data included in each data transfer request is determined, where the starting storage address of the data included in the v-th data transfer request is the sum of the starting storage address of the data block and (v - 1)×R, 1 ≤ v ≤ Y, and v is an integer; Cause the thread to generate v data transfer requests corresponding to the data block.
12. A data transmission device, characterized in that: The device is applied to a first module, and there are multiple transmission paths between the first module and the second module. The device includes: A first determination module, configured to determine the bandwidth coefficient of each transmission path according to the bandwidths of the multiple transmission paths, and the proportional relationship of the bandwidth coefficients indicates the proportional relationship of the bandwidths of the transmission paths; A splitting module, configured to split the first data to be transmitted into multiple data blocks; A first allocation module, configured to sequentially allocate the multiple data blocks to the multiple transmission paths according to the bandwidth coefficients of each transmission path. Each transmission path is allocated at least one consecutive data block each time, and the number of data blocks allocated each time is the smaller one of the bandwidth coefficient of the transmission path and the number of unallocated data blocks; A first transmission module, configured to generate multiple data transfer requests corresponding to each data block for each data block. Each data transfer request includes a part of the corresponding data block, and outputs each data transfer request to the second module through the transmission path to which the data block corresponding to each data transfer request is allocated.
13. An electronic device, characterized in that: Includes: A processor; A memory for storing instructions executable by the processor; Wherein, the processor is configured to implement the method according to any one of claims 1 to 11 when executing the instructions stored in the memory.
14. A non-volatile computer-readable storage medium having computer program instructions stored thereon, characterized in that: The computer program instructions, when executed by the processor, implement the method according to any one of claims 1 to 11.