Skip to content

All multi-circuit programs to be batched in the same request in Engine.#8036

Open
dstrain115 wants to merge 3 commits intoquantumlib:mainfrom
dstrain115:add_multi_programs_client
Open

All multi-circuit programs to be batched in the same request in Engine.#8036
dstrain115 wants to merge 3 commits intoquantumlib:mainfrom
dstrain115:add_multi_programs_client

Conversation

@dstrain115
Copy link
Copy Markdown
Collaborator

  • Allow the client to accept a jobs_per_batch which batches multiple circuits within the same request.
  • Adjusts the signature of the functions accordingly to match that this could include a mapping or sequence of circuits.

- Allow the client to accept a jobs_per_batch which batches multiple
circuits within the same request.
@github-actions github-actions bot added the size: L 250< lines changed <1000 label Apr 13, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.63%. Comparing base (5b3eb0b) to head (42883be).
⚠️ Report is 8 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8036      +/-   ##
==========================================
- Coverage   99.63%   99.63%   -0.01%     
==========================================
  Files        1110     1110              
  Lines       99755    99860     +105     
==========================================
+ Hits        99394    99497     +103     
- Misses        361      363       +2     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dstrain115 dstrain115 marked this pull request as ready for review April 15, 2026 00:10
@pavoljuhas
Copy link
Copy Markdown
Collaborator

Small point - if there is an internal bug for this consider adding a b/NNN link to the description.

program: (
cirq.AbstractCircuit
| Sequence[cirq.AbstractCircuit]
| Mapping[str, cirq.AbstractCircuit]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

In our internal code when we do the equivalent of passing a Sequence or Mapping here, we iterate over those in the "inner loop", e.g. the execution order would be something like:

results = [
    self.run(circuit, params)
    for params in sweep
    for circuit in circuits
]

where the results would have to be flattened into a single list to conform to the specified return type.

On the other hand, for run_batch as defined in the Sampler base class, we expect to return a nested list where the loop over circuits is the outer loop, e.g.

results = [
    [self.run(circuit, params) for params in sweep]
    for circuit, sweep in zip(circuits, sweeps)
]

I think we need to define what the intended execution order is, in particular for the first case since that is not supported at all on the Sampler base class. If for the first case we align with internal code where the loop over circuits is the "inner" loop, then we would either need a way to communicate the ordering to the server since the run_batch case instead runs over servers on the outer loop. Or if we don't actually care about the order things execute on hardware then we might need to "reshape" the output from quantum engine so that we return results in the appropriate order for both multi-circuit case and run_batch case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size: L 250< lines changed <1000

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants