Data transmission optimization method, device and readable storage medium based on federated learning

By converting the data to be transmitted into a bitstream carrying the information of hardware device in the federated learning heterogeneous framework, and performing adaptive conversion on the receiving device, the problem of poor data transmission compatibility between different hardware devices in federated learning is solved, and the problem of improved Data transmission efficiency.

CN112948129BActive Publication Date: 2025-02-07CLUSTAR TECH LO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110343403.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-03-30
Publication Date
2025-02-07
Estimated Expiration
2041-03-30

AI Technical Summary

Technical Problem

In the federated learning heterogeneous framework, different types of hardware devices have poor compatibility when transmitting data, resulting in inefficient data transmission.

Method used

By obtaining the data to be transmitted and converting it into a bit stream to be transmitted carrying the information of the hardware device, it is sent to the receiving device. The receiving device converts data format based on the information of the sending device and its own hardware device to adapt to the target hardware device, and finally copies the data to the hardware acceleration device to perform calculation tasks.

Benefits of technology

The data transmission compatibility between different types of hardware devices in the federated learning heterogeneous framework is achieved, and data transmission efficiency and accuracy are improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112948129B_ABST
    Figure CN112948129B_ABST
Patent Text Reader

Abstract

The present application discloses a data transmission optimization method, device and readable storage medium based on federated learning, wherein the data transmission optimization method based on federated learning is applied to a first device, and the data transmission optimization method based on federated learning includes: obtaining data to be transmitted, and converting the data to be transmitted into a bit stream to be transmitted carrying information of a first hardware device; sending the bit stream to be transmitted to a second device, so that the second device can convert the bit stream to be transmitted into target format data adapted to the second hardware device information based on the data conversion method corresponding to the first hardware device information and the acquired second hardware device information, and copy it to the target device memory corresponding to the second hardware device information. The present application solves the technical problem of poor compatibility of different types of hardware devices in a federated learning heterogeneous framework when performing data transmission.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of communication technology, and in particular to a data transmission optimization method, device and readable storage medium based on federated learning. Background Art

[0002] With the continuous development of computer technology, the development of communication technology is also getting faster and faster. At present, when data is transmitted, the data is usually sent directly from the CPU device of the data sender to the CPU device of the data receiver to perform computing tasks. In the federated learning scenario, since the data is usually dense data with a very large data bit width, the computing power of the CPU device often cannot meet the requirements of federated learning. Therefore, each participant in federated learning usually has its own hardware acceleration solution, such as parallel acceleration computing solution based on GPU hardware and parallel acceleration computing solution based on FPGA hardware. Therefore, in the heterogeneous framework of federated learning, the compatibility of different types of hardware devices of each participant during data transmission is poor. Summary of the invention

[0003] The main purpose of this application is to provide a data transmission optimization method, device and readable storage medium based on federated learning, aiming to solve the technical problem of poor compatibility of different types of hardware devices during data transmission in a heterogeneous framework of federated learning in the prior art.

[0004] To achieve the above object, the present application provides a data transmission optimization method based on federated learning, the data transmission optimization method based on federated learning is applied to a first device, and the data transmission optimization method based on federated learning includes:

[0005] Acquire data to be transmitted, and convert the data to be transmitted into a bit stream to be transmitted carrying information of the first hardware device;

[0006] The bit stream to be transmitted is sent to the second device, so that the second device can convert the bit stream to be transmitted into target format data adapted to the second hardware device information based on the data conversion method corresponding to the first hardware device information and the acquired second hardware device information, and copy it to the target device memory corresponding to the second hardware device information.

[0007] To achieve the above object, the present application provides a data transmission optimization method based on federated learning, wherein the data transmission optimization method based on federated learning is applied to a second device, and the data transmission optimization method based on federated learning includes:

[0008] Receiving a bit stream to be transmitted sent by a first device, and performing a first deserialization on the bit stream to be transmitted to obtain first hardware device information and a bit stream to be converted;

[0009] Acquire second hardware device information, and based on the first hardware device information and the second hardware device information, convert the to-be-converted bit stream into target format data adapted to the second hardware device information;

[0010] The target format data is copied to the target hardware acceleration device corresponding to the second hardware device information to execute the computing task.

[0011] To achieve the above object, the present application provides a data transmission optimization method based on federated learning, the data transmission optimization method based on federated learning is applied to a first device, and the data transmission optimization method based on federated learning includes:

[0012] Receiving the second hardware device information sent by the second device, and acquiring the data to be transmitted and the first hardware device information;

[0013] Based on the first hardware device information and the second hardware device information, converting the data to be transmitted into a bit stream to be transmitted;

[0014] The bit stream to be transmitted is sent to the second device, so that the second device converts the bit stream to be transmitted into target format data adapted to the second hardware device information.

[0015] To achieve the above object, the present application provides a data transmission optimization method based on federated learning, wherein the data transmission optimization method based on federated learning is applied to a second device, and the data transmission optimization method based on federated learning includes:

[0016] Acquire second hardware device information, and send the second hardware device information to the first device, so that the first device converts the data to be transmitted into a bit stream to be transmitted that is adapted to the second hardware device information based on the first hardware device information and the second hardware device information corresponding to the data to be transmitted;

[0017] Receiving the bit stream to be transmitted, and converting the bit stream to be transmitted into target format data;

[0018] The target format data is copied to the target hardware acceleration device corresponding to the second hardware device information to execute the computing task.

[0019] The present application also provides a data transmission optimization device based on federated learning, wherein the data transmission optimization device based on federated learning is a virtual device, and the data transmission optimization device based on federated learning is applied to a first device, and the data transmission optimization device based on federated learning includes:

[0020] A conversion module, used for acquiring data to be transmitted, and converting the data to be transmitted into a bit stream to be transmitted carrying information of the first hardware device;

[0021] A sending module is used to send the bit stream to be transmitted to a second device, so that the second device can convert the bit stream to be transmitted into target format data adapted to the second hardware device information based on the data conversion method corresponding to the first hardware device information and the acquired second hardware device information, and copy it to the target device memory corresponding to the second hardware device information.

[0022] The present application also provides a data transmission optimization device based on federated learning, wherein the data transmission optimization device based on federated learning is a virtual device, and the data transmission optimization device based on federated learning is applied to a second device, and the data transmission optimization device based on federated learning includes:

[0023] A deserialization module, used for receiving a bit stream to be transmitted sent by a first device, and performing a first deserialization on the bit stream to be transmitted to obtain first hardware device information and a bit stream to be converted;

[0024] a conversion module, configured to obtain second hardware device information, and based on the first hardware device information and the second hardware device information, convert the bit stream to be converted into target format data adapted to the second hardware device information;

[0025] A memory copy module is used to copy the target format data to the target hardware acceleration device corresponding to the second hardware device information to perform a computing task.

[0026] The present application also provides a data transmission optimization device based on federated learning, wherein the data transmission optimization device based on federated learning is a virtual device, and the data transmission optimization device based on federated learning is applied to a first device, and the data transmission optimization device based on federated learning includes:

[0027] A receiving module, used to receive the second hardware device information sent by the second device, and obtain the data to be transmitted and the first hardware device information;

[0028] A conversion module, configured to convert the data to be transmitted into a bit stream to be transmitted based on the first hardware device information and the second hardware device information;

[0029] The sending module is used to send the bit stream to be transmitted to the second device, so that the second device converts the bit stream to be transmitted into target format data adapted to the second hardware device information.

[0030] The present application also provides a data transmission optimization device based on federated learning, wherein the data transmission optimization device based on federated learning is a virtual device, and the data transmission optimization device based on federated learning is applied to a second device, and the data transmission optimization device based on federated learning includes:

[0031] a sending module, configured to obtain second hardware device information, and send the second hardware device information to the first device, so that the first device converts the data to be transmitted into a bit stream to be transmitted that is adapted to the second hardware device information based on the first hardware device information and the second hardware device information corresponding to the data to be transmitted;

[0032] A conversion module, used for receiving the bit stream to be transmitted, and converting the bit stream to be transmitted into target format data;

[0033] A memory copy module is used to copy the target format data to the target hardware acceleration device corresponding to the second hardware device information to perform a computing task.

[0034] The present application also provides a data transmission optimization device based on federated learning, which is a physical device. The data transmission optimization device based on federated learning includes: a memory, a processor, and a program of the data transmission optimization method based on federated learning stored in the memory and executable on the processor. When the program of the data transmission optimization method based on federated learning is executed by the processor, the steps of the data transmission optimization method based on federated learning as described above can be implemented.

[0035] The present application also provides a readable storage medium, on which is stored a program for implementing a data transmission optimization method based on federated learning. When the program for the data transmission optimization method based on federated learning is executed by a processor, the steps of the data transmission optimization method based on federated learning as described above are implemented.

[0036] The present application also provides a computer program product, including a computer program, which, when executed by a processor, implements the steps of the above-mentioned data transmission optimization method based on federated learning.

[0037] The present application provides a method, device and readable storage medium for data transmission optimization based on federated learning. Compared with the technical means adopted in the prior art that the CPU device of the data sender directly sends the data to the CPU device of the data receiver to perform the computing task, the present application first obtains the data to be transmitted, and then converts the data to be transmitted into a bit stream to be transmitted carrying the first hardware device information, and then sends the bit stream to be transmitted to the second device. Since the bit stream to be transmitted carries the first hardware device information, the second device can convert the bit stream to be transmitted into a data conversion method suitable for the second hardware device based on the data conversion method corresponding to the first hardware device information and the acquired second hardware device information. The target format data of the information realizes that when data is transmitted, the data receiver makes an intelligent decision on how to convert the bit stream to be transmitted into the target format data corresponding to the second hardware device information according to the hardware device information of the data sender, and then the second device can directly copy the target format data to the hardware acceleration device corresponding to the second hardware device information to perform the computing task, thereby achieving the purpose of data transmission compatible with different types of hardware devices of each federation participant. Therefore, the technical defect of poor compatibility of different types of hardware devices of each participant during data transmission in the heterogeneous framework of federated learning is overcome, and the compatibility of different types of hardware devices during data transmission in the heterogeneous framework of federated learning is improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0039] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0040] Figure 1 This is a flow chart of the first embodiment of the data transmission optimization method based on federated learning of the present application;

[0041] Figure 2 This is a flow chart of the second embodiment of the data transmission optimization method based on federated learning of the present application;

[0042] Figure 3 This is a flow chart of a third embodiment of the data transmission optimization method based on federated learning of the present application;

[0043] Figure 4 This is a flow chart of a fourth embodiment of the data transmission optimization method based on federated learning of the present application;

[0044] Figure 5 A schematic diagram of communication interaction between a first device and a second device in the data transmission optimization method based on federated learning of the present application;

[0045] Figure 6 Schematic diagram of the device structure of the hardware operating environment involved in the data transmission optimization method based on federated learning in the embodiment of the present application.

[0046] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0047] It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0048] The present application embodiment provides a data transmission optimization method based on federated learning. In the first embodiment of the data transmission optimization method based on federated learning of the present application, the data transmission optimization method based on federated learning is applied to a first device, referring to Figure 1 , the data transmission optimization method based on federated learning includes:

[0049] Step S10, obtaining data to be transmitted, and converting the data to be transmitted into a bit stream to be transmitted carrying information of the first hardware device;

[0050] In this embodiment, it should be noted that the data transmission optimization method based on federated learning is applied to a federated learning heterogeneous framework, wherein each federated learning participant under the federated learning heterogeneous framework includes at least one of a CPU device, a GPU device and an FPGA device, wherein data is usually stored in a CPU device, and when the GPU device and the FPGA device perform parallel computing tasks, the data needs to be copied to the GPU video memory and the memory of the FPGA device by memory copying.

[0051] In the embodiment of the present application, the entire data transmission process is that the hardware acceleration device of the first device first generates data, and then copies the data to the CPU memory of the first device via the memory, and then sends the data from the CPU memory of the first device to the CPU memory of the second device, and then copies the data from the CPU memory of the second device to the device memory of the hardware acceleration device of the second device via the memory, thereby completing the data transmission process. For example, assuming that the hardware acceleration device of the first device is a GPU device and the hardware acceleration device of the second device is an FPGA device, the data transmission process can be represented as from the GPU video memory to the CPU memory of the first device, then from the CPU memory of the first device to the CPU memory of the second device, and finally from the CPU memory of the second device to the device memory of the FPGA device.

