Real machine assembly line quantum circuit parallel execution method and related device

By dividing the quantum circuit and executing it in parallel on multiple real machines, and combining the parameter drift method for gradient calculation, the problem of slow running speed of a single real machine is solved, and the computing efficiency and resource utilization are improved.

CN118586509APending Publication Date: 2024-09-03ORIGIN QUANTUM COMPUTING TECH (HEFEI) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410728257.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-06
Publication Date
2024-09-03

AI Technical Summary

Technical Problem

When training large-scale quantum neural network models, a single real machine runs slowly and is difficult to effectively handle complex computing tasks, resulting in limitations in computing power and resource utilization.

Method used

By dividing the quantum circuit into multiple independent quantum circuit modules and sending them to multiple real machines for execution, the parameter drift method is used for gradient calculation, so that the execution timing of the current quantum circuit module is earlier than or equal to the previous quantum circuit The gradient calculation timing of the module enables parallel execution of the real machine pipeline.

Benefits of technology

It reduces the memory burden of a single real machine, increases the fault tolerance and scalability of the system, improves the efficiency of the parameter optimization process, and improves the execution speed of quantum circuits and the computing efficiency of real machines.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118586509A
    Figure CN118586509A
Patent Text Reader

Abstract

The invention discloses a real machine assembly line quantum circuit parallel execution method and a related device. The method comprises the following steps: segmenting a quantum circuit into a plurality of mutually independent quantum circuit modules according to a logic gate execution time sequence; a plurality of mutually independent quantum circuit modules are sent to a plurality of different real machines, so that each real machine executes the quantum circuit module according to the input data and calculates the gradient of the quantum circuit module according to a parameter drift method, and the execution time sequence of the current quantum circuit module is earlier than or equal to the gradient calculation time sequence of the previous quantum circuit module. According to the method, the quantum circuit is subjected to module splitting, so that the assembly lines on a plurality of different real machines are parallel, the execution burden of a single real machine is relieved, and the execution speed of the quantum circuit is increased.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of quantum computing technology, and in particular, relates to a real machine pipeline quantum circuit parallel execution method and related devices. Background Art

[0002] In the training process of traditional deep neural network models, training large-scale network models can achieve better results in various learning tasks, such as improving the accuracy of image classification tasks. However, training larger-scale network models will consume more video memory resources, and even exceed the video memory capacity of a single device, making the model unable to be trained.

[0003] With the continuous advancement of technology and the increase in model complexity, there are still challenges in computing power and resource utilization, especially when dealing with certain specific problems or performing complex calculations, traditional computing methods are prone to reach their physical limits. At this time, quantum computing, as a new computing paradigm, provides unprecedented computing potential and processing power, which can train and evaluate larger-scale quantum neural network models in a shorter time, thereby solving complex problems that are difficult to handle with traditional methods.

[0004] Quantum computing is still in its early stages of development. Training large-scale quantum machine learning models can achieve good results in a variety of learning tasks. However, as the parameter scale increases, executing related learning tasks on a single real machine still has the problem of slow running speed. Summary of the invention

[0005] The purpose of the present invention is to provide a real machine pipeline parallel execution method and related devices, aiming to solve the deficiencies in the prior art, and to help reduce the operating burden of a single real machine and improve the computing efficiency of the real machine.

[0006] An embodiment of the present invention provides a real machine pipeline parallel execution method, the method comprising:

[0007] Divide the quantum circuit into multiple independent quantum circuit modules according to the execution sequence of logic gates;

[0008] The multiple independent quantum circuit modules are sent to multiple different real machines, so that each real machine executes the quantum circuit module according to input data, and calculates the gradient of the quantum circuit module according to the parameter drift method, and the execution timing of the current quantum circuit module is earlier than or equal to the gradient calculation timing of the previous quantum circuit module.

[0009] Optionally, when the input data batch is 1, the execution timing of the current quantum circuit module is equal to the gradient calculation timing of the previous quantum circuit module.

[0010] Optionally, when the batch of input data is greater than 1, each quantum circuit module calculates the gradient of each batch of input data after completing execution in the batch order of the input data. When the batches of input data are the same, the execution timing of the current quantum circuit module is later than the execution timing of the previous quantum circuit module.

[0011] Optionally, after calculating the gradient of each quantum circuit module, each real machine further updates the parameters of the quantum circuit module based on the calculated gradient;

[0012] The parameter update timing of each quantum circuit module is the same, or the parameter update timing of each quantum circuit module is located at the next timing of the gradient calculation timing of the quantum circuit module, or the parameter update timing of multiple quantum circuit modules is performed in the reverse order of the execution timing of multiple quantum circuit modules.

[0013] Optionally, the functions implemented by each of the mutually independent quantum circuit modules are different from each other, or the execution time of each of the mutually independent quantum circuit modules is less than or equal to the maximum fault tolerance time of the real machine.

[0014] Optionally, each independent quantum circuit module is sent to the real machine via a quantum communication link.

[0015] Another embodiment of the present invention provides a real machine pipeline parallel execution device, the device comprising:

[0016] A module division unit, used to divide the quantum circuit into multiple independent quantum circuit modules according to the execution sequence of the logic gates;

[0017] A data processing unit is used to send the multiple independent quantum circuit modules to multiple different real machines, so that each real machine executes the quantum circuit module according to input data, and calculates the gradient of the quantum circuit module according to the parameter drift method, and the execution timing of the current quantum circuit module is earlier than or equal to the gradient calculation timing of the previous quantum circuit module.

[0018] Yet another embodiment of the present invention provides a storage medium, in which a computer program is stored, wherein the computer program is configured to execute the method described in any one of the above embodiments when running.

[0019] Yet another embodiment of the present invention provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the method described in any one of the above embodiments.

[0020] Compared with the prior art, the present invention provides a real machine pipeline parallel execution method, which first divides the quantum circuit into multiple independent quantum circuit modules according to the execution timing of the logic gate; then sends the multiple independent quantum circuit modules to multiple different real machines, so that each real machine executes the quantum circuit module according to the input data, and calculates the gradient of the quantum circuit module according to the parameter drift method, and the execution timing of the current quantum circuit module is earlier than or equal to the gradient calculation timing of the previous quantum circuit module.

[0021] The present invention reduces the video memory burden on a single real machine device and increases the fault tolerance and scalability of the system by dividing the quantum circuit into multiple different quantum circuit modules; performs gradient calculation of the quantum circuit module on the real machine by the parameter drift method, thereby improving the efficiency of the parameter optimization process; and accelerates the execution speed of the quantum circuit and improves the computing efficiency of the real machine by parallel processing of the execution sequence of the current quantum circuit module and the gradient calculation sequence of the previous quantum circuit module. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] Figure 1 A network block diagram of a real machine pipeline quantum circuit parallel execution system provided by an embodiment of the present invention.

[0023] Figure 2 A flowchart of a real machine pipeline quantum circuit parallel execution method provided by an embodiment of the present invention.

[0024] Figure 3 A schematic diagram of a single-batch real machine pipeline quantum circuit for parallel execution and gradient calculation provided by an embodiment of the present invention.

[0025] Figure 4 A schematic diagram of a multi-batch real machine pipeline quantum circuit parallel sequential execution and gradient calculation provided by an embodiment of the present invention.

[0026] Figure 5 A schematic diagram of a multi-batch real machine pipeline quantum circuit that performs parallel alternating execution and gradient calculations in an embodiment of the present invention.

[0027] FIG. 6(A) is a schematic diagram of a simultaneous execution parameter update provided by an embodiment of the present invention.

[0028] FIG. 6(B) is a schematic diagram of a sequential timing execution parameter update provided by an embodiment of the present invention.

[0029] FIG6(C) is a schematic diagram of performing parameter updating in reverse timing sequence provided by an embodiment of the present invention.

[0030] Figure 7 A schematic diagram of the structure of a real machine pipeline parallel execution device provided by an embodiment of the present invention.

[0031] Figure 8 A schematic diagram of the structure of a computer device provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0032] The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, but should not be construed as limiting the present invention.

[0033] Figure 1 1 is a network block diagram of a real machine pipeline parallel execution system provided by an embodiment of the present invention. The real machine pipeline parallel execution system may include a network 110, a server 120, a wireless device 130, a client 140, a storage 150, a classical computing unit 160, a quantum computing unit 170, and may also include additional memories, classical processors, quantum processors, and other devices not shown.

[0034] Network 110 is a medium used to provide communication links between various devices and computers connected together in the real machine pipeline parallel execution system, including but not limited to the Internet, corporate intranet, local area network, mobile communication network and their combinations. The connection method can be wired, wireless communication links or optical fiber cables, etc.

[0035] The server 120, the wireless device 130 and the client 140 are conventional data processing systems, which may contain data and applications or software tools for performing conventional computing processes. The client 140 may be a personal computer or a network computer, so the data may also be provided by the server 120. The wireless device 130 may be a smart phone, a tablet, a laptop, a smart wearable device, etc. The storage unit 150 may include a database 151, which may be configured to store data such as quantum bit parameters, quantum logic gate parameters, quantum circuits, quantum programs, etc.

[0036] The classical computing unit 160 (quantum computing unit 170) may include a classical processor 161 (quantum processor 171) for processing classical data (quantum data) and a memory 162 (memory 172) for storing classical data (quantum data). The classical data (quantum data) may be a boot file, an operating system image, and an application 163 (application 173). The application 163 (application 173) may be used to implement a quantum algorithm compiled by a real machine pipeline parallel execution method provided in an embodiment of the present invention.

[0037] Any data or information stored or generated in the classical computing unit 160 (quantum computing unit 170) can also be configured to be stored or generated in another classical (quantum) processing system in a similar manner, and any application program executed by it can also be configured to be executed in another classical (quantum) processing system in a similar manner.

[0038] It should be noted that a true quantum computer is a hybrid structure, which includes at least Figure 1 There are two major parts in it: the classical computing unit 160, which is responsible for performing classical computing and control; the quantum computing unit 170, which is responsible for running quantum programs and thus realizing quantum computing.

