client-superstaq
client-superstaq copied to clipboard
validate qubit types in cirq-superstaq
What is happening?
we only support qubit types defined in cirq-core. cirq-rigetti and cirq-pasqal both define custom qubit types, which currently result in internal server errors when submitted to superstaq, e.g.
css.Service().compile(
cirq.Circuit(cirq.X(cirq_rigetti.AspenQubit(2, 3))),
target="ss_unconstrained_simulator"
) # SuperstaqServerException: Internal Server Error (Status code: 500)
css.Service().compile(
cirq.Circuit(cirq.X(cirq_rigetti.AspenQubit(2, 3))),
target="ss_unconstrained_simulator"
) # SuperstaqServerException: Internal Server Error (Status code: 500)
we should add a validator to reject these circuits client-side with a helpful message
something like this should be sufficient:
supported_qid_types = (
cirq.LineQubit, cirq.LineQid, cirq.GridQubit, cirq.GridQid, cirq.NamedQubit, cirq.NamedQid
)
if not all(isinstance(q, supported_qid_types) for q in circuit.all_qubits()):
raise ...
What are the current alternatives?
- add server-side support for these qubit types
- issue an error server side
Any additional context?
No response