-
Notifications
You must be signed in to change notification settings - Fork 38
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
Solves Issue #1316: Implement an option to print out instructions in the null device #1346
base: main
Are you sure you want to change the base?
Conversation
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.
Hi @smml1996, thank you for submitting your PR!
Overall this looks really nice, good work! I left a few review comments below.
Btw, don't forget to include your name as a contributor in the changelog. This PR can be considered a new feature.
Co-authored-by: David Ittah <[email protected]>
Co-authored-by: David Ittah <[email protected]>
Awesome!! I added it this commit b3df667 (and fixed a missing line here 4c82c8d) |
I am not sure how to fix this issue from CodeFactor. I do not see any blank line at the end of the block code. How can I fix it? |
Oh weird, sometimes CodeFactor is bugged. You can ignore it! : ) |
This PR looks fantastic! There is one open comment, other than that once the merge conflict is resolved I'll approve the CI run to confirm tests are passing and we can consider this PR completed 💪 |
I have realized that for some reason I was not handling properly zero coefficients in the real part for the string representation of complex numbers. I have fixed it here 5ea6b8e |
Nice! Are you able to resolve the merge conflict so we can test the CI ? :) |
Sure! |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1346 +/- ##
==========================================
- Coverage 80.79% 78.29% -2.51%
==========================================
Files 73 75 +2
Lines 8104 8372 +268
Branches 839 893 +54
==========================================
+ Hits 6548 6555 +7
- Misses 1502 1763 +261
Partials 54 54 ☔ 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.
Thank you @smml1996! You can consider this PR completed 🎉
Awesome!!! I see the coverage test did not passed though. Should I try to improve my tests? |
That's because your tests call the string builder functionality as unit tests, which is great! It does leave the lines uncovered in the device itself ( |
Ahh ok! great then! 🥳 |
Context: The PennyLane plugin should have an Boolean option
print_instructions
(other names can also be proposed) with a defaultFalse
value. This option must forwarded to the C++ device constructor. In the runtime plugin, the QuantumDevice should be able to print out the instructions when the option is set toTrue
:Description of the Change: The PennyLane plugin now has a boolean option
print_instructions
with a default valueFalse
.If this option is set to
True
and we have generated the intermediate code using a null device, then executing the circuit prints out the instructions mentioned in Issue #1316 .Benefits: allows to visualize and confirm the instructions we have called in a circuit that uses the null device. We can now print instructions by simply compiling the circuit and by passing the flag set set to
True
(E.g.jitted_circ = qjit(circ_circuit, print_instructions=False)
).Possible Drawbacks: Printing some matrices can take a lot of space.
Related GitHub Issues: #1316