-
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
Add MCM bindings and tests for L-Kokkos. #672
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## feature/mid-measure-kokkos #672 +/- ##
==============================================================
+ Coverage 98.65% 98.70% +0.04%
==============================================================
Files 172 172
Lines 24458 24475 +17
==============================================================
+ Hits 24128 24157 +29
+ Misses 330 318 -12 ☔ 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.
I've tried to run this:
import numpy as np
import pennylane as qml
dev = qml.device("lightning.kokkos", wires=3)
@qml.qnode(dev)
def circuit(x, y):
qml.RY(x, wires=0)
qml.CNOT(wires=[0, 1])
m_0 = qml.measure(1)
qml.cond(m_0, qml.RY)(y, wires=0)
return qml.probs(wires=[0])
circuit(np.pi/2, np.pi/4)
I got
Traceback (most recent call last):
File "/home/thomas.germain/PennyLane/pennylane-lightning/debug.py", line 20, in <module>
circuit(np.pi/2, np.pi/4)
File "/home/thomas.germain/PennyLane/pennylane/pennylane/workflow/qnode.py", line 1085, in __call__
res = self._execution_component(args, kwargs, override_shots=override_shots)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/thomas.germain/PennyLane/pennylane/pennylane/workflow/qnode.py", line 1039, in _execution_component
res = qml.execute(
^^^^^^^^^^^^
File "/home/thomas.germain/PennyLane/pennylane/pennylane/workflow/execution.py", line 603, in execute
tapes, program_post_processing = transform_program(tapes)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/thomas.germain/PennyLane/pennylane/pennylane/transforms/core/transform_program.py", line 509, in __call__
new_tapes, fn = transform(tape, *targs, **tkwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/thomas.germain/PennyLane/pennylane/pennylane/transforms/dynamic_one_shot.py", line 94, in dynamic_one_shot
output_tapes = [aux_tape] * tape.shots.total_shots
~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
TypeError: can't multiply sequence by non-int of type 'NoneType'
Have I done something wrong in my setup? (The C++ tests run successfully.)
pennylane_lightning/core/src/simulators/lightning_kokkos/StateVectorKokkos.hpp
Show resolved
Hide resolved
pennylane_lightning/core/src/simulators/lightning_kokkos/StateVectorKokkos.hpp
Show resolved
Hide resolved
A more general question: Why are |
Looks like PennyLane might not be the right version. |
That's right, it is an old/new API difference. |
* collapse() and normalized() with Kokkos * Auto update version * CodeFactor * normalize() abort if norm is zero * unittest for normalize() * Auto update version * unittest for normalize() in LighningQubit * Auto update version * Add MCM bindings and tests for L-Kokkos. (#672) * Add MCM bindings and tests for L-Kokkos. * Auto update version * Refactor collapse. * Try parallelizing tests. * Only run test_native_mcm once amongst all workflows since it takes quite a bit of time. * trigger ci --------- Co-authored-by: Dev version update bot <github-actions[bot]@users.noreply.github.com> * Do not run test_native_mcm with LK-GPU. * Auto update version * trigger ci * Update pennylane_lightning/core/src/simulators/lightning_kokkos/bindings/LKokkosBindings.hpp Co-authored-by: Ali Asadi <[email protected]> * Auto update version * Update pennylane_lightning/core/src/simulators/lightning_kokkos/StateVectorKokkos.hpp Co-authored-by: Ali Asadi <[email protected]> * Update pennylane_lightning/core/src/simulators/lightning_kokkos/StateVectorKokkos.hpp Co-authored-by: Ali Asadi <[email protected]> * Update pennylane_lightning/core/src/simulators/lightning_kokkos/StateVectorKokkos.hpp Co-authored-by: Ali Asadi <[email protected]> * Update pennylane_lightning/core/src/simulators/lightning_kokkos/StateVectorKokkos.hpp Co-authored-by: Ali Asadi <[email protected]> * Increase shotsfor flaky test_composite_mcm_single_measure_obs * Create separate device_allowed_operations list for ops supported by the device but not Catalyst. * Use isinstance instead of name comparison. * Check projector. * Update operations at device init. * Modify stopping condition in LK. * Cannot use instance with Hamiltonian check. * Update pennylane_lightning/core/src/simulators/lightning_kokkos/tests/Test_StateVectorLKokkos.cpp Co-authored-by: Amintor Dusko <[email protected]> * Update pennylane_lightning/core/src/simulators/lightning_kokkos/StateVectorKokkos.hpp Co-authored-by: Amintor Dusko <[email protected]> * Remove obsolete comment. * Auto update version * trigger ci --------- Co-authored-by: Dev version update bot <github-actions[bot]@users.noreply.github.com> Co-authored-by: Vincent Michaud-Rioux <[email protected]> Co-authored-by: Vincent Michaud-Rioux <[email protected]> Co-authored-by: Ali Asadi <[email protected]> Co-authored-by: Amintor Dusko <[email protected]>
* collapse() and normalized() with Kokkos * Auto update version * CodeFactor * normalize() abort if norm is zero * unittest for normalize() * Auto update version * unittest for normalize() in LighningQubit * Auto update version * Add MCM bindings and tests for L-Kokkos. (#672) * Add MCM bindings and tests for L-Kokkos. * Auto update version * Refactor collapse. * Try parallelizing tests. * Only run test_native_mcm once amongst all workflows since it takes quite a bit of time. * trigger ci --------- Co-authored-by: Dev version update bot <github-actions[bot]@users.noreply.github.com> * Do not run test_native_mcm with LK-GPU. * Auto update version * trigger ci * Update pennylane_lightning/core/src/simulators/lightning_kokkos/bindings/LKokkosBindings.hpp Co-authored-by: Ali Asadi <[email protected]> * Auto update version * Update pennylane_lightning/core/src/simulators/lightning_kokkos/StateVectorKokkos.hpp Co-authored-by: Ali Asadi <[email protected]> * Update pennylane_lightning/core/src/simulators/lightning_kokkos/StateVectorKokkos.hpp Co-authored-by: Ali Asadi <[email protected]> * Update pennylane_lightning/core/src/simulators/lightning_kokkos/StateVectorKokkos.hpp Co-authored-by: Ali Asadi <[email protected]> * Update pennylane_lightning/core/src/simulators/lightning_kokkos/StateVectorKokkos.hpp Co-authored-by: Ali Asadi <[email protected]> * Increase shotsfor flaky test_composite_mcm_single_measure_obs * Create separate device_allowed_operations list for ops supported by the device but not Catalyst. * Use isinstance instead of name comparison. * Check projector. * Update operations at device init. * Modify stopping condition in LK. * Cannot use instance with Hamiltonian check. * Update pennylane_lightning/core/src/simulators/lightning_kokkos/tests/Test_StateVectorLKokkos.cpp Co-authored-by: Amintor Dusko <[email protected]> * Update pennylane_lightning/core/src/simulators/lightning_kokkos/StateVectorKokkos.hpp Co-authored-by: Amintor Dusko <[email protected]> * Remove obsolete comment. * Auto update version * trigger ci --------- Co-authored-by: Dev version update bot <github-actions[bot]@users.noreply.github.com> Co-authored-by: Vincent Michaud-Rioux <[email protected]> Co-authored-by: Vincent Michaud-Rioux <[email protected]> Co-authored-by: Ali Asadi <[email protected]> Co-authored-by: Amintor Dusko <[email protected]>
* collapse() and normalized() with Kokkos * Auto update version * CodeFactor * normalize() abort if norm is zero * unittest for normalize() * Auto update version * unittest for normalize() in LighningQubit * Auto update version * Add MCM bindings and tests for L-Kokkos. (#672) * Add MCM bindings and tests for L-Kokkos. * Auto update version * Refactor collapse. * Try parallelizing tests. * Only run test_native_mcm once amongst all workflows since it takes quite a bit of time. * trigger ci --------- Co-authored-by: Dev version update bot <github-actions[bot]@users.noreply.github.com> * Do not run test_native_mcm with LK-GPU. * Auto update version * trigger ci * Update pennylane_lightning/core/src/simulators/lightning_kokkos/bindings/LKokkosBindings.hpp Co-authored-by: Ali Asadi <[email protected]> * Auto update version * Update pennylane_lightning/core/src/simulators/lightning_kokkos/StateVectorKokkos.hpp Co-authored-by: Ali Asadi <[email protected]> * Update pennylane_lightning/core/src/simulators/lightning_kokkos/StateVectorKokkos.hpp Co-authored-by: Ali Asadi <[email protected]> * Update pennylane_lightning/core/src/simulators/lightning_kokkos/StateVectorKokkos.hpp Co-authored-by: Ali Asadi <[email protected]> * Update pennylane_lightning/core/src/simulators/lightning_kokkos/StateVectorKokkos.hpp Co-authored-by: Ali Asadi <[email protected]> * Increase shotsfor flaky test_composite_mcm_single_measure_obs * Create separate device_allowed_operations list for ops supported by the device but not Catalyst. * Use isinstance instead of name comparison. * Check projector. * Update operations at device init. * Modify stopping condition in LK. * Cannot use instance with Hamiltonian check. * Update pennylane_lightning/core/src/simulators/lightning_kokkos/tests/Test_StateVectorLKokkos.cpp Co-authored-by: Amintor Dusko <[email protected]> * Update pennylane_lightning/core/src/simulators/lightning_kokkos/StateVectorKokkos.hpp Co-authored-by: Amintor Dusko <[email protected]> * Remove obsolete comment. * Auto update version * trigger ci --------- Co-authored-by: Dev version update bot <github-actions[bot]@users.noreply.github.com> Co-authored-by: Vincent Michaud-Rioux <[email protected]> Co-authored-by: Vincent Michaud-Rioux <[email protected]> Co-authored-by: Ali Asadi <[email protected]> Co-authored-by: Amintor Dusko <[email protected]>
* Init commit * Auto update version * Add MidMeasureMP Kokkos (#658) * collapse() and normalized() with Kokkos * Auto update version * CodeFactor * normalize() abort if norm is zero * unittest for normalize() * Auto update version * unittest for normalize() in LighningQubit * Auto update version * Add MCM bindings and tests for L-Kokkos. (#672) * Add MCM bindings and tests for L-Kokkos. * Auto update version * Refactor collapse. * Try parallelizing tests. * Only run test_native_mcm once amongst all workflows since it takes quite a bit of time. * trigger ci --------- Co-authored-by: Dev version update bot <github-actions[bot]@users.noreply.github.com> * Do not run test_native_mcm with LK-GPU. * Auto update version * trigger ci * Update pennylane_lightning/core/src/simulators/lightning_kokkos/bindings/LKokkosBindings.hpp Co-authored-by: Ali Asadi <[email protected]> * Auto update version * Update pennylane_lightning/core/src/simulators/lightning_kokkos/StateVectorKokkos.hpp Co-authored-by: Ali Asadi <[email protected]> * Update pennylane_lightning/core/src/simulators/lightning_kokkos/StateVectorKokkos.hpp Co-authored-by: Ali Asadi <[email protected]> * Update pennylane_lightning/core/src/simulators/lightning_kokkos/StateVectorKokkos.hpp Co-authored-by: Ali Asadi <[email protected]> * Update pennylane_lightning/core/src/simulators/lightning_kokkos/StateVectorKokkos.hpp Co-authored-by: Ali Asadi <[email protected]> * Increase shotsfor flaky test_composite_mcm_single_measure_obs * Create separate device_allowed_operations list for ops supported by the device but not Catalyst. * Use isinstance instead of name comparison. * Check projector. * Update operations at device init. * Modify stopping condition in LK. * Cannot use instance with Hamiltonian check. * Update pennylane_lightning/core/src/simulators/lightning_kokkos/tests/Test_StateVectorLKokkos.cpp Co-authored-by: Amintor Dusko <[email protected]> * Update pennylane_lightning/core/src/simulators/lightning_kokkos/StateVectorKokkos.hpp Co-authored-by: Amintor Dusko <[email protected]> * Remove obsolete comment. * Auto update version * trigger ci --------- Co-authored-by: Dev version update bot <github-actions[bot]@users.noreply.github.com> Co-authored-by: Vincent Michaud-Rioux <[email protected]> Co-authored-by: Vincent Michaud-Rioux <[email protected]> Co-authored-by: Ali Asadi <[email protected]> Co-authored-by: Amintor Dusko <[email protected]> * Trigger CI * make format * Auto update version * Trigger CIs * Auto update version * Trigger CI * Auto update version * add more docstring * add changelog * Update pennylane_lightning/core/src/simulators/lightning_gpu/utils/cuStateVecError.hpp Co-authored-by: Ali Asadi <[email protected]> * Update pennylane_lightning/core/src/simulators/lightning_gpu/utils/cuStateVecError.hpp Co-authored-by: Ali Asadi <[email protected]> * Update pennylane_lightning/core/src/simulators/lightning_gpu/utils/cuStateVec_helpers.hpp Co-authored-by: Ali Asadi <[email protected]> * Update pennylane_lightning/core/src/simulators/lightning_gpu/utils/cuStateVecError.hpp Co-authored-by: Ali Asadi <[email protected]> * Update pennylane_lightning/core/src/simulators/lightning_gpu/utils/cuStateVec_helpers.hpp Co-authored-by: Ali Asadi <[email protected]> * Update pennylane_lightning/core/src/simulators/lightning_gpu/utils/cuStateVec_helpers.hpp Co-authored-by: Ali Asadi <[email protected]> * Update pennylane_lightning/core/src/utils/cuda_utils/cuError.hpp Co-authored-by: Ali Asadi <[email protected]> * Update pennylane_lightning/core/src/simulators/lightning_gpu/utils/cuStateVecError.hpp Co-authored-by: Ali Asadi <[email protected]> * Trigger CI * make format * quick fix * fix --------- Co-authored-by: Dev version update bot <github-actions[bot]@users.noreply.github.com> Co-authored-by: Thomas Germain <[email protected]> Co-authored-by: Vincent Michaud-Rioux <[email protected]> Co-authored-by: Vincent Michaud-Rioux <[email protected]> Co-authored-by: Ali Asadi <[email protected]> Co-authored-by: Amintor Dusko <[email protected]>
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:
Description of the Change:
Benefits:
Possible Drawbacks:
Related GitHub Issues:
[sc-60946]