qiskit-community / qiskit-ionq

Qiskit provider for IonQ backends
https://qiskit-community.github.io/qiskit-ionq/
Apache License 2.0
42 stars 24 forks source link

Warn when a Qiskit circuit has null mappings for all registers #114

Closed splch closed 1 year ago

splch commented 1 year ago

Summary

Emits a warning when a submitted circuit has no valid qubit->bit mappings.

Details and comments

provider = IonQProvider()
backend = provider.get_backend("ionq_simulator")

qc = qiskit.QuantumCircuit(1, 1, name="null circuit")
qc.h(0)

job = backend.run(qc)

> /qiskit-ionq/qiskit_ionq/ionq_backend.py:359: UserWarning: Circuit null mappings is not measuring any qubits
Cynocracy commented 1 year ago

I would actually slightly prefer that this warning be done server-side through https://github.com/Qiskit-Partners/qiskit-ionq/blob/39989e51f3970a9ee11416ffa4f26a051bcc62bf/qiskit_ionq/ionq_job.py#L346-L348 but I am okay with one being added client side as well