-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Remove BasicAer shot limit - QAMP #7801
Conversation
Update 11/30/20
At this point, there is an arbitrary number for the maximum shots in the BasicAer simulator "65536". The solution proposed @kevinsung is to work with zero as the default value of max_shots. This solves the problem with the evaluation of max_shots in the assemble function "_parse_common_args" in qiskit/compiler/assembler.py.
correcting some errors about where to add the test.
Pull Request Test Coverage Report for Build 2265135965
💛 - Coveralls |
@kevinsung now this issue is passing. |
@alejomonbar Please use descriptive titles for your pull requests. For example, "Remove BasicAer shot limit". Also, if you add the sentence "Fixes #7634" somewhere in the description then this PR will automatically close that issue. |
@jakelishman thoughts on this solution? |
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.
Looks good to me, thanks! Please can you also add an "upgrade" release note that says that the limit has been removed?
Do you know how long the new test takes to run?
Thank you @jakelishman, I added the release note. About the time, I don't know if there is any command to know it, but, the circuit for the test is simple and only requires 2e6 shots, I don't think this adds much extra time for the tox test. |
releasenotes/notes/remove-basicaer-shot-limit-b7cd4e6f6739885c.yaml
Outdated
Show resolved
Hide resolved
….yaml Co-authored-by: Kevin J. Sung <[email protected]>
The test previously just ran `BasicAer` with two million shots on the transpiled circuit to see if it encountered a limit. This is simple enough functionality (and unlikely enough to be broken accidentally) that it can do without a test - the previous one took about 8 seconds, which is a long time for testing a toggle.
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.
Two million shots is actually quite a lot, especially for a simulator implemented in pure Python. As things stood, the test took about 8 seconds. Taken alone, that's ok, but Terra's test suite has something like ten to fifteen thousand tests in it, and at that scale, 8 seconds is a long time to test on a simple toggle.
While writing the test was definitely the right thing to do, in this very particular circumstance, I think the best course of action is just to not have one. It can be hard to test for the absence of a limit efficiently, and this particular feature is something that's very unlikely to be accidentally changed - if a limit is re-instated in the future, it'll almost certainly be somebody having made a deliberate technical choice.
Thanks for the contribution!
Summary
Fixes #7634
Executing the following code gives an error because
max_shots
for BasicAer has a limit of 65536 shots.Details and comments
The idea is that BasicAer does not have a limit in terms of the number of shots. Instead, the default value equals zero which works as no restriction on the number of shots.
Part of qiskit-advocate/qamp-spring-22#37