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

Need a test that ensures barriers are re-combined correctly in transforms.py #626

Open
garrison opened this issue Jun 15, 2024 · 4 comments
Labels
cutting QPD-based circuit cutting code good first issue Good for newcomers tests Related to tests

Comments

@garrison
Copy link
Member

garrison commented Jun 15, 2024

See #625 (comment). Such a test is currently lacking, and having 100% test coverage is giving us a false sense of security here.

@garrison garrison added good first issue Good for newcomers tests Related to tests cutting QPD-based circuit cutting code labels Jun 15, 2024
@lodenrogue
Copy link

Any more details you can provide here? An example of what is meant by a barrier or re-combined for those of us new to this repo?

@garrison
Copy link
Member Author

If you take the first tutorial notebook and place a barrier across all qubits at some point in the circuit, there is some special logic to split that barrier into single-qubit barriers so that it will not prevent the circuit from separating into multiple pieces. Then, after separation, those barriers are recombined. #625 fixed this code to work with Qiskit 1.2. It is the stuff in transforms.py that has to do with uuids.

@garrison
Copy link
Member Author

The test should ideally verify the behavior of the seprate_circuit utility function, which is called inside of the partition_problem function, which itself appears in the first tutorial. And the test should live in teat_transforms.py, alongside other tests of the separate_circuit function.

@garrison
Copy link
Member Author

garrison commented Jun 15, 2024

The crux of the problem is that the test suite should fail if the following patch is made to disable (comment out) an important line, but it does not.

diff --git a/circuit_knitting/utils/transforms.py b/circuit_knitting/utils/transforms.py
index 2849d09..715321a 100644
--- a/circuit_knitting/utils/transforms.py
+++ b/circuit_knitting/utils/transforms.py
@@ -135,7 +135,7 @@ def separate_circuit(
             [new_qc.qubits[j] for j in qubits_by_subsystem[label]],
             new_qc.cregs,
         )
-        _combine_barriers(tmp_circ)
+        # _combine_barriers(tmp_circ)
         subcircuits[label] = tmp_circ
 
     return SeparatedCircuits(subcircuits, qubit_map)

@garrison garrison changed the title Need test that barriers and re-combined correctly in transforms.py Need a test that ensures barriers are re-combined correctly in transforms.py Jun 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cutting QPD-based circuit cutting code good first issue Good for newcomers tests Related to tests
Projects
None yet
Development

No branches or pull requests

2 participants