Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unneeded cirq dependency in qiskit-superstaq #117

Closed
singular-value opened this issue Aug 12, 2021 · 3 comments
Closed

Remove unneeded cirq dependency in qiskit-superstaq #117

singular-value opened this issue Aug 12, 2021 · 3 comments
Assignees

Comments

@singular-value
Copy link
Contributor

Right now, we convert qiskit circuits to cirq circuits just so that we can call cirq.to_json(circuit) and get a JSON-serialized version. But then on the server, we go back down to the qiskit circuit anyways.

There should be a way to get qiskit circuits down to a serialized format; there shouldn't be a need for a cirq dependency.
repr(qc) doesn't work, but maybe just taking the qc.qasm() would work.

@singular-value singular-value changed the title Remove unneeded cirq dependencies in qiskit-supersta Remove unneeded cirq dependencies in qiskit-superstaq Aug 12, 2021
@singular-value singular-value changed the title Remove unneeded cirq dependencies in qiskit-superstaq Remove unneeded cirq dependency in qiskit-superstaq Aug 12, 2021
@mtreinish
Copy link

If you going from Qiskit's QuantumCircuit object in the client to a qiskit QuantumCircuit on the server side I'd suggest you take a look at QPY serialization which is a new feature we added in the latest qiskit-terra 0.18.x release:

https://qiskit.org/documentation/apidoc/qpy.html

it's a native binary serialization format for Qiskit's quantum circuit object. You can pass qpy_serialization.dump a circuit (or a list of circuits) and get the same circuits out from runing load().

For example, IBM Quantum has started to use it for the circuit runner serialization by b64 encoding the QPY file written to a BytesIO buffer and embedding that in the json payload: https://github.com/Qiskit/qiskit-ibmq-provider/blob/abc88dbd224cae3c492af177c08a610592e7cd7f/qiskit/providers/ibmq/runtime/utils.py#L124-L132

It also gives you a certain level of backwards compatibility as the format is designed such that newer versions of Qiskit can always load QPY files generated with older versions of Qiskit.

@vtomole
Copy link
Member

vtomole commented Aug 12, 2021

Thank you very much for the recommendation. @mtreinish. We are going to serialize our circuits to qasm strings for now as a stopgap and circle around to QPY in the future.

@singular-value
Copy link
Contributor Author

singular-value commented Aug 12, 2021

Yup, thanks @mtreinish — that makes a lot of sense. Tracking in #118.

@richrines1 richrines1 transferred this issue from another repository Mar 15, 2023
perlinm pushed a commit that referenced this issue Mar 22, 2023
* casablanca has retired

* update

* update
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants