-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Modify run_batch_async #6387
Modify run_batch_async #6387
Conversation
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
return [ | ||
await self.run_sweep_async(circuit, params=params, repetitions=repetitions) | ||
for circuit, params, repetitions in zip(programs, params_list, repetitions) | ||
] |
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 probably want to use a variant of duet.pmap
("parallel map") to make multiple calls in parallel. In this case, the zip
produces tuples of args and we want to call the underlying function like self.run_sweep_async(*args)
, so we need a "starmap", something like:
return await duet.pstarmap_async(self.run_sweep_async, zip(programs, params_list, repetitions))
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.
For reference, here's the definition of duet.pstarmap_async
: https://github.com/google/duet/blob/main/duet/api.py#L171
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.
Thank you for the code pointer!
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #6387 +/- ##
========================================
Coverage 97.80% 97.81%
========================================
Files 1111 1111
Lines 96877 97054 +177
========================================
+ Hits 94754 94931 +177
Misses 2123 2123 ☔ View full report in Codecov by Sentry. |
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.
LGTM % some test nits. Thanks!
call run batch async asynchronously
This change gives a 2x speedup when using
run_batch