API Reference: qbraid.runtime.qiskit

Installation & Setup

To interface with IBM Quantum backends, install the qiskit extra,

pip install 'qbraid[qiskit]'

and configure your IBM credentials.

Basic Usage

Now we go through an example of using the QiskitRuntimeProvider to submit a job to an IBM device.

>>> from qbraid.runtime.qiskit import QiskitRuntimeProvider
>>> provider = QiskitRuntimeProvider(YOUR_QISKIT_API_KEY)
>>> provider.get_devices()
[<qbraid.runtime.qiskit.device.QiskitBackend('ibm_brisbane')>,
 <qbraid.runtime.qiskit.device.QiskitBackend('ibm_kyoto')>,
 <qbraid.runtime.qiskit.device.QiskitBackend('ibm_osaka')>,
 <qbraid.runtime.qiskit.device.QiskitBackend('ibm_sherbrooke')>]
>>> device = provider.get_device('ibm_osaka')
>>> type(device)
qbraid.runtime.qiskit.device.QiskitBackend
>>> device.metadata()
{'device_id': 'ibm_osaka',
 'device_type': 'QPU',
 'num_qubits': 127,
 'instance': 'ibm-q/open/main',
 'max_shots': 100000,
 'status': 'ONLINE',
 'queue_depth': 37}

Our chosen device is the IBM Osaka Backend, which we will now submit a Qiskit job to.

from qiskit import QuantumCircuit

circuit = QuantumCircuit(2)
circuit.h(0)
job = device.run(circuit, shots=10)

So now we have job which is of type QiskitJob, which inherits from QuantumJob. To see the results, we can do the following:

>>> res = job.result()
>>> res.measurements()
array([[1, 1],
       [0, 0],
       [0, 0],
       [1, 1],
       [0, 0],
       [1, 1],
       [0, 0],
       [1, 1],
       [0, 0],
       [0, 0]])

See how to visualize these results in the Visualization section.