-
Notifications
You must be signed in to change notification settings - Fork 42
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
Sample minimal subset of wires on LightningQubit #813
Conversation
…wires, num_shots).
Co-authored-by: Ali Asadi <[email protected]>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #813 +/- ##
===========================================
- Coverage 98.77% 58.78% -40.00%
===========================================
Files 114 17 -97
Lines 17858 1895 -15963
===========================================
- Hits 17640 1114 -16526
- Misses 218 781 +563 ☔ View full report in Codecov by Sentry. |
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.
The performance is excellent. Is there an actual coverage issue, or is codecov just being a nuisance?
The patch cov is 100%, but project cov is low because C++ tests didn't run. |
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.
Nice job. The improvement in the performance is good
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.
Thank you, @vincentmr! Super cool!
[sc-65127] |
Before submitting
Please complete the following checklist when submitting a PR:
All new features must include a unit test.
If you've fixed a bug or added code that should be tested, add a test to the
tests
directory!All new functions and code must be clearly commented and documented.
If you do make documentation changes, make sure that the docs build and
render correctly by running
make docs
.Ensure that the test suite passes, by running
make test
.Add a new entry to the
.github/CHANGELOG.md
file, summarizing thechange, and including a link back to the PR.
Ensure that code is properly formatted by running
make format
.When all the above are checked, delete everything above the dashed
line and fill in the pull request template.
Context:
With enough qubits and shots, it is wasteful to generate samples on all wires.
Description of the Change:
LightningQubit calls
generate_samples(wires)
on a minimal subset of wires when executing in finite-shot mode.Benefits:
Faster sampling and execution.
We perform a simple benchmark of
where
wires
takes values[0]
,range(0, nq//2)
andrange(0, nq)
. For a large enough number of qubits and/or samples, we observe good speed-ups (up to 8x) for the 1-wire and half-wire cases. As expected, the all-wire case yields ~1x for all simulations.Possible Drawbacks:
Related GitHub Issues: