-
Notifications
You must be signed in to change notification settings - Fork 370
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
Fix handling of circuit metadata #1436
Fix handling of circuit metadata #1436
Conversation
06d98a3
to
efde95e
Compare
I'm not very knowledgeable about the C++/Python handoff with pybind11, so a slight question: what we need out of the header seems very simple - can we just leave the metadata in Python space, and reattach it to the new output circuit (if there is one)? It feels like we could save time by just not serialising it, if we don't use it. |
I believe that |
efde95e
to
cb6e908
Compare
cb6e908
to
81992f6
Compare
Please add a test that ensures the repro code from #1435 works. |
16e7818
to
b075ec0
Compare
I added test cases to check metadata is copied correctly. |
667d00e
to
f47fd62
Compare
f47fd62
to
562e8cb
Compare
TODO:
|
Aer does not use Metadata to simulate circuits. Therefore, I believe, we can reduce metadata from qobj before simulation. Previously, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. @chriseclectic or someone else with write access please take a look.
4396035
to
c7ed644
Compare
c7ed644
to
fd65ac7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall LGTM, just one question inline and a suggestion on the release note. Thanks for updating this
releasenotes/notes/remove_circuit_metadata_from_qobj-324e7ea9b369ee67.yaml
Outdated
Show resolved
Hide resolved
…369ee67.yaml Co-authored-by: Matthew Treinish <[email protected]>
I realized that |
976deb7
to
9392f75
Compare
The to_json() method is called for each circuit header. A header may include metadata and metadata can be a python object. This PR changes serialization of circuit headers to use py::handle without serializing to a json. Fixes Qiskit#1435 * use python parser for circuit.header * support metadata copy with parameterization * avoid serialization of circuit metadata * use circuit_index to specify metadata * remove metadata from qobj for Aer to simulate circuits * add release note * clear circuite metadata correctly. * take unnecessary tests for circuit metadata backup/recovery * work around metadata serialization issue within _run method * Update releasenotes/notes/remove_circuit_metadata_from_qobj-324e7ea9b369ee67.yaml
Summary
#1435
Details and comments
to_json
is called for each circuit header.A header may include metadata and metadata can be a python object.
This PR changes serialization of circuit headers to use
py::handle
without serializing to a json.Another solution can be in
_assemble()
to remove all unnecessary metadata from input.