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

Add timeout parameter to GreedyPauliSimp #1664

Merged
merged 21 commits into from
Nov 11, 2024
Merged

Conversation

sjdilkes
Copy link
Contributor

@sjdilkes sjdilkes commented Nov 8, 2024

Description

Use std::async to add a timeout to greedy_pauli_optimisation.

A segmentation fault was occurring when modifying the python expression held in ClassicalExpBox to relabel the expression bits to match a relabelling.

To work around this, I've added a new argument to Circuit::flatten_registers, Circuit::rename_units and FlattenRelabelRegistersPass to optionally relabel expressions in ClassicalExpBox. This is fine for the greedy_pauli_optimisation case as the synthesis method does not effect the held expressions and we relabel back to the original assignment after re-synthesising the circuit.

Checklist

  • I have performed a self-review of my code.
  • I have commented hard-to-understand parts of my code.
  • I have made corresponding changes to the public API documentation.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have updated the changelog with any user-facing changes.

@sjdilkes sjdilkes marked this pull request as ready for review November 8, 2024 16:26
@sjdilkes sjdilkes requested a review from yao-cqc November 8, 2024 16:26
Copy link
Contributor

@yao-cqc yao-cqc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a test for the timeout?

@sjdilkes
Copy link
Contributor Author

sjdilkes commented Nov 9, 2024

Can you add a test for the timeout?

Do the test changes in predicates_test.py and test_greedypauli not cover it, where I add a 0 timeout and confirm that the false branch is returned? Happy to add more

@sjdilkes sjdilkes requested a review from yao-cqc November 11, 2024 09:02
Copy link
Contributor

@yao-cqc yao-cqc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh I see. Looks great, thanks!

@sjdilkes sjdilkes merged commit fbc3ebc into main Nov 11, 2024
32 checks passed
@sjdilkes sjdilkes deleted the greedypaulisimp-timeout branch November 11, 2024 09:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants