-
Notifications
You must be signed in to change notification settings - Fork 123
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
feature: Implement run_batch for MultiSimulator #1000
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1000 +/- ##
===========================================
- Coverage 100.00% 99.56% -0.44%
===========================================
Files 135 135
Lines 8941 9005 +64
Branches 2008 2022 +14
===========================================
+ Hits 8941 8966 +25
- Misses 0 39 +39 ☔ View full report in Codecov by Sentry. |
dispatch = { | ||
Circuit: self._run_multiple_internal_circuit, | ||
Problem: self._run_multiple_internal_problem, | ||
OpenQASMProgram: self._run_multiple_internal_openqasm_program, | ||
SerializableProgram: self._run_multiple_internal_serializable_program, | ||
AnalogHamiltonianSimulation: self._run_multiple_internal_ahs, | ||
AHSProgram: self._run_multiple_internal_ahs_program, | ||
} |
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.
This is temporary and will be deleted. Need to refactor all of this and the _run_internal
methods above, to get rid of duplication.
with Pool(min(max_parallel, len(tasks_and_inputs))) as pool: | ||
param_list = [(task, shots, inp, *args, *kwargs) for task, inp in tasks_and_inputs] | ||
results = pool.starmap(self._run_internal_wrap, param_list) | ||
if isinstance(self._delegate, MultiSimulator): |
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 would like to avoid this if statement, if possible. Maybe after we refactor to minimize duplication, there will be a reasonable way to get rid of 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.
Yes, I'll do my best to get rid of this. I agree, I think there should be a more elegant way.
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.
Use Python's multiple dispatch package? 😇
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.
You can also just use @singledispatchmethod
Closing this in favor of #1005 |
Issue #, if available:
Description of changes:
Braket SDK changes to support
run_batch
for the newMultiSimulator
class in amazon-braket/amazon-braket-default-simulator-python#260Testing done:
Merge Checklist
Put an
x
in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your pull request.General
Tests
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.