-
Notifications
You must be signed in to change notification settings - Fork 370
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
MPS with cuQuantum #2168
Open
MozammilQ
wants to merge
36
commits into
Qiskit:main
Choose a base branch
from
MozammilQ:mps-cutensor
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
MPS with cuQuantum #2168
Changes from all commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
563ae6e
initial layout
MozammilQ 280f868
refactor code
MozammilQ ae44c69
refactor code
MozammilQ 5b48265
refactor code
MozammilQ 517a554
refactor code
MozammilQ 7e40588
refactor code
MozammilQ ebf9ca0
refactor code
MozammilQ a422690
refactor code
MozammilQ 80b59d5
refactor code
MozammilQ 52f1ed4
refactor code
MozammilQ ed43e71
refactor code
MozammilQ 649a5d7
refactor code
MozammilQ 83e4b5e
Merge branch 'main' into mps-cutensor
doichanj c33571f
refactor code
MozammilQ abc5552
Merge branch 'main' into mps-cutensor
doichanj f0205e3
refactor code
MozammilQ 629f65f
refactor code
MozammilQ 644a822
added release note
MozammilQ e6f2288
refactor code
MozammilQ 42f983e
Merge branch 'Qiskit:main' into mps-cutensor
MozammilQ c24b9e2
refactor code
MozammilQ 34e9502
refactor code
MozammilQ 00f88e9
refactor code; included test
MozammilQ 454f8c0
lint
MozammilQ 985c7f2
added suggestion
MozammilQ 7ffab7d
Merge branch 'main' into mps-cutensor
doichanj 6b0b41d
Merge branch 'main' into mps-cutensor
MozammilQ 34a5e75
fixed a typo
MozammilQ a1ae308
refactor code
MozammilQ 859e946
Merge branch 'Qiskit:main' into mps-cutensor
MozammilQ 2ae116e
Merge branch 'Qiskit:main' into mps-cutensor
MozammilQ ed9a907
refactor code
MozammilQ a4dbd12
Merge branch 'Qiskit:main' into mps-cutensor
MozammilQ e1e80d1
added cublas for contract
MozammilQ 321230c
fixed typo
MozammilQ 702ecd0
Merge branch 'Qiskit:main' into mps-cutensor
MozammilQ File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
releasenotes/notes/mps-svd-with-cuquantum-c0392854d1f373e0.yaml
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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
--- | ||
features: | ||
- | | ||
This PR adds the ability to run Matrix Product State Simulation on Nvidia GPUs. | ||
|
||
While choosing for the backend for Matrix Product State simulation users can | ||
choose all as usual, but this time when they can choose the device as GPU, the | ||
simulation is accelerated by NVIDIA GPU. To be precise, this PR offloads the | ||
Singular Value Decomposition and matrix multiplication of bigger matrices involved | ||
in Matrix Product State Simulation to GPU. | ||
|
||
|
||
Example | ||
|
||
.. code-block:: python | ||
|
||
from qiskit_aer import AerSimulator | ||
from qiskit.circuit import QuantumCircuit | ||
from qiskit.compiler import transpile | ||
|
||
num_qubits = 10 | ||
shots = 5 | ||
|
||
qc = QuantumCircuit(num_qubits) | ||
qc.h(0) | ||
|
||
for control, target in zip(range(num_qubits-1), range(1, num_qubits)): | ||
qc.cx(control, target) | ||
|
||
qc.measure_all() | ||
|
||
sim = AerSimulator(method="matrix_product_state", device="GPU") | ||
qc_t = transpile(qc, backend=sim) | ||
job = sim.run(qc_t, shots = shots) | ||
|
||
counts = job.result().get_counts() | ||
counts | ||
|
||
|
||
|
||
|
||
|
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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Even though MPI acceleration is not available for MPS, still I compiled with
AER_MPI=True
.Upon re-testing, the code against different CPUs:
Cascade Lake 4-cores + CUDA Arch 89, SapphireRapids 4-cores, zen+ 8-cores + CUDA Arch 86
In case of very low qubit count like 2,3 etc, GPU version is 1.5-2.5 seconds slower, maybe this is the time for GPU initialization.
The offloading of SVD to the GPU does accelerates the computation( in all cases! )
It will still be faster to offload to CUDA Arch 89 even with SapphireRapids CPU.