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 Catalyst specific Lightning Kokkos class #770

Merged
merged 42 commits into from
Jul 8, 2024

Conversation

AmintorDusko
Copy link
Contributor

@AmintorDusko AmintorDusko commented Jun 19, 2024

Context: Catalyst needs to build a class wrapping the Lightning Kokkos class. Here we are moving the logic from Catalyst to the Lightning repository.

Description of the Change: Moving code from Catalyst to this repository and updating the build system to build against Catalyst.

Benefits: Catalyst wheels will build faster.

Possible Drawbacks: Our build system now relies on headers coming from Catalyst. It is unclear if this may cause a deadlock in the future because of our cyclic dependencies (PennyLane, PennyLane Lightning, Catalyst). Chances are small because we don't rely on Catalyst wheels or build it from scratch.

Usage: This PR offers three ways to configure the CMake building system:

  1. Providing a local source path for Catalyst. Example:
cmake   -BBuildTests -G Ninja \
        -DCMAKE_INSTALL_PREFIX=$path_to_kokkos \
        -DCATALYST_SRC_PATH=$path_to_catalyst \
        -DCMAKE_BUILD_TYPE=Debug \
        -DBUILD_TESTS=ON \
        -DENABLE_WARNINGS=ON \
        -DPL_BACKEND=lightning_kokkos
  1. Providing a GIT TAG. Example with the main branch:
cmake   -BBuildTests -G Ninja \
        -DCMAKE_INSTALL_PREFIX=$path_to_kokkos \
        -DCATALYST_GIT_TAG=main \
        -DCMAKE_BUILD_TYPE=Debug \
        -DBUILD_TESTS=ON \
        -DENABLE_WARNINGS=ON \
        -DPL_BACKEND=lightning_kokkos
  1. If the dev/user doesn't say anything the configuration will default to get headers from Catalyst GitHub main branch. Example:
cmake   -BBuildTests -G Ninja \
        -DCMAKE_INSTALL_PREFIX=$path_to_kokkos \
        -DCMAKE_BUILD_TYPE=Debug \
        -DBUILD_TESTS=ON \
        -DENABLE_WARNINGS=ON \
        -DPL_BACKEND=lightning_kokkos

Check out ADR 76 for alternative approaches.

[sc-59312]

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.

@AmintorDusko AmintorDusko added the ci:build_wheels Activate wheel building. label Jun 19, 2024
@AmintorDusko AmintorDusko marked this pull request as ready for review June 19, 2024 12:44
Copy link

codecov bot commented Jun 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.09%. Comparing base (91241a0) to head (ee1d8b5).

❗ There is a different number of reports uploaded between BASE (91241a0) and HEAD (ee1d8b5). Click for more details.

HEAD has 4 uploads less than BASE
Flag BASE (91241a0) HEAD (ee1d8b5)
10 6
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #770      +/-   ##
==========================================
- Coverage   94.32%   87.09%   -7.24%     
==========================================
  Files         109       74      -35     
  Lines       15783    11152    -4631     
==========================================
- Hits        14888     9713    -5175     
- Misses        895     1439     +544     

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

@AmintorDusko
Copy link
Contributor Author

AmintorDusko commented Jun 19, 2024

Catalyst files were moved from here.
I only updated the copyright date, but we might want to return to this later and review these files.

Edit: Catalyst files also needed some format updates.

@AmintorDusko
Copy link
Contributor Author

Tests are still needed.

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 @AmintorDusko , not much in the way of this PR, I wrote some thoughts for future work as suggestions.

@AmintorDusko AmintorDusko added the urgent Mark a pull request as high priority label Jun 21, 2024
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.

Thank you @AmintorDusko! 🎸

Copy link
Member

@mlxd mlxd left a comment

Choose a reason for hiding this comment

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

Thanks folks. I have a few questions, but given the size we can explicit backlog anything that's needed.

Though, are we expecting the Kokkos data to work with a CUDA backend, as well as an OpenMP? Given we are using std::vector of kokkos complex in some places, I wonder if this will cause issues.

Copy link
Contributor

@dime10 dime10 left a comment

Choose a reason for hiding this comment

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

Since this essentially moves the files over there is not much for me to review, it is better if lightning maintainers give it a good review from their perspective. I've answered all the questions I could however.

Copy link
Member

@mlxd mlxd left a comment

Choose a reason for hiding this comment

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

💯

@AmintorDusko AmintorDusko removed the urgent Mark a pull request as high priority label Jul 8, 2024
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 @AmintorDusko , I just have a question about the change log.

.github/CHANGELOG.md 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.

Massive PR! Looks good to me, thanks @AmintorDusko .

@AmintorDusko AmintorDusko merged commit b9b6e1c into master Jul 8, 2024
88 of 93 checks passed
@AmintorDusko AmintorDusko deleted the add/rtd_lightning_kokkos branch July 8, 2024 19:10
paul0403 added a commit that referenced this pull request Jul 26, 2024
… We make a small update to track these changes.

The Catalyst PR adds seeding to qjit: PennyLaneAI/catalyst#936
paul0403 added a commit that referenced this pull request Jul 26, 2024
### Before submitting

Please complete the following checklist when submitting a PR:

- [x] 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`](../tests) directory!

- [x] 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`.

- [x] Ensure that the test suite passes, by running `make test`.

- [x] Add a new entry to the `.github/CHANGELOG.md` file, summarizing
the
      change, and including a link back to the PR.

- [x] 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:**
The lightning kokkos files in the Catalyst repo has changed since #770.
We make a small update to track these changes.

The Catalyst PR that made the changes added seeding to qjit:
PennyLaneAI/catalyst#936

**Description of the Change:**
The `lightning_kokkos/catalyst` files now has the MCM seeding support added in catalyst 
PennyLaneAI/catalyst#936

**Benefits:** unblocks kokkos with catalyst

**Possible Drawbacks:** None

**Related GitHub Issues:** None

---------

Co-authored-by: ringo-but-quantum <github-ringo-but-quantum@xanadu.ai>
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.

6 participants