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, |
kevinsung
left a comment
There was a problem hiding this comment.
LGTM. @chriseclectic or someone else with write access please take a look.
4396035 to
c7ed644
Compare
c7ed644 to
fd65ac7
Compare
mtreinish
left a comment
There was a problem hiding this comment.
Overall LGTM, just one question inline and a suggestion on the release note. Thanks for updating this
…369ee67.yaml Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
|
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_jsonis 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::handlewithout serializing to a json.Another solution can be in
_assemble()to remove all unnecessary metadata from input.