[0052] In addition, it should be noted that the data to be transmitted is data stored in the CPU memory waiting for data transmission, and the data to be transmitted is generated by the hardware device after executing a computing task, wherein the data format of the data to be transmitted generated by different types of hardware devices is usually different, wherein the data format includes a memory storage mode and a data address alignment mode, etc. For example, the memory storage mode of the data generated by the CPU device is usually a swap page memory mode, the memory storage mode of the data generated by the GPU device is usually a page locked memory mode, and the data address alignment model of the data generated by the FPGA device is usually a specific byte alignment mode, such as 4096 bytes, etc.

[0053] Acquire data to be transmitted, and convert the data to be transmitted into a bit stream to be transmitted carrying first hardware device information. Specifically, acquire data to be transmitted in a CPU memory, determine a data generating hardware device that generates the data to be transmitted, and use a device identifier corresponding to the data generating hardware device as first hardware device information, and then convert the first hardware device information into a first bit stream, convert the data to be transmitted into a second bit stream, and then concatenate the first bit stream and the second bit stream to obtain a bit stream to be transmitted carrying the first hardware device information. For example, assuming that the first bit stream corresponding to the first hardware device information is 0101, and the second bit stream corresponding to the data to be transmitted is 1010101010, then the bit stream to be transmitted is 01011010101010.

[0054] The step of converting the data to be transmitted into a bit stream to be transmitted carrying the first hardware device information includes:

[0055] Step S11, serializing the first hardware device information in a preset application layer to obtain first serialized data;

[0056] In this embodiment, it should be noted that the preset application layer is the upper layer of the CPU device whose language environment is the upper layer programming language, wherein the upper layer programming language includes Python language and Java language, etc. Relatively speaking, the underlying language environment of the CPU device is C language.

[0057] The first hardware device information is serialized in a preset application layer to obtain first serialized data. Specifically, the first hardware device information is serialized in an environment of an upper-layer programming language of the preset application layer to convert the first hardware device information into a bit stream to obtain first serialized data.

[0058] Step S12, performing a second serialization on the data to be transmitted to obtain second serialized data;

[0059] In this embodiment, the data to be transmitted is serialized for the second time to obtain second serialized data. Specifically, in a C language environment, the data to be transmitted is serialized for the second time to convert the data to be transmitted into a bit stream to obtain second serialized data.

[0060] Step S13: concatenate the first serialized data and the second serialized data to obtain the bit stream to be transmitted that carries the first hardware device information.

[0061] In this embodiment, it should be noted that the first serialization is a first bit stream corresponding to the first hardware device information, and the second serialization data is a second bit stream corresponding to the data to be transmitted.

[0062] The first serialized data and the second serialized data are spliced ​​to obtain the bit stream to be transmitted that carries the first hardware device information. Specifically, the first bit stream and the second bit stream are spliced ​​to obtain the bit stream to be transmitted that carries the first hardware device information.

[0063] Step S20, sending the bit stream to be transmitted to the second device, so that the second device can convert the bit stream to be transmitted into target format data adapted to the second hardware device information based on the data conversion method corresponding to the first hardware device information and the acquired second hardware device information, and copy it to the target device memory corresponding to the second hardware device information.

[0064] In this embodiment, it should be noted that the first device and the second device are devices that need to perform data transmission in federated learning. The first device and the second device can be either participants in federated learning or coordinators of federated learning. The data conversion method is a data format conversion method jointly determined based on the first hardware device information and the second hardware device information, and is used to convert the bit stream corresponding to the data format adapted to the first hardware device information into data adapted to the data format adapted to the second hardware device information, for example, converting the bit stream corresponding to the data format adapted to the CPU into data adapted to the data format adapted to the GPU, and converting the bit stream corresponding to the data format adapted to the CPU into data adapted to the data format adapted to the FPGA, etc.

[0065] The bit stream to be transmitted is sent to the second device, so that the second device, based on the data conversion method corresponding to the first hardware device information and the acquired second hardware device information, converts the bit stream to be transmitted into target format data adapted to the second hardware device information, and copies it to the target device memory corresponding to the second hardware device information. Specifically, the bit stream to be transmitted is transmitted to the CPU memory of the second device, and then the second device first deserializes the bit stream to be transmitted in the upper-level programming language environment to obtain the first hardware device information and the second bit stream, and then the second device obtains the second hardware device information, wherein the second hardware device information is the second The target hardware acceleration device that performs the computing task in the device is matched with the target deserialization function corresponding to the first hardware device information and the second hardware device information, and then the second bit stream is converted into target format data that is adapted to the data format of the target hardware acceleration device corresponding to the second hardware device information by calling the target deserialization function, so as to speed up the speed of copying the target format data from the CPU memory to the device memory of the target hardware acceleration device, and then the target format data is copied from the CPU memory to the device memory corresponding to the target hardware acceleration device to perform the computing task, wherein it should be noted that the deserialization function is a function with deserialization capability and data format conversion capability, which is used to convert the bit stream into data in a specific data format, and different combinations of the first hardware device information and the second hardware device information correspond to different types of deserialization functions. For example, assuming that the first hardware device information is the device identification of the CPU device and the second hardware device information is the device identification of the GPU device, the device identification of the CPU device and the device identification of the GPU device correspond to the data format conversion capability of the first type of deserialization function, which is to convert the memory storage mode of the data from the swap page memory mode to the page locked memory mode, wherein it should be noted that if the memory storage mode is the swap page memory mode, 2 It takes two memory copies to copy the data from the CPU memory to the GPU video memory. If the memory storage mode is the page-locked memory mode, only one memory copy is needed to copy the data from the CPU memory to the GPU video memory. If the first hardware device information is the device identifier of the CPU device, and the second hardware device information is the device identifier of the FPGA device, then the device identifier of the CPU device and the device identifier of the FPGA device correspond to each other. The data format conversion capability of the second type of deserialization function is to change the data address alignment mode of the data from 8 bytes or 16 bytes to a specific number of bytes, such as 4096 bytes, so as to speed up the speed of copying data from the CPU device to the FPGA device.

