Basic circuit execution¶
This notebooks illustrates how you can run your qiskit code on the Quantum Inspire 2 platform.
This notebook makes the following assumptions:¶
quantuminspire2 sdk installed
account exists in the QI2 platform
qiskit plugin installed (pip install qiskit-quantuminspire) in the same environment as this notebook
# Be sure to have logged in to the QI2 platform via the SDK. If you have installed it in the same environment as
# this notebook, you may run this cell.
!qi login "https://staging.qi2.quantum-inspire.com"
The necessary imports¶
from qiskit import QuantumCircuit
from qiskit_quantuminspire.qi_provider import QIProvider
What QI Backends are available?¶
provider = QIProvider()
# Show all current supported backends:
print(provider.backends())
Create your Qiskit Circuit¶
Let’s create a bell state circuit.
circuit = QuantumCircuit(3, 10)
circuit.h(0)
circuit.cx(0, 1)
circuit.measure(0, 0)
circuit.measure(1, 1)
Create the Job in the Quantum Inspire Platform¶
On the appropriate backend, you run your circuit. Be aware that if your circuit contains gates that are not supported by the target, compilation errors may arise.
backend = provider.get_backend(name="QX emulator")
job = backend.run(circuit, shots=1024)
Obtain the result¶
After a while the result should be available. Depending on the current load, the time for completion may vary.
result = job.result()
print(result)