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 import QiskitRuntimeProvider

provider = QiskitRuntimeProvider(YOUR_QISKIT_API_KEY)

provider.get_devices()
# [<qbraid.runtime.ibm.device.QiskitBackend('ibm_brisbane')>,
#  <qbraid.runtime.ibm.device.QiskitBackend('ibm_kyoto')>,
#  <qbraid.runtime.ibm.device.QiskitBackend('ibm_osaka')>,
#  <qbraid.runtime.ibm.device.QiskitBackend('ibm_sherbrooke')>]

device = provider.get_device('ibm_osaka')

type(device)
# qbraid.runtime.ibm.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.data.get_counts()
# {'00': 6, '11': 4}

res.data.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.