[0066] In addition, it should be noted that the data optimization method in the embodiment of the present application is compatible with data transmission between different types of hardware devices of multiple parties. The data receiving party can determine the deserialization function information based on the hardware device information, and then intelligently select the corresponding target deserialization function based on the deserialization function information, thereby achieving the purpose of intelligent decision-making to select the corresponding deserialization function, and then based on the target deserialization function, the bit stream sent by the data sender can be deserialized into target format data that is adapted to the data format of the target hardware acceleration device of the data receiving party, thereby achieving the purpose of directly converting the bit stream sent by the first device into data in the data format adapted to the target hardware acceleration device while deserializing, thereby speeding up the speed of copying data from the CPU to the device memory of the target hardware acceleration device.

[0067] The embodiment of the present application provides a method for optimizing data transmission based on federated learning. Compared with the technical means adopted in the prior art in which the CPU device of the data sender directly sends the data to the CPU device of the data receiver to perform computing tasks, the embodiment of the present application first obtains the data to be transmitted, and then converts the data to be transmitted into a bit stream to be transmitted carrying the first hardware device information, and then sends the bit stream to be transmitted to the second device. Since the bit stream to be transmitted carries the first hardware device information, the second device can convert the bit stream to be transmitted into a bit stream that is suitable for the second hardware device information based on the data conversion method corresponding to the first hardware device information and the acquired second hardware device information. The target format data is realized, and when data is transmitted, the data receiving party makes an intelligent decision on how to convert the bit stream to be transmitted into the target format data corresponding to the second hardware device information according to the hardware device information of the data sender, and then the second device can directly copy the target format data to the hardware acceleration device corresponding to the second hardware device information to perform the computing task, thereby achieving the purpose of being compatible with different types of hardware devices of each federation participant for data transmission. Therefore, the technical defect of poor compatibility of different types of hardware devices of each participant for data transmission in the heterogeneous framework of federated learning is overcome, and the compatibility of different types of hardware devices for data transmission in the heterogeneous framework of federated learning is improved.

[0068] Based on the first embodiment of this application, refer to Figure 2 In another embodiment of the data transmission optimization method based on federated learning of the present application, the data transmission optimization method based on federated learning is applied to a second device, and the data transmission optimization method based on federated learning includes:

[0069] Step A10, receiving a bit stream to be transmitted sent by a first device, and performing a first deserialization on the bit stream to be transmitted to obtain first hardware device information and a bit stream to be converted;

[0070] In this embodiment, it should be noted that the bit stream to be transmitted is a concatenation of a first bit stream corresponding to the first hardware device information and a second bit stream corresponding to the data to be transmitted, wherein the first bit stream is generated by serializing the first hardware device information in an upper-level programming language environment, and the second bit stream is generated by serializing the data to be transmitted in a C language environment, wherein the process of generating the bit stream to be transmitted in the first device can be specifically referred to steps S11 to S13, which will not be repeated here.

[0071] A bit stream to be transmitted sent by a first device is received, and the bit stream to be transmitted is deserialized for the first time to obtain first hardware device information and a bit stream to be converted. Specifically, a bit stream to be transmitted sent by a first device is received, and the bit stream to be transmitted is deserialized for the first time in an upper-level programming language environment to obtain first hardware device information and a bit stream to be converted, wherein the bit stream to be converted is the second bit stream, and since the first bit stream is generated by serializing the first hardware device information in an upper-level programming language environment, and the second bit stream is generated by serializing the data to be transmitted in a C language environment, and then deserialized in an upper-level programming language environment, a part of the first bit stream of the bit stream to be transmitted is converted into data, namely the first hardware device information, and the second bit stream cannot be converted into data.

[0072] Step A20, obtaining second hardware device information, and based on the first hardware device information and the second hardware device information, converting the to-be-converted bit stream into target format data adapted to the second hardware device information;

[0073] In this embodiment, the second hardware device information is obtained, and based on the first hardware device information and the second hardware device information, the bit stream to be converted is converted into target format data adapted to the second hardware device information. Specifically, the second hardware device information is obtained, wherein the second hardware device information is a device identifier of a target hardware acceleration device that performs a computing task in the second device, and then a target deserialization function corresponding to the first hardware device information and the second hardware device information is matched, and then by calling the target deserialization function, the bit stream to be converted is converted into target format data adapted to the data format of the target hardware acceleration device corresponding to the second hardware device information, so as to speed up the speed of copying the target format data from the CPU memory to the device memory of the target hardware acceleration device, and then the target format data is copied from the CPU memory to the device memory corresponding to the target hardware acceleration device to perform the computing task.

[0074] The step of converting the to-be-converted bit stream into target format data adapted to the second hardware device information based on the first hardware device information and the second hardware device information comprises:

[0075] Step A21, determining deserialization function information based on the first hardware device information and the second hardware device information;

[0076] In this embodiment, the deserialization function information is determined based on the first hardware device information and the second hardware device information. Specifically, the first hardware device information and the second hardware device information are concatenated to obtain the deserialization function information. For example, assuming that the first hardware device information is a and the second hardware device information is b, the deserialization function information is (a, b).

[0077] Step A22, performing a second deserialization on the bit stream to be converted by calling the target deserialization function corresponding to the deserialization function information to obtain the target format data.

[0078] In this embodiment, the target deserialization function corresponding to the deserialization function information is called to perform a second deserialization on the bit stream to be converted to obtain the target format data. Specifically, based on the deserialization function information, an intelligent decision is made to call the corresponding target deserialization function. For example, the deserialization function information is used as an index, and the target deserialization function corresponding to the deserialization function information is queried to intelligently call the target deserialization function, etc., and then according to the target deserialization function, the bit stream to be converted is deserialized for a second time to convert the bit stream to be converted into data in a data format suitable for the target hardware acceleration device corresponding to the second hardware device information to obtain the target format data. It should be noted that the data formats of the data converted by different types of deserialization functions are different. For details, please refer to the specific content in step S20, which will not be repeated here.