[0039] The classical computing unit 160 and the quantum computing unit 170 may be integrated into one device or distributed in two different devices. For example, the first device including the classical computing unit 160 runs a classical computer operating system, on which quantum application development tools and services are provided, as well as storage and network services required for quantum applications. Users develop quantum programs through the quantum application development tools and services thereon, and send quantum programs to the second device including the quantum computing unit 170 through the network services thereon. The second device runs a quantum computer operating system, and the code of the quantum program is parsed and compiled into instructions that can be recognized and executed by the quantum processor 170 through the quantum computer operating system. The quantum processor 170 implements the quantum algorithm corresponding to the quantum program according to the instructions.

[0040] The computing unit of the classic processor 161 in the classic computing unit 160 is a CMOS tube based on a silicon chip. This computing unit is not limited by time and coherence, that is, this computing unit is not limited by the length of use and can be used at any time. In addition, in the silicon chip, the number of such computing units is also sufficient. At present, the number of computing units in a classic processor 161 is tens of thousands. The number of computing units is sufficient and the computing logic that can be selected by the CMOS tube is fixed, such as: AND logic. When calculating with the help of CMOS tubes, a large number of CMOS tubes are combined with limited logic functions to achieve the calculation effect.

[0041] The basic computing unit of the quantum processor 171 in the quantum computing unit 170 is a quantum bit. The input of the quantum bit is limited by coherence and coherence time, that is, the quantum bit is limited by the duration of use and is not available at any time. Making full use of the quantum bit within the available duration of use of the quantum bit is a key problem in quantum computing. In addition, the number of quantum bits in a quantum computer is one of the representative indicators of the performance of the quantum computer. Each quantum bit realizes the computing function through the logical function configured on demand. In view of the limited number of quantum bits, the logical functions in the field of quantum computing are diverse, such as: Hadamard gate (Hadamard gate, H gate), Pauli-X gate (X gate), Pauli-Y gate (Y gate), Pauli-Z gate (Z gate), X gate, RY gate, RZ gate, CNOT gate, CR gate, iSWAP gate, Toffoli gate, etc. In quantum computing, it is necessary to use limited quantum bits combined with a variety of logical function combinations to achieve the computing effect.

[0042] Based on these differences, the design of CMOS tubes by classical logic functions and the design of quantum bits by quantum logic functions are significantly and essentially different. The design of CMOS tubes by classical logic functions does not need to consider the individuality of CMOS tubes. For example, the representation of CMOS tubes in silicon chips is the individual identification, position, and usable life of each CMOS tube. Therefore, the classical algorithm composed of classical logic functions only expresses the operational relationship of the algorithm, but does not express the algorithm's dependence on individual CMOS tubes.

[0043] When quantum logic functions act on qubits, the individuality of qubits needs to be considered, such as the individual identification of the qubit in the quantum chip, its position, its relationship with surrounding qubits, and the usable time of each qubit. Therefore, the quantum algorithm composed of quantum logic functions not only expresses the computational relationship of the algorithm, but also expresses the algorithm's dependence on individual qubits.

[0044] Quantum chips can include quantum bits and channels for regulating quantum bits. Quantum logic gates are implemented through analog signals. Different combinations of analog signals are applied to quantum bits through channels for regulating quantum bits, thereby realizing quantum circuits with different functions and completing data processing. Therefore, the design of quantum logic functions acting on quantum bits (including the design of whether quantum bits are used or not and the design of the efficiency of each quantum bit) is the key to improving the computing performance of quantum computers, and special designs are required. This is also the uniqueness of quantum algorithms based on quantum logic functions, which is essentially and significantly different from classical algorithms based on classical logic functions. The above-mentioned design for quantum bits is a technical issue that ordinary computing devices do not need to consider or face.

[0045] In the field of quantum computing, training large-scale quantum machine learning models can achieve good results in a variety of learning tasks. However, as the parameter scale increases and the number of quantum circuit executions required increases, executing related learning tasks on a single real machine is still slow.

[0046] Therefore, a more efficient operation scheme for quantum circuit execution task processing is needed to improve the computing efficiency of the real machine. The present invention proposes a real machine pipeline parallel execution method and related devices.

[0047] See also Figure 2 , Figure 2 A real machine pipeline parallel execution method provided by an embodiment of the present invention comprises the following steps:

[0048] Step S201, dividing the quantum circuit into a plurality of mutually independent quantum circuit modules according to the execution sequence of the logic gates;

[0049] Among them, the logic gate execution sequence refers to the time sequence or time control of the operation of quantum bits, and multiple independent quantum circuit modules are several logically independent sub-circuit modules containing specific quantum bits and logic gates.

[0050] Specifically, according to the time sequence or time control of multiple quantum logic gates in the quantum circuit operating on quantum bits, the original quantum circuit is divided into several logically independent sub-circuit modules containing specific quantum bits and logic gates.

[0051] By dividing the quantum circuit into multiple independent quantum circuit modules, these modules can run on different real machines. On the one hand, this reduces the execution burden of a single real machine, and on the other hand, it can increase the fault tolerance of the system. If a real machine fails or fails, the remaining real machines can still continue to execute, thereby maintaining the reliability and robustness of the entire system. At the same time, the processing capacity of the quantum circuit can be further improved by increasing the number of real machines, and the division and allocation of quantum circuit modules can be adjusted according to specific needs, making the system processing more flexible and increasing the scalability of the system.

