Introduction to Q# & Quantum Development Kit - Azure Quantum (2024)

  • Article

The Quantum Development Kit (QDK) is the SDK required to interface with the Azure Quantum service. It is built-in to the Azure Quantum portal, where you can develop programs using the free hosted Jupyter Notebooks. You can also install the QDK locally on your computer to use your own local development environment and work both online and offline with the Azure Quantum service. With the Quantum Development Kit, you can build programs that run on quantum hardware in Azure Quantum.

The QDK includes the quantum programming language Q#, a high-level, open-source programming language that allows you to focus your work at the algorithm and application level to create quantum programs.

The QDK offers support for Q#, but also for Qiskit, and Cirq for quantum computing, so if you are already working in other development languages, you can also run your circuits on Azure Quantum.

The QDK contains components that can be used standalone, independently from the Azure Quantum service:

  • Q# language and quantum libraries, all open-source.
  • Quantum simulators that simulate current and future quantum machines, so that you can run and debug your quantum algorithms written in Q#.
  • Extensions for Visual Studio 2022 and Visual Studio Code, and integration with Jupyter Notebooks.

Get started with Q# and the Quantum Development Kit

To jump right in, you can explore Q# in the Azure Quantum portal with no installation required. For more information, see Get started with Q# and an Azure Quantum notebook.

For other development environment options, see Setup the Quantum Development Kit.

Tip

If you want to accelerate your quantum computing journey, check out Code with Azure Quantum, a unique feature of the Azure Quantum website. Here, you can run built-in Q# samples or your own Q# programs, generate new Q# code from your prompts, open and run your code in VS Code for the Web, and ask Copilot any questions about quantum computing.

The quantum programming language Q#

Q# is an open-source, high-level, programming language for developing and running quantum algorithms. It’s part of the Quantum Development Kit (QDK) and it's designed to be hardware agnostic, scale to the full range of quantum applications, and to optimize execution. For more information on the Q# language development project, see the Q# and core libraries design repository on GitHub.

As a programming language, Q# draws familiar elements from Python, C#, and F#, and supports a basic procedural model for writing programs with loops, if/then statements, and common data types. It also introduces new quantum-specific data structures and operations, such as repeat-until-success and adaptive phase estimation, which allow the integration of quantum and classical computations. For example, the flow control of a classical program can be based on the outcome of a quantum measurement.

Integration with quantum and classical computation

Q# is a standalone language offering a high level of abstraction. There is no notion of a quantum state or a circuit; instead, Q# implements programs in terms of statements and expressions, much like classical programming languages. Distinct quantum capabilities, such as support for functors and control-flow constructs, facilitate expressing, for example, phase estimation and quantum chemistry algorithms.

The Q# language supports the integration of rich classical and quantum computing. This allows clean expression of adaptive algorithms such as the random walk phase estimation operation that are difficult to express directly in the circuit model of a fixed sequence of quantum gates.

Q# supports general classical flow control during the execution of an algorithm. In particular, classical flow control is based on quantum measurement outcomes, which makes it much easier to write things that depend on intermediate measurements. For instance, the loop required for probabilistic algorithms such as Grover search can easily be expressed in Q#, rather than having to return to the classical driver to test whether the result satisfies the oracle and rerunning if not.

Qubits as opaque references

In Q#, qubits are a resource that are requested from the runtime when needed and returned when no longer in use. This is similar to the way that classical languages deal with heap memory.

In Q# qubits are modeled as opaque data types that represent a reference to a specific two-state quantum system, whether physical or logical (error-corrected), on which quantum operations may be performed. This is an operational view of qubits - that is, qubits are defined by what you can do to them.

The mapping from a qubit variable in a program to an actual logical or physical qubit is decided by the runtime, and that mapping may be deferred until after the topology and other details of the target device is known. The runtime is responsible for determining a mapping that allows the algorithm to execute, including any qubit state transfer and remapping required during execution.

The representation used in Q# has the interesting implication that all of the actual quantum computing is done by side effect. There is no way to directly interact with the quantum state of the computer; it has no software representation at all. Instead, you perform operations on qubit entities that have the side effect of modifying the quantum state. Effectively, the quantum state of the computer is an opaque global variable that is inaccessible except through a small set of accessor primitives (measurements) — and even these accessors have side effects on the quantum state, and so are really “mutators with results” rather than true accessors.

Respect the laws of physics

Quantum programs should be required to respect the laws of physics. For example, copying the state of a qubit or directly accessing the qubit state are not possible in Q#.

