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

Add the simulate class for the new device #817

Merged
merged 26 commits into from
Jul 30, 2024

Conversation

LuisAlfredoNu
Copy link
Contributor

@LuisAlfredoNu LuisAlfredoNu commented Jul 25, 2024

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 the
    change, 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:
Migrate the lightning.kokkos device to the new device API.

Description of the Change:
The 'simulate' method is necessary to achieve full functionality with the new device API.
We are going to follow the same recipe used with LightningQubit.

Benefits:
Add one of the essential methods for the new device API into LightningKokkos.

Possible Drawbacks:

Related GitHub Issues:

Partial / Freezzed PR ⚠️ ❄️

To make a smooth integration of LightningKokkos with the new device API, we set the branch kokkosNewAPI_backend as the base branch target for this development.

The branch kokkosNewAPI_backend has the mock of all classes and methods necessary for the new API. Also, several tests were disabled with

if device_name == "lightning.kokkos":
    pytest.skip("Kokkos new API in WIP.  Skipping.",allow_module_level=True)

Additionally, the CI testing from PennyLane for LKokkos is temporally disabled through commenting the following lines in .github/workflows files

: # pl-device-test --device ${DEVICENAME} --skip-ops --shots=20000 $COVERAGE_FLAGS --cov-append
: # pl-device-test --device ${DEVICENAME} --shots=None --skip-ops $COVERAGE_FLAGS --cov-append

However, these tests will unblocked as the implementation progresses.

After all the developments for integrating LightningKokkos with the new API have been completed then the PR will be open to merge to master

[sc-68801] [sc-68816] [sc-68819]

Copy link
Contributor

Hello. You may have forgotten to update the changelog!
Please edit .github/CHANGELOG.md with:

  • A one-to-two sentence description of the change. You may include a small working example for new features.
  • A link back to this PR.
  • Your name (or GitHub username) in the contributors section.

@LuisAlfredoNu LuisAlfredoNu added do not merge Do not merge PR until this label is removed ci:build_wheels Activate wheel building. labels Jul 25, 2024
Copy link

codecov bot commented Jul 25, 2024

Codecov Report

Attention: Patch coverage is 87.19512% with 42 lines in your changes missing coverage. Please review.

Project coverage is 90.01%. Comparing base (bcd323e) to head (c4860a9).

Files with missing lines Patch % Lines
...nylane_lightning/lightning_kokkos/_state_vector.py 88.23% 18 Missing ⚠️
...nylane_lightning/lightning_kokkos/_measurements.py 89.93% 16 Missing ⚠️
...ane_lightning/lightning_kokkos/lightning_kokkos.py 50.00% 8 Missing ⚠️
Additional details and impacted files
@@                    Coverage Diff                    @@
##           kokkosNewAPI_backend     #817       +/-   ##
=========================================================
+ Coverage                 64.27%   90.01%   +25.74%     
=========================================================
  Files                        18       19        +1     
  Lines                      1702     2034      +332     
=========================================================
+ Hits                       1094     1831      +737     
+ Misses                      608      203      -405     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@LuisAlfredoNu LuisAlfredoNu changed the title Kokkos new api simulate Add the simulate class for the new device Jul 25, 2024
@LuisAlfredoNu LuisAlfredoNu removed the do not merge Do not merge PR until this label is removed label Jul 25, 2024
@LuisAlfredoNu LuisAlfredoNu marked this pull request as ready for review July 25, 2024 20:16
Copy link
Contributor

@AmintorDusko AmintorDusko left a comment

Choose a reason for hiding this comment

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

I'm observing several coverage complaints coming from Codecov. Some of them might be a "codecov fluke", some of them might not. @LuisAlfredoNu, could you please double-check and let us know when the coverage is OK (even if codecov is complaining). You might want to rerun all CIs. You can use:

git commit -m "trigger CIs" --allow-empty
git push -u origin kokkosNewAPI_simulate

or any variant of that.

@AmintorDusko
Copy link
Contributor

AmintorDusko commented Jul 26, 2024

I'm observing several coverage complaints coming from Codecov. Some of them might be a "codecov fluke", some of them might not. @LuisAlfredoNu, could you please double-check and let us know when the coverage is OK (even if codecov is complaining). You might want to rerun all CIs. You can use:

git commit -m "trigger CIs" --allow-empty
git push -u origin kokkosNewAPI_simulate

or any variant of that.