[0079] Step A30: copy the target format data to the target hardware acceleration device corresponding to the second hardware device information to execute the computing task.

[0080] In this embodiment, it should be noted that the target hardware acceleration device includes a GPU device and an FPGA device, and because the data format of the target format data is adapted to the target hardware acceleration device, the speed of the memory copy can be improved when performing memory copy. For example, when the target hardware acceleration device is a GPU device, the memory storage mode of the target format data is a page-locked memory mode. Compared with the swap page memory mode adapted to the data format of the CPU device, the memory copy efficiency from the CPU memory to the GPU video memory is higher. When the target hardware acceleration device is an FPGA device, the data address alignment mode of the target format data is a specific byte number alignment, such as 4096 bytes. Compared with the 8-byte or 16-byte alignment of the data format adapted to the CPU device, the target format data can be directly copied to the memory of the FPGA device at a faster speed, thereby improving the efficiency of the memory copy.

[0081] In addition, it should be noted that since the target format data is directly generated through deserialization, the purpose of indirectly converting the data format of the data to be transmitted during deserialization is achieved, without increasing other calculation amounts, reducing the data conversion process, and thus improving the efficiency of data transmission. For example, when the target hardware acceleration device is a GPU device, the data is directly deserialized into a page-locked memory mode during deserialization. When the target hardware acceleration device is an FPGA device, the data generated by deserialization is directly deserialized into a target format data aligned with a 4096-byte data address, etc. There is no need to add other data calculations or memory copy processes, thereby improving the efficiency of data transmission.

[0082] The embodiment of the present application provides a data transmission optimization method based on federated learning, that is, receiving a bit stream to be transmitted sent by a first device, and performing a first deserialization on the bit stream to be transmitted, obtaining first hardware device information and the bit stream to be converted, and then obtaining second hardware device information, and based on the first hardware device information and the second hardware device information, converting the bit stream to be converted into target format data adapted to the second hardware device information, and then copying the target format data to a target hardware acceleration device corresponding to the second hardware device information to perform a computing task, thereby achieving data transmission compatible with different types of hardware devices at each communication site, while enabling the data recipient to intelligently decide to select a target deserialization function, and then according to the target deserialization function, converting the bit stream to be transmitted into target format data adapted to the target hardware acceleration device of the data recipient, so that the target format data can be copied from the CPU memory to the memory of the target hardware acceleration device with higher efficiency, thereby improving the data copying efficiency, and thereby improving the data transmission efficiency.

[0083] Based on the first and second embodiments of the present application, refer to Figure 3In another embodiment of the data transmission optimization method based on federated learning of the present application, the data transmission optimization method based on federated learning is applied to a first device, and the data transmission optimization method based on federated learning includes:

[0084] Step B10, receiving the second hardware device information sent by the second device, and obtaining the data to be transmitted and the first hardware device information;

[0085] In this embodiment, second hardware device information sent by the second device is received, and the data to be transmitted and the first hardware device information are obtained. Specifically, a hardware device information acquisition request is sent to the second device, and the second hardware device information sent by the second device in response to the hardware device information acquisition request is received, and the data to be transmitted and the first hardware device information corresponding to the data to be transmitted are obtained, wherein the data to be transmitted is stored in the CPU memory, the first hardware device information is the device identifier of the hardware device that generates the data to be transmitted in the first device, and the second hardware device information is the identifier of the hardware device in the second device for performing computing tasks related to the data to be transmitted.

[0086] Step B20, based on the first hardware device information and the second hardware device information, converting the data to be transmitted into a bit stream to be transmitted;

[0087] In this embodiment, based on the first hardware device information and the second hardware device information, the data to be transmitted is converted into a bit stream to be transmitted. Specifically, it is determined whether the first hardware device information and the second hardware device information are consistent. If they are consistent, the data to be transmitted is directly converted into a bit stream to be transmitted. If they are inconsistent, the data format of the data to be transmitted is converted into a data format adapted to the target hardware acceleration device corresponding to the second hardware device information to obtain target format data, and then the target format data is converted into a bit stream to be transmitted.

[0088] The step of converting the data to be transmitted into a bit stream to be transmitted based on the first hardware device information and the second hardware device information comprises:

[0089] Step B21, determining whether the first hardware device information and the second hardware device information are consistent;

[0090] Step B22: if they are consistent, serializing the data to be transmitted into the bit stream to be transmitted;

[0091] In this embodiment, specifically, it is determined whether the first hardware device information and the second hardware device information are consistent. If they are consistent, the data to be transmitted is serialized to obtain a bit stream to be transmitted.

[0092] Step B23: if they are inconsistent, converting the data format of the data to be transmitted into a target data format adapted to the second hardware device information to obtain target format data;

[0093] In this embodiment, it should be noted that the data format includes a memory storage mode and a data address alignment mode.

[0094] If there is inconsistency, the data format of the data to be transmitted is converted into a target data format adapted to the second hardware device information to obtain target format data. Specifically, if there is inconsistency, the memory storage mode of the data to be transmitted is adjusted to a memory storage mode adapted to the target hardware device corresponding to the second hardware device information; and / or the data address alignment mode of the data to be transmitted is adjusted to a data address alignment mode adapted to the target hardware device corresponding to the second hardware device information, thereby obtaining the target format data.

[0095] The step of converting the data format of the data to be transmitted into a target data format adapted to the second hardware device information to obtain the target format data comprises:

[0096] Step B231, if the second hardware device information is GPU device information, converting the data format of the data to be transmitted from the swap page memory mode to the page locked memory mode to obtain the target format data;

[0097] In this embodiment, if the second hardware device information is GPU device information, the data format of the data to be transmitted is converted from the swap page memory mode to the page locked memory mode to obtain the target format data. Specifically, if the second hardware device information is GPU device information, the memory storage mode of the data to be transmitted is converted from the swap page memory mode to the page locked memory mode to obtain the target format data. It should be noted that since the first hardware device information is not GPU device information, the memory storage mode of the data to be transmitted is usually the swap page memory mode, and the data in the swap page memory mode requires two memory copies to copy the data from the CPU memory to the GPU video memory, while the data in the page locked memory mode only requires one memory copy to copy the data from the CPU memory to the GPU video memory, thereby improving the memory copy speed from the CPU memory to the GPU video memory, thereby improving the efficiency of data transmission from non-GPU devices to GPU devices.

