Disclosure of Invention
The invention aims to provide a quantum computing task scheduling method, a device, a medium and equipment for a quantum cloud platform, which are used for solving the problem of resource scheduling caused by incapability of interconnection and intercommunication between quantum cloud platforms.
According to an aspect of the present invention, there is provided a method for quantum computing task scheduling of a quantum cloud platform, including: obtaining a quantum computing resource list from one or more quantum cloud platforms; selecting quantum computing resources for a pre-created quantum computing circuit from the quantum computing resource list; generating a quantum computing task based on the quantum computing circuit and the quantum computing resource; sending a quantum computing task to a quantum cloud platform to which the quantum computing resource belongs; and acquiring an execution result of the quantum computing task from the quantum cloud platform.
According to one embodiment of the invention, the obtaining a quantum computing resource list from one or more quantum cloud platforms includes: according to the user rights of a user on one or more quantum cloud platforms, quantum computing resources are respectively obtained from the corresponding quantum cloud platforms; and forming a quantum computing resource list according to the acquired quantum computing resources.
According to one embodiment of the present invention, the generating a quantum computing task based on the quantum computing circuit and the quantum computing resource includes: judging whether the quantum computing circuit meets the operation requirement of a quantum cloud platform to which the selected quantum computing resource belongs; if not, translating the quantum computing circuit into a quantum computing circuit suitable for being executed by a quantum cloud platform to which the selected quantum computing resource belongs, and combining the translated quantum computing circuit with the selected quantum computing resource to generate a quantum computing task; if so, directly combining the quantum computing circuit with the selected quantum computing resource to generate a quantum computing task.
According to one embodiment of the invention, the method further comprises: and if the execution result of the quantum computing task is that the execution fails, reselecting the quantum computing resource for the quantum computing circuit from the quantum computing resource list, and retransmitting the quantum computing task to a quantum cloud platform to which the reselected quantum computing resource belongs.
According to one embodiment of the invention, the one or more quantum cloud platforms comprise a target quantum cloud platform, a local quantum cloud platform; the method further comprises the steps of: if the selected quantum computing resource is located on the target quantum cloud platform, sending the quantum computing task to the target quantum cloud platform, configuring the quantum computing resource of the local quantum cloud platform for the quantum computing circuit, and sending the quantum computing resource to the local quantum cloud platform after the quantum computing task is generated.
According to one embodiment of the invention, the method further comprises: and carrying out consistency comparison on task execution results respectively acquired from the target quantum cloud platform and the local quantum cloud platform.
According to one embodiment of the invention, the quantum computing resource comprises a quantum simulator and/or a quantum computer.
According to another aspect of the present invention, there is provided a quantum computing task scheduling apparatus of a quantum cloud platform, including: a resource acquisition module configured to acquire a quantum computing resource list from one or more quantum cloud platforms; a resource allocation module configured to select quantum computing resources for a pre-created quantum computing circuit from the quantum computing resource list; the task scheduling module is configured to generate a quantum computing task based on the quantum computing circuit and the quantum computing resource and send the quantum computing task to a quantum cloud platform to which the quantum computing resource belongs; and the result acquisition module is configured to acquire the execution result of the quantum computing task from the quantum cloud platform.
According to another aspect of the invention, there is provided a computer readable storage medium storing a computer program which, when executed by a processor, implements a method of quantum computing task scheduling for a quantum cloud platform as previously described.
According to another aspect of the present invention, there is provided a computer apparatus comprising: a processor; and the memory stores a computer program which is executed by the processor to realize the quantum computing task scheduling method of the quantum cloud platform.
Compared with the prior art, the invention has the beneficial effects that:
(1) Resource sharing
The quantum cloud platforms are isolated from each other and cannot be compatible, and the quantum cloud platform and the method can obtain quantum computing resources of one or more quantum cloud platforms by using the user rights, so that quantum computing resources of the quantum cloud platforms can be shared, and more convenient resource selection can be provided for users.
(2) Good compatibility
The user only needs to log in one quantum cloud platform by using the user authority and create a quantum computing task on the quantum cloud platform, when the quantum computing task needs to be executed by the target quantum cloud platform, the quantum computing circuit of the quantum computing task is translated, and the translated quantum computing circuit is suitable for the selected target quantum computing resource as the rear end of the computing task, so that the computing resource requirement of more computing tasks is met.
(3) Simple and convenient
The user can generate a quantum computing circuit in a dragging mode by utilizing a graphical programming mode, and task information and task execution results submitted to a third party quantum cloud platform can be obtained through a local quantum cloud platform after the quantum computing task is submitted.
Detailed Description
The invention has the conception that: the method comprises the steps that a quantum cloud platform in which a user logs in currently is utilized to obtain quantum computing resources from one or more quantum cloud platforms by utilizing user rights to form a quantum computing resource list; selecting quantum computing resources from a quantum computing resource list for a pre-created quantum computing circuit, thereby generating a quantum computing task; and sending the quantum computing task to a target quantum cloud platform corresponding to the selected quantum computing resource, and acquiring an execution result of the quantum computing task from the target quantum cloud platform.
The invention discloses a quantum computing task scheduling method of a quantum cloud platform, which comprises the following steps:
obtaining a quantum computing resource list from one or more quantum cloud platforms;
selecting quantum computing resources for a pre-created quantum computing circuit from the quantum computing resource list;
generating a quantum computing task based on the quantum computing circuit and the quantum computing resource;
sending a quantum computing task to a quantum cloud platform to which the quantum computing resource belongs;
and acquiring an execution result of the quantum computing task from the quantum cloud platform.
Hereinafter, embodiments of the present invention will be described in detail with reference to the accompanying drawings.
As shown in fig. 1, a method for quantum computing task scheduling of a quantum cloud platform is provided, which includes the following steps:
s1: the first quantum cloud platform acquires a quantum computing resource list from one or more second quantum cloud platforms; the user logs in to a first quantum cloud platform (also called a local quantum cloud platform), the first quantum cloud platform can acquire quantum computing resources from one or more second quantum cloud platforms by using user rights on one hand, and can acquire the quantum computing resources of the first quantum cloud platform on the other hand, and a quantum computing resource list is formed according to the acquired quantum computing resources.
S2: creating or loading a quantum computing circuit by the first quantum cloud platform, and selecting quantum computing resources for the quantum computing circuit from a quantum computing resource list; the quantum cloud platform of the selected quantum computing resource can be called a target quantum cloud platform, wherein a user can utilize a graphic or text programming tool to create the quantum computing circuit on line or upload the created quantum computing circuit.
S3: the first quantum cloud platform generates a quantum computing task according to the quantum computing circuit and the selected quantum computing resource;
s4: the first quantum cloud platform sends a quantum computing task to a quantum cloud platform to which the selected quantum computing resource belongs;
s5: the first quantum cloud platform acquires an execution result of the quantum computing task from the quantum cloud platform to which the selected quantum computing resource belongs.
As shown in fig. 2, a schematic diagram of interconnection and interworking between a first quantum cloud platform and a plurality of second quantum cloud platforms is provided. And the user logs in the first quantum cloud platform through the client by utilizing the first authority, if the user also has the second authority of one or more second quantum cloud platforms, under the condition of the user authority, the first quantum cloud platform interacts with the one or more second quantum cloud platforms according to the second authority, and the interaction process is carried out through an API interface of the second quantum cloud platform. The quantum computing resources of the first quantum cloud platform include quantum simulators and/or quantum computers. The quantum computing resources of the second quantum cloud platform include quantum simulators and/or quantum computers.
After a user logs in, the first quantum cloud platform acquires local quantum computing resources available to the user according to the first authority of the user to form a first quantum computing resource list; and if the second authority is valid, acquiring remote quantum computing resources from the second quantum cloud platform through the API interface to form a second quantum computing resource list. The first list of quantum computing resources and the second list of quantum computing resources together comprise a list of quantum computing resources presented to the user.
After a user logs in the first quantum cloud platform through the client by utilizing the first authority, a quantum computing circuit can be established on line or a pre-established quantum computing circuit can be uploaded according to the needs of the user, and a required quantum computing resource is selected from a quantum computing resource list. And the first quantum cloud platform selects quantum computing resources for the quantum computing circuit according to a user instruction or according to the computing resource state. Generally, a first quantum cloud platform creates a generated quantum computing circuit for a user according to a quantum programming framework of the first quantum cloud platform, and selects quantum computing resources for the quantum computing circuit according to a selection instruction of the user.
If the selected quantum computing resource is a local quantum computing resource of the first quantum cloud platform, generating a quantum computing task according to the quantum computing circuit and the selected quantum computing resource, sending the quantum computing task to the first quantum cloud platform for execution, executing the quantum computing circuit by the first quantum cloud platform by using the selected quantum computing resource, and feeding back an execution result of the quantum computing task.
If the selected quantum computing resource is a remote quantum computing resource of the second quantum cloud platform, the first quantum cloud platform judges whether the quantum computing circuit meets the operation requirement of the remote second quantum cloud platform, if not, the quantum computing circuit is translated into a quantum computing circuit meeting the quantum programming framework requirement of the second quantum cloud platform, then a quantum computing task is generated according to the translated quantum computing circuit and the selected quantum computing resource, and if so, the quantum computing task is directly generated. And then, the quantum computing task is transmitted from the first quantum cloud platform to a second quantum cloud platform to which the selected quantum computing resource belongs through a corresponding API interface for execution. The second quantum cloud platform performs the translated quantum computing circuit using the selected quantum computing resource. And the first quantum cloud platform queries and obtains an execution result of the quantum computing task through the API interface by utilizing the second authority, and feeds back the result to the user.
In order to realize consistency test, in the process of sending the quantum computing task to the target quantum cloud platform, the quantum computing resource of the local quantum cloud platform is distributed for the quantum computing task, and the generated quantum computing task is sent to the local quantum cloud platform to be executed. And comparing the execution results of the target quantum cloud platform and the local quantum cloud platform, so that consistency inspection of quantum tasks on different quantum cloud platforms can be realized.
As shown in fig. 3, a schematic block structure diagram of a quantum computing task scheduling device of a quantum cloud platform is provided. The quantum computing task scheduling device of the quantum cloud platform comprises:
a resource acquisition module configured to acquire a quantum computing resource list from one or more second quantum cloud platforms;
a line generation module configured to create a quantum computing line for which quantum computing resources are selected from a list of quantum computing resources;
a task scheduling module configured to generate a quantum computing task including the quantum computing circuit and the selected quantum computing resource, and to send the quantum computing task to a quantum cloud platform to which the selected quantum computing resource belongs;
the result acquisition module is configured to acquire an execution result of the quantum computing task from a quantum cloud platform to which the selected quantum computing resource belongs.
Taking the first quantum cloud platform as a Qigorship quantum cloud platform, taking the second quantum cloud platform as a third party quantum cloud platform as an example, for example, the third party quantum cloud platform is any one of a QWEGeL quantum cloud platform, a Microsoft quantum cloud platform and a hundred-degree quantum cloud platform.
The first quantum cloud platform and the second quantum cloud platform are equivalent, and the positions of the first quantum cloud platform and the second quantum cloud platform can be interchanged.
As shown in fig. 4, the process of obtaining the quantum computing resource of the second quantum cloud platform includes the following steps: a user logs in to a first quantum cloud platform by using a first user authority through a client;
the user provides a second authority of the second quantum cloud platform for the first quantum cloud platform;
the first quantum cloud platform queries quantum computing resources available to the user on the second quantum cloud platform by using the second authority and the API interface of the user;
the first quantum cloud platform presents to a user a quantum computing resource comprising a local quantum cloud platform and a second quantum cloud platform, the quantum computing resource comprising a quantum simulator and/or a quantum computer.
In embodiment 1, according to a first authority of a user on a first quantum cloud platform, logging into the first quantum cloud platform, and acquiring quantum computing resources available to the user on the first quantum cloud platform. The first quantum cloud platform can acquire quantum computing resources available to a user of the second quantum cloud platform through an API interface according to the second authority of the user on the second quantum cloud platform. And combining the quantum computing resources of the two cloud platforms to form a quantum computing resource list, and presenting the quantum computing resource list to a user so that the user can select the required quantum computing resources. The method can also be expanded to obtain quantum computing resources from a plurality of second quantum cloud platforms to form a quantum computing resource list based on the embodiment 1.
OPENQASM, full name Open Quantum Assembly Language, is an open source quantum assembly language. It was introduced by IBM in 2017, 7, on the quantum computing platform, to describe general quantum computing. OPENQASM can be used to describe general quantum computation based on circuit models, measurement-based models, and recent quantum computation experiments. Its nature makes it well suited for developers and researchers to explore and simulate quantum computing on a software platform that leads hardware.
QuTruk is a free, open-source, cross-platform quantum computing programming framework independently developed by the QS, and comprises a quantum programming API, quantum command translation, a quantum computing back-end interface and the like, and provides rich quantum algorithms and quantum application templates. Qualink also provides a visual editor that a user can build and run quantum circuits by dragging and configuring elements such as quantum gates, qubits, etc. The quantum programming framework of the QuTruk can be widely applied to the fields of quantum communication, quantum cryptography, quantum simulation, quantum chemistry and the like.
As shown in fig. 5, an architecture schematic diagram of the start quantum cloud platform is given. The Kernel quantum cloud platform comprises a front end, a service layer and a calculation layer. As shown in fig. 6, a schematic diagram of creating quantum wire code based on a visual programming tool is presented. Various quantum logic gate visual programming modules (compomers) are presented in fig. 6 for providing a user with the ability to drag programming to generate quantum wires. The visual editing process comprises the following steps: opening the front page of the Ke quantum cloud platform, wherein the page provides various door controls, and a user can edit an electronic circuit and configure a quantum door by clicking and dragging the controls. The user can drag the required quantum logic gate to the corresponding quantum bit (qr 0, qr 1, qr 2), and arrange the quantum logic gates on the quantum bit in time sequence, finally forming the quantum circuit.
The quantum circuit shown in fig. 6 sequentially performs the following quantum logic gates from 1 to 10 in time sequence.
1 Z * qr[0]
2 Y * qr[1]
3 X * qr[2]
4 Z * qr[0]
5 CRx(pi/2) * (qr[1], qr[0])
6 CRy(pi/2) * (qr[2], qr[0])
7 Measure * qr[0]
8 Measure * qr[1]
9 S * qr[2]
10 Measure * qr[2]
The quantum circuit shown in fig. 6 performs quantum logic gates in the order of 1 to 10 described above, performing a series of operations for each qubit. First the Z gate is performed on the 0 th qubit (corresponding to the Pauli-Z operation), then the Y gate is performed on the 1 st qubit (corresponding to the Pauli-Y operation), and finally the X gate is performed on the 2 nd qubit (corresponding to the Pauli-X operation). The Z gate is then performed again on the 0 th qubit. Then, the control rotation gate CRx (pi/2) (i.e., rotation gate rotated by pi/2 angle) is performed for the 1 st and 0 th qubits, and then the control rotation gate CRy (pi/2) is performed for the 2 nd and 0 th qubits. Next, a measurement operation (Measure) is performed on the 0 th and 1 st qubits, and a state preparation operation (S) is performed on the 2 nd qubit.
The translation process of the quantum computing program is demonstrated below taking the code of the program generated by the QuTrunk programming framework of the quantum cloud platform of the quantum of the opening family as an example to translate to the OPENQASM2.0 programming framework of the IBM quantum cloud platform. Example codes are as follows:
from qutrunk.circuit.gates import *
from qutrunk.circuit import QCircuit
from math import pi
class MyQCircuit(QCircuit):
def my_openqasm(self):
d = [
"OPENQASM 2.0",
'include "qelib1.inc"',
f"qreg q[{str(len(self.qreg))}]",
f"creg c[{str(len(self.qreg))}]",
]
for c in self.cmds:
d.append(c.qasm())
a = ";\n".join(d) + ";\n"
return a
qubit = 3
qc = MyQCircuit()
qr = qc.allocate(qubit)
cmd = qc.cmds
qasmdef = qc.my_openqasm().split(';\n')[4:]
print(qasmdef)
the code operation results are as follows:
['z q[0]', 'y q[1]', 'x q[2]', 'z q[0]', 'crx(1.5707963267948966) q[1],q[0]', 'cry(1.5707963267948966) q[2],q[0]', 'measure q[0] -> c[0]', 'measure q[1] -> c[1]', 's q[2]', 'measure q[2] -> c[2]', '']
in the above code example, first, a class named myqccircuit is defined, which inherits from qccircuit, and implements a method my_openqasm () for converting a quantum circuit based on QuTrunk into an instruction sequence conforming to the OPENQASM2.0 standard. The variable qubit in the code is assigned 3, indicating that 3 qubits (qubits) are used in the quantum circuit. Then an instance qc of myqccircuit is created and assigned the 3 qubits described above using the allocate method. Finally, the quantum circuit is converted into an instruction sequence conforming to OPENQASM2.0 standard by calling a my_openqasm () method, and the result is printed.
The purpose of this code section is to demonstrate how quantum circuit analog codes are written using Python and to convert QuTrunk-based quantum circuits into instruction sequences of the OPENQASM standard. And when the front end of the quantum cloud platform of the quantum in the opening department receives the quantum circuit program code generated by the user based on the Quantum code, the generated quantum circuit code is transmitted to the rear end of the quantum cloud platform of the quantum in the opening department. The back end converts the quantum wire into an instruction of the OPENQASM2.0 standard through the QuTruk.
As shown in fig. 7, a flow chart of quantum computing task execution is presented.
A user logs in to a quantum cloud platform (called a local quantum cloud platform) according to user rights.
The user creates a quantum computing circuit on the local quantum cloud platform, or uploads the created quantum computing circuit.
Quantum computing resources are selected for the quantum computing circuit from the list of quantum computing resources.
A quantum computing task may be generated from the quantum computing circuit and the selected quantum computing resource, in which the quantum computing circuit is instructed to execute with the selected quantum computing resource.
And sending the quantum computing task to a second quantum cloud platform (called a target quantum cloud platform) corresponding to the selected quantum computing resource, wherein the target quantum cloud platform utilizes the selected quantum computing resource to operate the quantum computing circuit when executing the quantum computing task. Quantum computing circuitry quantum computing resources that may be selected include quantum simulators or quantum computers.
The quantum computing task may be selectively performed at a local quantum cloud platform or a target quantum cloud platform. The target quantum cloud platform may be, for example, a third party quantum cloud platform such as the google quantum cloud platform, microsoft quantum cloud platform, hundred degree quantum cloud platform.
If quantum computing resources of the target quantum cloud platform are selected to be utilized to execute the quantum computing tasks, the user authority and an API interface of the target quantum cloud platform can be utilized to send the quantum computing tasks to the target quantum cloud platform. Before quantum computing tasks are generated, the quantum computing circuit needs to be translated into a quantum computing circuit conforming to the quantum programming framework standard of the target quantum cloud platform. And the target quantum cloud platform executes quantum computing tasks by using the selected quantum computing resources, and generates quantum computing task execution results after task execution is finished.
The local quantum cloud platform queries the target quantum cloud platform by using the user permission and the API interface to obtain a quantum computing task execution result, feeds the quantum computing task execution result back to the client, and allows the user to check the quantum computing task execution result through the client.
The information of the quantum computing task includes: task name, task ID, creation time, quantum computing resource, and may also include task source, resource provider, and execution times.
The result information of the quantum computing task includes: task name, task ID, creation time, execution times, end time, execution state, running time, quantum computing resources, task line codes, probability statistics, and may also include task sources, resource providers.
A specific flow of performing quantum computing tasks by a user using multiple quantum cloud platforms is given as shown in fig. 8 and 9.
In fig. 8, after the flow starts, the user logged into the first quantum cloud platform further provides a key for a third party platform as the second quantum cloud platform. And then judging whether the key is correct, wherein the key is used for logging in the second quantum cloud platform to obtain the second authority, and if the key is incorrect, only displaying the available resources of the user of the first quantum cloud platform to the user. And if the key is correct, collecting the quantum computing resources of the third party quantum cloud platform through the API interface by using the key. Further judging whether quantum computing resources of the third party quantum cloud platform are available, and if not, only displaying the available resources of the first quantum cloud platform to a user; if available, all quantum computing resources available are presented to the user.
In fig. 9, a user inputs a quantum circuit to be calculated, judges whether a first quantum cloud platform has configured a user key of a third party quantum cloud platform serving as a second quantum cloud platform, if the key has been configured, displays all available quantum computing resources of the first quantum cloud platform and the third party quantum cloud platform to the user, and if the key has not been configured, displays only the quantum computing resources provided by the first quantum cloud platform. The user selects a quantum computing resource from available quantum computing resources for a quantum computing circuit, generates a quantum computing task and sends the quantum computing task to a quantum cloud platform to which the selected quantum computing resource belongs, and after the quantum computing task is executed, an execution result is obtained. And the first quantum cloud platform displays the quantum computing task execution result to the user.
Table 1 execution result parameter table
Table 1 gives the execution result parameters of the quantum computing circuit shown in fig. 6. And recording task related information, executing codes of the quantum computation circuit and carrying out probability statistical results obtained according to the circuit codes.
According to the technical scheme of quantum computing task scheduling of the quantum cloud platform, firstly, quantum computing resource integration is achieved, all quantum computing resources available to users of a plurality of quantum cloud platforms are obtained by means of API interfaces of third-party quantum cloud platforms and user key rights, and further more operation rear ends are selected for the quantum computing tasks on the local quantum cloud platform, so that computing resource requirements of the computing tasks are met; meanwhile, in order to be compatible with quantum circuit programming frameworks of a plurality of platforms, code command translation of a quantum circuit is supported by using a QuTruk open source library, and the quantum circuit created at the front end of a local quantum cloud platform can be converted into a quantum circuit supported by a corresponding third party platform through a translation process; and finally, when the user selects the third-party platform computing resource as the back end, the task is submitted and the computing result is acquired in the third-party platform, and the task is submitted and the computing result is acquired through the key and the platform interface configured by the user. Finally, a task closed loop is formed among the quantum cloud platforms, so that the compatibility and universality of computing resources among the quantum cloud platforms are greatly improved.
Task scheduling among quantum cloud platforms relates to task allocation of quantum computing resources of different quantum cloud platforms so as to realize reasonable and efficient execution of tasks. Specifically, the quantum cloud platform can acquire tasks according to task types and distribute the tasks to different quantum cloud platforms. Therefore, the situation that some quantum cloud platforms always distribute tasks and the other quantum cloud platforms are idle or the task amount is small can be avoided, the situation that tasks are accumulated on the local quantum cloud platform is relieved, and the task scheduling efficiency is improved.
The technical scheme of the invention can realize interoperability verification. To ensure interoperability between different quantum cloud platforms, verification tests need to be performed. These tests may include running the same algorithm, program, experiment, etc. between different platforms and comparing the results for consistency. Through interoperability verification, whether interconnection and interworking between different quantum cloud platforms are reliable and accurate can be confirmed. Meanwhile, the technical scheme of the invention can realize the sharing and the coordination of quantum computing resources: the quantum cloud platforms need to share computational resources and datasets between them in order to perform more efficient collaboration and computation.
Furthermore, a computer-readable storage medium storing a computer program may also be provided according to an exemplary embodiment of the present invention. The computer readable storage medium stores a computer program that when executed by a processor causes the processor to perform a method of quantum task scheduling for a quantum cloud platform according to an exemplary embodiment of the invention. The computer readable recording medium is any data storage device that can store data which can be read out by a computer system. Examples of the computer-readable recording medium include: read-only memory, random access memory, compact disc read-only, magnetic tape, floppy disk, optical data storage device, and carrier waves (such as data transmission through the internet via wired or wireless transmission paths).
Furthermore, a computing device may be provided in accordance with an exemplary embodiment of the present invention. The computing device includes a processor and a memory. The memory is used for storing a computer program. The computer program is executed by a processor to cause the processor to perform a method of quantum task scheduling of a quantum cloud platform according to an exemplary embodiment of the invention.
It should be noted that the first, second, third, fourth, etc. words of description and similar language in the above specification do not denote any order, quantity, or importance, but rather are used to distinguish one feature from another in the same or different embodiments, and are not necessarily limited in quantity. And the invention is not limited to the specific configurations and processes described above or shown in the drawings. The foregoing is merely specific embodiments of the present invention, and it will be clearly understood by those skilled in the art that, for convenience and brevity of description, specific working processes of the described system, apparatus, module or unit may refer to corresponding processes in the method embodiments, and need not be repeated. It should be understood that the scope of the present invention is not limited thereto, and any person skilled in the art may conceive various equivalent modifications or substitutions within the technical scope of the present invention, which are intended to be included in the scope of the present invention.