[0052] For example, assume that there is a quantum circuit containing four quantum bits (labeled as q0, q1, q2, q3), which is composed of a series of controlled NOT gates and quantum rotation logic gates, etc. The quantum circuit is divided into three sub-modules according to the execution timing of the quantum bits, namely, the first quantum circuit module, the second quantum circuit module, and the third quantum circuit module.

[0053] Step S202: Send the multiple independent quantum circuit modules to multiple different real machines, so that each real machine executes the quantum circuit module according to the input data, and calculates the gradient of the quantum circuit module according to the parameter drift method, and the execution timing of the current quantum circuit module is earlier than or equal to the gradient calculation timing of the previous quantum circuit module.

[0054] Among them, the real machine refers to the actual quantum computing device that can perform quantum computing tasks. Multiple different real machines correspond to multiple independent quantum circuit modules. The parameter drift method is a method of estimating the gradient of a parameter in a quantum circuit through the finite difference method. Unlike classical neural networks, back propagation is not required, so gradient calculation can be performed without waiting for the next quantum circuit module to be executed, so that the execution of one quantum circuit module can be performed simultaneously with the gradient calculation of another quantum circuit module.

[0055] Specifically, the multiple independent quantum circuit modules after segmentation are respectively sent to multiple different real machines, and data is transmitted between adjacent real machines through communication links. The input data is input into the quantum circuit module for data processing. According to the data processing results of each quantum circuit module, the gradient calculation of the quantum circuit module is performed through the parameter drift method. In the process of parallel execution of the real machine pipeline, there are two situations for the execution timing of the current quantum circuit module. First, when a single batch of data is input and processed, it is equal to the gradient calculation timing of the previous quantum circuit module; second, when multiple batches of data are input and processed, it is earlier than the gradient calculation timing of the previous quantum circuit module.

[0056] The input data of each quantum circuit module is determined according to the coupling relationship between the quantum circuit modules. For example, if the quantum logic gate included in the first quantum circuit module acts on the first and second quantum bits, and the quantum logic gate included in the second quantum circuit module acts on the second and third quantum bits, then there is a coupling relationship between the first quantum circuit module and the second quantum circuit module, and the input data of the second quantum circuit module is the output data of the first quantum circuit module; for another example, if the quantum logic gate included in the first quantum circuit module acts on the first and second quantum bits, and the quantum logic gate included in the second quantum circuit module acts on the third and fourth quantum bits, then there is no coupling relationship between the first quantum circuit module and the second quantum circuit module, and the input data of the second quantum circuit module is not the output data of the first quantum circuit module.

[0057] According to the output results of each quantum circuit module on multiple real machines, the gradient calculation of each module is performed through the parameter drift method, which improves the efficiency of the model parameter optimization process; by performing data processing on the current quantum circuit module and gradient calculation on the previous quantum circuit module in parallel, pipeline parallelism on the real machine is achieved, which speeds up the execution of the quantum circuit and improves the computing efficiency of the real machine.

[0058] Exemplarily, the first quantum circuit module obtained after the quantum circuit is split is sent to the first real machine, the second quantum circuit module is sent to the second real machine, and the third quantum circuit module is sent to the third real machine. The first real machine is directly connected to the second real machine, and the second real machine is directly connected to the third real machine. The input data is input to the first quantum circuit module of the first real machine to obtain the first output result; the first output result is input to the second quantum circuit module of the second real machine to obtain the second output result; the second output result is input to the third quantum circuit module of the third real machine to obtain the third output result; the gradient calculation of the first quantum circuit module is performed according to the first output result, the gradient calculation of the second quantum circuit module is performed according to the second output result, and the gradient calculation of the third quantum circuit module is performed according to the third output result. Furthermore, in a single-batch data processing process, when the second quantum circuit module performs data processing, it is in the same execution timing as the gradient calculation of the first quantum circuit module; in a multi-batch data processing process, when the three batches of input data of the second quantum circuit module perform data processing respectively, the gradient calculation timing of the three batches of input data of the first quantum circuit module will be equal to or later than the gradient calculation timing of the three batches of input data of the second quantum circuit module.

[0059] In summary, the present application divides the quantum circuit into multiple independent quantum circuit modules according to the execution sequence of the logic gate; sends multiple independent quantum circuit modules to multiple different real machines, so that each real machine executes the quantum circuit module according to the input data, and calculates the gradient of the quantum circuit module according to the parameter drift method, and the execution sequence of the current quantum circuit module is earlier than or equal to the gradient calculation sequence of the previous quantum circuit module. First, by dividing the quantum circuit into multiple different quantum circuit modules, the video memory burden on a single real machine device is reduced, and the fault tolerance and scalability of the system are increased; the gradient calculation of the quantum circuit module on the real machine is performed by the parameter drift method to improve the efficiency of the parameter optimization process; by parallel processing of the execution sequence of the current quantum circuit module and the gradient calculation sequence of the previous quantum circuit module, the execution speed of the quantum circuit is accelerated, and the computing efficiency of the real machine is improved.

[0060] In one embodiment of the present application, when the input data batch is 1, the execution timing of the current quantum circuit module is equal to the gradient calculation timing of the previous quantum circuit module.

