-
Notifications
You must be signed in to change notification settings - Fork 47
Add resource tracking to NullQubit #1619
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
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1619 +/- ##
==========================================
+ Coverage 96.51% 96.58% +0.07%
==========================================
Files 82 82
Lines 9029 9158 +129
Branches 861 861
==========================================
+ Hits 8714 8845 +131
+ Misses 258 256 -2
Partials 57 57 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Oh wow, I was just starting on this as well a couple of hours ago (just as a hack) 😆 Super useful though, thanks! |
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.
Thanks @jzaia18!
…nstead of destructor
… CIs from running
…alyst into feature/complexity-stats
…alyst into feature/complexity-stats
**Context:** PR #7226 added a resource-tracking feature to PennyLane. The same feature is desired in Catalyst: PennyLaneAI/catalyst#1619 **Description of the Change:** Adds a class attribute to `null.qubit` which allows the `resource_tracking` argument to get passed through to Catalyst. **Benefits:** `track_resources` can more cleanly be passed through to Catalyst. **Possible Drawbacks:** **Related GitHub Issues:** #7226 PennyLaneAI/catalyst#1619 PennyLaneAI/pennylane-benchmarks#76 [sc-88213](https://app.shortcut.com/xanaduai/story/88213) --------- Co-authored-by: Ali Asadi <[email protected]>
**Context:** PR #7226 added a resource-tracking feature to PennyLane. The same feature is desired in Catalyst: PennyLaneAI/catalyst#1619 **Description of the Change:** Adds a class attribute to `null.qubit` which allows the `resource_tracking` argument to get passed through to Catalyst. **Benefits:** `track_resources` can more cleanly be passed through to Catalyst. **Possible Drawbacks:** **Related GitHub Issues:** #7226 PennyLaneAI/catalyst#1619 PennyLaneAI/pennylane-benchmarks#76 [sc-88213](https://app.shortcut.com/xanaduai/story/88213) --------- Co-authored-by: Ali Asadi <[email protected]>
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.
🎉
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 work @jzaia18! 🥳 Just a few minor comments to resolve before merge!
Co-authored-by: Ali Asadi <[email protected]>
Co-authored-by: Ali Asadi <[email protected]>
Co-authored-by: Ali Asadi <[email protected]>
…alyst into feature/complexity-stats
Context:
For benchmarking, we need a method of precise resource tracking. This method has to be compatible with code run directly from PennyLane and should be able to track precise resources after various transformation passes have already occurred.
See also: https://github.com/PennyLaneAI/pennylane-benchmarks/pull/76 and PennyLaneAI/pennylane#7226
Description of the Change:
Adds 2 new class attributes to
NullQubit
, as well as an optional argument to its constructor. When this option is toggled on,NullQubit
will track precise gate counts while "executing" a circuit and save them to a file when all qubits are released.Benefits:
It is now possible to track precise gate counts (with or without gate decomposition or other transformation passes) for measuring circuit complexity.
Possible Drawbacks:
This implementation currently write the resources JSON to a file on disk as opposed to neatly returning an object back through to the Python caller in PennyLane. In the future, a more robust solution may be desired.
Related GitHub Issues:
[sc-88213]