Origin Pilot A Quantum Operating System For Effecient Usage of Quantum Resources
Origin Pilot A Quantum Operating System For Effecient Usage of Quantum Resources
of quantum task scheduling, quantum resource management, quantum program compilation and
qubits’ automatic calibration. With these modules, Origin Pilot can manage the quantum com-
puting resources and solve the multi-quantum processor scheduling problem. It can also allow the
parallel execution of multiple quantum programs and calibrate the quantum resource effectively.
Thus, the performance of resources is guaranteed and the resource utilization is improved. By com-
paring the results with and without Origin Pilot, we evaluate the impact on a quantum circuit’s
fidelity of qubits mapping algorithm. We also evaluate the effectiveness of automatic calibration
and parallel execution of multi-quantum processors. Finally, Origin Pilot can be easily customized
for hybrid computing resources.
Keywords: Origin Pilot; Quantum Operating System; Quantum Computing; Quantum Proces-
sor
there is no automatic resource allocation and scheduling superposition of 0 and 1. Formally |ψi = α|0 > +β|1 >,
for multiple quantum tasks. Thus, in this paper we de- where α, β ∈ C, |α|2 + |β|2 = 1.
sign an algorithm to allocate quantum resources based Quantum Measurement: Quantum measurement is
on the requirements of the submitted quantum tasks. an approach for acquisition of a quantum state’s infor-
2) automatically optimize the quality of a qubit. The mation. The quantum measurement can collapse to |0 >
qubit can be easily disturbed by environment, which or |1 >.
makes the qubits’ performance fluctuate. The quantum Quantum logic gate: A quantum gate can be seen as
gates’ fidelity will decrease if the qubits’ are not prop- a unitary transformation to qubits. The quantum logic
erly calibrated. An existing solution is to calibrate all gate should be a revertible gate. To support universal
the qubits when the performance deteriorates. However, quantum computing, we only need to implement several
the existing calibration approach has the following draw- single qubit’s unitary transformation and a double gate
backs: a quantum circuit’s fidelity cannot be guaranteed (CNOT). The single qubit gates include the Hadamard
before calibration; the quantum processors cannot work gate, T gate and S gate. Widely used quantum logic
during the long period of calibration. The Optimus is gates and their corresponding unitary matrix are shown
an automatic calibration system developed by Google. in Table. II A.
The Optimus can traverse all the qubits’ state and deal Quantum circuit: Quantum circuit is one of the most
with the “bad” qubits in real time. However, they don’t widely used quantum computing model. In this model,
explicitly determine the state of qubits which are not cal- any unitary transformation can be implemented by com-
ibrated. Moreover, they don’t consider the situation that bining several universal quantum gates. A sequence of
the calibration is conducted while there are other general quantum gates is called a “quantum circuit”. A quan-
quantum tasks. tum circuit can be visualized. For instance, the quantum
To compensate the above problems, we propose Ori- circuit for the Grover algorithm can be represented as
gin Pilot, which is a quantum operating system that can Fig. 1.
effectively use quantum resources. We implement four
services to tackle the above problems, including quantum
task scheduling, quantum resource automatic calibration,
quantum circuit compiling and quantum resource man-
agement.
The main contribution of Origin Pilot includes:
1) Origin Pilot can calibrate a single or multiple qubits
online without interrupting other quantum circuits;
2) Origin Pilot can allocate quantum resources for FIG. 1. The quantum circuit for the Grover algorithm
quantum circuits according to the state of the quantum
resources and the requirements of quantum circuits; Generally, the initial quantum states are all zeroed in
3) Origin Pilot can reduce the decoherent noise with most quantum computing cases. After execution of a
dynamic decoupling in qubits. Thus, Origin Pilot allows quantum circuit, we can get the results by measuring the
multiple circuits executing on the same quantum proces- qubits.
sor. The average completion time for quantum circuits Quantum Program: A quantum program is con-
can be greatly reduced. sisted of a combination of quantum logic gates, classic
The rest of this paper is organized as follows: In Sec- computing and measurement.
tion 2 we introduce the basic concepts of quantum com- Quantum state’s fidelity: Due to the interference
puting and quantum operating system; In Section 3 we of noise and the quality of a quantum processor, the ideal
propose the overall architecture and workflow of Ori- results of quantum gate is not exactly the same as the
gin Pilot; In Section 4 we describe the solution to the real execution of quantum gates. The difference between
multi-quantum processor load balancing, multi-quantum the ideal quantum state and real quantum state can be
program parallel computing and automatic calibration of represented as “fidelity”. The higher the fidelity means
qubits; In Section 5 we analyze the experimental results the less error, which also means the computing results
of Origin Pilot; In Section 6 we conclude this paper and tend to be better.
propose the future works.
1 0 0 0
1 0 0 1 0 0
S= CZ =
0 i 0 0 1 0
0 0 0 −1
1 0 0 0
1 0 0 0 1 0
T= SWAP =
0 eiπ/4 0 1 0 0
0 0 0 1
1 0 0 0
0 1 0 1 0 0
X= CU =
1 0 0 0 U00 U01
0 0 U10 U11
1 0 0 0 0 0 0 0
0 1 0 0 0 0 0 0
0 0 1 0 0 0 0 0
0 −i 0 0 0 1 0 0 0 0
Y= Toffoli =
i 0 0 0 0 0 1 0 0 0
0 0 0 0 0 1 0 0
0 0 0 0 0 0 0 1
0 0 0 0 0 0 1 0
1 0 0 0
1 0 0 1 0 0
Z= CR =
0 −1 0 0 1 0
0 0 0 eiθ
1 0 0 0
iλ
cos( θ2 ) −e × sin( θ2 ) θ θ
0 cos( ) isin( ) 0
U3 = iSWAP = 2 2
eiφ × sin( θ2 ) eiλ+iφ × cos( θ2 ) 0 isin( θ ) cos( θ ) 0
2 2
0 0 0 1
operating system cannot be directly applied to quantum qubit mapping more difficult.
computing.
2. Multi-Processor Scheduling
1. Qubit Mapping
In a classic computer, the cores in a CPU are mostly
The topology and basic logic gates of different quan- homogeneous. Thus, when scheduling tasks on these
tum processors are different. Thus, the different qubit cores, we don’t need to consider the difference between in-
mapping strategies can make the fidelity of the results structions. Different physical implementations of a quan-
given by a certain quantum circuit different during com- tum computer can have different topology and support
pilation of a quantum program. Moreover, the qubits’ different quantum gates. After compilation, even the
properties can also vary with time, which can make the same circuit can be compiled as different quantum cir-
4
cuits under different topology and quantum gates. Thus, Quantum Task: A quantum application can send
we should carefully schedule the quantum tasks in the multiple quantum circuits to quantum processors. Each
quantum processors to better enable the performance. quantum circuit can be seen as an individual quantum
task. Thus, we abstract a quantum circuit as a quantum
task.
3. Quantum Parallel Computing Quantum Transaction A quantum transaction is the
basic element which can be executed on a single quantum
processor. It can includes multiple quantum tasks. These
Thread is the basic scheduling unit in a classic oper-
quantum tasks in a quantum transaction can be executed
ating system. A single core can only execute a thread at
wholy or not.
a time. By switching between contexts, multiple threads
Quantum Thread: The basic unit for scheduling in a
can be easily switched with each other. Thus, multiple
quantum operating system. The quantum operating sys-
threads parallelism can be realized.
tem schedules the quantum threads based on the resource
In a quantum computer, the quantum circuit is the
requirement of a quantum transaction. Once a quantum
basic scheduling unit. Since the state of a qubit cannot
transaction is executed on a quantum processor, we can
be cloned and the decoherence time of qubits is short,
call it a “quantum thread”.
multiple quantum circuits cannot switch with each other
Quantum processor: The basic execution unit of a
as classic computing. However, when the qubits used by
quantum computer. A quantum processor can only exe-
quantum circuits are different, the execution of multiple
cute a quantum thread at a time. A quantum application
circuits can be realized in a quantum processor.
can use multiple quantum processors.
Quantum programming framework: A fundamen-
tal framework for building, excuting and optimizing a
4. Automatic Calibration quanutm application. The framework can also provide
basic algorithmatic libraries.
The manufacture of physical instruments in classic Quantum resource: Quantum resources refer to
computing is quite mature. The quality of these de- the physical system for processing and storing quantum
vices is stable. Their performance will not fluctuate in information, following the rule of quantum mechanics.
a short period of time. The objective of classic operat- Specifically, the quantum resource includes the quantum
ing system is to improve the resource utilization through processor and quantum storage.
technologies such as memory management. For a quan-
tum computer, we can improve the resource utilization
through the parallel execution of quantum circuits. Ex- III. ARCHITECTURE OF ORIGIN PILOT
isting solutions are based on an assumption that the qual-
ity of qubits are stable for a period of time. However, the A. Overall Architecture
quality of qubits will deteriorate during the execution of
quantum circuits. In such situations, the qubit mapping
Origin Pilot can support different computing backends
cannot achieve satisfiable results with static single gate’s
such as quantum processors, quantum virtual machines
fidelity, double gate’s fidelity and measurement fidelity.
and high performance computing clusters etc. The quan-
When using quantum computers we should continuously
tum computing needs the assistance of classic computers.
check the quality of qubits and calibrate the qubits au-
For instance, when solving NP-hard problems, we should
tomatically.
use classic computers to validate the results. For hy-
In summary, the classic computing and quantum com-
brid algorithms like quantum machine learning, quantum
puting are quite different. Thus, classic operating sys-
chemistry and quantum finance algorithms, the classic
tems cannot be easily compatible with a quantum com-
computing part plays a vital role. Thus, we should deal
puter. To meet this ends, Origin Pilot provides quantum
with classic information during the meanwhile execution
task scheduling, quantum resource management, qubits’
of quantum tasks. Thus, we classify the system services
calibration, quantum circuits compiling to overcome the
to quantum services and classic services, which are shown
problem of qubits’ automatic calibration and multiple
in Fig 2.
quantum processors’ load balancing. With Origin Pilot,
The quantum services are repsonsible for dealing with
the quantum circuits’ fidelity and resource utilization of
quantum tasks and interact with the quantum computing
quantum resources can be greatly improved.
backend. By supporting multiple quantum processors’
task scheduling, quantum resource management, multi-
ple quantum circuit parallism, quantum program compi-
C. Basic Definitions lation and automatic calibration of qubits, we can im-
prove the resource utilization of quantum processors and
Quantum application: A quantum application is keep the fidelity of qubits within a certain threshold.
a hybrid program including both the classic computing The classic computing services are dealing with classic
part and quantum computing part; computing tasks and interact with the classic comput-
5
ing backend. Moreover, the classic service should also be quantum application which can be executed on the server
responsible for quantum computer’s configuration, quan- side of Origin Pilot. If a hybrid program wants to use
tum device monitoring and system service monitoring. the high performance computing clusters, users can also
Specifically, large scale data processing with quantum program with distributed computing frameworks for the
and classic hybrid algorithms can be enabled with these classic part.
classic services. The classic services should also moni- 2. When Origin Pilot receives a hybrid quantum ap-
tor the state of quantum devices and system service to plication, the classic part can be executed on the con-
maintain the stability of the system. trolling server. If the hybrid program is written in dis-
A quantum application can call the system services tributed computing programming languages, the Origin
provided above. Based on the quantum programming Pilot will send the classic computing tasks to high perfor-
framework and distributed computing framework, Ori- mance computing clusters with a classic job scheduling
gin Pilot can support the quantum and classic hybrid system.
distributed computing. A quantum application can pre- 3. The quantum computing part will be sent to the
process the data with classic services. The quantum quantum task scheduling service. The quantum task
programs can be generated and sent to quantum pro- scheduling service will sort the quantum tasks based on
cessors. After computation, results can be retrieved by their priority and choose a quantum task with the high-
measurements and analyzed by classic computers. Fur- est priority when its resource requirement can be met.
ther, we can determine the next parameterized quantum Then the quantum circuit will be compiled to the topol-
task. The users can also manage quantum devices and ogy of the target quantum processor. Then the compiled
quantum resources with the resource manager in Origin code will be sent to the quantum computer. Before ex-
Pilot. ecution, a quantum transaction will bind to a quantum
thread which will record the quantum transaction’s ID,
the target quantum processor’s ID, the tasks’s ID etc. Af-
B. Workflow of Origin Pilot ter computing, we can identify the corresponding result
for a quantum task and return it to the users’ program.
The workflow of Origin Pilot is shown in Fig.3. Then the occupied qubits will be released.
1. Users can write hyrbid programs with QRunes[21]. When executing the quantum tasks, Origin Pilot can
The QRunes compiler can identify the quantum part and also calibrate the performance of quantum resources.
classic part with lexical, grammer and semantic analysis. When the performance of qubits deteriorate, the auto-
Then the hybrid quantum program can be transpiled to a matic calibration service will set the qubits to be under-
6
calibrated and notify the quantum task scheduling ser- system’s state. Different scheduling algorithms will be
vice to calibrate their state. Origin Pilot will assign high- applied based on the type of a quantum task.
est priority to the calibration task and combine them A qubits’ automatic calibration task usually requires
with other quantum computing tasks as a quantum trans- real time response. The runtime of these tasks are usu-
action which will be sent to the quantum devices. ally very short. The physical qubits to be calibrated
are explicitly described in a quantum task. To guaran-
tee the reliability of the quantum computing, these type
IV. SOLUTIONS OF ORIGIN PILOT of quantum tasks should be prior to be executed. For
general quantum tasks, we can allocate qubit resources
In this section, we will describe the solutions to the based on the topology of quantum processors and sys-
problem of multiple quantum processors’ load balancing, tem’s state.We apply the HRRN (Highest Response Ra-
multi-quantum program parallism and automatic cali- tio Next) scheduling algorithm for the general quantum
bration. tasks. The HRRN algorithm considers both the waiting
time and runtime of quantum tasks. The priority of a
quantum task is defined as:
A. Load Balancing of Multiple Quantum
Processors
Twaiting time + Truntime Tresponse time
Rp = = (1)
Truntime Truntime
The multiple quantum processors’ load balancing is to
schedule multiple quantum tasks on multiple quantum With the increase of waiting time Twaiting time , the
processors. In Origin Pilot, a quantum task is consisted quantum task with higher Rp is prior to be executed.
of the following elements: Based on the above algorithm, the workflow of quan-
(1) The number of qubits required for a quantum task; tum task scheduling service is shown in Fig.4.
(2) Quantum program’s intermediate representation; Once receiving a quantum task, the quantum task
(3) Quantum processor’s ID; scheduling service will:
(4) Type of a quantum task: a quantum task can be a (1) acquire the runtime of the quantum task and put
general quantum task or automatic calibration task; the task into the waiting list;
(5) Priority: The priority of a quantum task. (2) update the Rp of all the tasks in waiting list;
A quantum task can only be executed on corresponding (3) allocate quantum processors that can best fit the
the quantum processor if the quantum processor’s ID is quantum task;
assigned. Otherwise, the quantum task scheduling sys- (4) compile the quantum task to the quantum exe-
tem will allocate the quantum processors based on the cutable file and pulse;
7
Pseudo code of the mapping algorithm is shown framework, we can assure the user-submitted quantum
above. (1) We first convert the quantum program to tasks being executed on the best region of the quantum
a DAG(Directed Acyclic Graph). The vertices represent processor. Thus, the fidelity of the result of the quantum
the double gate operation. When two vertices are con- task tends to be better.
nected, the corresponding double gates will use the same
qubit. The direction denotes the timing sequence. (2) We
traverse the DAG from the node with 0 in-degree. The V. EXPERIMENTS
first node will be directly mapped based on the topol-
ogy of the quantum processor. Each mapping will be We conduct several exepriments to evaluate the differ-
represented as a subgraph. (3) We get the new DAG ent aspects of Origin Pilot’s effectiveness.
by deleting the mapped vertices. Then we traverse the
new DAG until all the nodes with 0 in-degree cannot be
directly mapped. In this way, we can finally get the max- A. Runtime Analysis
imum subgraph sequence. (4) By repeating step (2) and
(3), we can get multiple maximum subgraph sequences. To evaluate the effectiveness of the parallesm in Origin
(5) With Token-Swapping algorithm, we can calculate Pilot, we conduct the runtime analysis with and without
the path with the least SWAP gates of multiple mapping Origin Pilot on two superconducting quantum processors
strategies by connecting the adjacent subgraphs. (6) We (KF C6-130) provided by Origin Quantum.
elaborate all the possible mapping strategies and choose We conduct four exepriments in total. In the first sce-
the mapping with best fidelity. nario, we execute a single quantum circuit of GHZ in
a quantum chip for 10 times. The GHZ circuit uses 2
qubits. In the second scenario, we execute two quan-
C. Automatic Calibration tum circuits in a quantum chip. In the third scenario,
we run a quantum circuit in two quantum chips, tak-
There are two parameters describing the quality of ing advantage of the parallelism of Origin Pilot. In the
qubits: coherence time and gate fidelity. fourth scenario, we execute the two quantum circuits in
Qubits’ coherence time can be used to dscribe the two quantum chips. From Fig.5 we can see the accelera-
coupling strength between a quantum system and the tion of Origin Pilot by running the above four scenarios
environment. A quantum algorithm may need a mas- for 10 times.
sive number of gate operations. Thus, the qubits should
maintain their state during these gate operations.
Quantum logic gate operations serve as the basic ele-
ments in a quantum circuit. The gate error has a great
impact on the final result of a quantum circuit. Gener-
ally, the average logic gate error should be less than 1
percent[26].
There are many factors that can affect the qubits’ qual-
ity. To maintain the quality, we need to keep calibrating
the qubits. The qubits’ calibration includes the check-
ing and calibration phase. In the checking phase, we
can check the qubits’ performance parameters by inter-
val checking or random traverse techniques. If calibra-
tion is needed, we can call the corresponding calibration
procedure based on the error type and extent.
The factors that can affect the qubits’ performance are
co-related with each other. To conduct an effective cali- FIG. 5. Runtime of four different situations
bration, we need to determine which phyiscal parameters
degrade the qubits’ performance. This process can be Origin Pilot can effectively improve the utilisation of
formulated as a Markov decision process and automated. quantum processors by supporting parallel execution of
We build a partial observable Markov Decision Process multiple tasks in a quantum processor. The average run-
to automate the process of automatic calibration. time of executing a GHZ quantum circuit can be im-
Moreover, we build an oline calibration strategy by us- proved to 120 percent.
ing a block partitioning automatic calibration technique.
The approach dynamically divide the quantum proces-
sor to the executable region and calibration region. The B. Automatic Calibration Results
quantum program can be compiled to different regions
and combined as a quantum transaction which can be All the results of this part are evaluated on the Orig-
further sent to the quantum processors. With the above inQ Wuyuan. We mainly evaluate the single gate’s and
9
double gate’s fidelity results with automatic calibration. C. Effect of the Qubit Mapping Mechanism in
Moreover, since the automatic calibration quantum tasks Origin Pilot
are also considered as quantum tasks executed on the
quantum processors. Thus, we record the number of 1. Dataset
quantum tasks as well.
We build a topology of a quantum processor including
8 qubits. Double gate operations can be applied in ad-
jacent qubits. We configure a quantum virtual machine
1. Single gate results
with noise and only consider the CZ gate. The noise can
be assigned to the corresponding qubits and CZ gate. To
The calibration threhold is set to 0.98. When Origin better validate our algorithm, we set the fidelity on the
Pilot detects the fidelity of single gate operation of a right part of the topology higher than the left. We use
qubit below 0.98, the calibration procedure is triggered. the classic quantum algorithms including QFT, GHZ, DJ
The calibration interval is initially set as 60 minutes and and BV as the benchmarking quantum circuits.
gradually degraded to 20 minutes. Once the calibration The topology of the quantum processor is shown as
is triggered, the interval is recovered to 60 minutes. Fig.9.
Experimental results are shown in Fig.6.
2. Experimental Results
TABLE II. Fidelity Results for GHZ with and without Origin 3. Results’ Analysis
Pilot
We can see that the fidelity from QST (Quantum State
Tomography) shows that mapping with Origin Pilot out-
(3) DJ Circuit
performs mapping with BMT. In the worst case we can
Fig. 12(a) shows the original circuit of DJ. Fig.12(b)
increase the fidelity of a quantum circuit by 10 percent on
shows a transpiled circuit with BMT. Fig.12(c) shows a
average. From the transpiled results we can also see that
transpiled circuit with Origin Pilot.
the mapping of Origin Pilot prefers choosing the qubits
with better fidelity. Thus, the mapping with Origin Pilot
can achieve better fidelity.
[1] M. A. Nielsen and I. L. Chuang, Mathematical Structures [6] B. Ghosh and E. Kozarevic, Investment Management and
in Computer Science 17, 1115 (2002). Financial Innovations 15, 208 (2018).
[2] L. K. Grover, (1996). [7] J. Biamonte, P. Wittek, N. Pancotti, P. Rebentrost,
[3] A. W. Harrow, A. Hassidim, and S. Lloyd, Physical Re- N. Wiebe, and S. Lloyd, Nature.
view Letters 103, 150502 (2009). [8] Petruccione, Francesco, Sinayskiy, Ilya, Schuld, and
[4] P. Shor, In Proceedings of 35th Annual Symposium on Maria, Contemporary Physics A Review of Physics and
the Foundations of Computer Science, IEEE Computer Associated Technologies (2015).
Society Press, Los Alamitos, CA , 124 (1994). [9] Li and X., Science 301, 809 (2003).
[5] A. Peruzzo, J. Mcclean, P. Shadbolt, M. H. Yung, X. Q. [10] A. A. Houck, H. Türeci, and J. Koch, Nature Physics 8,
Zhou, P. J. Love, A. Aspuru-Guzik, and J. L. O’Brien, 292 (2012).
Nature Communications 5 (2013). [11] H. Haffner, C. Roos, and R. Blatt, Physics Reports
12