Quantum Computing: Using IBM’s Online Computers

Friday , 29, November 2019

We ran our quantum enatnglement program on a simulator in the previous post, so it’s pretty obvious what we need to do now. Qiskit is made for interacting with IBM’s quantum resources, so this is going to be easy. Let’s get started!

Qiskit has four main parts: Aer, Aqua, Terra, and Ignis. It is fashionable to name your quantum computing libraries and modules after the elemental forces it seems – others in the industry do it as well. The official qiskit documentation is the place to read up on this, but for our purposes let’s just point out that Aer has the simulator that we used in the previous post and handles management of the backends for us.

We don’t need to change our code from last time, we only need to change the backend that our code will run on.

We previously saved our IBM account token, so we only need to load it if we’re using the same machine as before. We could have chosen the least busy machine using the method we saw in the previous post, but here we’ll simply choose a backend provider by name.

job = execute(c, backend=quantumcomp)

All that’s left to do is execute our job, as shown above. I would be remiss if I didn’t mention a nice aid that we can use to watch the status of our job(s) called job watcher that will run inside our Jupyter notebook.

import qiskit.tools.jupyter
%qiskit_job_watcher

This will render s display in the top left corner of our page with information about how many jobs are queued and where our job is currently in that queue.

Let’s take a look at the results of running this on an actual 5-qubit quantum computer called ibmq_ourense, plotted in a histogram:

We successfully ran our job and measured the two qubits to be in a state of entanglement more than 95% of the time. Remember quantum algorithms are probabilistic so we run them many times. They’re also sensitive to noise, in that the qubits don’t remain in a coherent state for long, so we need to keep programs short if possible. Decoherence is one of the main challenges in fact. It does not affect our little two gate computation here, but it would be an obstacle if we tried to run Shor’s algorithm. We’ll do it anyway in a future post, because qiskit’s Aqua module provides code for just that purpose.

Time to mention a best practice: documenting the software version used for a given notebook. This can be done with qiskit.__qiskit_version__
If you want to, feel free to play around with the notebook on github. I should also mention that this is but one version of entanglement, there are others and they are useful primitives for other algorithms.

Next let’s talk about what is really going on here, so we better understand this magic. Also in the next post, let’s compare and contrast this with other quantum computing architectures a little, as a warmup for exploring other software frameworks in future posts. Hopefully we can cover some of that territory without getting too deep, and take a look at Shor’s algorithm at the same time. Stay tuned!