Distributed processing method, device and electronic device for quantum circuit
By determining the connection tightness of qubits in the quantum circuit and allocating them to multiple QPUs, the problem of low operating efficiency of quantum circuits on real hardware is solved, and efficient calculation and rational utilization of resources for large-scale quantum algorithms are achieved.
Patent Information
- Application Number
- CN202310713535.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-15
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2043-06-15
AI Technical Summary
When existing quantum circuits are run on real hardware, the qubit allocation method is unreasonable, resulting in large-scale quantum algorithms running inefficiently on real machines, and the scalability of a single QPU is poor, making it difficult to meet the resource requirements of large-scale quantum circuits.
By obtaining the instruction list of the quantum circuit and the number of target QPUs, the tightness of the connections between qubits is determined, and a distributed processing method is used to allocate the qubits to multiple QPUs, making the dual-qubit gate operations inside each QPU more intensive. , while the dual-qubit gate operations across the QPU are relatively sparse, enabling efficient operation of large-scale quantum circuits.
It improves the operating efficiency of large-scale qubit circuits on real quantum computers, rationally allocates qubit resources, meets the computing needs of large-scale quantum algorithms, and optimizes hardware usage characteristics.
Smart Images

Figure CN116757291B
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of quantum computing technology, in particular to the field of quantum circuit technology, and specifically to a distributed processing method, device and electronic device for quantum circuits. Background Art
[0002] Quantum computing uses the unique operating rules of the quantum world to provide a new and very promising way of information processing. In many specific problems, quantum algorithms can bring advantages over classical algorithms.
[0003] With the development of quantum theory, new quantum algorithms are constantly being proposed. The number of quantum bits required for most quantum algorithms still far exceeds the scale of quantum processing units (QPUs). How to run these quantum algorithms on real quantum hardware has always been an issue that has received widespread attention in the industry. Summary of the invention
[0004] The present disclosure provides a distributed processing method, device and electronic device for a quantum circuit.
[0005] According to a first aspect of the present disclosure, a distributed processing method for a quantum circuit is provided, comprising:
[0006] Obtaining an instruction list of a quantum circuit and obtaining a target number of quantum processing units executing the quantum circuit;
[0007] Based on the instruction list, determining first characterization information, where the first characterization information is used to characterize the tightness of connection between different quantum bits of the quantum circuit, where the tightness of connection indicates the number of two-qubit gates acting between the quantum bits of the quantum circuit;
[0008] Based on the first characterization information, determining a distribution scheme of the quantum bits of the quantum circuit on the target number of quantum processing units;
[0009] Based on the allocation scheme, the quantum bits in the quantum circuit are allocated to the target number of quantum processing units to process the quantum circuit.
[0010] According to a second aspect of the present disclosure, there is provided a distributed processing device for a quantum circuit, comprising:
[0011] An acquisition module, used to acquire an instruction list of a quantum circuit and a target number of quantum processing units executing the quantum circuit;
[0012] A first determination module is used to determine first characterization information based on the instruction list, where the first characterization information is used to characterize the tightness of connection between different quantum bits of the quantum circuit, where the tightness of connection indicates the number of two-qubit gates acting between the quantum bits of the quantum circuit;
[0013] A second determination module is used to determine, based on the first characterization information, a distribution scheme of the quantum bits of the quantum circuit on the target number of quantum processing units;
[0014] A processing module is used to allocate the quantum bits in the quantum circuit to the target number of quantum processing units to process the quantum circuit based on the allocation scheme.
[0015] According to a third aspect of the present disclosure, there is provided an electronic device, including:
[0016] at least one processor; and
[0017] a memory communicatively connected to at least one processor; wherein,
[0018] The memory stores instructions that can be executed by at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform any method in the first aspect.
[0019] According to a fourth aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to cause a computer to execute any one of the methods in the first aspect.
[0020] According to a fifth aspect of the present disclosure, a computer program product is provided, comprising a computer program, which implements any one of the methods in the first aspect when executed by a processor.
[0021] The technology disclosed in the present invention solves the problem of unreasonable allocation of quantum bits of quantum circuits to QPUs in related technologies, and can more efficiently realize the real machine operation of quantum circuits with large-scale quantum bits.
[0022] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present disclosure.
[0024] Figure 1 is a flow chart of a distributed processing method for a quantum circuit according to the first embodiment of the present disclosure;
[0025] Figure 2 is a schematic diagram of the structure of an example quantum circuit;
[0026] Figure 3 is an example of a weighted undirected graph;
[0027] Figure 4 This is a comparison chart of the minimum cut segmentation method and the more uniform segmentation method;
[0028] Figure 5 is a schematic diagram of the structure of another example of a quantum circuit;
[0029] Figure 6 yes Figure 5 The weighted undirected graph of the quantum circuit shown;
[0030] Figure 7 It is a flowchart of a specific example of allocating quantum bits in a quantum circuit to quantum hardware with a multi-QPU architecture;
[0031] Figure 8 is a schematic diagram of the structure of another example of a quantum circuit;
[0032] Fig. 9 yes Figure 8 The weighted undirected graph of the quantum circuit shown;
[0033] Fig.10 It is a visualization of the clustering results based on the k-means algorithm;
[0034] Fig.11 yes Fig.10 The clustering result shown is a schematic diagram of the partitioning of the weighted undirected graph;
[0035] Fig.12 This is an example of a comparison of segmentation methods obtained by solving the minimum cut problem and the normalized cut problem;
[0036] Fig.13 is a schematic structural diagram of a distributed processing device for a quantum circuit according to a second embodiment of the present disclosure;
[0037] Fig.14 is a schematic block diagram of an example electronic device for implementing an embodiment of the present disclosure. DETAILED DESCRIPTION
[0038] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0039] First embodiment
[0040] like Figure 1 As shown, the present disclosure provides a distributed processing method for quantum circuits, comprising the following steps:
[0041] Step S101: obtaining an instruction list of a quantum circuit, and obtaining a target number of quantum processing units executing the quantum circuit.
[0042] In this embodiment, the distributed processing method of the quantum circuit relates to the field of quantum computing technology, and in particular to the field of quantum circuit technology, which can be widely used in scenarios where the quantum circuit runs on a real quantum computer containing multiple QPUs. The distributed processing method of the quantum circuit of the embodiment of the present disclosure can be executed by the distributed processing device of the quantum circuit of the embodiment of the present disclosure. The distributed processing device of the quantum circuit of the embodiment of the present disclosure can be configured in any electronic device to execute the distributed processing method of the quantum circuit of the embodiment of the present disclosure.
[0043] Since the length of the column vector describing the quantum state grows exponentially with the corresponding number of bits, it is difficult for classical computers to simulate large-scale quantum systems. Limited by computer memory and processor capabilities, existing quantum circuit simulation methods can only support algorithms that simulate dozens of quantum bits at most. For example, a laptop can simulate about 20-30 quantum bits, and large supercomputers and clusters can simulate up to 30-40 quantum bits. For some large-scale quantum algorithms, they need to be run on real quantum systems to test their effects in order to better understand and further optimize these algorithms.
[0044] However, due to current technical conditions, the scalability of a single quantum chip is poor. For example, in most QPU architectures, there is an upper limit to the number of quantum bits. Once this upper limit is exceeded, increasing the number of quantum bits will reduce the overall performance of the QPU. In order to continue to increase the number of quantum bits beyond the inherent size limit of a single QPU system, one approach is to interconnect multiple QPUs of limited size, which is similar to interconnecting multiple classical processing units (CPUs) on a single silicon chip in classical computing to obtain a chip system with stronger computing performance. Therefore, a hardware system with multiple QPUs interconnected is required to meet the resource requirements of some large-scale quantum algorithms.
[0045] For some quantum circuits or quantum algorithms whose number of quantum bits exceeds the scale of a single QPU, the logical quantum bits in the quantum circuit can be distributed to different QPUs of multi-QPU architecture hardware, so that these larger-scale quantum circuits or quantum algorithms can be run on real quantum computers to test and improve them.
[0046] When a multi-QPU architecture is used for quantum information processing, communication between QPUs needs to rely on quantum channels. There are generally two ways to implement quantum channels. The most direct way is to transport the physical quantum bits on a QPU to another QPU to achieve quantum information interaction. However, this process is usually slow and inefficient. The quantum bit transmission speed achieved by a quantum charge-coupled device (QCCD) is 6-15 times slower than the local operation speed on a single QPU. Another way to implement a quantum channel is to use resource states shared between different QPUs. These resource states can transmit interactions between two QPUs through local operations and classical communications. Although the communication speed is higher than some QCCD-based transmission operations, it is still much slower than local operations on a single QPU.
[0047] Under current hardware conditions, cross-QPU operations based on the above-mentioned quantum channel implementation are limited by speed and cost, and in the foreseeable future, the interconnection between QPUs will still be a scarce resource. In other words, in the hardware of multi-QPU architecture that may be realized in the future, the density of internal connections in QPUs is much higher than the density of connections between QPUs. For example, in a monolithic ion trap chip, assuming that the number of quantum bits on a single QPU is N, since the quantum bits inside the ion trap architecture chip are fully connected (that is, any two quantum bits can act as a double quantum bit gate), the number of internal connections in the QPU is O(N). 2 ), while the number of cross-QPU connections between different chips may be only in the order of O(N).
[0048] In addition, the multi-QPU architecture hardware that is currently available and may be realized in the future has the structural characteristics of "dense connections within the QPU and sparse connections between QPUs". The logical qubits in large-scale quantum circuits can be distributed to different QPUs in a way that is more in line with the structural characteristics of such multi-QPU hardware, making it possible for these large-scale quantum circuits to run more efficiently on real quantum computers.
[0049] In other words, when running a quantum circuit on quantum hardware with a multi-QPU architecture, a key point is how to effectively distribute the logical quantum bits in the quantum circuit to different QPUs, so that the number of two-qubit gates within each QPU is large, while the number of cross-QPU two-qubit gates between different QPUs is small, thereby obtaining an executable circuit that is more in line with the hardware structure and more efficient.
[0050] Based on this, this embodiment provides a new distributed processing solution for quantum circuits. Given a quantum circuit and target multi-QPU hardware, logical quantum bits are allocated to different QPUs according to the structural characteristics of the quantum circuit, so that the two-qubit gate operations within each QPU are more intensive, while the two-qubit gate operations across QPUs are relatively sparse, thereby realizing the real machine operation of large-scale quantum circuits.
[0051] The quantum circuit model is introduced in detail below.
[0052] At present, quantum computing can be implemented based on the quantum circuit model, which is the most commonly used quantum computing method. The quantum circuit model can complete the evolution of quantum states by applying a series of quantum gates to quantum bits, and perform quantum measurements at the end of the circuit to obtain calculation results.
[0053] The quantum circuit diagram represents the entire process of quantum circuit model calculation. Figure 2 As shown in the figure, each horizontal line represents a quantum bit system, and the quantum bits of the quantum bits are numbered from top to bottom (usually starting from zero). The direction of time evolution in the quantum circuit diagram is from left to right. The leftmost end is the initial quantum state (usually the quantum bits are initialized to the |0> state), and then different quantum gate operations are applied to the initial state in turn to complete the evolution of the quantum state. At the end of the circuit, quantum measurements can be performed on certain quantum bits to obtain calculation results.
[0054] More generally, in the operation of a quantum circuit, it is possible to perform quantum measurements on a portion of the qubits and control the evolution of the remaining qubits based on the measurement results. Such operations are called classically controlled quantum operations (e.g. Figure 2 The quantum operation 201 shown in FIG. 201 ); and the quantum bit after measurement can be reset (such as Figure 2 The quantum operation 202 shown is in the |0> state and continues to be used in subsequent calculation processes.
[0055] In the quantum circuit diagram, except for the initial state, the rest is usually represented by an ordered instruction list according to the order of action of the quantum gates. Each element in the list represents a quantum operation instruction. Specifically,
[0056] Each single-qubit gate (such as H, X, Y, Z, S, T, Rx, Ry, Rz, etc.) is represented by a four-element instruction [name, which_qubit, parameters, None], where name is the name of the quantum gate, which_qubit is the quantum bit acted on by the quantum gate, and parameters are the parameters of the quantum gate (if there are no parameters, the default is None).
[0057] For example, [Rx,2,pi,None] means applying an Rx rotation gate to the quantum bit at quantum bit 2 with a rotation angle of pi.
[0058] Each two-qubit gate (such as the controlled NOT gate CNOT gate and the SWAP gate) is represented by an instruction containing four elements [name, which_qubit, parameters, condition], where name is the name of the quantum gate, which_qubit is a list of qubits that the two-qubit gate acts on. If it is a control quantum gate, it is a list of control bits and controlled bits, parameters are the parameters of the quantum gate (if there are no parameters, the default is None), and condition indicates which qubit measurement result controls the quantum gate operation (if there are no parameters, the default is None).
[0059] For example, [SWAP,[1,2],None,None] means applying a SWAP gate between qubit 1 and qubit 2, and [CNOT,[3,1],None,None] means applying a CNOT gate between qubit 1 and qubit 3. Among them, qubit 3 is the control bit and qubit 1 is the controlled bit.
[0060] Each single-bit measurement is represented by a four-element instruction [measure, which_qubit, basis, mid], where which_qubit is the qubit being measured, basis is a list of four parameters, including the measurement angle angle, the measurement plane plane, the domain set s, the domain set t, and mid is the identification ID that identifies the current measurement.
[0061] For example, [measure,2,[0,'YZ',[1],[2]],'a'] means measuring qubit 2, with a measurement angle of 0, a measurement plane of the 'YZ' plane, a domain set of 1, a domain set of 2, and the ID of the current measurement instruction of 'a'.
[0062] Each classical control quantum operation can be represented as an instruction containing four elements [name, which_qubit, parameters, condition], where name is the name of the quantum gate, which_qubit is the quantum bit acted on by the quantum gate, parameters are the parameters of the quantum gate (if there are no parameters, the default is None), and condition indicates which quantum bit measurement result controls the quantum gate operation.
[0063] For example, Figure 2 The classical controlled quantum operation 201 is a classical controlled quantum gate X, which can be expressed as [X, 2, None, 'a'], i.e., a Pauli X gate acting on quantum bit 2. The controlled condition is the measurement result corresponding to the measurement operation with mid being 'a'. If the measurement result is 0, the quantum gate is not acted on, and if the measurement result is 1, the quantum gate is acted on.
[0064] Each reset operation can be represented as a four-element instruction [reset, which_qubit, None, None], where which_qubit represents the qubit to be reset.
[0065] According to the above instruction expression rules, Figure 2 The quantum circuit in can be represented as the following ordered list of instructions:
[0066] circuit=[[H,0,None,None],[H,1,None,None],[H,2,None,None],[CNOT,[0,1],None,None],[SW AP,[1,2],None,None],[H,0,None,None],[H,1,None,None],[H,2,None,None],[measure,1,[0,'Y Z',[],[]],'a'],[X,2,None,'a'],[reset,2,None,None],[measure,2,[0,'YZ',[],[]],'b'],[C NOT,[0,1],None,None],[measure,0,[0,'YZ',[],[]],'c'],[measure,1,[0,'YZ',[],[]],'d']].
[0067] In step S101, the instruction list input by the user may be used as the instruction list of the quantum circuit, or the ordered instruction list of the quantum circuit may be obtained according to the instruction representation rule based on the quantum circuit to be executed, which is not specifically limited here.
[0068] The quantum processing unit may be a quantum processing unit on target hardware, and the quantum algorithm of the quantum circuit may be executed by the target hardware. The target hardware includes at least two QPUs, and the target number of quantum processing units for executing the quantum circuit may be obtained by obtaining the number of QPUs on the target hardware. The target number may also be preset.
[0069] Step S102: Based on the instruction list, determine first characterization information, where the first characterization information is used to characterize the connection tightness between different quantum bits of the quantum circuit, and the connection tightness indicates the number of two-qubit gates acting between the quantum bits of the quantum circuit.
[0070] In this step, in an optional implementation, the first characterization information may include N values, the N values correspond one-to-one to the N quantum bits of the quantum circuit, and the difference between two values represents the connection tightness between the corresponding two quantum bits. The larger the difference, the sparser the connection tightness between the two quantum bits, and the smaller the difference, the tighter the connection tightness between the two quantum bits.
[0071] In another optional embodiment, the first characterization information may include N indicator vectors, the N indicator vectors correspond one-to-one to the N quantum bits of the quantum circuit, and the distance between two indicator vectors represents the connection tightness between the two corresponding quantum bits. The larger the distance, the sparser the connection tightness between the two quantum bits, and the smaller the distance, the tighter the connection tightness between the two quantum bits.
[0072] In another optional embodiment, the first characterization information may include a parameter value for characterizing the tightness of the connection between different quantum bits of a quantum circuit, and the parameter value may be determined based on the number of two-qubit gates acting between the quantum bits of the quantum circuit. For example, the larger the number, the smaller the parameter value, representing a tighter connection; the smaller the number, the larger the parameter value, representing a sparser connection.
[0073] In an optional implementation, the number of two-qubit gates acting between quantum bits of the quantum circuit can be determined based on the instruction list of the quantum circuit, and based on the number of two-qubit gates acting between different quantum bits, a calibration algorithm is used to calibrate the N values or N indicator vectors corresponding to the N quantum bits one by one, so that the more two-qubit gates act between two quantum bits, the smaller the two differences corresponding to the two quantum bits, or the smaller the distance between the two indicator vectors corresponding to the two quantum bits; the fewer two-qubit gates act between two quantum bits, the larger the two differences corresponding to the two quantum bits, or the larger the distance between the two indicator vectors corresponding to the two quantum bits.
[0074] In another optional implementation, second characterization information of a weighted undirected graph of the quantum circuit can be determined based on an instruction list of the quantum circuit, and the second characterization information can characterize information about connections between all nodes in the weighted undirected graph; then a normalized Laplace matrix can be determined based on the second characterization information, wherein the vector elements of the eigenvectors of the normalized Laplace matrix correspond one-to-one to the nodes in the graph, and can characterize the tightness of connections between different quantum bits of the quantum circuit, and correspondingly, the first characterization information can be determined based on the normalized Laplace matrix.
[0075] In yet another optional implementation, an objective function of a normalized cut problem may be constructed based on a normalized Laplace matrix; the normalized cut problem may be solved, and the first representation information may be determined based on an obtained target solution.
[0076] Among them, the weighted undirected graph includes nodes and undirected edges connecting the nodes. The nodes correspond one-to-one to the quantum bits of the quantum circuit. The undirected edge refers to the existence of a two-qubit gate between the two quantum bits of the quantum circuit. The weight of the undirected edge can indicate the number of two-qubit gates between the two quantum bits. For example, the more two-qubit gates there are, the greater the weight, and the fewer two-qubit gates there are, the smaller the weight.
[0077] Since the normalized cut problem can be expressed as: given a graph G(V,E), we want to find a partitioning method that partitions all nodes in the weighted undirected graph into k(K) disjoint subsets (V1,V2,…,v k ) to minimize the objective function.
[0078] The objective function of the normalized cut problem is defined as shown in the following formula (1).
[0079]
[0080] Among them, NCut is the function representation of the normalized cut problem, Indicates that V i The size of the cut from V, and vol(V i ) is cluster V i The volume of is specifically defined as shown in the following formula (2).
[0081]
[0082] Cluster v i The volume of v i The value is the sum of the degrees of all nodes in a cluster, which measures the size of a cluster by the sum of the weights of the undirected edges associated with the nodes in the cluster (indicating the number of two-qubit gates associated with the qubit corresponding to the node).
[0083] It can be seen that the objective function of the normalized cut problem, in which the numerator of each term represents the conversion of v i After being split from V, the weight sum of the undirected edges is used to measure the i The size of the cut from V; and the denominator measures the size of a cluster by the weights of the undirected edges associated with the nodes in the cluster after the cut. Obviously, the smaller the numerator and the larger the denominator, the smaller the objective function value will be. Therefore, the objective function hopes to find a way to make the internal connections of each cluster denser after the cut (vol(V i ) is large), while the connections between clusters are sparse ( smaller).
[0084] Therefore, by constructing a normalized cut problem based on the second characterization information of the weighted undirected graph of the quantum circuit and solving the normalized cut problem, the first characterization information can be determined to characterize the connection tightness between different quantum bits of the quantum circuit, thereby segmenting the weighted undirected graph.
[0085] Step S103: Based on the first characterization information, determine a distribution scheme of the quantum bits of the quantum circuit on the target number of quantum processing units.
[0086] In this step, when the first characterization information includes N values or N indicator vectors corresponding one-to-one to the N quantum bits of the quantum circuit, the N quantum bits can be clustered in a clustering manner to form K cluster sets, where K is the target number of quantum processing units that execute the quantum circuit.
[0087] Based on K cluster sets, an allocation scheme can be obtained, that is, the quantum bits corresponding to each cluster set are allocated to a quantum processing unit, and the quantum bits of different cluster sets are allocated to different quantum processing units.
[0088] In the case where the first characterization information includes a parameter value for characterizing the tightness of connection between different quantum bits of a quantum circuit, a heuristic algorithm can be used to traverse various partitioning methods to find a partitioning method so that the two-qubit gate operations associated with the quantum bits within the partitioned cluster are more dense, while the two-qubit gate operations associated with the quantum bits between the partitioned clusters are relatively sparse. Accordingly, the quantum bits of the different partitioned clusters are allocated to different quantum processing units, and the quantum bits of one cluster are allocated to one quantum processing unit.
[0089] Step S104: Based on the allocation scheme, the quantum bits in the quantum circuit are allocated to the target number of quantum processing units to process the quantum circuit.
[0090] When allocating quantum bits, characteristic parameters of the quantum processing unit may be considered, such as the upper limit of quantum bits that the quantum processing unit can execute. When the number of quantum bits included in the set is less than or equal to the upper limit of quantum bits that the quantum processing unit can execute, it may be allocated to the quantum processing unit.
[0091] Correspondingly, based on the allocation scheme, the quantum bits corresponding to each set can be allocated to a quantum processing unit, and the quantum bits of different sets can be allocated to different quantum processing units.
[0092] When quantum bit allocation is completed, quantum circuit processing can be carried out to realize the real machine operation of large-scale quantum circuits.
[0093] In this embodiment, by giving a quantum circuit and a target multi-QPU hardware, according to the instruction list of the quantum circuit, the number of two-qubit gates acting between the quantum bits of the quantum circuit is determined (that is, the structural characteristics of the quantum circuit are determined), and based on the structural characteristics, first characterization information for characterizing the tightness of the connection between different quantum bits of the quantum circuit is determined, and then the allocation scheme of the quantum bits of the quantum circuit on the target multi-QPU hardware is determined based on the first characterization information, and the logical quantum bits of the quantum circuit are allocated to different QPUs based on the allocation scheme, so that the two-qubit gate operations within each QPU are more intensive, while the two-qubit gate operations across QPUs are relatively sparse, which can make the allocation of the quantum bits of the quantum circuit to the target multi-QPU hardware more reasonable, thereby more efficiently realizing the real machine operation of quantum circuits with large-scale quantum bits.
[0094] Optionally, the step S102 specifically includes:
[0095] Based on the instruction list, second characterization information of a weighted undirected graph of the quantum circuit is determined, the weighted undirected graph comprising: nodes and undirected edges connecting the nodes, the nodes corresponding one-to-one to the quantum bits of the quantum circuit, the undirected edges indicating that a two-qubit gate acts between two quantum bits corresponding to two nodes, and the second characterization information comprising adjacency information, the adjacency information indicating the number of two-qubit gates acting between two quantum bits corresponding to two nodes connected by the undirected edges;
[0096] Based on the second characterization information, the first characterization information is determined.
[0097] In this implementation, the weighted undirected graph consists of a series of nodes and undirected edges connecting the nodes, usually represented by G(V,E), where V is a set of all nodes in the graph, and E is a set of all edges in the graph. The edges in the graph usually represent a tuple (i, j), where i and j are both nodes in V.
[0098] Figure 3 For an example weighted undirected graph, Figure 3 As shown in the figure, the edge connecting two nodes has no directionality, the node set is V = {1,2,3,4,5,6}, and the edge set is E = {(1,2),(1,3),(2,4),(2,6),(5,6)}. In addition, for a weighted graph, each edge in the graph can also have a non-negative weight w ij ≥0,(i,j)∈E.
[0099] Corresponding to the quantum circuit, the nodes in the weighted undirected graph correspond one-to-one to the quantum bits of the quantum circuit, and its undirected edges refer to the two quantum bits corresponding to the two nodes acting on the two quantum bits. The weight refers to the number of two-qubit gates acted on by the two quantum bits corresponding to the two nodes.
[0100] The second characterization information may include adjacency information. Optionally, the second characterization information also includes degree information, where the degree information indicates the number of two-qubit gates associated with the qubit corresponding to the node. The method further includes:
[0101] For any node in the weighted undirected graph, summing the target information of the node in the adjacency information to obtain the degree information;
[0102] The target information indicates weight information of each undirected edge associated with the same node.
[0103] The adjacency information and degree information may be represented by an object, a matrix, or other data structures. The adjacency information and degree information will be represented in matrix form to illustrate the specific content of this embodiment.
[0104] All connectivity information in the graph can be represented by an adjacency matrix, which is defined as shown in the following equation (3).
[0105]
[0106] That is, if there is an edge between two nodes i and j, the matrix element in the i-th row and j-th column of the adjacency matrix A is the weight w of the edge (i, j) ij ; On the contrary, if there is no edge between two nodes i and j, the corresponding matrix element is 0.
[0107] For a node i∈V, its degree is defined as the sum of the weights of the undirected edges associated with the node, which can indicate the number of two-qubit gates associated with the qubit corresponding to the node, expressed as d i , expressed by the following formula (4).
[0108]
[0109] That is, the sum of the rows corresponding to the node in the adjacency matrix is calculated.
[0110] The degree matrix of a graph can be a diagonal matrix, where the diagonal elements D ii is the degree d of node i i , that is, the degree matrix is expressed by the following formula (5).
[0111]
[0112] In an optional implementation, the instruction list can be traversed to find the two-qubit gate in the quantum circuit, and the adjacency information and degree information can be determined based on the qubits acted upon by the operation instructions of the traversed two-qubit gate. In another optional implementation, a weighted undirected graph of the quantum circuit can be constructed based on the instruction list, and the adjacency information and degree information can be obtained based on the constructed weighted undirected graph.
[0113] Afterwards, the first characterization information can be determined based on the second characterization information according to the number of two-qubit gates acting between qubits corresponding to different nodes, so that the first characterization information can characterize the tightness of the connection between different qubits of the quantum circuit.
[0114] In this implementation, by determining the second characterization information of the weighted undirected graph of the quantum circuit in a graph theory manner based on the instruction list, the first characterization information is determined, which can make the determination of the first characterization information more accurate.
[0115] Optionally, determining second representation information of the weighted undirected graph of the quantum circuit based on the instruction list includes:
[0116] Based on the instruction list, determining a weighted undirected graph of the quantum circuit;
[0117] Second representation information of the weighted undirected graph is obtained.
[0118] In this embodiment, the connection relationship of all two-qubit gates in the quantum circuit can be determined based on the instruction list of the quantum circuit to determine the weighted undirected graph of the quantum circuit, and obtain the second characterization information of the weighted undirected graph, which can make the acquisition of the second characterization information more intuitive.
[0119] Optionally, determining second representation information of the weighted undirected graph of the quantum circuit based on the instruction list includes:
[0120] Based on the instruction list, obtaining a target operation instruction of a two-qubit gate of the quantum circuit;
[0121] Based on the quantum bit acted upon by the target operation instruction, the weight information of the undirected edge in the weighted undirected graph is determined to obtain the adjacency information, wherein the adjacency information includes the weight information of the undirected edge in the weighted undirected graph, and the weight information indicates the number of two-qubit gates acting between the two quantum bits corresponding to the two nodes connected by the undirected edge.
[0122] In this embodiment, all target operation instructions of the two-qubit gate of the quantum circuit can be obtained based on the instruction list to count the number of target operation instructions that act on the same qubit among all target operation instructions, determine the undirected edges in the weighted undirected graph and the weight information of the undirected edges, and thus obtain adjacency information.
[0123] Alternatively, the undirected edges in the weighted undirected graph and the weight information of the undirected edges may be updated by traversal based on the instruction list to find the target operation instruction, and the adjacency information may be obtained after the traversal is completed.
[0124] In this way, the adjacency information in the second representation information can be determined.
[0125] Optionally, determining the weight information of the undirected edges in the weighted undirected graph based on the qubit acted upon by the target operation instruction to obtain the adjacency information includes:
[0126] In the case where the target operation instruction is traversed based on the instruction list, adding 1 to the weight information of the target undirected edge in the adjacency information, wherein the target undirected edge is an undirected edge connecting the nodes corresponding to the quantum bits acted upon by the target operation instruction;
[0127] When the instruction list traversal is completed, the adjacency information is obtained.
[0128] In this implementation, the undirected edges and weight information of the undirected edges in the authorized undirected graph can be updated by traversing to the target operation instruction, and the adjacency information can be obtained after the traversal is completed. In this way, the adjacency information can be determined simply.
[0129] Optionally, the second representation information further includes degree information, the adjacency information is represented by an adjacency matrix, the degree information is represented by a degree matrix, and determining the first representation information based on the second representation information includes:
[0130] Subtracting the adjacency matrix from the degree matrix to obtain the Laplacian matrix of the weighted undirected graph;
[0131] Based on the degree matrix, normalizing the Laplacian matrix;
[0132] The first representation information is determined based on the normalized Laplacian matrix.
[0133] In this embodiment, the Laplacian matrix of the graph can be calculated using the adjacency matrix and degree matrix of the graph, which is expressed by the following formula (6).
[0134] L=DA(6)
[0135] The Laplacian matrix also contains information about the connections between all nodes in the graph.
[0136] The Laplacian matrix has the following properties:
[0137] 1. The Laplace matrix is a symmetric and semi-positive matrix with n non-negative eigenvalues, the smallest of which is 0, that is, 0 = λ1≤λ2≤…≤λ n .
[0138] 2. For any n-dimensional column vector The following conclusion is obtained from equation (7).
[0139]
[0140] The normalized Laplacian matrix of the graph is defined as shown in the following equation (8).
[0141] L n =D -1 / 2 LD -1 / 2 (8)
[0142] The normalized Laplacian matrix also contains information about the connections between all nodes in the graph.
[0143] The normalized Laplacian matrix has the following properties:
[0144] 1. The normalized Laplace matrix is a semi-positive definite matrix with n non-negative eigenvalues, the smallest of which is 0, that is, 0 = λ1≤λ2≤…≤λ n .
[0145] 2. The vector element of an eigenvector of the normalized Laplacian matrix corresponds one-to-one to the nodes in the graph, and its value contains information about the close connectivity between the nodes, so its eigenvector can be used for graph segmentation.
[0146] For example, for Figure 3 The normalized Laplacian matrix of the weighted undirected graph shown is an eigenvector of The vector element of the feature vector corresponding to each node can be Figure 3It can be seen that the difference in the vector elements of the feature vectors between nodes with tighter connections (indicating that there are edges between them and the weight value of the edge is larger), such as node 1 and node 3, and node 5 and node 6; the difference in the vector elements of the feature vectors between nodes with sparser connections (indicating that there are edges between them but the weight value of the edge is smaller), such as node 2 and node 6; and for nodes that are not directly connected by edges, the difference in the vector elements of their feature vectors is even greater, such as node 4 and node 5.
[0147] That is, in an optional implementation, the first characterization information can be constructed based on the eigenvector of the normalized Laplace matrix determined by the second characterization information. Thus, the normalized Laplace matrix can be determined by the second characterization information, and the first characterization information can be determined based on the normalized Laplace matrix.
[0148] Optionally, the determining the first representation information based on the normalized Laplace matrix includes:
[0149] Based on the normalized Laplace matrix, determining a target solution of a normalized cut problem, wherein the normalized cut problem is to divide the nodes in the weighted undirected graph into K disjoint subsets so that an objective function reaches a minimum value, wherein the objective function is a function that characterizes the connection tightness of the K disjoint subsets, wherein the objective function is inversely proportional to the connection tightness between the quantum bits corresponding to the nodes in the subset, and is directly proportional to the connection tightness between the quantum bits corresponding to the nodes in different subsets, and K is the target number;
[0150] Based on the target solution, the first characterization information is determined.
[0151] A k (i.e. K) partition on a graph G(V,E) means that after removing some edges from the graph, all nodes V in the graph can be divided into k disjoint subsets (V1, V2, ..., V k ), these subsets satisfy V1∪V2∪…∪V k =V, Each subset is called a cluster, and there are no edges connecting the clusters. The size of the cut that divides a graph into k clusters is defined as shown in the following formula (9).
[0152]
[0153] The 1 / 2 is to avoid repeated counting, and It is defined as shown in the following formula (10).
[0154]
[0155] In formula (10), Indicates Vi In the complement of set V, we can see It represents the sum of the weights of the edges between the nodes belonging to the i-th cluster and the nodes of other clusters. Therefore, the size of the cut is the sum of the weights of all the edges removed in the segmentation.
[0156] The most common graph segmentation problem is the minimum cut problem, which is to find a k-partition of the graph G(V,E) such that the size of the cut is minimized. The objective function of the minimum cut problem is expressed as follows:
[0157]
[0158] However, since the objective function of the minimum cut problem only includes the size of the cut, its solution often separates a small number of relatively isolated nodes in the graph. However, in some practical situations, it is more desirable to obtain a more uniform segmentation, that is, to obtain the smallest possible cut while the sizes of the clusters are relatively uniform. For example Figure 4 As shown, the segmentation method of the dotted line 401 is a minimum cut solution, while the segmentation method of the dotted line 402 is intended to obtain a more uniform segmentation.
[0159] In order to obtain a more uniform partition, it is necessary to add some terms to the objective function of the cut problem to balance the size of each cluster after partitioning. The normalized cut problem can meet this condition. Therefore, the problem of allocating logical qubits in quantum circuits to multiple QPU hardware can be transformed into a normalized cut problem of the graph.
[0160] When allocating qubits in a quantum circuit to different QPUs, the main restriction comes from the cross-QPU two-qubit gate operation, because such operations are slow and costly. In a quantum circuit, if there is no two-qubit gate between two qubits, it means that the correlation between the quantum information of the two qubits is weak, and allocating the two to different QPUs will not introduce cross-QPU operations; if there is a two-qubit gate between two qubits, it means that there is a certain correlation between the quantum information of the two qubits, and cross-QPU operations will be introduced when the two are allocated to different QPUs. The more two-qubit gates there are between the two qubits, the stronger the correlation between the quantum information of the two qubits, and the more cross-QPU operations are introduced when the two are allocated to different QPUs. Therefore, when allocating qubits, it is hoped that the quantum information correlation between the qubits allocated to the same QPU is strong (that is, the number of two-qubit gates between the qubits on the same QPU is large), while the quantum information correlation between the qubits on different QPUs is weak (that is, the number of two-qubit gates between the qubits on different QPUs is small).
[0161] At the same time, considering that all single-qubit operations (single-qubit gates, measurements, resets, etc.) are local operations (i.e., operations within the QPU), all single-qubit operations in the quantum circuit can be ignored, and the correlation of quantum information between qubits can be converted into a weighted undirected graph of the quantum circuit according to the number of double-qubit gates between different qubits. For classical control quantum operations, although this type of operation involves two qubits, only classical information needs to be transmitted between the two qubits. Therefore, if the two qubits involved in the classical control quantum operation are assigned to different QPUs, only classical information needs to be transmitted between the QPUs without the need for quantum channels, so it can also be regarded as a local operation.
[0162] When constructing a weighted undirected graph based on the input quantum circuit, the number of nodes in the weighted undirected graph is equal to the number of qubits in the quantum circuit (that is, the circuit width), and each node in the weighted undirected graph corresponds one-to-one to a qubit in the quantum circuit, that is, node 1 corresponds to qubit 0, ..., and node n corresponds to qubit n-1. At the same time, if there is no two-qubit gate between two qubits, there is no edge between the nodes corresponding to the two qubits; and if there is a two-qubit gate between two qubits, there is an edge between the nodes corresponding to the two qubits, and the weight of the edge is equal to the number of two-qubit gates between the two qubits. For example Figure 5 is a schematic diagram of the structure of another quantum circuit. Figure 6 for Figure 5 Weighted undirected graph of the quantum circuit shown.
[0163] When allocating qubits, we hope that the quantum information correlation between qubits on the same QPU is strong, while the quantum information correlation between qubits on different QPUs is weak. Translated into the language of graphs, we hope to divide the weighted undirected graph of the quantum circuit into k clusters, where the connections within the clusters are denser and the connections between clusters are sparser. Obviously, this division method corresponds exactly to the objective function of the k-normalized cut problem. Therefore, the problem of allocating logical qubits in a quantum circuit to k QPU hardware can be transformed into solving the k-normalized cut problem on the weighted undirected graph of the quantum circuit.
[0164] Among them, the construction of the normalized cut problem is shown in the above equations (1) and (2). After derivation, its objective function can be converted into a function of the normalized Laplace matrix and the solution of the partitioning method. In this way, the normalized cut problem can be constructed based on the normalized Laplace matrix, and the target solution of the normalized cut problem can be determined based on the normalized Laplace matrix, so as to determine the first characterization information based on the target solution. In this way, the normalized cut problem can be used to balance the size of each cluster after partitioning, so that the allocation of quantum bits of the quantum circuit is more reasonable.
[0165] Moreover, the normalized cut problem does not need to introduce additional constraints when solving the partitioning method, and a relatively uniform partitioning can be obtained. At the same time, compared with the minimum cut problem, the partitioning method does not need to be restricted to the condition that the number of quantum bits allocated to each QPU is equal. Therefore, in some practical application scenarios, the solution given by the normalized cut problem is more flexible and has better effects.
[0166] Optionally, under the condition that the indicator vector of the subset is a continuous value, the objective function is:
[0167] min(Tr(H T L n H));
[0168] in, H=D 1 / 2 V, H T H=I, D is the degree matrix, V is the matrix composed of indicator vectors of K disjoint subsets, L n is the normalized Laplacian matrix.
[0169] In this implementation, we want to solve the k-normalized cut problem on a graph G(V,E) containing n (i.e., N) nodes, which can be solved by k indicator vectors To represent the assignment relationship between nodes and clusters. Specifically, for the i-th cluster, the indicator vector is a column vector of n rows, that is Each vector element is defined as shown in the following equation (12).
[0170]
[0171] That is, if the node labeled j belongs to the i-th cluster, then the j-th vector element of the i-th indicator vector is Otherwise zero.
[0172] After sorting the k indicator vectors by column, we can obtain a matrix with n rows and k columns. Note that any two indicator vectors are orthogonal, so V T V=I, where I is a unit matrix with k rows and k columns.
[0173] According to the definition of degree matrix, it is not difficult to obtain the following equations (13) and (14).
[0174]
[0175]
[0176] It can be seen that the matrix V satisfies V T DV=I.
[0177] According to the properties of the Laplace matrix, the following equation (15) can be obtained.
[0178]
[0179] Considering that when the node labeled j and the node labeled k both belong to the i-th cluster or neither belongs to the i-th cluster, (v j,i -v k,i )=0.
[0180] Therefore, the above formula (15) can be transformed into the following formula (16).
[0181]
[0182] Easy to verify
[0183] Therefore, the following conclusion (17) can be obtained.
[0184]
[0185] Based on the above derivation, the problem of solving k-normalized cuts on a graph G(V,E) containing n nodes can be transformed into an optimization problem: given the Laplace matrix L corresponding to the graph, find a matrix V with n rows and k columns that satisfies formula (12), so that Tr(V T LV) takes the minimum value.
[0186] However, the normalized cut problem is a non-deterministic polynomial-hard (NP-hard) problem and is difficult to solve accurately. Therefore, it is necessary to relax the constraints of the optimization problem and use the spectral partitioning method to solve the relaxed version of the normalized cut problem.
[0187] Since solving a discrete optimization problem such as the normalized cut problem is NP-hard, in order to approximate the solution, it is necessary to relax the constraints of the matrix elements of the matrix V from the discrete values of equation (12) to continuous values (that is, the matrix elements of the matrix V can take any value in the real number range). According to the derivation, under the continuous value condition, the matrix V should satisfy V T DV=I, and variable substitution H=D 1 / 2 V, so the optimization problem can be transformed into: given the Laplace matrix L corresponding to the graph, find a matrix In meeting H T Under the condition of H=I, Tr(H T D -1 / 2 LD -1 / 2 H) takes the minimum value.
[0188] In this implementation, the objective function can be converted into a function of a normalized Laplace matrix and a solution of the partitioning method, so that the exact solution of the normalized cut problem can be determined based on the normalized Laplace matrix through a spectral partitioning method.
[0189] Optionally, determining a target solution of a normalized cut problem based on the normalized Laplace matrix includes:
[0190] Determine K eigenvectors of the normalized Laplace matrix, where the K eigenvectors are eigenvectors of K target eigenvalues, and the target eigenvalues are less than or equal to other eigenvalues of the eigenvalues of the normalized Laplace matrix except the K target eigenvalues;
[0191] The target matrix formed by the K eigenvectors is determined as the target solution of the normalized cut problem.
[0192] Since the eigenvalues of the Laplacian matrix are called the spectrum of the Laplacian matrix, the method of segmenting a graph using the eigenvalues and eigenvectors of the Laplacian matrix is called spectral segmentation.
[0193] In this embodiment, by using the spectrum segmentation method, according to the Courant-Fisher theorem, the solution of the above optimization problem corresponds to the normalized Laplace matrix L n =D -1 / 2 LD -1 / 2 The eigenvectors corresponding to the first k smallest eigenvalues (i.e., target eigenvalues) of are arranged in columns. n The n eigenvalues of are arranged from small to large λ1≤λ2≤…≤λ n , take the eigenvectors corresponding to the first k eigenvalues And arrange the resulting matrix by columns This is the solution to the above optimization problem.
[0194] In this way, the target solution of the normalized cut problem can be determined based on the normalized Laplace matrix.
[0195] Optionally, the determining the first characterization information based on the target solution includes:
[0196] For each node, obtaining an indication vector corresponding to the node in the target solution to obtain the first representation information;
[0197] The indicator vector corresponding to the node is used to characterize the connection tightness between the node and other nodes in the weighted undirected graph.
[0198] In this implementation, for the eigenvectors of the eigenvalues of the normalized Laplace matrix, their vector elements correspond one-to-one to the nodes in the graph. Accordingly, for each node, the vector element corresponding to the node in the target solution can be obtained, thereby obtaining the indicator vector corresponding to the node and obtaining the first representation information.
[0199] The indication vector corresponding to the node may be composed of all or part of the vector elements corresponding to the node in the target solution. In this way, the first representation information is determined based on the target solution.
[0200] Optionally, the K feature vectors are arranged in columns to obtain the target matrix, and the obtaining the indicator vector corresponding to the node in the target solution includes:
[0201] Obtain a row vector of a row corresponding to the node in the target matrix to obtain an indicator vector corresponding to the node.
[0202] In this embodiment, the indicator vector of the node can be formed by all the vector elements corresponding to the node in the target solution, and the eigenvalues and eigenvectors of the normalized Laplace matrix are solved to obtain the matrix Afterwards, the i-th row of the matrix U can be taken as the indicator vector corresponding to the i-th node. In this way, the accuracy of determining the indicator vector corresponding to the node can be improved, thereby improving the accuracy of node segmentation in the graph, and further improving the accuracy of quantum bit allocation in the quantum circuit.
[0203] Optionally, the first characterization information includes an indicator vector corresponding to each qubit, and the distance between two indicator vectors can characterize the closeness of the connection between the qubits corresponding to the two indicator vectors;
[0204] The step S103 specifically includes:
[0205] Based on the first representation information, clustering the quantum bits of the quantum circuit according to the distances between different indicator vectors to obtain K cluster sets, where K is the target number;
[0206] Based on the K cluster sets, a distribution scheme of the quantum bits of the quantum circuit on the target number of quantum processing units is determined.
[0207] After obtaining the indicator vector corresponding to each node (i.e., each quantum bit), it is necessary to obtain discrete segmentation based on the indicator vector under continuous value. Since the distance between the indicator vectors can characterize the connection tightness between different quantum bits in the quantum circuit, the quantum bits can be clustered with the help of the distance between the indicator vectors, thereby achieving the purpose of discrete segmentation.
[0208] The k-means algorithm can be used to cluster the nodes (i.e., quantum bits) in the graph. The k-means algorithm is a commonly used clustering algorithm, which aims to divide n indicator vectors (multidimensional data points) into k clusters, so that each data point belongs to the cluster to which the cluster center closest to it belongs. The specific process is as follows:
[0209] Step 1: Randomly select k data points from n data points as the centers of the initial k clusters;
[0210] Step 2: Calculate the distances from other data points to these k centers, and assign each data point to the cluster to which the center closest to it belongs;
[0211] Step 3: For each cluster, recalculate the center point of the cluster based on all the data points belonging to the cluster;
[0212] Step 4: Repeat steps 2 and 3 until the clustering method no longer changes or the maximum number of iterations is reached.
[0213] There is a correspondence between the vector elements of the eigenvector of the normalized Laplace matrix and the nodes in the graph, and their values contain information about the density of connections between the nodes. The tighter the connection between two nodes, the closer the values of their corresponding vector elements in a certain eigenvector. Therefore, if the indicator vector corresponding to each node is used as input to run the k-means algorithm, it is obvious that the tighter the connection, the closer the spatial distance of the corresponding indicator vector will be, and the more likely it is that they will be classified into the same cluster.
[0214] In this way, the allocation scheme determined based on the clustering results can achieve the effect that the two-qubit gate operations within each QPU are more dense, while the two-qubit gate operations across QPUs are relatively sparse.
[0215] Figure 7 This is a specific example of a flow chart of allocating quantum bits in a quantum circuit to quantum hardware with a multi-QPU architecture. Figure 7 As shown, based on the connection relationship of all two-qubit gates in the quantum circuit, the weighted undirected graph of the circuit and the matrix representation of the corresponding weighted undirected graph can be obtained. The normalized cut problem can be tried to be solved on the weighted undirected graph of the quantum circuit through the spectral partitioning method, and the quantum bits in the quantum circuit can be allocated to different QPUs according to the solution results.
[0216] The exact solution to the normalized cut problem can be a matrix where the eigenvectors corresponding to the first k smallest eigenvalues of the normalized Laplace matrix are arranged in columns. The i-th row of the matrix U can be used as the indicator vector corresponding to the i-th node, and the n indicator vectors can be input into the k-means algorithm to be divided into k clusters, so that an allocation scheme can be obtained, and the quantum bits in the quantum circuit can be allocated to different QPUs based on the allocation scheme.
[0217] In one example, the specific process is as follows:
[0218] Input: circuit_list, the instruction list corresponding to the quantum circuit; n, the number of quantum bits in the quantum circuit; k, the number of QPUs in the target hardware;
[0219] Output: Allocation of qubits to QPUs.
[0220] Step 1: According to the number of quantum bits n of the input quantum circuit, initialize two two-dimensional matrices, A and D, as the adjacency matrix and degree matrix of the weighted undirected graph of the quantum circuit, respectively. The number of rows and columns of the two matrices are both equal to n, and their matrix elements are all 0;
[0221] Step 2: Input the quantum circuit instruction list circuit_list by looping, set the current traversed operation as operation, and perform the following operations:
[0222] Operation a) If operation is a single-qubit operation (such as a single-qubit gate, measurement, or reset operation) or a classically controlled quantum operation, no operation is performed and the next operation instruction is traversed. If operation is a two-qubit gate, the two elements in the qubit list which_qubit that it acts on are recorded as vertex0 and vertex1 respectively. The values of the two matrix elements (vertex0+1, vertex1+1) and (vertex1+1, vertex0+1) in matrix A are increased by 1 respectively, and then the next operation instruction is traversed. After traversing the entire circuit_list, matrix A is the adjacency matrix of the weighted undirected graph of the input quantum circuit.
[0223] Step 3: Initialize the loop variable i, whose initial value is 1; if the value of i is less than or equal to n, then sum the values of all matrix elements in the i-th row of matrix A, assign the sum to the (i,i) matrix element of matrix D, and add 1 to the value of the loop variable i; if the value of i is greater than n, it means that all rows of matrix A have been traversed, and matrix D is now the degree matrix of the weighted undirected graph of the input quantum circuit, and the loop ends;
[0224] Step 4: Perform matrix operations to calculate the value of matrix D minus matrix A, and assign it to matrix L. Matrix L is the Laplace matrix of the weighted undirected graph of the input quantum circuit.
[0225] Step 5: Perform matrix operations to calculate the normalized Laplacian matrix L n =D -1 / 2 LD -1 / 2 ;
[0226] Step 6: Calculate the normalized Laplacian matrix L n The first k smallest eigenvalues and corresponding eigenvectors of are assumed to be λ1≤λ2≤…≤λ k , and their corresponding normalized eigenvectors are The matrix composed of these k eigenvectors arranged in columns is recorded as matrix U (i.e., target matrix), that is,
[0227] Step 7: Let the jth row of matrix U be the row vector Will and the number of QPUs k of the target hardware as input to run the k-means algorithm to divide the n row vectors into k clusters;
[0228] Step 8: Based on the output of the k-means algorithm, obtain the allocation scheme of quantum bits to QPUs.
[0229] Since only the matrix representation of the weighted undirected graph is needed in the subsequent spectrum segmentation process, the required adjacency matrix can be generated directly according to the instruction list of the quantum circuit during the algorithm process.
[0230] Since the qubits in a quantum circuit generally start from zero, the row or column index corresponding to a qubit in the adjacency matrix of the quantum circuit is 1 greater than its qubit. After obtaining the qubit acted upon by the two-qubit gate, one can be added to the value of the qubit to obtain the matrix element that needs to be updated, and the value of the corresponding matrix element in the adjacency matrix is updated.
[0231] The row vector of the j-th row of matrix U It corresponds to node j in the weighted undirected graph, that is, it corresponds to the quantum bit j-1 in the quantum circuit.
[0232] In order to facilitate understanding of the solution of this embodiment, a specific example is given below. Figure 8 The quantum circuit shown contains eight qubits distributed across hardware consisting of two QPUs.
[0233] Based on the connectivity of the two-qubit gates in the quantum circuit, we can construct Figure 8 The weighted undirected graph of a quantum circuit is Fig. 9As shown in the figure, the circle represents the node, the value inside the circle represents the node number, the node numbered i corresponds to the quantum bit i-1 in the quantum circuit, and the value in the middle of the undirected edge is the weight corresponding to the edge, that is, the number of two-qubit gates between the quantum bits corresponding to the two nodes. It should be noted that in the actual algorithm, it is not necessary to construct a weighted undirected graph, and the adjacency matrix of the weighted undirected graph can be directly generated through the instruction list of the quantum circuit.
[0234] Then obtain the Laplace matrix corresponding to the weighted undirected graph and calculate the normalized Laplace matrix.
[0235] Fig. 9 The Laplacian matrix and normalized Laplacian matrix corresponding to the weighted undirected graph shown are as follows:
[0236]
[0237]
[0238] Since the target hardware contains two QPUs, that is, k = 2, it is necessary to calculate the eigenvectors corresponding to the first two smallest eigenvalues and arrange them in columns to form a matrix
[0239]
[0240] The row vector of each row of matrix U Enter the k-means algorithm to classify the 8 two-dimensional vectors into two different clusters. The classification results achieved by the k-means algorithm in the mathematical toolkit of the programming language Python are visualized as follows Fig.10 shown.
[0241] from Fig.10 It can be seen that the eight two-dimensional vectors are divided into two clusters, cluster 1001 and cluster 1002, which are marked with diamond points and circles respectively. Fig.10 The star-shaped points represent the centers of the two clusters, namely center point 1003 and center point 1004. The assignment of qubits to QPUs given by the k-means clustering algorithm is: QPU1: {0, 1, 3, 7}, QPU2: {2, 4, 5, 6}, which means that qubits with qubits of 0, 1, 3, and 7 are assigned to QPU1 (the cluster formed by the dots), and qubits with qubits of 2, 4, 5, and 6 are assigned to QPU2 (the cluster formed by the diamond dots).
[0242] In a weighted undirected graph, the above allocation scheme is expressed as Fig.11As shown in the cut, it can be seen that under such allocation, the number of operations within QPU1 is: 3+2+3=8, the number of operations within QPU2 is: 1+2+2+2+2=9, and the number of cross-QPU operations is only 1+1+1=3, which meets the requirement of dense operations within QPU and sparse operations between QPUs.
[0243] In addition, the main goal of implementing graph partitioning based on the minimum cut problem is to reduce the number of cross-QPU operations as much as possible. Therefore, the problem of allocating quantum bits to QPUs is transformed into a problem of solving the minimum cut problem on a weighted undirected graph, and at the same time, the size of the subgraphs cut off from each part is restricted. In this embodiment, the goal is to obtain an allocation scheme with as many operations as possible within the QPU and as few operations as possible across the QPU. Therefore, the problem of allocating quantum bits to QPUs is transformed into a problem of solving the normalized cut problem on a weighted undirected graph. At the same time, since the size of each cluster after partitioning is included in the objective function of the normalized cut, there is no need to add additional restrictions during the specific solution to ensure that the size of each cluster after partitioning is relatively uniform.
[0244] Considering the structural characteristics of the implemented multi-QPU hardware, that is, the density of the internal connection of the QPU is much higher than the density of the connection between QPUs, when allocating quantum bits to different QPUs, it is necessary to make full use of the structural characteristics of the input quantum circuit and provide a quantum bit allocation scheme that is more in line with the hardware structural characteristics. Obviously, in this context, it is more reasonable to transform the quantum bit allocation problem into a normalized cut problem on a weighted undirected graph in this embodiment.
[0245] At the same time, since no additional restrictions are added when solving the normalized cut problem, the allocation method provided in this embodiment is applicable to a wider range of scenarios. For example, in actual application scenarios, it is only necessary to ensure that the allocation method can be run on the target hardware, and the restriction on the equal number of quantum bits allocated to different QPUs is not necessary. Some non-completely uniform allocations can also be run on the target hardware, and may have better results.
[0246] For example, a quantum circuit containing 8 qubits is distributed to two QPUs, each of which can support 5 qubits. The weighted undirected graph corresponding to the quantum circuit is as follows: Fig.12As shown, according to the minimum cut problem, the graph is partitioned to allocate quantum bits, that is, each subgraph is guaranteed to contain 4 nodes after partitioning, and the number of cut edges is the smallest. Then, corresponding to the allocation scheme of QPU1:{0,1,2,3}, QPU2:{4,5,6,7} (i.e., the partitioning method based on the dotted line 1201), the number of operations across QPUs is 4. If the allocation is performed according to the scheme of this embodiment, the allocation scheme is QPU1:{0,1,3}, QPU2:{2,4,5,6,7} (i.e., the partitioning method based on the dotted line 1202), and the number of operations across QPUs is 3. Obviously, the quantum circuits corresponding to these two allocation methods can be run on the target hardware, and the number of operations across QPUs in the allocation scheme given in this embodiment is less.
[0247] In this embodiment, when solving the normalization problem, the spectral segmentation method is used. The normalization cut problem is solved by using the spectral segmentation method, and the eigenvectors corresponding to the first k smallest eigenvalues of the normalized Laplace matrix are specifically calculated. Then, according to the solved eigenvectors, the indicator vectors corresponding to each node in the weighted undirected graph are obtained, and then the k-means algorithm is used to cluster these indicator vectors, so as to obtain the quantum bit allocation plan according to the clustering results.
[0248] Since the vector elements of a certain eigenvector of the normalized Laplace matrix correspond one-to-one to the nodes in the weighted undirected graph, and their values contain information about the closeness of the node connections: the closer the connection between two nodes, the closer the values of their corresponding vector elements, and the closer the distance in the vector space, so they are more likely to be clustered into the same cluster by the k-means algorithm, which can make the allocation of quantum bits more reasonable.
[0249] Second embodiment
[0250] like Fig.13 As shown, the present disclosure provides a distributed processing device 1300 for a quantum circuit, comprising:
[0251] An acquisition module 1301 is used to acquire an instruction list of a quantum circuit and acquire a target number of quantum processing units that execute the quantum circuit;
[0252] A first determining module 1302 is used to determine first characterization information based on the instruction list, where the first characterization information is used to characterize the tightness of connection between different quantum bits of the quantum circuit, and the tightness of connection indicates the number of two-qubit gates acting between the quantum bits of the quantum circuit;
[0253] A second determination module 1303 is used to determine, based on the first characterization information, a distribution scheme of the quantum bits of the quantum circuit on the target number of quantum processing units;
[0254] The processing module 1304 is used to allocate the quantum bits in the quantum circuit to the target number of quantum processing units to process the quantum circuit based on the allocation scheme.
[0255] Optionally, the first determining module 1302 includes:
[0256] A first determination submodule is configured to determine, based on the instruction list, second characterization information of a weighted undirected graph of the quantum circuit, the weighted undirected graph comprising: nodes and undirected edges connecting the nodes, the nodes corresponding one-to-one to the quantum bits of the quantum circuit, the undirected edges indicating that a two-qubit gate acts between two quantum bits corresponding to two nodes, and the second characterization information comprising adjacency information, the adjacency information indicating the number of two-qubit gates acting between two quantum bits corresponding to two nodes connected by the undirected edges;
[0257] The second determining submodule is configured to determine the first representation information based on the second representation information.
[0258] Optionally, the first determining submodule includes:
[0259] A first determining unit, configured to determine a weighted undirected graph of the quantum circuit based on the instruction list;
[0260] The first acquisition unit is used to acquire second representation information of the weighted undirected graph.
[0261] Optionally, the first determining submodule includes:
[0262] A second acquisition unit, configured to acquire a target operation instruction of a two-qubit gate of the quantum circuit based on the instruction list;
[0263] A second determination unit is used to determine the weight information of the undirected edge in the weighted undirected graph based on the quantum bit acted upon by the target operation instruction, and obtain the adjacency information, wherein the adjacency information includes the weight information of the undirected edge in the weighted undirected graph, and the weight information indicates the number of two-qubit gates acting between two quantum bits corresponding to two nodes connected by the undirected edge.
[0264] Optionally, the second determining unit is specifically configured to:
[0265] In the case where the target operation instruction is traversed based on the instruction list, adding 1 to the weight information of the target undirected edge in the adjacency information, wherein the target undirected edge is an undirected edge connecting the nodes corresponding to the quantum bits acted upon by the target operation instruction;
[0266] When the instruction list traversal is completed, the adjacency information is obtained.
[0267] Optionally, the second characterization information further includes degree information, where the degree information indicates the number of two-qubit gates associated with the qubit corresponding to the node, and the first determination submodule further includes:
[0268] A first operation unit is used for adding the target information of the node in the adjacency information for any node in the weighted undirected graph to obtain the degree information;
[0269] The target information indicates weight information of each undirected edge associated with the same node.
[0270] Optionally, the second representation information further includes degree information, the adjacency information is represented by an adjacency matrix, the degree information is represented by a degree matrix, and the second determination submodule includes:
[0271] A second operation unit is used to subtract the adjacency matrix from the degree matrix to obtain the Laplacian matrix of the weighted undirected graph;
[0272] a normalization unit, configured to normalize the Laplace matrix based on the degree matrix;
[0273] A third determining unit is configured to determine the first representation information based on the normalized Laplace matrix.
[0274] Optionally, the third determining unit includes:
[0275] A first determination subunit is used to determine a target solution of a normalized cut problem based on the normalized Laplace matrix, wherein the normalized cut problem is to divide the nodes in the weighted undirected graph into K non-overlapping subsets so that the target function reaches a minimum value, and the target function is a function that characterizes the connection tightness of the K non-overlapping subsets, and the target function is inversely proportional to the connection tightness between the quantum bits corresponding to the nodes in the subset, and is directly proportional to the connection tightness between the quantum bits corresponding to the nodes in different subsets, and K is the target number;
[0276] The second determining subunit is configured to determine the first representation information based on the target solution.
[0277] Optionally, under the condition that the indicator vector of the subset is a continuous value, the objective function is:
[0278] min(Tr(H T L n H));
[0279] in, H=D 1 / 2 V, H TH=I, D is the degree matrix, V is the matrix composed of indicator vectors of K disjoint subsets, L n is the normalized Laplacian matrix.
[0280] Optionally, the first determining subunit is specifically configured to:
[0281] Determine K eigenvectors of the normalized Laplace matrix, where the K eigenvectors are eigenvectors of K target eigenvalues, and the target eigenvalues are less than or equal to other eigenvalues of the eigenvalues of the normalized Laplace matrix except the K target eigenvalues;
[0282] The target matrix formed by the K eigenvectors is determined as the target solution of the normalized cut problem.
[0283] Optionally, the second determining subunit is specifically configured to:
[0284] For each node, obtaining an indication vector corresponding to the node in the target solution to obtain the first representation information;
[0285] The indicator vector corresponding to the node is used to characterize the connection tightness between the node and other nodes in the weighted undirected graph.
[0286] Optionally, the K feature vectors are arranged in columns to obtain the target matrix, and the second determining subunit is specifically used to:
[0287] Obtain a row vector of a row corresponding to the node in the target matrix to obtain an indicator vector corresponding to the node.
[0288] Optionally, the first characterization information includes an indicator vector corresponding to each quantum bit, and the distance between two indicator vectors can characterize the closeness of the connection between the quantum bits corresponding to the two indicator vectors; the second determination module 1303 is specifically used to:
[0289] Based on the first representation information, clustering the quantum bits of the quantum circuit according to the distances between different indicator vectors to obtain K cluster sets, where K is the target number;
[0290] Based on the K cluster sets, a distribution scheme of the quantum bits of the quantum circuit on the target number of quantum processing units is determined.
[0291] The distributed processing device 1300 for quantum circuits provided in the present disclosure can implement each process implemented in the distributed processing method embodiment for quantum circuits, and can achieve the same beneficial effects. To avoid repetition, it will not be described here.
[0292] In the technical solution of the present disclosure, the collection, storage, use, processing, transmission, provision and disclosure of user personal information involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0293] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.
[0294] Fig.14 A schematic block diagram of an example electronic device that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.
[0295] like Fig.14 As shown, the device 1400 includes a computing unit 1401, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 1402 or a computer program loaded from a storage unit 1408 into a random access memory (RAM) 1403. In the RAM 1403, various programs and data required for the operation of the device 1400 can also be stored. The computing unit 1401, the ROM 1402, and the RAM 1403 are connected to each other via a bus 1404. An input / output (I / O) interface 1405 is also connected to the bus 1404.
[0296] A number of components in the device 1400 are connected to the I / O interface 1405, including: an input unit 1406, such as a keyboard, a mouse, etc.; an output unit 1407, such as various types of displays, speakers, etc.; a storage unit 1408, such as a disk, an optical disk, etc.; and a communication unit 1409, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 1409 allows the device 1400 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0297] The computing unit 1401 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 1401 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 1401 performs the various methods and processes described above, such as the distributed processing method of quantum circuits. For example, in some embodiments, the distributed processing method of quantum circuits may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 1408. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 1400 via the ROM 1402 and / or the communication unit 1409. When the computer program is loaded into the RAM 1403 and executed by the computing unit 1401, one or more steps of the distributed processing method of quantum circuits described above may be performed. Alternatively, in other embodiments, the computing unit 1401 may be configured to execute the distributed processing method of the quantum circuit by any other appropriate means (for example, by means of firmware).
[0298] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0299] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0300] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0301] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0302] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.
[0303] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship with each other. The server may be a cloud server, a server of a distributed system, or a server combined with a blockchain.
[0304] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.
[0305] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. A distributed processing method for quantum circuits, include: Obtaining an instruction list of a quantum circuit and obtaining a target number of quantum processing units executing the quantum circuit; Based on the instruction list, second characterization information of a weighted undirected graph of the quantum circuit is determined, the weighted undirected graph comprising: nodes and undirected edges connecting the nodes, the nodes corresponding to the quantum bits of the quantum circuit one-to-one, the undirected edges indicating that a two-qubit gate acts between two quantum bits corresponding to two nodes, the second characterization information comprising adjacency information, the adjacency information comprising a weight of the undirected edge in the weighted undirected graph, the weight indicating the number of two-qubit gates acting between two quantum bits corresponding to two nodes connected by the undirected edge; Determine first characterization information based on the second characterization information, where the first characterization information is used to characterize the tightness of connection between different quantum bits of the quantum circuit, where the tightness of connection indicates the number of two-qubit gates acting between the quantum bits of the quantum circuit; Based on the first characterization information, determining a distribution scheme of the quantum bits of the quantum circuit on the target number of quantum processing units; Based on the allocation scheme, the quantum bits in the quantum circuit are allocated to the target number of quantum processing units to process the quantum circuit.
2. The method according to claim 1, in, The step of determining second representation information of a weighted undirected graph of the quantum circuit based on the instruction list includes: Based on the instruction list, determining a weighted undirected graph of the quantum circuit; Second representation information of the weighted undirected graph is obtained.
3. The method according to claim 1, in, The step of determining second representation information of a weighted undirected graph of the quantum circuit based on the instruction list includes: Based on the instruction list, obtaining a target operation instruction of a two-qubit gate of the quantum circuit; Based on the quantum bit acted upon by the target operation instruction, the weight information of the undirected edge in the weighted undirected graph is determined to obtain the adjacency information, wherein the adjacency information includes the weight information of the undirected edge in the weighted undirected graph, and the weight information indicates the number of two-qubit gates acting between the two quantum bits corresponding to the two nodes connected by the undirected edge.
4. The method according to claim 3, in, The step of determining the weight information of the undirected edge in the weighted undirected graph based on the quantum bit acted upon by the target operation instruction to obtain the adjacency information includes: In the case where the target operation instruction is traversed based on the instruction list, adding 1 to the weight information of the target undirected edge in the adjacency information, wherein the target undirected edge is an undirected edge connecting the nodes corresponding to the quantum bits acted upon by the target operation instruction; When the instruction list traversal is completed, the adjacency information is obtained.
5. The method according to claim 1, in, The second characterization information further includes degree information indicating a number of two-qubit gates associated with a qubit corresponding to the node, the method further comprising: For any node in the weighted undirected graph, summing the target information of the node in the adjacency information to obtain the degree information; The target information indicates weight information of each undirected edge associated with the same node.
6. The method according to claim 1, in, The second representation information further includes degree information, the degree information includes the weight sum of the undirected edges associated with the nodes in the weighted undirected graph, the adjacency information is represented by an adjacency matrix, the degree information is represented by a degree matrix, and determining the first representation information based on the second representation information includes: Subtracting the adjacency matrix from the degree matrix to obtain the Laplacian matrix of the weighted undirected graph; Based on the degree matrix, normalizing the Laplacian matrix; The first representation information is determined based on the normalized Laplacian matrix.
7. The method according to claim 6, in, The determining the first representation information based on the normalized Laplace matrix includes: Based on the normalized Laplace matrix, determining a target solution of a normalized cut problem, wherein the normalized cut problem is to divide the nodes in the weighted undirected graph into K disjoint subsets so that an objective function reaches a minimum value, wherein the objective function is a function that characterizes the connection tightness of the K disjoint subsets, wherein the objective function is inversely proportional to the connection tightness between the quantum bits corresponding to the nodes in the subset, and is directly proportional to the connection tightness between the quantum bits corresponding to the nodes in different subsets, and K is the target number; Based on the target solution, the first characterization information is determined.
8. The method according to claim 7, in, Under the condition that the indicator vector of the subset is a continuous value, the objective function is: min(Tr(H T L n H)); in, H=D 1 / 2 V, H T H=I, D is the degree matrix, V is the matrix composed of indicator vectors of K disjoint subsets, L n is the normalized Laplacian matrix.
9. The method according to claim 8, in, Determining a target solution to the normalized cut problem based on the normalized Laplace matrix includes: Determine K eigenvectors of the normalized Laplace matrix, where the K eigenvectors are eigenvectors of K target eigenvalues, and the target eigenvalues are less than or equal to other eigenvalues of the eigenvalues of the normalized Laplace matrix except the K target eigenvalues; The target matrix formed by the K eigenvectors is determined as the target solution of the normalized cut problem.
10. The method according to claim 9, in, The determining the first characterization information based on the target solution includes: For each node, obtaining an indication vector corresponding to the node in the target solution to obtain the first representation information; The indicator vector corresponding to the node is used to characterize the connection tightness between the node and other nodes in the weighted undirected graph.
11. The method according to claim 10, in, The K feature vectors are arranged in columns to obtain the target matrix, and the obtaining of the indicator vector corresponding to the node in the target solution includes: Obtain a row vector of a row corresponding to the node in the target matrix to obtain an indicator vector corresponding to the node.
12. The method according to claim 1, in, The first characterization information includes an indicator vector corresponding to each quantum bit, and the distance between two indicator vectors can characterize the tightness of the connection between the quantum bits corresponding to the two indicator vectors; The step of determining, based on the first characterization information, a distribution scheme of quantum bits of the quantum circuit on the target number of quantum processing units comprises: Based on the first representation information, clustering the quantum bits of the quantum circuit according to the distances between different indicator vectors to obtain K cluster sets, where K is the target number; Based on the K cluster sets, a distribution scheme of the quantum bits of the quantum circuit on the target number of quantum processing units is determined.
13. A distributed processing device for quantum circuits, include: An acquisition module, used to acquire an instruction list of a quantum circuit and a target number of quantum processing units executing the quantum circuit; A first determination submodule is configured to determine second characterization information of a weighted undirected graph of the quantum circuit based on the instruction list, wherein the weighted undirected graph includes: nodes and undirected edges connecting the nodes, wherein the nodes correspond one-to-one to the quantum bits of the quantum circuit, wherein the undirected edges indicate that a two-qubit gate acts between two quantum bits corresponding to two nodes, and wherein the second characterization information includes adjacency information, wherein the adjacency information includes a weight of the undirected edge in the weighted undirected graph, wherein the weight indicates the number of two-qubit gates acting between two quantum bits corresponding to two nodes connected by the undirected edge; A second determination submodule is used to determine first characterization information based on the second characterization information, where the first characterization information is used to characterize the tightness of connection between different quantum bits of the quantum circuit, and the tightness of connection indicates the number of two-qubit gates acting between the quantum bits of the quantum circuit; A second determination module is used to determine, based on the first characterization information, a distribution scheme of the quantum bits of the quantum circuit on the target number of quantum processing units; A processing module is used to allocate the quantum bits in the quantum circuit to the target number of quantum processing units to process the quantum circuit based on the allocation scheme.
14. The device according to claim 13, in, The first determining submodule includes: A first determining unit, configured to determine a weighted undirected graph of the quantum circuit based on the instruction list; The first acquisition unit is used to acquire second representation information of the weighted undirected graph.
15. The device according to claim 13, in, The first determining submodule includes: A second acquisition unit, configured to acquire a target operation instruction of a two-qubit gate of the quantum circuit based on the instruction list; A second determination unit is used to determine the weight information of the undirected edge in the weighted undirected graph based on the quantum bit acted upon by the target operation instruction, and obtain the adjacency information, wherein the adjacency information includes the weight information of the undirected edge in the weighted undirected graph, and the weight information indicates the number of two-qubit gates acting between two quantum bits corresponding to two nodes connected by the undirected edge.
16. The device according to claim 15, in, The second determining unit is specifically configured to: In the case where the target operation instruction is traversed based on the instruction list, adding 1 to the weight information of the target undirected edge in the adjacency information, wherein the target undirected edge is an undirected edge connecting the nodes corresponding to the quantum bits acted upon by the target operation instruction; When the instruction list traversal is completed, the adjacency information is obtained.
17. The device according to claim 13, in, The second characterization information further includes degree information, where the degree information indicates the number of two-qubit gates associated with the qubit corresponding to the node, and the first determination submodule further includes: A first operation unit is used for adding the target information of the node in the adjacency information for any node in the weighted undirected graph to obtain the degree information; The target information indicates weight information of each undirected edge associated with the same node.
18. The device according to claim 13, in, The second representation information further includes degree information, the degree information includes the weight sum of the undirected edges associated with the nodes in the weighted undirected graph, the adjacency information is represented by an adjacency matrix, the degree information is represented by a degree matrix, and the second determination submodule includes: A second operation unit is used to subtract the adjacency matrix from the degree matrix to obtain the Laplacian matrix of the weighted undirected graph; a normalization unit, configured to normalize the Laplace matrix based on the degree matrix; A third determining unit is configured to determine the first representation information based on the normalized Laplace matrix.
19. The device according to claim 18, in, The third determining unit includes: A first determination subunit is used to determine a target solution of a normalized cut problem based on the normalized Laplace matrix, wherein the normalized cut problem is to divide the nodes in the weighted undirected graph into K non-overlapping subsets so that the target function reaches a minimum value, and the target function is a function that characterizes the connection tightness of the K non-overlapping subsets, and the target function is inversely proportional to the connection tightness between the quantum bits corresponding to the nodes in the subset, and is directly proportional to the connection tightness between the quantum bits corresponding to the nodes in different subsets, and K is the target number; The second determining subunit is configured to determine the first representation information based on the target solution.
20. The device according to claim 19, in, Under the condition that the indicator vector of the subset is a continuous value, the objective function is: min(Tr(H T L n H)); in, H=D 1 / 2 V, H T H=I, D is the degree matrix, V is the matrix composed of indicator vectors of K disjoint subsets, L n is the normalized Laplacian matrix.
21. The device according to claim 20, in, The first determining subunit is specifically configured to: Determine K eigenvectors of the normalized Laplace matrix, where the K eigenvectors are eigenvectors of K target eigenvalues, and the target eigenvalues are less than or equal to other eigenvalues of the eigenvalues of the normalized Laplace matrix except the K target eigenvalues; The target matrix formed by the K eigenvectors is determined as the target solution of the normalized cut problem.
22. The device according to claim 21, in, The second determining subunit is specifically used for: For each node, obtaining an indication vector corresponding to the node in the target solution to obtain the first representation information; The indicator vector corresponding to the node is used to characterize the connection tightness between the node and other nodes in the weighted undirected graph.
23. The device according to claim 22, in, The K feature vectors are arranged in columns to obtain the target matrix, and the second determining subunit is specifically used to: Obtain a row vector of a row corresponding to the node in the target matrix to obtain an indicator vector corresponding to the node.
24. The device according to claim 13, in, The first characterization information includes an indicator vector corresponding to each quantum bit, and the distance between two indicator vectors can characterize the connection tightness between the quantum bits corresponding to the two indicator vectors; the second determination module is specifically used to: Based on the first representation information, clustering the quantum bits of the quantum circuit according to the distances between different indicator vectors to obtain K cluster sets, where K is the target number; Based on the K cluster sets, a distribution scheme of the quantum bits of the quantum circuit on the target number of quantum processing units is determined.
25. An electronic device, include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 12.
26. A non-transitory computer-readable storage medium storing computer instructions, in, The computer instructions are used to cause the computer to execute the method according to any one of claims 1-12.
27. A computer program product comprising a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 12.