[0061] Specifically, when a single batch of data is input, the current quantum circuit module processes the gradient calculation of the previous quantum circuit module in parallel while executing data processing.

[0062] By inputting a single batch of data, while executing data processing for the current quantum circuit module, the gradient calculation of the previous quantum circuit module is processed in parallel, which reduces the time required for the overall calculation and improves the execution speed of the quantum circuit.

[0063] For example, see Figure 3 , Figure 3 A schematic diagram of a single batch real machine pipeline quantum circuit parallel execution and gradient calculation provided by an embodiment of the present invention. When a single batch of data is input into the first quantum circuit module for data processing, a first output result is obtained, and when the first output result is input into the second quantum circuit module for data processing, a second output result is obtained, and when the second output result is input into the third quantum circuit module for data processing, the gradient calculation of the second quantum circuit module is processed in parallel, and finally the gradient calculation of the third quantum circuit module is performed.

[0064] Assume that the time to execute a circuit is T, the number of circuits executed in a forward propagation is n, and the number of variable parameters is p. The specific calculation time is as follows:

[0065] Here, the number of execution lines of forward propagation is n, that is, the time of forward propagation operation is nT, the number of execution lines of gradient calculation is 2np, and the running time is 2npT; after module parallelization, the original execution time of nT+2npT becomes nT / 3+2npT, because the time of gradient calculation does not change at this time, and the execution of modules 1, 2, and 3 only needs to execute the first module, that is, nT / 3 (the time at this time is approximate, whether it is this time length depends on the circuit complexity of each module). This design can effectively reduce the burden of running a single real machine.

[0066] In one embodiment of the present application, when the input data batch is greater than 1, each quantum circuit module calculates the gradient of each batch of the input data after completing the execution in the batch order of the input data. When the batches of the input data are the same, the execution timing of the current quantum circuit module is later than the execution timing of the previous quantum circuit module.

[0067] Specifically, the input data is divided into multiple batches of data and input into the quantum circuit module. Each quantum circuit module first performs processing in the order of each batch of input data of each quantum circuit module. After the processing is completed, the gradient calculation corresponding to each batch of input data module of each quantum circuit module is calculated. When the input data belongs to the same batch of processed data, the same batch of data of the previous module is processed first, and then the same batch of data of the next module is executed.

[0068] For example, see Figure 4 , Figure 4A schematic diagram of parallel sequential execution and gradient calculation of a multi-batch real machine pipeline quantum circuit provided by an embodiment of the present invention. The input data is divided into three batches of data input, and the first batch, second batch, and third batch of input data of the first quantum circuit module, the second quantum circuit module, and the third quantum circuit module are processed respectively, and then the gradient calculation of the first batch, second batch, and third batch of data corresponding to the first quantum circuit module, the second quantum circuit module, and the third quantum circuit module is performed in sequence. Secondly, when the input data is the same batch, for example, after the first batch of input data of the first quantum circuit module is executed, the output result of the first batch of the first quantum circuit module is obtained, and the output result is input to the first batch of the second quantum circuit module for data processing, and the output result of the first batch of the second quantum circuit module is obtained, and then the output result is input to the first batch of the third quantum circuit module for data processing, that is, the data between different modules of the same batch are processed in sequence according to the time sequence.

[0069] Figure 4 The running time of the pipeline parallel part of the embodiment is referenced Figure 3 According to the idea of ​​the embodiment, when the line batch is n during the forward transmission, it is divided into three blocks. The time to execute the same batch is nT / 3, and the required gradient calculation time is 2npT / 3. When the pipeline parallel is not adopted, the running time is still nT+2npT. After adoption, it can be observed that the modules of the forward transmission and gradient calculation are compact. At this time, it can be observed that the running of the modules in the figure shows that the running time of the bottom three modules plus the remaining gradient calculation time is also approximately one-third, so it is nT / 3. Then add the time of subsequent gradient calculation, the time of the entire gradient calculation is 2npT, and the time of the next batch is 2npT / 3. Add the time of module 3 batch 2 and module 3 batch 3. The running time of these two modules is approximately 1 / 3 of 2npT / 3, so the final calculation is nT / 3+2npT / 3+2npT*2 / 3. The execution time of the second and third batches on the last module is also determined by the circuit complexity, which is approximately 2npT / 3*1 / 3. It can be understood that 1 / 3 modules execute 1 / 3 of the total execution times.

[0070] In one embodiment of the present application, when the input data batch is greater than 1, each of the quantum circuit modules executes and calculates the gradient alternately according to the batch order of the input data, and when the batches of the input data are the same, the execution timing of the current quantum circuit module is later than the execution timing of the previous quantum circuit module.

[0071] Specifically, the input data is divided into multiple batches of data input. Each quantum circuit module first performs data processing on the input data one by one in batch order. After each batch of data processing is completed in each quantum circuit module, in the horizontal execution direction of the timing, the data processing and gradient calculation of each batch of the same quantum circuit module are executed alternately. When the input data belongs to the same batch, the input data of the same batch of the previous module is processed first, and then the same batch of data of the next module is executed in sequence.

[0072] For example, see Figure 5 , Figure 5 A schematic diagram of a multi-batch real machine pipeline quantum circuit parallel alternating execution and gradient calculation provided by an embodiment of the present invention. The input data is divided into three batches of data input. For example, in the horizontal execution direction of the timing sequence, after the first batch of data of the first quantum circuit module is processed, the gradient calculation of the first batch of the first quantum circuit module is then performed in the next timing sequence. After the processing is completed, the second batch of data of the first quantum circuit module is processed in the next timing sequence, and finally the gradient calculation of the third batch of the first quantum circuit module is performed, so that the data processing and gradient calculation of each batch of the first quantum circuit module are formed in an alternating execution mode according to the timing sequence. Secondly, when the input data is the same batch, after the first batch of input data of the first quantum circuit module is executed, it is input to the first batch of the second quantum circuit module for continued processing. After the processing is completed, it is input to the first batch of the third quantum circuit module for continued processing, that is, the data between different modules of the same batch are processed in sequence according to the execution timing sequence.

[0073] Figure 5 The running time of the parallel pipeline of the embodiment is Figure 4 The embodiment is the same, and it is also approximated from nT+2npT to nT / 3+2npT / 3+2npT*2 / 3. The specific process is not elaborated in detail. Figure 4 Example.

[0074] By dividing the input data into multiple batches, the consumption of computing resources caused by processing a large amount of data at one time can be avoided, so that each quantum circuit module can use computing resources more efficiently. At the same time, performing data processing and gradient calculation in batch order helps to optimize the calculation process and reduce unnecessary waiting time, thereby improving overall computing efficiency.

[0075] In one embodiment of the present application, after calculating the gradient of each quantum circuit module, each real machine also updates the parameters of the quantum circuit module based on the calculated gradient;

[0076] The parameter update timing of each quantum circuit module is the same, or the parameter update timing of each quantum circuit module is located at the next timing of the gradient calculation timing of the quantum circuit module, or the parameter update timing of multiple quantum circuit modules is performed in the reverse order of the execution timing of multiple quantum circuit modules.

[0077] Specifically, after the quantum circuit module corresponding to each real machine completes the gradient calculation, it is necessary to update the parameters of each quantum circuit module according to the obtained gradient calculation result; there are three updating methods in the embodiment of the present invention: first, the parameter update steps of each quantum circuit module are in the same time sequence; second, after the gradient calculation of the quantum circuit module corresponding to each real machine is completed, the parameter update of the module is immediately performed in the next time sequence; third, after all real machines complete the execution of the corresponding quantum circuit modules, the parameters are updated in the reverse order of the execution time sequence of multiple quantum circuit modules.

[0078] Exemplarily, see Figure 6, where Figure 6 (A) is a schematic diagram of a simultaneous execution of parameter updates provided by an embodiment of the present invention. After completing the gradient calculation of the third quantum circuit module, in the next time sequence, the parameter update of the first quantum circuit module, the parameter update of the second quantum circuit module, and the parameter update of the third quantum circuit module are executed in parallel.

[0079] Referring to FIG. 6 , FIG. 6 (B) is a schematic diagram of sequentially executing parameter updates provided by an embodiment of the present invention. After the gradient calculation of the first quantum circuit module is completed, the parameter update of the first quantum circuit module is performed immediately in the next sequence. After the gradient calculation of the second quantum circuit module is completed, the parameter update of the second quantum circuit module is performed in the next sequence. After the gradient calculation of the second quantum circuit module is completed, the parameter update of the third quantum circuit module is performed in the next sequence.

[0080] Referring to FIG. 6 , FIG. 6 (C) is a schematic diagram of performing parameter update in reverse order according to an embodiment of the present invention. After the gradient calculation of the third quantum circuit module is completed, the local parameter update of the first quantum circuit module is performed in the next order. After the update is completed, the local update of the second quantum circuit module and the third quantum circuit module is then performed in the next order. After the update is completed, the global update of the entire quantum circuit module is finally performed.

[0081] Above Figure 3-Figure 5 The embodiment specifically describes the time saving from the perspective of the execution of the quantum circuit and the gradient calculation. In addition to the execution of the quantum circuit module and the gradient calculation, the quantum circuit module also needs to perform parameter update. Figure 6(A)-Figure 6(C)Three ways of updating quantum circuits are given. If the update time of the original quantum circuit before cutting is set to T, then in the three embodiments, the update time is T / 3, T / 3, and T respectively. It can be seen that in addition to saving time and improving the calculation speed in the execution and gradient calculation of the quantum circuit module, the embodiment of the present application can further save time and improve the calculation speed in the update stage. At the same time, the update is also distributed to multiple real machines, which can also reduce the video memory burden on a single real machine device and increase the fault tolerance and scalability of the system.

[0082] In summary, by updating the parameters of the quantum circuit through the obtained gradient calculation results, the model parameters can be gradually adjusted to optimize the performance of the model, which helps to reduce the error rate of prediction or classification tasks and improve the accuracy of the model. Further parameter update is a key step in the machine learning training process. Timely parameter update can accelerate the convergence speed of the model, thereby shortening the time of the entire training process. Whether it is simultaneous parameter update, sequential timing update or reverse timing update, it is aimed at reducing the idle time of computing resources and improving the training efficiency of the model.

[0083] In one embodiment of the present application, each mutually independent quantum circuit module implements a different function, or the execution time of each mutually independent quantum circuit module is less than or equal to the maximum fault tolerance time of the real machine.

[0084] Among them, the maximum fault tolerance time refers to the length of time required to run the quantum circuit module before the accumulated errors of the real machine exceed the fault tolerance threshold.

[0085] Specifically, the present application divides the quantum circuit into multiple independent quantum circuit modules in two ways: first, dividing according to the functional modules of the quantum circuit; second, dividing according to the fault tolerance performance of the real machine, dividing the number of quantum logic gates that the real machine can run within a certain fault tolerance time range.

[0086] Exemplarily, a complete quantum circuit, in which the quantum logic circuit includes X gates, H gates, CNOT gates, etc., is firstly divided into three quantum circuit modules according to the module functions. For example, the first quantum circuit module realizes the creation of quantum entangled states, the second quantum circuit module realizes the transfer of quantum states, and the third quantum circuit module realizes the reading of quantum information; secondly, the quantum circuit is divided according to the fault tolerance performance of the real machine. Assuming that the quantum computer can maintain sufficient accuracy before running 10 quantum logic gates each time, the quantum circuit is divided into multiple sub-modules containing no more than 10 logic gates. This ensures that each module can be completed within the maximum fault tolerance time of the real machine and can maintain sufficient accuracy.

[0087] By dividing quantum circuit modules according to functional modules and real machine fault tolerance performance, the design of quantum circuits becomes more flexible. This modular design allows for rapid adjustment and expansion of quantum circuits based on actual needs and performance requirements, which helps optimize the utilization of quantum resources.

[0088] In one embodiment of the present application, each independent quantum circuit module is sent to the real machine via a quantum communication link.

[0089] Specifically, after the quantum circuit is split, multiple independent quantum circuit modules are obtained, and the multiple independent quantum circuit modules after the split are placed on different real machines respectively. Adjacent real machines transmit data through quantum communication links, and each independent quantum circuit module is sent to a different real machine through the communication link.

[0090] See also Figure 7 , Figure 7 A real machine pipeline parallel execution device provided in an embodiment of the present invention may include:

[0091] A module division unit 701 is used to divide the quantum circuit into a plurality of mutually independent quantum circuit modules according to the execution sequence of the logic gates;

[0092] Among them, the logic gate execution sequence refers to the time sequence or time control of the operation of quantum bits, and multiple independent quantum circuit modules are several logically independent sub-circuit modules containing specific quantum bits and logic gates.

[0093] Specifically, according to the time sequence or time control of multiple quantum logic gates in the quantum circuit operating on quantum bits, the original quantum circuit is divided into several logically independent sub-circuit modules containing specific quantum bits and logic gates.

[0094] The data processing unit 702 is used to send the multiple independent quantum circuit modules to multiple different real machines, so that each real machine executes the quantum circuit module according to the input data, and calculates the gradient of the quantum circuit module according to the parameter drift method, and the execution timing of the current quantum circuit module is earlier than or equal to the gradient calculation timing of the previous quantum circuit module.

[0095] Among them, the real machine refers to the actual quantum computing device that can perform quantum computing tasks. Multiple different real machines correspond to multiple independent quantum circuit modules; the parameter drift method is a method of estimating the gradient of a parameter in a quantum circuit through the finite difference method.

[0096] Specifically, when the input data batch is 1, the execution timing of the current quantum circuit module is equal to the gradient calculation timing of the previous quantum circuit module.

[0097] Specifically, when the batch of input data is greater than 1, each quantum circuit module calculates the gradient of each batch of input data after completing execution in the batch order of the input data. When the batches of the input data are the same, the execution timing of the current quantum circuit module is later than the execution timing of the previous quantum circuit module.

[0098] Specifically, when the batch of input data is greater than 1, each of the quantum circuit modules executes and calculates gradients alternately according to the batch order of the input data. When the batches of the input data are the same, the execution timing of the current quantum circuit module is later than the execution timing of the previous quantum circuit module.

[0099] Specifically, after calculating the gradient of each quantum circuit module, each real machine also updates the parameters of the quantum circuit module based on the calculated gradient;

[0100] The parameter update timing of each quantum circuit module is the same, or the parameter update timing of each quantum circuit module is located at the next timing of the gradient calculation timing of the quantum circuit module, or the parameter update timing of multiple quantum circuit modules is performed in the reverse order of the execution timing of multiple quantum circuit modules.

[0101] Specifically, each mutually independent quantum circuit module implements a different function, or the execution time of each mutually independent quantum circuit module is less than or equal to the maximum fault tolerance time of the real machine.

[0102] Specifically, each independent quantum circuit module is sent to the real machine through a quantum communication link.

[0103] Regarding the specific functions and effects achieved by the above-mentioned real machine pipeline parallel execution device, you can refer to the other embodiments of this specification for comparative explanation, and will not repeat them here. Each module in the real machine pipeline parallel execution device can be implemented in whole or in part by software, hardware and a combination thereof. Each module can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0104] See also Figure 8 , the present specification also provides a computer device, including a memory and a processor, the memory stores a computer program, and the processor implements the execution method in any of the above embodiments when executing the computer program. Figure 8 , the computer device may be a classical computer. The computer device may also be a quantum computer.

[0105] The embodiments of this specification also provide a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a computer, the computer executes the execution method in any of the above embodiments.

[0106] It should be understood that the specific examples in this specification are only intended to help those skilled in the art to better understand the implementation methods of this specification, rather than to limit the scope of the present invention.

[0107] It can be understood that in the various implementations of this specification, the size of the serial number of each process does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the implementation methods of this specification.

[0108] It can be understood that the various embodiments described in this specification can be implemented individually or in combination, and the embodiments of this specification are not limited to this.

[0109] Unless otherwise specified, all technical and scientific terms used in the embodiments of this specification have the same meaning as those generally understood by those skilled in the art of the technical field of this specification. The terms used in this specification are only for the purpose of describing specific embodiments and are not intended to limit the scope of this specification. The term "and / or" used in this specification includes any and all combinations of one or more related listed items. The singular forms of "a", "above", and "the" used in the embodiments of this specification and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings.

[0110] It can be understood that the processor of the embodiment of this specification can be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method implementation can be completed by the hardware integrated logic circuit or software instructions in the processor. The above processor can be a general processor, a digital signal processor (Digital Signal Processor, DSP), an application specific integrated circuit (Application Specific Integrated Circuit, ASIC), a field programmable gate array (Field Programmable Gate Array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The disclosed methods, steps and logic block diagrams in the embodiment of this specification can be implemented or executed. The general processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the embodiment of this specification can be directly embodied as a hardware decoding processor to perform, or the hardware and software modules in the decoding processor are combined and executed. The software module can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware.

[0111] It is understood that the memory in the embodiments of this specification may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memory. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (programmable ROM, PROM), an erasable programmable read-only memory (erasablePROM, EPROM), an electrically erasable programmable read-only memory (EEPROM) or a flash memory. The volatile memory may be a random access memory (RAM). It should be noted that the memory of the systems and methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.

[0112] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this specification.

[0113] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method implementation methods and will not be repeated here.

[0114] In the several embodiments provided in this specification, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device implementation described above is only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0115] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0116] In addition, each functional unit in each embodiment of the present specification may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0117] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this specification, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of this specification. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc., various media that can store program codes.

[0118] The above is only a specific implementation of this specification, but the protection scope of the present invention is not limited thereto. Any person skilled in the art who is familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in this specification, which should be included in the protection scope of this specification. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.

Claims

1. A real machine pipeline quantum circuit parallel execution method, It is characterized in that include: Divide the quantum circuit into multiple independent quantum circuit modules according to the execution sequence of logic gates; The multiple independent quantum circuit modules are sent to multiple different real machines, so that each real machine executes the quantum circuit module according to input data, and calculates the gradient of the quantum circuit module according to the parameter drift method, and the execution timing of the current quantum circuit module is earlier than or equal to the gradient calculation timing of the previous quantum circuit module.

2. The method according to claim 1, It is characterized in that When the input data batch is 1, the execution timing of the current quantum circuit module is equal to the gradient calculation timing of the previous quantum circuit module.

3. The method according to claim 1, It is characterized in that When the batch of input data is greater than 1, each quantum circuit module calculates the gradient of each batch of input data after completing the execution in the batch order of the input data. When the batches of input data are the same, the execution timing of the current quantum circuit module is later than the execution timing of the previous quantum circuit module.

4. The method according to claim 1, It is characterized in that When the batch of input data is greater than 1, each quantum circuit module executes and calculates gradients alternately according to the batch order of the input data. When the batches of input data are the same, the execution timing of the current quantum circuit module is later than the execution timing of the previous quantum circuit module.

5. The method according to claim 1, It is characterized in that After calculating the gradient of each quantum circuit module, each real machine also updates the parameters of the quantum circuit module based on the calculated gradient; The parameter update timing of each quantum circuit module is the same, or the parameter update timing of each quantum circuit module is located at the next timing of the gradient calculation timing of the quantum circuit module, or the parameter update timing of multiple quantum circuit modules is performed in the reverse order of the execution timing of multiple quantum circuit modules.

6. The method according to claim 1, It is characterized in that The functions implemented by each of the mutually independent quantum circuit modules are different from each other, or the execution time of each of the mutually independent quantum circuit modules is less than or equal to the maximum fault tolerance time of the real machine.

7. The method according to claim 1, It is characterized in that Each independent quantum circuit module is sent to the real machine through a quantum communication link.

8. A real machine pipeline parallel execution device, It is characterized in that The device comprises: A module division unit, used to divide the quantum circuit into multiple independent quantum circuit modules according to the execution sequence of the logic gates; A data processing unit is used to send the multiple independent quantum circuit modules to multiple different real machines, so that each real machine executes the quantum circuit module according to input data, and calculates the gradient of the quantum circuit module according to the parameter drift method, and the execution timing of the current quantum circuit module is earlier than or equal to the gradient calculation timing of the previous quantum circuit module.

9. An electronic device, It is characterized in that include: Processor and memory; The processor is connected to a memory, wherein the memory is used to store a computer program, and the processor is used to call the computer program to execute the method according to claims 1-7.

10. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a processor, the method according to claims 1 to 7 is executed.