I just noticed that there is also a formatting complaint.
You can fix that with make format.

@LuisAlfredoNu
Copy link
Contributor Author

I'm observing several coverage complaints coming from Codecov. Some of them might be a "codecov fluke", some of them might not. @LuisAlfredoNu, could you please double-check and let us know when the coverage is OK (even if codecov is complaining). You might want to rerun all CIs. You can use:

git commit -m "trigger CIs" --allow-empty
git push -u origin kokkosNewAPI_simulate

or any variant of that.

Checking why codecov does not show the increase in the coverage of the changes I conclude the following:

The failing test from the repo of PennyLane blocks the next steps in the GitHub actions to upload the coverage file generated by the Lightning test.

To solve this issue I comment the lines that run the test from Pennyline repo in the github/workflows files

@LuisAlfredoNu LuisAlfredoNu requested review from AmintorDusko and a team July 26, 2024 15:48
Copy link
Contributor

@vincentmr vincentmr left a comment

Choose a reason for hiding this comment

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

Nice work @LuisAlfredoNu.

pennylane_lightning/lightning_kokkos/_measurements.py Outdated Show resolved Hide resolved
pennylane_lightning/lightning_kokkos/_state_vector.py Outdated Show resolved Hide resolved
pennylane_lightning/lightning_kokkos/_state_vector.py Outdated Show resolved Hide resolved
pennylane_lightning/lightning_kokkos/_state_vector.py Outdated Show resolved Hide resolved
tests/lightning_qubit/test_simulate_method.py Outdated Show resolved Hide resolved
Copy link
Contributor

@vincentmr vincentmr left a comment

Choose a reason for hiding this comment

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

Thanks @LuisAlfredoNu . A few more suggestions/comments, but this is almost ready to merge IMO.

Copy link
Member

@multiphaseCFD multiphaseCFD left a comment

Choose a reason for hiding this comment

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

Nice work @LuisAlfredoNu! Just a few Q.

pennylane_lightning/lightning_kokkos/_measurements.py Outdated Show resolved Hide resolved
pennylane_lightning/lightning_kokkos/_measurements.py Outdated Show resolved Hide resolved
pennylane_lightning/lightning_kokkos/_state_vector.py Outdated Show resolved Hide resolved
Copy link
Member

@maliasadi maliasadi left a comment

Choose a reason for hiding this comment

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

Nice work! 💯

.github/workflows/tests_lkcuda_python.yml Show resolved Hide resolved
.github/workflows/tests_lkcuda_python.yml Outdated Show resolved Hide resolved
pennylane_lightning/lightning_kokkos/_measurements.py Outdated Show resolved Hide resolved
pennylane_lightning/lightning_kokkos/_measurements.py Outdated Show resolved Hide resolved
pennylane_lightning/lightning_kokkos/_state_vector.py Outdated Show resolved Hide resolved
pennylane_lightning/lightning_kokkos/_state_vector.py Outdated Show resolved Hide resolved
tests/lightning_qubit/test_simulate_method.py Show resolved Hide resolved
Copy link
Contributor

@AmintorDusko AmintorDusko left a comment

Choose a reason for hiding this comment

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

Nice work, @LuisAlfredoNu!
Thank you, @PennyLaneAI/performance, for your very thorough review.
This is the type of high-quality work (review and dev) the whole team consistently delivers!
I resolved some apparent complete conversations, please feel free to re-open if sensible.
Regarding overall problems with coverage, or updates that would apply to LQubit too, let's keep attention to it and come back later if having time.
@LuisAlfredoNu, keep notes of suggestions the very nice suggestions here. They will be very useful after we have our MVP in place.

Copy link
Contributor

@vincentmr vincentmr left a comment

Choose a reason for hiding this comment

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

Nice work @LuisAlfredoNu . I'll approve while leaving a suggestion. Feel free to resolve as you wish. Cheers!

tests/lightning_qubit/test_state_vector_class.py Outdated Show resolved Hide resolved
Copy link
Member

@multiphaseCFD multiphaseCFD left a comment

Choose a reason for hiding this comment

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

Great job! @LuisAlfredoNu Happy to approve!

@LuisAlfredoNu LuisAlfredoNu merged commit 80277d9 into kokkosNewAPI_backend Jul 30, 2024
62 checks passed
@LuisAlfredoNu LuisAlfredoNu deleted the kokkosNewAPI_simulate branch July 30, 2024 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci:build_wheels Activate wheel building.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants