Executing your algorithm

Initiating a run

Running your algorithm on one of the available backends is initiated by clicking on the RUN button at the top right of the screen. A popup window will appear that shows you:

  • The backend that has been selected for this experiment
  • The number of qubits used in this experiment
  • The name of the current experiment (can be changed by the user)
  • The number of shots of this experiment (can be changed by the user)
  • Information whether simulation optimization will be used or not (only for emulator backends)

Executing algorithms on a hardware backend

When you run a quantum algorithm on a hardware backend the list of quantum operations is limited by the set of operations that is supported by the backend and the topology of the chip. The list of allowed operations for the current backends can be found here.

For hardware backends, the number of qubits in your algorithm must always be set equal to the number of qubits on the chip, although you do not need to perform operations on all qubits.

When you do not provide any prep statements for your algorithm, all qubits will be initialized in the ground state or |0> state in the z-basis.

When you do not put any measure statements at the end of your algorithm, by default all qubits will be measured in the z-direction. When you do close your algorithm with a measurement on one or more qubits, only those qubits will be measured and the result for non-measured qubits will be set to the default value of zero.

In most cases you will have to execute multiple shots in order to get some statistics on your measurement and to reduce the effects of decoherence, leakage, and control imperfections. On a hardware backend, when you execute N shots of your algorithm, all shots will be executed in succession. For each shot, the final measurements will be stored in the binary register and written to the raw data file, see displaying and downloading your results. The histogram will show the probability distribution of each state of the binary register.

Executing algorithms on a emulator backend

Quantum Inspire provides different emulator backends, depending on your needs and on your account privileges. Make sure you select the backend which best fits the requirements of your algorithm in order to optimize overall execution time.

When you execute your algorithm on an emulator backend it is usually unnecessary to execute multiple shots of the same algorithm. In this case Quantum Inspire will use simulation optimization to produce the results more quickly. This can only be done when there are no measurement instructions in your algorithm and no error model is used. Please refer to the section on simulation optimization to understand the difference between deterministic and non-deterministic algorithms, when optimization will be applied, how you can influence this decision, and what the number of shots implies for these situations.

To understand how simulation optimization works with the SDK, experienced users should refer to the Advanced user guide.

Selecting the number of shots

When no simulation optimization can be used the algorithm will be executed N times. When simulation optimization is used, no randomization will be applied when N=1. In all other cases randomization with N virtual shots will be applied.

Keeping track

When a simulation is put in the queue of a backend, a copy of the current code of the algorithm is stored with the result of the execution. This way you can compare different versions of your project quickly (e.g. with error model and without error model). More on this in managing your projects.