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

Fix qiskit-gpu when precision is set #36

Merged
merged 1 commit into from
Feb 24, 2022
Merged

Fix qiskit-gpu when precision is set #36

merged 1 commit into from
Feb 24, 2022

Conversation

stavros11
Copy link
Member

Fixes the issue we have with qiskit-gpu for which performance appears similar to qiskit-cpu in the library comparison bar plots. Apparently our qiskit-gpu falls back to cpu when the precision option is used in the compare.py script, due to a typo in the simulator option definition.

@scarrazza
Copy link
Member

Thanks, but here you have simply renamed self.options with self.sim_options, no?

@stavros11
Copy link
Member Author

stavros11 commented Feb 24, 2022

Thanks, but here you have simply renamed self.options with self.sim_options, no?

Yes, because self.sim_options is used in the Qiskit class, which is inherited by QiskitGpu. It's important to use the same name for this attribute in both classes because otherwise some methods, such as set_precision, do not work as intended. I tested this and it works, but I am re-running the qiskit part of the library plots to be sure.

A quick test is the following:

python compare.py --nqubits 27 --library qiskit-gpu --precision double

will run on CPU if using the libraries branch, but on GPU using this branch. If you drop the --precision setting it will run on GPU with both branches.

@scarrazza
Copy link
Member

I see, thanks for spotting this issue, I am curious to see its performance.

@stavros11
Copy link
Member Author

Here are the fixed plots, with the numbers for other libraries kept the same:

Single precision

image
image

Double precision

image
image

Single precision is not very impressive but I remember we also observed this in qiboteam/qibojit#53 for the multi-qubit operator. Double precision looks as expected, so I guess from our side the scripts are correct and properly running on GPU now.

It's nice to see that the CPU/GPU ratios are consistent for all libraries both on 20 qubits (CPU faster) and 30 qubits (GPU faster), especially in double precision. Qibojit GPU is surprisingly fast which I hope is true and not due to a bug or something!

@stavros11 stavros11 added the bug Something isn't working label Feb 24, 2022
@scarrazza
Copy link
Member

Thanks!

I hope is true and not due to a bug or something!

Well, you know, this is very unlikely. If the simulation numbers are ok, then we are fine, given that we can reproduce this setup on multiple devices.

Copy link
Contributor

@mlazzarin mlazzarin left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@scarrazza scarrazza merged commit 6cdc7fb into libraries Feb 24, 2022
@stavros11 stavros11 deleted the fixqiskitgpu branch February 26, 2022 11:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants