Classical and Quantum Data Interaction in Programming Languages: A Runtime Architecture Evandro Chagas Ribeiro da Rosa, Rafael de Santiago Departamento de Inform´aticae Estat´ıstica- INE PPGCC Universidade Federal de Santa Catarina - UFSC Florian´opolis,Santa Catarina, Brazil Abstract We propose a runtime architecture that can be used in the development of a quantum programming language and its programming environment. The proposed runtime architecture enables dynamic interaction between classical and quantum data following the restriction that a quantum computer is available in the cloud as a batch computer, with no interaction with the classical computer during its execution. It is done by leaving the quantum code generation for the runtime and introducing the concept of futures for quantum measurements. When implemented in a quantum program- ming language, those strategies aim to facilitate the development of quantum applications, especially for beginning programmers and students. Being suitable for the current Noisy Intermediate-Scale Quantum (NISQ) Computers, the runtime architecture is also appropriate for simulation and future Fault-Tolerance Quantum Computers. Keywords: Quantum Computation, Programming Language, Quantum Programming, Runtime Architecture 1. Introduction with a few dozen of noise qubits, where the commercial ones are accessible through the cloud, e.g., the Ama- A quantum computer uses quantum mechanics phe- zon Braket service [18]. Due to the low-fidelity of the nomena, such as superposition and entanglement, to small number of qubits and the implemented gates, ev- solve some problems faster than classical computers. ery quantum execution needs to be as much optimized Such a claim was first proposed by Feynman [1] mo- as possible, forbidding the execution of a generic quan- tivated by the difficulty of simulating the evolution of tum code. For example, to activate the best perfor- quantum states. Later, confirmed by the pioneer works mance, the quantum code that sums an arbitrary integer of Shor [2] and Grover [3]. And, recently demonstrated x into a quantum superposition should be specialized for experimentally by Google [4]. every possible value of x. A quantum programming language describes instruc- tions for a quantum computer. It is a relatively new In opposition to the NISQ computers, there are Fault- paradigm, but there are several implementations [5–16] tolerant Quantum Computers [19] with enough qubits from both industry and academy. The level of abstrac- to run expensive quantum error correction (QEC) codes tion and quantum architecture targets vary from each [19] on top of quantum applications. Nevertheless, we language. For instance, Q# [6] is a high-level domain- are still far from them. Although even there, we may specific language used to program quantum computers have the same restrictions of accessibility (in the cloud, arXiv:2006.00131v1 [quant-ph] 29 May 2020 based on quantum logic gates, and Blackbird [8] is a not locally) and the need to run highly optimize quan- low-level language used for continuous-variable quan- tum applications due to the high cost of the QEC codes. tum computation on photonic quantum computers. In this context, we propose a runtime architecture Today, we are in the Noisy Intermediate-Scale Quan- that can be used to both develop quantum programming tum (NISQ) era [17] marked by quantum computers languages, or embed quantum programming in general propose programming languages. The runtime architec- ture enables dynamic interaction between classical and Email addresses: [email protected] (Evandro Chagas Ribeiro da Rosa), [email protected] (Rafael de quantum data stored in qubits despite the limitations that Santiago) a quantum computer executes in bach, without interac- tion between classical and quantum computers during the quantum execution, and that the generated quantum code needs to be highly optimized for a specific execu- tion. More precisely, this dynamic interaction allows the loop of classical information controlling quantum oper- ations and quantum measurement operation with clas- sical information, all regardless of whether that data is stored on the classic or quantum computer. With the proposed runtime architecture, a quantum programming language can be developed as a general- propose programming language that supports the quan- tum programming paradigm, and not a domain-specific programming language as must quantum programming languages [6, 13, 15, 16]. This abstraction permits the Figure 1: Bloch sphere used to visualize a single qubit. development of an application that takes advantage of quantum and classical computers with a single and con- sistent programming language, facilitating the develop- or 1 according to the probability amplitude of the qubit j i j i j i j j2 ment of quantum applications, especially for beginning state, e.g., = α 0 + β 1 has the probability α of j j2 programmers and students. return 0 and β of return 1. When a measurement is The proposed architecture has several components, done, the qubit’s superposition is destroyed, collapsing j i where the main one is a shared library that manages the its state. For example, if the measurement of returns j i j i quantum code generation, optimization, and execution. 0 or 1, it collapses, respectively, to state 0 or 1 . Those components form a general framework for the Quantum entanglement is another important phe- construction of a quantum programming environment nomenon for quantum computation. When a set of with a simulator and optimizing compilers. qubits is entangled, we cannot fully describe every qubit The remainder of this paper is organized as follows. separately. It means that any operation on a single qubit A brief introduction to quantum computation is given in will change the state of all qubits in the set. For ex- Section 2. An overview of quantum programming and ample, if we measure one of two maximally entangled the constraints imposed on the proposed runtime archi- qubits, we know what will be the measurement result of tecture are shown in Section 3. The runtime architecture the other qubit. and its component are detailed in Section 4. The shared The evolution of a quantum state is described by a library features that enable the dynamic interaction be- unitary operation. Consequently, any quantum oper- tween classical and quantum data are presented in Sec- ation, except measurement, is time-reversible, and we tion 5. And, in Section 6, there are our conclusions and cannot copy the state of a qubit [20]. final remarks. A quantum circuit [21] is a diagram that defines the evolution of a quantum state through time. An example 2. Quantum computation of quantum circuit can be seen in Figure 2. A quantum circuit is executed from left to right by the application of This section introduces the concepts of quantum bit quantum gates and measurements. The therm quantum (qubit), quantum measurement, quantum entanglement, operation used in this paper refers to any process (not quantum circuit, and decoherence. necessarily a quantum circuit) that changes the quantum The basic unity of information used in quantum com- state of a qubit. putation is the qubit. A qubit (or quantum bit), alike to a bit, can be at states 0 or 1, denoted by j0i and j1i, but different from a bit, it can also be at both states at the same time, in what we call a superposition. In a su- perposition, a qubit is denoted by a convex sum, e.g., j i = α j0i + β j1i where α, β 2 C and jαj2 + jβj2 = 1. It can be visualized geometrically in the Bloch sphere, θ iφ θ j00i+j11i e.g., the qubit j i = cos j0i + e sin j1i of Figure 1. Figure 2: Quantum teleportation circuit, where jβ00i = p . The 2 2 2 To extract information from a superposition, we need last two quantum gates Z and X are controlled by the measurement to perform a measurement that will randomly return 0 result of the top two qubits. 2 Decoherence is the process of loss of information that Source code Quantum code a quantum computer suffers due to its interaction with the environment, or the inaccurate execution of quantum operations. It is the primary barrier for quantum com- Generate putation, limiting the time that a quantum computer can Classical code maintain the quantum information, and consequently, the circuit deep (number of quantum gates). To over- come this limitation, we can encode the quantum state Run in a quantum error correction (QEC) code [19]. How- ever, this approach adds a costly overhead in the number Send quantum code Classical of qubits and quantum gates used. computer Quantum computer 3. Quantum programming Return measurements In this section, a general overview of quantum pro- gramming languages is given along with the quantum Figure 3: The general workflow of a quantum programming language. programming restriction and characteristics imposed on the proposed runtime architecture. Although it is acknowledged that an abstraction be- The general workflow of a programming language is yond the quantum circuit would benefit the develop- summarized in Figure 3. There, a single source code ment of new quantum applications [22], the abstrac- generates both the classical and quantum codes. This tion of most quantum programming languages is equiv- generation can be done by a compiler, interpreter (simi- alent to quantum circuit. It is particularly true for a set lar to Python), or a mixed approach. The classical code of quantum programming languages [5, 7–9, 12] called is then executed by a local classical computer, and the quantum instruction set or quantum assembly language. quantum code is sent to a remote quantum computer. Those quantum programming languages aim to be an The quantum computer is a batch computer that takes intermediary representation for higher-level program- a quantum code as input and outputs the measurement ming languages and other quantum programming soft- results. It is connected to a classical computer throw a ware [8, 12, 23].
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages8 Page
-
File Size-