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.
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
feat: Introduce MultiSimulator class #260
feat: Introduce MultiSimulator class #260
Changes from 1 commit
16ab922
119439f
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
It seems like a little overkill to create a new abstract class/interface this one method that's very related to the existing run method.
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.
Yes, I'm also curious why we couldn't just add
run_multiple
to the existing interface, and provide a default implementation.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.
Regardless, we're going to need a new method for the backend to run multiple circuits; this means it has to live either in BraketSimulator or a new class. If it lives in
BraketSimulator
, then the SDK would need either check whether the method throws an exception (not great), or we'd need to add a new property inBraketSimulator
for the SDK to check, which then leads to a situation where devs can implement the method and forget to mark the property true, or vice-versa.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.
Could
BraketSimulator
also provide a default implementation ofrun_multiple
? (maybe it could do exactly what the SDK does today forrun_batch
- delegate toPool
)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.
I suppose it could; it just doesn't seem useful to have the same implementation in both the simulator and the SDK; as well, the abstract
BraketSimulator
class having a default implementation could potentially lead to multiple inheritance issues down the line.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.
Alternative implementation in #264
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.
We should probably have a default implementation of this, so that future simulators don't need to re-implement it.
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.
Why do we call it
run_multiple
instead ofrun_batch
? It's also a little confusing because it's unspecified how the *args and **kwargs should apply to the batch. For example, do they apply globally to all of the tasks? Or should these be lists of the (*args, **kwargs) that would be provided to a singlerun
call?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.
The SDK already provides the default implementation if the simulator doesn't subclass
MultiSimulator
; if someone doesn't want a nativerun_multiple
method, they can just implementBraketSimulator
.As for
run_multiple
vsrun_batch
, the reasons are twofold: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.
I know this is copied from the
run
docstring, but "number of qubits" is a weird example here. Better examples would be number of shots, or lists of input parameters to the tasks.