-
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
Optimize the input state-vector copy into the LGPU #1071
Conversation
Hello. You may have forgotten to update the changelog!
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1071 +/- ##
==========================================
+ Coverage 97.99% 98.11% +0.12%
==========================================
Files 233 232 -1
Lines 40019 39268 -751
==========================================
- Hits 39215 38527 -688
+ Misses 804 741 -63 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…ne-lightning into optimize_memory_lgpu
pennylane_lightning/core/src/simulators/lightning_gpu/StateVectorCudaManaged.hpp
Outdated
Show resolved
Hide resolved
pennylane_lightning/core/src/simulators/lightning_gpu/StateVectorCudaManaged.hpp
Outdated
Show resolved
Hide resolved
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.
Good job! A great improvement for memory usage. I assume you checked the codecov warning and they are all fake, right?
pennylane_lightning/core/src/simulators/lightning_gpu/StateVectorCudaManaged.hpp
Outdated
Show resolved
Hide resolved
pennylane_lightning/core/src/simulators/lightning_gpu/StateVectorCudaManaged.hpp
Outdated
Show resolved
Hide resolved
...tning/core/src/simulators/lightning_gpu/gates/tests/Test_StateVectorCudaManaged_NonParam.cpp
Outdated
Show resolved
Hide resolved
...tning/core/src/simulators/lightning_gpu/gates/tests/Test_StateVectorCudaManaged_NonParam.cpp
Outdated
Show resolved
Hide resolved
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.
Nice one. Thanks @LuisAlfredoNu
pennylane_lightning/core/src/simulators/lightning_gpu/StateVectorCudaManaged.hpp
Outdated
Show resolved
Hide resolved
pennylane_lightning/core/src/simulators/lightning_gpu/StateVectorCudaManaged.hpp
Show resolved
Hide resolved
pennylane_lightning/core/src/simulators/lightning_gpu/StateVectorCudaManaged.hpp
Outdated
Show resolved
Hide resolved
...tning/core/src/simulators/lightning_gpu/gates/tests/Test_StateVectorCudaManaged_NonParam.cpp
Show resolved
Hide resolved
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.
Thank you for your nice job!
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.
Awesome work! Thanks @LuisAlfredoNu 🥇
Don't forget to add your PR to the changelog :)
pennylane_lightning/core/src/simulators/lightning_gpu/StateVectorCudaManaged.hpp
Show resolved
Hide resolved
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.
Happy to approve 🥳
Context:
After running different algorithm with LGPU and perform a memory profile. Show a memory bottleneck for LGPU on the Python layer because the peak of memory is 3 times the need for the computation.
Description of the Change:
Remove tmp allocation and skip indexes computation for common cases.
Benefits:

Using a test algorithm with 31 qubits produce the following memory profile:
Reduction of the memory peak from 100GB to 66GB
Note:
memray
measures all the memory allocation, even for the GPUcudaMallocX
.Using the following toy circuit
Produce the following times
Possible Drawbacks:
Related GitHub Issues:
[sc-58833]