Announcing v1.0 of the Azure Quantum Development Kit
Today we are excited to announce the 1.0 release of the Azure Quantum Development Kit, which we often refer to simply as “the QDK”.
As outlined in an earlier blog post, this is a significant re-write over the prior QDK with an emphasis on speed, simplicity, and a delightful experience. Review that post for the technical details on how we rebuilt it, but at a product level the re-write has enabled us to make some incredible improvements that exceeded the expectations we set out with, some highlights being:
- A full-featured browser experience
- Vastly simplified installation across platforms
- Up to 100x performance improvement
- Comprehensive code editing productivity features
- A debugger to gain new insights as you develop and fix your quantum programs
- Powerful resource estimation capabilities directly in the editor
- Integration with the Azure Quantum service
And much more! This post will include lots of video clips to try and highlight some of these experiences (all videos were recorded in real time).
Up and running in a flash
For the fastest getting started experience, just go to https://vscode.dev/quantum/playground/ . The QDK extension for VS Code works fully in VS Code for the Web, and this URL loads an instance of VS Code in the browser with the QDK extension preinstalled, along with a virtual file system pre-loaded with some common quantum algorithms. You can experiment here, then simply close the browser tab when done, without installing anything or accessing any files on your local machine.
If using VS Code on your local machine (or using https://vscode.dev directly), then installing the extension is a snap. Simply go to the VS Code Extension Marketplace, search for “QDK”, and install the “Azure Quantum Development Kit” extension published by “Microsoft DevLabs” (direct link). The extension is lightweight with no dependencies and will install in seconds, as shown below.
Run some sample code
Once the extension is running, you can open a Q# file (with a .qs extension) and start coding. The below clip demonstrates how to create a new Q# file, use one of the sample ‘snippets’ to quickly insert a well-known algorithm, and then use the built in simulator to run the code and see the output (including quantum state dumps and debug messages).
(Note: If unfamiliar with Q#, or quantum development in general, then the Quantum Katas are a great way to learn in an interactive AI assisted experience).
Rich language features
We believe the true power of quantum computing will be realized once we reach “scalable quantum computing”, and the Q# language was designed for this. It includes both higher level abstractions to more naturally express quantum operations, as well as being a typed language to help develop, refactor, and collaborate on more complex programs. (See the “Why do we need Q#” blog post for more background).
For this release we’ve invested heavily on the editor features developers expect from a modern and productive language. This includes:
The Q# editor provides completion lists, auto-open of namespaces, signature help, hover information, go-to definition, rename identifier, syntax and type-checking errors, and more! All behave as developers familiar with other strongly typed languages such as Rust, C#, TypeScript, etc. have come to expect.
We’ve designed the experience to be as smooth as possible and to work as fast as you can type. Many of these features are available not only while editing Q# files directly, but also when writing Q# code in Jupyter Notebook cells, as shown in the clip below.
Quantum simulation and debugging
A quantum simulator is critical when developing quantum programs, and the QDK includes a sparse simulator that enables the output of diagnostic messages and quantum state as it runs in both the VS Code extension and the Python package.
The VS Code integration takes this up a notch, and the QDK brings a powerful debugging experience to Q# development. You can set breakpoints, step in and out of operations, and view both the quantum and classical state as you step through the code. It also includes some quantum-specific goodness, such as stepping through loops & operations backwards when running the generated adjoint of an operation. We’re very excited about the productivity this can unlock, and some of the ideas for where we could take it even further in future releases.
Today’s quantum hardware is still quite limited in terms of practical application, and we are still in what is termed the “Noisy Intermediate Scale Quantum” era. We consider this Level 1 in a roadmap to a quantum supercomputer. The industry is making great strides towards Level 2 currently, when it will become possible to start using “logical qubits” on real hardware. Achieving practical quantum advantage for useful problems will require logical qubits.
As with early classical computers, there will be considerable resource constraints for a number of years. (My first computer had 16KB of RAM and a cassette tape for storage!). Developing code that can squeeze the most out of the hardware will be critical to building useful applications and to advancing the field generally. There are numerous factors such as qubit types, error correction schemas, layout & connectivity, etc. that determine how a program using logical qubits maps to physical resource requirements.
Over the past year we’ve built numerous capabilities into our Azure Quantum service to assist with Resource Estimation (see the docs for details). With this release of the QDK, we’re bringing many of those capabilities directly into the client, enabling a rapid getting started experience and a very fast inner-loop to enable quantum developers to experiment and view resource requirements for their code as quickly as possible. This is an area we will continue to invest in to add capabilities for developers & researchers throughout the quantum stack to make rapid progress and develop new insights.
In the below clip showing VS Code in the browser, the “Calculate Resource Estimates” command is run to view the estimates for various qubit types and other parameters. Once complete, this brings up a comparison table, and as rows are selected a visualization chart and detailed table of results is shown for the selected hardware configuration.
If you’d like to try this exact code in the Resource Estimator, you can visit the code sharing link used in the video. (Note this code is designed for resource estimation and is unlikely to finish if you try to actually run it in the simulator).
Azure Quantum service integration
The QDK extension in VS Code enables you to connect to a Quantum Workspace in your Azure Subscription. You can then directly submit your Q# program from the editor to one of our hardware partners. You can see the status of the jobs and download the results when completed. This provides for a simple and streamlined experience, reducing the need to switch to CLI tools or Python code to work with the service. (Though using the service via those methods is still fully supported).
Current quantum hardware is limited compared to simulator capabilities, and thus the compiler must be set to the ‘base’ profile in the QDK for programs to be runnable on a real quantum machine. If the compiler is set to ‘base’ profile and a program tries to use unavailable capabilities, then the editor will immediately show an error, avoiding the need to submit potentially invalid code and then wait to see if an error occurs from the service.
Note: VS Code had already signed-in and authenticated with the subscription account in this recording. On first run you may need to authenticate with the Microsoft Account for the subscription and consent to access.
There are more editor features than can be covered here, including built-in histograms, project support, viewing the QIR for a compiled program, etc. See the documentation for more details.
Python and Jupyter support
Much work in the quantum space happens via Python in Jupyter Notebooks. Beyond the rich tooling for working with Q# directly, we’ve also revamped and refined our Python packages and Jupyter Notebooks support.
For general Q# simulation and compilation all you need is “pip install qsharp”. This package is only a couple of MB with no dependencies, and compiled to binary wheels for Windows, Mac, and Linux for x64 and ARM64 – so installation should be pain free and near instant in most environments. If you will be using Jupyter Notebooks then you may also want to install the “qsharp-widgets” package for some nice visualizations for resource estimation and histograms.
If you will be using JupyterLab in the browser, then install the ‘qsharp-jupyterlab’ package to get Q# cell syntax highlighting. However, we recommend using the VS Code support for Jupyter Notebooks as this provides some of the rich language service features outlined above when working with Q#.
You can use the VS Code command “Create an Azure Quantum Notebook” to generate a sample Jupyter Notebook. If you have connected to an Azure Quantum Workspace already as outlined above, then this Notebook will be pre-populated with the correct Azure Quantum Workspace connection settings.
If you were using the prior QDK, which we now refer to as the ‘Classic QDK’ (with this release being the ‘Modern QDK’), then this will be a substantial change. While we have endeavored to make the Q# code compatible where we could, the new architecture removes a lot of the prior project infrastructure, such as .csproj based projects, NuGet package distribution, C# integration, etc. Existing projects and samples will need to be ported to move from the ‘Classic QDK’ to the ‘Modern QDK’. The ‘Classic QDK’ will still be available to run existing code, but the ‘Modern QDK’ is the basis for future releases and we recommend moving to it when you can.
While it really has been fun and rewarding getting to 1.0, it is the beginning of a journey. We have many new features and improvements we are keen to start tackling, including improvements to the Q# language, more powerful resource estimation capabilities, package management for code sharing, advanced compiler capabilities (such as better hardware targeting), richer visualizations, better documentation & samples, and much more.
We’d love to have your input in these decisions, as you are who we are building these tools for, so please do get involved and give us your feature requests and feedback on our issue tracker at https://github.com/microsoft/qsharp/issues . (And if you do encounter any bugs with the QDK, this is the place to log those too!).
The team is very excited to reach this milestone, and hope you have as much fun using it as we did building it. Please do give it a try, give us your feedback, and tell us what you’d like to see next!