[0098] Step B232: If the second hardware device information is FPGA device information, the data format of the data to be transmitted is converted from the current data address alignment mode to the preset target data address alignment mode to obtain the target format data.

[0099] In this embodiment, if the second hardware device information is FPGA device information, the data format of the data to be transmitted is converted from the current data address alignment mode to the preset target data address alignment mode to obtain the target format data. Specifically, if the second hardware device information is FPGA device information, the current data address alignment mode of the data to be transmitted is converted into the preset target data address alignment mode of the FPGA device corresponding to the FPGA device information to improve the efficiency of copying data from the CPU memory to the device memory of the FPGA device, and obtain the target format data, for example, from 8-byte or 16-byte alignment to 4096-byte alignment, etc.

[0100] Step B24: serialize the target format data into the bit stream to be transmitted.

[0101] In this embodiment, the target format data is serialized into the bit stream to be transmitted. Specifically, the target format data is serialized to convert the target format data into a bit stream to obtain the bit stream to be transmitted.

[0102] Step B30: sending the bit stream to be transmitted to the second device, so that the second device converts the bit stream to be transmitted into target format data adapted to the second hardware device information.

[0103] In this embodiment, the bit stream to be transmitted is sent to the second device so that the second device converts the bit stream to be transmitted into target format data adapted to the second hardware device information. Specifically, the bit stream to be transmitted is sent to the second device, and then the second device deserializes the bit stream to be transmitted to convert the bit stream to be transmitted into data stored in the CPU memory to obtain the target format data, wherein, since the target format data is obtained by the first device by performing data format conversion on the data to be transmitted based on the first hardware device information and the second hardware device information, the target format data is adapted to the target hardware acceleration device corresponding to the second hardware device information in the second device, and the target format data can be directly copied from the CPU memory to the device memory of the target hardware acceleration device, thereby achieving the purpose of data transmission between different types of hardware devices compatible with each communication site.

[0104] An embodiment of the present application provides a data transmission method. Compared with the technical means adopted in the prior art in which the CPU device of the data sender directly sends the data to the CPU device of the data receiver to perform a computing task, the embodiment of the present application receives the second hardware device information sent by the second device, and obtains the data to be transmitted and the first hardware device information, and then converts the data to be transmitted into a bit stream to be transmitted based on the first hardware device information and the second hardware device information, and then sends the bit stream to be transmitted to the second device, so that the second device can convert the bit stream to be transmitted into target format data adapted to the second hardware device information, and then the second device can directly copy the target format data to the hardware acceleration device corresponding to the second hardware device information to perform the computing task, thereby achieving the purpose of compatible data transmission of different types of hardware devices of each federation participant. Therefore, the technical defect of poor compatibility of different types of hardware devices of each participant in the federated learning heterogeneous framework when performing data transmission is overcome, and the compatibility of different types of hardware devices in the federated learning heterogeneous framework when performing data transmission is improved.

[0105] Based on the first embodiment, the second embodiment and the third embodiment of the present application, refer to Figure 4 In another embodiment of the data transmission optimization method based on federated learning of the present application, the data transmission optimization method based on federated learning is applied to a second device, and the data transmission optimization method based on federated learning includes:

[0106] Step C10, obtaining second hardware device information, and sending the second hardware device information to the first device, so that the first device converts the data to be transmitted into a bit stream to be transmitted that is adapted to the second hardware device information based on the first hardware device information and the second hardware device information corresponding to the data to be transmitted;

[0107] In this embodiment, specifically, the second hardware device information is obtained and sent to the first device, so that the first device can convert the data format of the data to be transmitted into target format data adapted to the second hardware device information based on the first hardware device information and the second hardware device information corresponding to the data to be transmitted, and then the first device serializes the target format data into a bit stream to be transmitted, wherein the specific steps for the first device to generate the bit stream to be transmitted can refer to the specific contents of steps B10 to B30, which will not be repeated here.

[0108] Step C20, receiving the bit stream to be transmitted, and converting the bit stream to be transmitted into target format data;

[0109] In this embodiment, the bit stream to be transmitted is received, and the bit stream to be transmitted is converted into target format data. Specifically, the bit stream to be transmitted is received, and the bit stream to be transmitted is deserialized to obtain the target format data.

[0110] Step C30: copy the target format data to the target hardware acceleration device corresponding to the second hardware device information to execute the computing task.

[0111] In this embodiment, the target format data is copied to the target hardware acceleration device corresponding to the second hardware device information to execute the computing task. Specifically, the target format data is copied from the CPU memory to the device memory of the target hardware acceleration device corresponding to the second hardware device information to execute the computing task.

[0112] In addition, it should be noted that the original data transmission scheme in which the data is directly sent from the CPU device of the data sender to the CPU device of the data receiver to perform computing tasks does not need to consider the problem of data format conversion. In the embodiment of the present application, the first device can convert the data format of the transmitted data in a targeted manner by pre-acquiring the second hardware device information and the first hardware device information, thereby eliminating the incompatibility between different hardware devices and solving the problem of incompatibility or poor compatibility.

[0113] like Figure 5 The figure shows a schematic diagram of the communication interaction between the first device and the second device in an embodiment of the present application, wherein the data sending site is the first device, the data receiving site is the second device, the hardware acceleration device information is the second hardware device information, the data conversion is the process of converting the data format, and the byte stream is the bit stream to be transmitted.

[0114] An embodiment of the present application provides a data transmission optimization method based on federated learning, that is, first obtaining second hardware device information, and sending the second hardware device information to the first device, so that the first device converts the data to be transmitted into a bit stream to be transmitted that is adapted to the second hardware device information based on the first hardware device information and the second hardware device information corresponding to the data to be transmitted, and then receives the bit stream to be transmitted, and converts the bit stream to be transmitted into target format data, and then copies the target format data to the target hardware acceleration device corresponding to the second hardware device information to perform a computing task, thereby achieving the purpose of data transmission compatible with different types of hardware devices of each communication site, avoiding incompatibility when different types of hardware devices perform data transmission, and thus improving the compatibility of different types of hardware devices in the federated learning heterogeneous framework when performing data transmission.

