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

feat: Introduce run_multiple method #264

Merged
merged 19 commits into from
Jun 27, 2024
Merged

feat: Introduce run_multiple method #264

merged 19 commits into from
Jun 27, 2024

Conversation

speller26
Copy link
Member

Issue #, if available:

Description of changes:

Introduces run_multiple method to BraketSimulator to allow backends to leverage their own batching implementations. Will next publish SDK PR to make use of this interface.

Testing 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

  • I have added tests that prove my fix is effective or that my feature works (if appropriate)
  • I have checked that my tests are not configured for a specific region or account (if appropriate)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@speller26 speller26 requested a review from a team as a code owner June 19, 2024 07:38
Copy link

codecov bot commented Jun 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (dc68323) to head (5a8b429).
Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #264   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           48        48           
  Lines         3791      3802   +11     
  Branches       927       930    +3     
=========================================
+ Hits          3791      3802   +11     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

krneta
krneta previously approved these changes Jun 19, 2024
expected_measurements = [[1, 0], [0, 1], [1, 1]]
simulator = DensityMatrixSimulator()
for result, payload_args, expected in zip(
simulator.run_multiple(payloads, args=args), args, expected_measurements
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aren't you missing a kwargs=kwargs here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I see what's going on. IMO this is pretty confusing, to allow shots to be in either

Args:
payloads (Sequence[Union[OQ3Program, AHSProgram, JaqcdProgram]]): The IR representations
of the programs
args (Optional[Sequence[Sequence[Any]]]): The positional args to include with
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can I only submit one of args and kwargs? Is the intent that specifying shots in kwargs should override any value in args?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can specify both, just as you can technically

device.run(circuit, 1000, shots=1000)

it'll just error out with something like

LocalSimulator.run() got multiple values for argument 'shots'

rmshaffer
rmshaffer previously approved these changes Jun 27, 2024
src/braket/simulator/braket_simulator.py Outdated Show resolved Hide resolved
src/braket/simulator/braket_simulator.py Outdated Show resolved Hide resolved
rmshaffer
rmshaffer previously approved these changes Jun 27, 2024
@speller26 speller26 merged commit e93e551 into main Jun 27, 2024
33 checks passed
@speller26 speller26 deleted the multi2 branch June 27, 2024 22:01
@speller26 speller26 restored the multi2 branch June 28, 2024 20:42
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 this pull request may close these issues.

5 participants