Building Microsoft Q# software for Quantum Computers using VSTS

At a customer I had the question if Microsoft Visual Studio Team Services (VSTS) or TFS, would be able to handle new technologies. So, because of the “Any Language, Any Platform” vision of the VSTS, I told the client that if he wanted to use VSTS for quantum computers this wouldn’t be any problem. Let’s keep it at that the client called my hand on this one. Many people think quantum computers are still a figure of the imagination. But if you look on tech forums and other news lately there has been a lot of buzz about real devices from different companies like Google, Intel, IBM and DWave coming out with their devices. But even though the machines become more accessible, one still needs to write software for this device. Because these devices are based on the characteristics of quantum mechanics, writing code for these devices hasn’t traditionally be a walk in the park. I can still think of the days where I needed to formulate my own Hamiltonian equations, just to put some computation in place. But as much research and development time is spend making it easier, we are starting to see quantum computing programming languages that help lesser gods to write code for these devices.

Usage of those Quantum operators. Yes I know that I need to add argument parsing 🙂

 

In the December 2017 Microsoft released the quantum enabled Q# language. Q# is a language that allows developers to use .Net to create hybrid applications which make use of both quantum and traditional computing in a much simpler way. Q# is packaged in an SDK which one can download to get a native Microsoft Visual Studio experience to program for quantum computers. By using Q# one can create C# projects which can contain Q# operations in order to have them usable as quantum operations. The quantum operations written in Q# live in a “.qs” file, which is currently interpreted by the Q# compiler which writes a “.g.cs” file in your obj directory. Dependencies and libraries are included using Nuget packages which also inject the targets for the Q# compiler. But because its using existing technologies and extension points of the MSBuild and Nuget package management framework, its technically still a “traditional” C# project.

We are running Microsoft Q# on an unmodified hosted VSTS buildserver.

And now for the amazing fact; by being a traditional C# project, we can add this project into the VSTS build environment by using the default dotNet Core build template. After doing this, the Q# build worked (after nudging the test folder) out of the box including the Q# written unittest. Because all the packages are published on Nuget.org, this build was running on the Hosted Build agent and ran just fine. Imagine that; writing code for quantum computers, is just as simple as creating a build as usual.

Woah.. “Any Language, Any Platform” indeed 🙂