[0115] Reference Figure 6 , Figure 6It is a schematic diagram of the device structure of the hardware operating environment involved in the embodiment of the present application.

[0116] like Figure 6 As shown, the data transmission optimization device based on federated learning may include: a processor 1001, such as a CPU, a memory 1005, and a communication bus 1002. The communication bus 1002 is used to realize the connection and communication between the processor 1001 and the memory 1005. The memory 1005 may be a high-speed RAM memory or a stable memory (non-volatile memory), such as a disk memory. The memory 1005 may optionally be a storage device independent of the aforementioned processor 1001.

[0117] Optionally, the data transmission optimization device based on federated learning may also include a rectangular user interface, a network interface, a camera, an RF (Radio Frequency) circuit, a sensor, an audio circuit, a WiFi module, etc. The rectangular user interface may include a display screen (Display), an input submodule such as a keyboard (Keyboard), and the optional rectangular user interface may also include a standard wired interface and a wireless interface. The network interface may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface).

[0118] Those skilled in the art will understand that Figure 6 The structure of the data transmission optimization device based on federated learning shown in the figure does not constitute a limitation of the data transmission optimization device based on federated learning, and may include more or fewer components than shown in the figure, or a combination of certain components, or a different arrangement of components.

[0119] like Figure 6 As shown, the memory 1005 as a computer storage medium may include an operating system, a network communication module, and a data transmission optimization program based on federated learning. The operating system is a program that manages and controls the hardware and software resources of the data transmission optimization device based on federated learning, and supports the operation of the data transmission optimization program based on federated learning and other software and / or programs. The network communication module is used to realize the communication between the components inside the memory 1005, and the communication with other hardware and software in the data transmission optimization system based on federated learning.

[0120] exist Figure 6 In the data transmission optimization device based on federated learning shown, the processor 1001 is used to execute the data transmission optimization program based on federated learning stored in the memory 1005 to implement the steps of any of the above-mentioned data transmission optimization methods based on federated learning.

[0121] The specific implementation of the data transmission optimization device based on federated learning in the present application is basically the same as the various embodiments of the data transmission optimization method based on federated learning mentioned above, and will not be repeated here.

[0122] The embodiment of the present application further provides a data transmission optimization device based on federated learning, wherein the data transmission optimization device based on federated learning is applied to a first device, and the data transmission optimization device based on federated learning includes:

[0123] A conversion module, used for acquiring data to be transmitted, and converting the data to be transmitted into a bit stream to be transmitted carrying information of the first hardware device;

[0124] A sending module is used to send the bit stream to be transmitted to a second device, so that the second device can convert the bit stream to be transmitted into target format data adapted to the second hardware device information based on the data conversion method corresponding to the first hardware device information and the acquired second hardware device information, and copy it to the target device memory corresponding to the second hardware device information.

[0125] Optionally, the conversion module is further used for:

[0126] Serializing the first hardware device information in a preset application layer to obtain first serialized data;

[0127] Performing a second serialization on the data to be transmitted to obtain second serialized data;

[0128] The first serialized data and the second serialized data are concatenated to obtain the bit stream to be transmitted that carries the first hardware device information.

[0129] The specific implementation of the data transmission optimization device based on federated learning in the present application is basically the same as the various embodiments of the data transmission optimization method based on federated learning mentioned above, and will not be repeated here.

[0130] The embodiment of the present application further provides a data transmission optimization device based on federated learning, wherein the data transmission optimization device based on federated learning is applied to a second device, and the data transmission optimization device based on federated learning includes:

[0131] A deserialization module, used for receiving a bit stream to be transmitted sent by a first device, and performing a first deserialization on the bit stream to be transmitted to obtain first hardware device information and a bit stream to be converted;

[0132] a conversion module, configured to obtain second hardware device information, and based on the first hardware device information and the second hardware device information, convert the bit stream to be converted into target format data adapted to the second hardware device information;

[0133] A memory copy module is used to copy the target format data to the target hardware acceleration device corresponding to the second hardware device information to perform a computing task.

[0134] Optionally, the conversion module is further used for:

[0135] Determine deserialization function information based on the first hardware device information and the second hardware device information;

[0136] The target format data is obtained by calling the target deserialization function corresponding to the deserialization function information to perform a second deserialization on the bit stream to be converted.

[0137] The specific implementation of the data transmission optimization device based on federated learning in the present application is basically the same as the various embodiments of the data transmission optimization method based on federated learning mentioned above, and will not be repeated here.

[0138] The embodiment of the present application further provides a data transmission optimization device based on federated learning, wherein the data transmission optimization device based on federated learning is applied to a first device, and the data transmission optimization device based on federated learning includes:

[0139] A receiving module, used to receive the second hardware device information sent by the second device, and obtain the data to be transmitted and the first hardware device information;

[0140] A conversion module, configured to convert the data to be transmitted into a bit stream to be transmitted based on the first hardware device information and the second hardware device information;

[0141] The sending module is used to send the bit stream to be transmitted to the second device, so that the second device converts the bit stream to be transmitted into target format data adapted to the second hardware device information.

[0142] Optionally, the conversion module is further used for:

[0143] Determining whether the first hardware device information and the second hardware device information are consistent;

[0144] If they are consistent, serializing the data to be transmitted into the bit stream to be transmitted;

[0145] If they are inconsistent, converting the data format of the data to be transmitted into a target data format adapted to the second hardware device information to obtain target format data;

[0146] The target format data is serialized into the bit stream to be transmitted.

[0147] Optionally, the conversion module is further used for:

[0148] If the second hardware device information is GPU device information, converting the data format of the data to be transmitted from the swap page memory mode to the page locked memory mode to obtain the target format data;

[0149] If the second hardware device information is FPGA device information, the data format of the data to be transmitted is converted from the current data address alignment mode to a preset target data address alignment mode to obtain the target format data.

[0150] The specific implementation of the data transmission optimization device based on federated learning in the present application is basically the same as the various embodiments of the data transmission optimization method based on federated learning mentioned above, and will not be repeated here.

