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

GPU version is slower than CPU version for hybrid_qnns.ipynb #2169

Open
4 tasks done
qinhui99 opened this issue Aug 28, 2024 · 4 comments
Open
4 tasks done

GPU version is slower than CPU version for hybrid_qnns.ipynb #2169

qinhui99 opened this issue Aug 28, 2024 · 4 comments

Comments

@qinhui99
Copy link

Required prerequisites

  • Consult the security policy. If reporting a security vulnerability, do not report the bug using this form. Use the process described in the policy to report the issue.
  • Make sure you've read the documentation. Your issue may be addressed there.
  • Search the issue tracker to verify that this hasn't already been reported. +1 or comment there if it has.
  • If possible, make a PR with a failing test to give us a starting point to work on!

Describe the bug

We did the performance test for hybrid_qnns.ipynb between GPU version and CPU version. Then we found GPU version is very slow and slower than CPU version. Why?

We tested both 4090 GPU and T4 GPU, got the same result.

Steps to reproduce the bug

just run the hybrid_qnns.ipynb.

Expected behavior

GPU version is faster than CPU version.

Is this a regression? If it is, put the last known working version (or commit) here.

Not a regression

Environment

  • CUDA Quantum version: 12.01
  • Python version: 3.10
  • C++ compiler:
  • Operating system: Ubuntu 18

Suggestions

No response

@zohimchandani
Copy link
Collaborator

Since this is a single qubit example, it is expected that the CPU version will be faster.

GPU executing time will be much faster if you run larger circuits with more qubit counts.

@qinhui99
Copy link
Author

Since this is a single qubit example, it is expected that the CPU version will be faster.

GPU executing time will be much faster if you run larger circuits with more qubit counts.

No. I tested 4 qubits, the winner still was the CPU version.
CPU version: 4.76 iter/s
GPU version: 2.95 iter/s

I used other quantum platform such as torch-quantum, deepquantum. There are GPU version faster than CPU version.

@zohimchandani
Copy link
Collaborator

zohimchandani commented Sep 3, 2024

Can you please share a minimal working example of the code you are running to benchmark with the section you are timing highlighted.

Thanks.

@qinhui99
Copy link
Author

qinhui99 commented Sep 3, 2024

mnist_torchquantum.zip

Yeah, pls check the mnist_torchquantum.zip.

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

No branches or pull requests

2 participants