I recently saw a tweet about the Qiskit Advocate Program. In response, I tweeted that I am an OpenQASM Advocate and that IBM Research should make that a real thing. I doubt that’s actually going to happen, but I’d like to make the case for it anyway.
my first OpenQASM code; it could’ve been only 7 lines instead of 8
“Hello, quantum world!” in OpenQASM
OpenQASM has been my favorite computing language ever since I first saw it. It was an accident, quite frankly. I had created an IBM Q Experience account and logged in, but was disappointed when the drag-and-drop circuit builder didn’t work on my smartphone.
After that initial disappointment, I noticed the OpenQASM circuit editor. I did a quick Internet search and was able to create the tutorial circuit by writing code instead. It stands out in my memory for multiple reasons: one obviously being that this was my first ever quantum computing experiment, but also that it worked on my very first try. Notwithstanding how little code was required, it was still my first time using a language that visually resembles a hybrid of Assembly Language and C, and errors could certainly be expected.
But, it worked and I was hooked. Not only does it visually resemble my two favorite classical languages, it’s far more simple and elegant than either. There are very few operations to learn —you can learn the language itself in mere minutes — so you can focus on designing algorithms and building circuits. And there is no word wrap or indentation or white space of any kind; it’s just a list of cannot-be-easier-to-read instructions.
Side note: I have since learned that the drag-and-drop circuit builder works on my smartphone when my Chrome browser is in “desktop mode.” It may or may not work in other browsers, too; I’ve been using Chrome to access IBM Q, so that’s the only one I tested.
screenshot of IBM Q’s “start coding with Qiskit” tutorial
“Hello, quantum world!” in Qiskit
After playing around with OpenQASM for a while, I decided to give Qiskit a try. My first observation was that it takes much more code to do in Qiskit what can be done in OpenQASM. For example, from the OpenQASM circuit editor, selecting a backend and viewing the results each requires merely tapping a button. In contrast, Qiskit requires code to do the same things, and that code can sometimes require troubleshooting.
There are some algorithms that might be shorter using Qiskit than OpenQASM, but you would probably need to run a fairly large circuit to achieve that advantage. A large Quantum Fourier Transform (QFT) would be a perfect example of this; the more qubits you use the more lines of code you save.
Another reason that I am an OpenQASM Advocate is that many variational algorithms (quantum-classical hybrids) have a whole lot of classical operations and a teeny tiny quantum circuit hiding somewhere within. While you can obviously do much, much more with Qiskit and Python than you could ever hope to do with OpenQASM, my personal interest is in the quantum components of these algorithms. In other words, my interest is not in quantum computing in general, but specifically in the role of the NISQ quantum processors.
For more information on OpenQASM, check out the paper arxiv:1707.03429 titled “Open Quantum Assembly Language.”
And if you’d like to tweet @ibmresearch in support of this idea, I’d greatly appreciate it. I’m not going to turn this into a full-fledged campaign or anything, but it would be cool to see recognition for those IBM Q Advocates that may or may not also be Qiskit Advocates.