[0151] The embodiment of the present application further provides a data transmission optimization device based on federated learning, wherein the data transmission optimization device based on federated learning is applied to a second device, and the data transmission optimization device based on federated learning includes:

[0152] a sending module, configured to obtain second hardware device information, and send the second hardware device information to the first device, so that the first device converts the data to be transmitted into a bit stream to be transmitted that is adapted to the second hardware device information based on the first hardware device information and the second hardware device information corresponding to the data to be transmitted;

[0153] A conversion module, used for receiving the bit stream to be transmitted, and converting the bit stream to be transmitted into target format data;

[0154] A memory copy module is used to copy the target format data to the target hardware acceleration device corresponding to the second hardware device information to perform a computing task.

[0155] The specific implementation of the data transmission optimization device based on federated learning in the present application is basically the same as the various embodiments of the data transmission optimization method based on federated learning mentioned above, and will not be repeated here.

[0156] An embodiment of the present application provides a readable storage medium, and the readable storage medium stores one or more programs, and the one or more programs can also be executed by one or more processors to implement the steps of any of the above-mentioned federated learning-based data transmission optimization methods.

[0157] The specific implementation methods of the readable storage medium of the present application are basically the same as the above-mentioned embodiments of the data transmission optimization method based on federated learning, and will not be repeated here.

[0158] An embodiment of the present application provides a computer program product, and the computer program product includes one or more computer programs, and the one or more computer programs can also be executed by one or more processors to implement the steps of any of the above-mentioned federated learning-based data transmission optimization methods.

[0159] The specific implementation methods of the computer program product of the present application are basically the same as the embodiments of the above-mentioned data transmission optimization method based on federated learning, and will not be repeated here.

[0160] The above are only preferred embodiments of the present application, and are not intended to limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent processing scope of the present application.

Claims

1. A data transmission optimization method based on federated learning, characterized in that: The data transmission optimization method based on federated learning is applied to a first device, and the data transmission optimization method based on federated learning includes: Acquire data to be transmitted, and convert the data to be transmitted into a bit stream to be transmitted carrying first hardware device information, wherein the first hardware device information is a device identifier corresponding to a data generating hardware device, and the data generating hardware device is a hardware acceleration device of the first device; Sending the bit stream to be transmitted to the second device, so that the second device converts the bit stream to be transmitted into target format data adapted to the second hardware device information based on the data conversion method corresponding to the first hardware device information and the acquired second hardware device information, and copies the data to the target device memory corresponding to the second hardware device information; The step of converting the data to be transmitted into a bit stream to be transmitted carrying the first hardware device information comprises: In an environment of an upper-layer programming language of a preset application layer, serializing the first hardware device information to obtain first serialized data; In a C language environment, serializing the data to be transmitted for a second time to obtain second serialized data; The first serialized data and the second serialized data are concatenated to obtain the bit stream to be transmitted that carries the first hardware device information.

2. A data transmission optimization method based on federated learning, characterized in that: The data transmission optimization method based on federated learning is applied to the second device, and the data transmission optimization method based on federated learning includes: Receiving a bit stream to be transmitted sent by a first device, and performing a first deserialization on the bit stream to be transmitted to obtain first hardware device information and a bit stream to be converted; Acquire second hardware device information, and based on the first hardware device information and the second hardware device information, convert the to-be-converted bit stream into target format data adapted to the second hardware device information; Copying the target format data to the target hardware acceleration device corresponding to the second hardware device information to execute the computing task; The step of converting the to-be-converted bit stream into target format data adapted to the second hardware device information based on the first hardware device information and the second hardware device information comprises: Determine deserialization function information based on the first hardware device information and the second hardware device information; The target format data is obtained by calling the target deserialization function corresponding to the deserialization function information to perform a second deserialization on the bit stream to be converted.

3. A data transmission optimization method based on federated learning, characterized in that: The data transmission optimization method based on federated learning is applied to a first device, and the data transmission optimization method based on federated learning includes: Receiving the second hardware device information sent by the second device, and acquiring the data to be transmitted and the first hardware device information; Based on the first hardware device information and the second hardware device information, converting the data to be transmitted into a bit stream to be transmitted; Sending the bit stream to be transmitted to the second device, so that the second device converts the bit stream to be transmitted into target format data adapted to the second hardware device information; The step of converting the data to be transmitted into a bit stream to be transmitted based on the first hardware device information and the second hardware device information comprises: Determining whether the first hardware device information and the second hardware device information are consistent; If they are consistent, serializing the data to be transmitted into the bit stream to be transmitted; If they are inconsistent, converting the data format of the data to be transmitted into a target data format adapted to the second hardware device information to obtain target format data; The target format data is serialized into the bit stream to be transmitted.

4. The data transmission optimization method based on federated learning as claimed in claim 3, characterized in that: The step of converting the data format of the data to be transmitted into a target data format adapted to the second hardware device information to obtain the target format data comprises: If the second hardware device information is GPU device information, converting the data format of the data to be transmitted from the swap page memory mode to the page locked memory mode to obtain the target format data; If the second hardware device information is FPGA device information, the data format of the data to be transmitted is converted from the current data address alignment mode to a preset target data address alignment mode to obtain the target format data.

5. A data transmission optimization device based on federated learning, characterized in that: The data transmission optimization device based on federated learning includes: a memory, a processor, and a program stored in the memory for implementing the data transmission optimization method based on federated learning. The memory is used to store a program for implementing a data transmission optimization method based on federated learning; The processor is used to execute a program for implementing the data transmission optimization method based on federated learning, so as to implement the steps of the data transmission optimization method based on federated learning as described in any one of claims 1 or 2 or 3 to 4.

6. A readable storage medium, characterized in that: The readable storage medium stores a program for implementing a data transmission optimization method based on federated learning, and the program for implementing a data transmission optimization method based on federated learning is executed by a processor to implement the steps of the data transmission optimization method based on federated learning as described in any one of claims 1 or 2 or 3 to 4.

Citation Information

Patent Citations

  • Methods for serialization and de-serialization, device and system

    CN102193787A

  • Data processing method, interface conversion structure and equipment

    CN110532208A