News

Microsoft Remakes Azure Quantum Dev Kit with Rust, 'and It Runs in the Browser!'

Microsoft chose the Rust programming language to completely redo its Azure Quantum Development Kit (QDK), noting that it's now 100 times faster, 100 times smaller "and it runs in the browser!"

In announcing the Azure Quantum Development Kit preview this week, the company provided its own tl;dr:

We rewrote it (mostly) in Rust which compiles to WebAssembly for VS Code or the web, and to native binaries for Python. It's over 100x smaller, over 100x faster, much easier to install & use, works fully in the browser, and is much more productive & fun for the team to work on.

Targeting the elusive and arcane field of quantum computing ("the use of quantum mechanics to run calculations on specialized hardware"), the kit has been around since 2017, being described as "a set of open-source tools designed to help developers write quantum programs at scale." While major industry players like Microsoft have been targeting quantum computing for years, little has materialized from the efforts, and whether it will truly serve as a useful new computing paradigm remains to be seen.

The Microsoft revamp comes in a Visual Studio Code extension that's brand-new in the code editor's marketplace, with development work carried out in the Q# language and tooling GitHub repo.

[Click on image for larger view.] Azure Quantum Development Kit (QDK) Preview (source: Microsoft).

Along with the VS Code tool, the QDK ties into some Python programming language packages and VS Code's ability to run in the browser (https://vscode.dev), as illustrated in this high-level diagram that shows how everything fits together:

[Click on image for larger view.] High-Level View (source: Microsoft).

While some parts of the kit are done in Python, the darling of data scientists everywhere, the fast-growing Rust language was used for most of it, with Microsoft explaining how the team simplified things by using only three languages:

  • Rust for the core of the product. This has the 'batteries included' benefit of cargo to manage dependencies, builds, testing, etc.
  • Python, as we build & ship packages to PyPI as part of the QDK and use Python for scripting tasks in the repo where practical.
  • JavaScript (including TypeScript), as we build a VS Code extension and write some web integration code.

Microsoft has been eying Rust closely for years as a memory-safe replacement for some C++ code in various products. Here, the memory-safe attributes are secondary to other benefits.

"By writing as much as possible in Rust, we have a codebase that can easily target native binaries for any platform supported by the Rust compiler (which we build into our Python wheels) and build for WebAssembly (via wasm-bindgen) to run in the browser," Microsoft said. "With a focused codebase, the resulting binaries are very small & fast too."

Microsoft provided a screenshot showing off the ability to load the editor in the browser by visiting https://vscode.dev, running a Q# file under the debugger and viewing the quantum simulator output in the Debug Console while the user is signed in to an Azure Quantum Workspace shown in the Explorer sidebar -- all done with nothing installed on the local machine:

[Click on image for larger view.] In the Browser (source: Microsoft).

Existing functionality includes:

  • Syntax highlighting and basic syntax features (e.g. brace matching)
  • Q# cell support in Jupyter notebooks. The extension will detect %%qsharp magic cells and automatically update the cell language to Q#
  • Error checking in Q# source files
  • Breakpoint debugging and script execution for Q# source files
  • Integration with Azure Quantum for job submission to quantum hardware providers
  • Hover-definition and docs
  • Go-to-definition
  • Function signature help
  • Snippet and sample support
  • Completions

Microsoft also offers an untested [DEV BUILD] Azure Quantum Development Kit in the marketplace, which has actually been installed more times (71) than the tested version (27).

Going forward from this early preview, the team plans to work on:

  • Multi-file support: For this preview all code for a Q# program needs to be in one source file. (With Q#, you can simply 'concat' source files together if need be).
  • Richer QIR support: This preview currently can compile programs for hardware that supports the QIR [Quantum Intermediate Representation] base-profile which, as the name suggests, provides for a basic level of capabilities. With some hardware starting to support more advanced capabilities (currently being specified in the QIR Adaptive Profile), we will be adding support for that also. (Note that running in the simulator isn't restricted to these profiles and can run any Q# code).
  • Migration: Being not entirely backwards compatible with the existing QDK, we also have a lot of work to do on updating samples & documentation. (The "Differences from the previous QDK" page on our wiki will highlight changes and how to migrate code).

The company noted the existing QDK still works and can be used if needed in certain scenarios, or if devs want to avoid too many changes as the team iterates toward stability. The company's Microsoft Quantum Development Kit for Visual Studio Code tool in the VS Code Marketplace has been installed more than 65,000 times.

More information can be found in Microsoft's "Set up the Quantum Development Kit" documentation and the qsharp GitHub wiki that details installation.

About the Author

David Ramel is an editor and writer at Converge 360.

comments powered by Disqus

Featured

  • Compare New GitHub Copilot Free Plan for Visual Studio/VS Code to Paid Plans

    The free plan restricts the number of completions, chat requests and access to AI models, being suitable for occasional users and small projects.

  • Diving Deep into .NET MAUI

    Ever since someone figured out that fiddling bits results in source code, developers have sought one codebase for all types of apps on all platforms, with Microsoft's latest attempt to further that effort being .NET MAUI.

  • Copilot AI Boosts Abound in New VS Code v1.96

    Microsoft improved on its new "Copilot Edit" functionality in the latest release of Visual Studio Code, v1.96, its open-source based code editor that has become the most popular in the world according to many surveys.

  • AdaBoost Regression Using C#

    Dr. James McCaffrey from Microsoft Research presents a complete end-to-end demonstration of the AdaBoost.R2 algorithm for regression problems (where the goal is to predict a single numeric value). The implementation follows the original source research paper closely, so you can use it as a guide for customization for specific scenarios.

  • Versioning and Documenting ASP.NET Core Services

    Building an API with ASP.NET Core is only half the job. If your API is going to live more than one release cycle, you're going to need to version it. If you have other people building clients for it, you're going to need to document it.

Subscribe on YouTube