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

For noiseless QVMs don't measure all qubits #1252

Merged
merged 5 commits into from
Oct 6, 2020

Conversation

notmgsk
Copy link
Contributor

@notmgsk notmgsk commented Sep 18, 2020

Description

QuantumComputer.run_and_measure inserts MEASURE instructions for all qubits into the program before it is sent for execution by the QPU or QVM. When the target is the QVM this may lead to memory exhaustion: the QVM allocates enough memory to track a wavefunction for the number of qubits used in the program. For a larger number of qubits (around 32), one will use over 1GB of memory which causes the QVM to (rather ungraciously) crash. This PR fixes that by measuring only the qubits used in the program if and only if the target is the QVM and there is no associated noise model.

Checklist

  • The above description motivates these changes.
  • There is a unit test that covers these changes.
  • All new and existing tests pass locally and on Travis CI.
  • Parameters and return values have type hints with PEP 484 syntax.
  • Functions and classes have useful Sphinx-style docstrings.
  • All code follows Black style and obeys flake8 conventions.
  • (New Feature) The docs have been updated accordingly.
  • (Bugfix) The associated issue is referenced above using auto-close keywords.
  • The changelog is updated, including author and PR number (@username, gh-xxx).

@notmgsk notmgsk requested a review from a team as a code owner September 18, 2020 15:00
Copy link
Contributor

@kalzoo kalzoo left a comment

Choose a reason for hiding this comment

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

Thanks! Users will appreciate this.

pyquil/api/_quantum_computer.py Outdated Show resolved Hide resolved
pyquil/api/_quantum_computer.py Outdated Show resolved Hide resolved
pyquil/api/_quantum_computer.py Outdated Show resolved Hide resolved
pyquil/api/_quantum_computer.py Show resolved Hide resolved
pyquil/api/_quantum_computer.py Outdated Show resolved Hide resolved
It has some overlap with unwrap_qubit() which I think is poorly
named. It should be something more like wrap_as_qubit().
Copy link
Contributor

@kalzoo kalzoo left a comment

Choose a reason for hiding this comment

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

lgtm, pending a small typo. Thanks!

pyquil/quilatom.py Outdated Show resolved Hide resolved
@notmgsk notmgsk merged commit d07a293 into master Oct 6, 2020
@notmgsk notmgsk mentioned this pull request Oct 6, 2020
@ameyer-rigetti ameyer-rigetti deleted the dont-measure-all-against-qvm branch July 12, 2021 18:57
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.

None yet

2 participants