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

Shor example performance drop #1432

Closed
stavros11 opened this issue Aug 30, 2024 · 4 comments · Fixed by #1439
Closed

Shor example performance drop #1432

stavros11 opened this issue Aug 30, 2024 · 4 comments · Fixed by #1439

Comments

@stavros11
Copy link
Member

First, the Shor example with the semi-classical approach, which can be executed using:

python examples/shor/main.py --semiclassical

is broken because it is no longer possible (I think after #1039) to execute circuits that only contain collapse measurements using state vectors. The error says to use density matrices, however this is intractable for the typically large circuits of this example. An easy fix is to add a normal (non-collapse) measurement at the end of the circuit, which makes it fall back to repeated execution and returns MeasurementOutcomes (instead of full state).

However, even with the above fix, the default N=15 did not finish execution within several minutes of using qibojit (numba). This is much slower than the original benchmark in #277 (comment). I also managed to roll back to qibo 0.1.6rc1 and qibojit 0.0.1 (not very trivial) and the same example runs in a few seconds so clearly something broke in between, or the last measurement I added breaks something (but this seems unlikely based on some profiling I did).

@igres26
Copy link
Contributor

igres26 commented Sep 5, 2024

I used this example at 0.2.8 and it is fast to execute. So something has been introduced in between these two versions.

@alecandido
Copy link
Member

#1039 was first included in v0.2.2.

We should take the time of running it with git bisect (or manually bisecting versions first), to find when this behavior appeared.

@stavros11
Copy link
Member Author

I used this example at 0.2.8 and it is fast to execute. So something has been introduced in between these two versions.

Are you using the qibojit numba backend for this? If yes, could you please also add the qibojit and numba versions? You can find them using pip list. I tried with

numba                  0.60.0
numpy                  1.26.4
qibo                   0.2.8
qibojit                0.1.4

and the --semiclassical case is still slow.

@stavros11
Copy link
Member Author

#1039 was first included in v0.2.2.

To me it seems that the problem was introduced in that version. In particular, the following environment

numba                  0.60.0
numpy                  1.26.4
qibo                   0.2.1
qibojit                0.1.5

is fast with qibojit (numba) and it becomes slow if I upgrade qibo to v0.2.2 (with the rest staying the same).

I am not sure if it is related to #1039 in particular or some other PR first included in v0.2.2. git bisect could help with that.

@stavros11 stavros11 linked a pull request Sep 9, 2024 that will close this issue
4 tasks
@stavros11 stavros11 mentioned this issue Sep 13, 2024
4 tasks
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.

3 participants