Therefore, Q# has no ability to introspect into the state of a qubit or other properties of quantum mechanics directly, which guarantees that a Q# program can be physically executed on any quantum computer. Instead, a Q# program has the ability to call operations and functions, such as DumpOperation operation, to extract classical information from a qubit, that allow validation and state examination to facilitate debugging with a simulator. For more information, see testing and debugging.

Hardware agnostic

Q# is hardware agnostic, meaning that it provides the means to express and leverage powerful quantum computing concepts independently of how hardware evolves in the future. To be useable across a wide range of applications, Q# allows you to build reusable components and layers of abstractions. To achieve performance with growing quantum hardware size, the Q# quantum programming language ensures the scalability of both applications and development effort. Even though the full complexity of such computations requires further hardware development, Q# programs can be targeted to run on various quantum hardware backends in Azure Quantum.

Efficient execution

The Q# language is focused on expressing information to optimize the execution of quantum components, independent of the context within which they are invoked. Q# allows the developer to communicate their knowledge about a computation so that the compiler can make an informed decision regarding how to translate it into instructions, leveraging information about the end-to-end application that is not available to the developer.

To learn more about the QDK features and the general pieces that fit within a Q# program, see the Q# quantum programming language user guide.

Quantum development workflow with the QDK

When you compile and run a quantum program, the QDK creates an instance of the quantum simulator and passes the Q# code to it. The simulator uses the Q# code to create qubits (simulations of quantum particles) and apply transformations to modify their state. The results of the quantum operations in the simulator are then returned to the program. Isolating the Q# code in the simulator ensures that the algorithms follow the laws of quantum physics and can run correctly on quantum computers.

Everything you need to write and run Q# programs, including the Q# compiler, the Q# libraries, and the quantum simulators, is pre-deployed in the hosted Jupyter Notebooks in the Azure portal. The QDK can also be installed and run from your local computer, so you can use your preferred IDE and language locally and submit jobs to quantum hardware or cloud-based simulators on Azure Quantum, or work with local simulators. For more information, see configure your quantum development environment.

The following diagram shows the stages through which a quantum program goes from idea to complete implementation on Azure Quantum, and the tools offered by the QDK for each stage.

Introduction to Q# & Quantum Development Kit - Azure Quantum (1)

Note

You use the same Q# code for all steps of the workflow. In the short term you might have to tweak some portions of the code to account for the current hardware limitations. But in the long run you’ll be able to switch between various simulators and hardware providers without any code modifications.

Write your quantum program

A Q# program can compile into a standalone application, run in a Jupyter Notebook, or be called by a host program that is written either in Python or a .NET language.

If you want to start practicing and writing your Q# programs without installing additional software, you can use the hosted Jupyter Notebooks available in your Azure Quantum workspace in the Azure portal. The sample gallery contains a collection of annotated notebook samples - select the sample you want to explore and run it on cloud-based simulators or real quantum computers.

If you prefer a local development environment, you can create your Q# program using Jupyter Notebooks with the IQ# kernel, or the QDK extensions for Visual Studio Code and Visual Studio 2022, and then run them against quantum hardware, or cloud-based or local simulators.

Whichever environment you prefer, you can follow the Q# tutorials and start writing quantum programs to explore quantum concepts such as superposition, entanglement, Grover's quantum algorithm, and other quantum phenomena.

If you don't have an Azure account, and you want to try Q# without installing the QDK locally, you can use Binder to run the Q# samples in Jupyter Notebooks online.

Explore domain-specific libraries

The Q# libraries will help you keep your code high level, enabling you to run complex quantum operations without having to design low-level operation sequences. New Q# projects automatically include the Q# standard library, which provides a set of essential and very useful functions and operations that can be used when writing quantum programs in Q#.

In addition to the standard library, the QDK includes a quantum chemistry library for simulating quantum dynamics and electronic structure problems on quantum computers, a quantum machine learning library which provides an implementation of the sequential classifiers that take advantage of quantum computing to run hybrid quantum/classical machine learning experiments, and a quantum numeric library which provides support for a wide range of numerics functionality.

Run programs in simulators

Once you’ve written your program, the QDK offers a set of quantum simulators - classical programs that simulate the behavior of a quantum system - so that you can run a small instance of your program and see what it does without actual hardware access. You can run your quantum programs on a full-state quantum simulator, a limited-scope Toffoli simulator, a sparse simulator for systems with larger number of qubits, and even use the noise simulator for simulating the behavior of Q# programs under the influence of noisy environments.

See the full list of quantum simulators.

Estimate resources

Before running on quantum hardware, you’ll need to figure out whether your program can run on existing hardware, and how many resources it will consume. You can use the trace simulator to estimate how many qubits and quantum gates you need and debug classical code that is part of your quantum program.

You can also submit your quantum program to the Azure Quantum Resource Estimator target in Azure portal. The Azure Quantum Resource Estimator computes post-layout physical resource estimation by taking assumptions about qubit parameters, quantum error correction codes, and an error budget into account. It is free of charge and requires an Azure account.

Submit jobs to the Azure Quantum service

Azure Quantum is the cloud quantum computing service of Azure, with a diverse set of quantum solutions and technologies. Azure Quantum ensures an open, flexible, and future-proofed path to quantum computing that allows you to run your program on quantum hardware. You can run your Qiskit, Cirq, and Q# programs on multiple quantum systems. See Quantum computing providers for the current list of supported hardware providers.

Tip

First-time users automatically get free $500 (USD) Azure Quantum Credits for use with each participating quantum hardware provider. If you have consumed all the credits and you need more, you can apply to the Azure Quantum Credits program.

Once you’ve created an Azure Quantum workspace, you can submit your Q# programs (also known as jobs) to Azure Quantum through your preferred development environment, both locally and online. For more information, see how to submit Q# jobs. You can also run and submit quantum circuits written in Qiskit or Cirq.

The following diagram shows the basic workflow after you submit your job:

Introduction to Q# & Quantum Development Kit - Azure Quantum (2)

Azure Quantum offers some of the most compelling and diverse quantum resources available today from industry leaders. With Azure Quantum and the QDK you can write quantum computing programs, and submit them to Azure Quantum to run on quantum hardware.

Next Steps

If you want to learn more, the Quantum Katas provide a good introduction to quantum computing concepts such as common quantum operations and how to manipulate qubits.

As an enthusiast and expert in quantum computing, my extensive knowledge and hands-on experience in the field allow me to provide a comprehensive overview of the concepts discussed in the article.

Quantum Development Kit (QDK) and Azure Quantum Service: The Quantum Development Kit serves as the software development kit (SDK) for interacting with the Azure Quantum service. It is seamlessly integrated into the Azure Quantum portal, allowing developers to create programs using Jupyter Notebooks. The QDK can be installed locally, enabling offline development in one's preferred environment. It supports the creation of programs that run on quantum hardware in Azure Quantum.

Quantum Programming Language Q#: The QDK includes the Q# programming language, designed for high-level quantum programming. It's an open-source language that abstracts away hardware details, allowing developers to focus on algorithms and applications. Q# draws elements from Python, C#, and F# and introduces quantum-specific data structures and operations. It supports a basic procedural model and facilitates the integration of quantum and classical computations.

QDK Components and Features:

  • Q# Language and Quantum Libraries: Open-source components for quantum programming.
  • Quantum Simulators: Simulate current and future quantum machines for debugging quantum algorithms written in Q#.
  • Extensions for Visual Studio 2022 and Visual Studio Code: Integration with popular development environments.
  • Integration with Jupyter Notebooks: Seamless interaction with Jupyter Notebooks for quantum programming.

Qubits in Q#: In Q#, qubits are treated as resources requested from the runtime when needed and returned when not in use. Qubits are modeled as opaque data types representing a reference to a two-state quantum system. The runtime decides the mapping from a qubit variable to an actual logical or physical qubit, allowing for flexibility in execution.

Integration of Quantum and Classical Computation: Q# supports the integration of classical and quantum computing, enabling the clean expression of adaptive algorithms. Classical flow control is based on quantum measurement outcomes, making it easier to express algorithms like Grover's search.

Respecting the Laws of Physics: Q# enforces respect for the laws of physics, prohibiting actions such as copying the state of a qubit or directly accessing the qubit state. This ensures that Q# programs can be physically executed on any quantum computer.

Hardware Agnosticism and Efficient Execution: Q# is hardware-agnostic, allowing the expression and leveraging of quantum computing concepts independently of hardware evolution. It enables the construction of reusable components and abstractions for scalable applications. The language focuses on expressing information for optimized execution, allowing developers to communicate knowledge for informed compilation decisions.

Quantum Development Workflow with QDK: The QDK facilitates the entire quantum development workflow, from writing and running Q# programs to exploring domain-specific libraries, running simulations, estimating resources, and submitting jobs to the Azure Quantum service.

Azure Quantum Service: Azure Quantum provides a cloud quantum computing service supporting various quantum solutions and technologies. Users can submit Q# programs to run on quantum hardware, and Azure Quantum supports multiple quantum systems, including Qiskit, Cirq, and Q#.

Next Steps: The article suggests exploring Quantum Katas for an introduction to quantum computing concepts and provides QuickStarts for understanding linear algebra in the context of quantum computing. It encourages users to take advantage of Azure Quantum Credits for quantum hardware usage.

In summary, the Quantum Development Kit and Azure Quantum service offer a powerful platform for quantum programming, simulation, and execution, with Q# as a versatile language designed for quantum computing applications.

Introduction to Q# & Quantum Development Kit - Azure Quantum (2024)

FAQs

What is Microsoft Quantum Development Kit? ›

Q# is an open-source, high-level, programming language for developing and running quantum algorithms. It's part of the Quantum Development Kit (QDK) and it's designed to be hardware agnostic, scale to the full range of quantum applications, and to optimize execution.

What is Microsoft Azure quantum? ›

Azure Quantum is the cloud quantum computing service of Azure, with a diverse set of quantum solutions and technologies. Azure Quantum ensures an open, flexible, and future-proofed path to quantum computing that adapts to your way of working, accelerates your progress, and protects your technology investments.

What is quantum toolkit? ›

The Munich Quantum Toolkit (MQT) is a collection of design automation tools and software for quantum computing developed at the Chair for Design Automation at the Technical University of Munich. Our overarching objective is to provide solutions for design tasks across the entire quantum software stack.

How many qubits are in Azure quantum? ›

IonQ's trapped-ion gate-based quantum computers are universal and dynamically reconfigurable in software, providing up to 11 qubits to use in IonQ Harmony QPU, up to 25 qubits to use in Ionq Aria QPU, and 32 qubits in the IonQ Forte QPU.

What is the reason for using the quantum toolkit? ›

It provides organizations with a framework to assess their quantum readiness and identifies steps to prioritize and enhance their quantum security measures. Though organizations vary in size, industry and maturity, the toolkit is offered a starting point for developing a tailored strategy for quantum readiness.

Does Azure have quantum computing? ›

Azure is the richest cloud development environment for quantum computing. Enjoy the most popular quantum SDKs: Q#, Qiskit, and Cirq. Write once and run on multiple hardware architectures.

Does NASA use Azure? ›

NASA's Jet Propulsion Laboratory (JPL) has turned to Azure Quantum to explore ways to communicate more efficiently with spacecraft exploring our solar system and beyond.

What is Azure called now? ›

Azure Active Directory (Azure AD), now known as Microsoft Entra ID, is an identity and access management solution from Microsoft that helps organizations secure and manage identities for hybrid and multicloud environments.

Which programming language is used for quantum computing? ›

Quantum circuits are created and manipulated using Python. Results are obtained either using simulators that run on the user's own device, simulators provided by IBM or prototype quantum devices provided by IBM.

What does Windows Software Development Kit do? ›

Microsoft Windows Software Development Kit (SDK) provides a set of features compilers, headers, libraries, code samples, and help systems that developers can use to create applications that run on Microsoft Windows. Users can use the Windows SDK to write applications for both Microsoft Windows and Microsoft .

What is quantum software used for? ›

Quantum computation has the potential to solve some of the most challenging computational problems faced in chemistry, allowing the scientific community to do chemical simulations that are intractable today.

What do quantum developers do? ›

Quantum developers are responsible for developing software solutions that can be easily tailored to COTS and GOTS systems. They also support development of user interfaces and web services solutions.

What do they use quantum computers for? ›

Quantum computers can run more accurate and realistic prototyping and testing. In the manufacturing space, this could help reduce the cost of prototyping and result in better designs that don't need as much testing. Drug and chemical research.

Top Articles
Latest Posts
Article information

Author: Kieth Sipes

Last Updated:

Views: 6011

Rating: 4.7 / 5 (47 voted)

Reviews: 86% of readers found this page helpful

Author information

Name: Kieth Sipes

Birthday: 2001-04-14

Address: Suite 492 62479 Champlin Loop, South Catrice, MS 57271

Phone: +9663362133320

Job: District Sales Analyst

Hobby: Digital arts, Dance, Ghost hunting, Worldbuilding, Kayaking, Table tennis, 3D printing

Introduction: My name is Kieth Sipes, I am a zany, rich, courageous, powerful, faithful, jolly, excited person who loves writing and wants to share my knowledge and understanding with you.