!qbraid

!qbraid --version

!qbraid jobs enable qbraid_sdk

import qbraid
qbraid.__version__
IBMQ.save_account('YOUR_IBM_KEY')

from qbraid import get_devices

get_devices()

get_devices(
    filters={
        "type": "Simulator",
        "name": {"$regex": "State"},
        "vendor": {"$in": ["AWS", "IBM"]},
    }
)

get_devices(
    filters={
        "paradigm": "gate-based",
        "type": "QPU",
        "numberQubits": {"$gte": 5},
        "status": "ONLINE",
    }
)

get_devices(filters={"runPackage": "qiskit", "requiresCred": "false"})

from qbraid import device_wrapper, job_wrapper, get_jobs
from qbraid.api import ibmq_least_busy_qpu, verify_config

qbraid_device = device_wrapper("ibm_aer_qasm_sim")
qbraid_device.info

verify_config("IBM")

least_busy = ibmq_least_busy_qpu()  # requires credential
least_busy

ibmq_id = "ibm_q_qasm_sim"
qbraid_ibmq_device = device_wrapper(ibmq_id)
qbraid_ibmq_device.vendor_dlo

from qiskit import QuantumCircuit
import numpy as np

qiskit_circuit = QuantumCircuit(1, 1)

qiskit_circuit.h(0)
qiskit_circuit.ry(np.pi / 4, 0)
qiskit_circuit.rz(np.pi / 2, 0)
qiskit_circuit.measure(0, 0)

qiskit_circuit.draw()

shots = 2

# qbraid_ibmq_job = qbraid_ibmq_device.run(qiskit_circuit, shots=shots)
# qbraid_ibmq_job.status()

google_id = "google_cirq_dm_sim"
qbraid_google_device = device_wrapper(google_id)

aws_id = "aws_dm_sim"
qbraid_aws_device = device_wrapper(aws_id)  # Credential handled by qBraid Quantum Jobs

qbraid_google_job = qbraid_google_device.run(qiskit_circuit, shots=shots)
qbraid_aws_job = qbraid_aws_device.run(qiskit_circuit, shots=shots)

get_jobs()

# qbraid_ibmq_job.wait_for_final_state()

jobs = [qbraid_google_job, qbraid_aws_job]
google_result, aws_result = [job.result() for job in jobs]

print(f"{qbraid_google_device.name} counts: {google_result.measurement_counts()}")
print(f"{qbraid_aws_device.name} counts: {aws_result.measurement_counts()}")
# print(f"{qbraid_ibmq_device.name} counts: {ibmq_result.measurement_counts()}")

google_result.plot_counts()

aws_result.plot_counts()

ibmq_result.plot_counts()



