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

Parallelize apply_Sparse_Matrix in lightning.qubit #991

Open
tomlqc opened this issue Nov 8, 2024 · 3 comments · May be fixed by #992
Open

Parallelize apply_Sparse_Matrix in lightning.qubit #991

tomlqc opened this issue Nov 8, 2024 · 3 comments · May be fixed by #992

Comments

@tomlqc
Copy link
Contributor

tomlqc commented Nov 8, 2024

Important Note

⚠️ This issue is part of an internal assignment and not meant for external contributors

Context

Compressed Sparse Row (CSR) matrix-vector product quickly computes the resulting vector entry-by-entry by ignoring the zero entries in a matrix. In Lightning, CSR matrix-vector products are used when computing the expectation value or variance of SparseHamiltonian observables. The core routine apply_Sparse_Matrix is implemented in the SparseLinAlg.hpp header file.

The goal of this task is to parallelize apply_Sparse_Matrix with C++ threads or OpenMP.

Requirements

The multi-threading support for the apply_Sparse_Matrix method has to be implemented in the lightning.qubit C++ backend, see pennylane_lightning/core/src/simulators/lightning_qubit/utils/SparseLinAlg.hpp

A PR must satisfy the following:

  • Create a draft pull-request in PennyLane Lightning that you can use for questions and further communication.
  • Parallelize apply_Sparse_Matrix with C++ threads or OpenMP.
  • Validate your implementation with C++ and Python tests (you may reuse existing tests, but add some if coverage requires it).
  • Benchmark the new C++ implementation (depending on number of qubits and number of threads) and upload the results to the pull-request for further discussions.
  • Ensure to complete all the steps outlined in the PR template and mark the PR ready for review.

Don't hesitate to ask for clarification or raise any concerns regarding the issue. We'll be happy to discuss with you!

@mvandelle
Copy link

Hi Thomas,
I have some issues installing the editable version of the lightning-qubit github repositry on my machine (windows sadly, i do not have a Mac OS or linux). I checked that i have all requirement, but in the last step when runing "pip install -e ." i got an error, it seems that a file is not properly created during the building process " error: can't copy 'C:\Users\User\AppData\Local\Temp\tmp67sbr2fa.build-lib\pennylane_lightning\lightning_qubit_ops.cp313-win_amd64.pyd': doesn't exist or not a regular file". Im starting to run out of option to solve this, is it a issue that maybe already happened on windows installation ?
Have a good day,
Marc

@tomlqc
Copy link
Contributor Author

tomlqc commented Nov 11, 2024

Hi @mvandelle ,
You would have more fun with Linux (think about dual boot if this is an option).
I would need a bit more context. How did you install python and do you use venv or conda?
Would you mind continuing the discussion in a draft PR?

@mvandelle
Copy link

I created the draft PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants