-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Optimize Lightning-Kokkos'
probs(wires)
using bitshift implementati…
…on (#802) ### 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:** `probs` is central in circuit simulation measurements. **Description of the Change:** Implement `probs(wires)` using bitshift implementation akin to the gate kernels in Lightning-Qubit. Enable `probs(unsorted_wires)` tests. **Benefits:** Faster execution. The following benchmarks are performed on ISAIC's AMD EPYC-Milan Processor using a varying number of OpenMP threads (ranging from 1 to 32, albeit 32 threads data isn't shown for clarity and because there is no guarantee that the benchmark application is the sole intensive process running on the machine, and hence there is a real possibility of oversubscribing). The times are obtained averaging the computation of `probs(targets)` 5 times, where `targets` includes one or several wires. The speed-ups vary quite a bit depending on the number of targets, but they are greater than 1 in any case. ![speedup_vs_nthreads](https://github.com/user-attachments/assets/54797c41-8184-4c6a-a096-d2fcf1652e5b) We also compute the parallelization efficiency which is displayed in the following figure. ![efficiency_vs_nthreads](https://github.com/user-attachments/assets/ce048c4c-d24d-4a5d-bba1-2632b9bf9a98) It is also important to validate that the CUDA backend performs equally well. We therefore repeat the exercise and found the new kernels to accelerate `probs` for any number of targets. ![speedup_cuda](https://github.com/user-attachments/assets/e9b2841a-139a-47ac-b45f-0ca0ba4a074f) **Possible Drawbacks:** Many implementation decreasing maintainability. **Related GitHub Issues:** [sc-65198] --------- Co-authored-by: ringo-but-quantum <github-ringo-but-quantum@xanadu.ai> Co-authored-by: Ali Asadi <10773383+maliasadi@users.noreply.github.com>
- Loading branch information
1 parent
11bf9dc
commit d1baa8f
Showing
11 changed files
with
749 additions
and
253 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,4 +16,4 @@ | |
Version number (major.minor.patch[-label]) | ||
""" | ||
|
||
__version__ = "0.38.0-dev14" | ||
__version__ = "0.38.0-dev15" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.