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

Use batch mode correctly in the tutorials #616

Merged
merged 2 commits into from
Jun 3, 2024
Merged

Conversation

garrison
Copy link
Member

@garrison garrison commented Jun 1, 2024

Apparently, if you use sampler = SamplerV2(backend=backend), even within the Batch context manager, Qiskit Runtime will use job mode instead of batch mode, without any warning. This fixes our example usage so batch mode will work properly.

@garrison garrison added documentation Improvements or additions to documentation stable backport potential Suitable to be backported to most recent stable branch by Mergify labels Jun 1, 2024
@garrison garrison requested a review from ibrahim-shehzad June 1, 2024 01:16
@coveralls
Copy link

coveralls commented Jun 1, 2024

Pull Request Test Coverage Report for Build 9326577472

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 100.0%

Totals Coverage Status
Change from base Build 9322309456: 0.0%
Covered Lines: 2401
Relevant Lines: 2401

💛 - Coveralls

@garrison
Copy link
Member Author

garrison commented Jun 1, 2024

I tested with QiskitRuntimeService, and a session was indeed created. But CI fails because it no longer works on a fake backend, in local mode.

@garrison garrison marked this pull request as ready for review June 1, 2024 01:49
@ibrahim-shehzad
Copy link
Collaborator

even within the Batch context manager, Qiskit Runtime will use batch mode instead of job mode, without any warning.

Did you mean Qiskit Runtime will use job mode instead of batch mode when this is the case? This was what I was running into.

@garrison
Copy link
Member Author

garrison commented Jun 1, 2024

even within the Batch context manager, Qiskit Runtime will use batch mode instead of job mode, without any warning.

Did you mean Qiskit Runtime will use job mode instead of batch mode when this is the case? This was what I was running into.

I did. I fixed it in the top comment.

Copy link
Collaborator

@ibrahim-shehzad ibrahim-shehzad left a comment

Choose a reason for hiding this comment

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

I think this looks good, thanks! I'm guessing we will change to

with Batch(backend=backend) as batch: 
    sampler = SamplerV2(mode=batch)

after runtime makes that change and backport that?

@garrison
Copy link
Member Author

garrison commented Jun 3, 2024

I'm guessing we will change to

with Batch(backend=backend) as batch: 
    sampler = SamplerV2(mode=batch)

after runtime makes that change and backport that?

It probably won't be a candidate for backporting, as I expect it to require us to bump the minimum required version of qiskit-ibm-runtime.

@garrison garrison merged commit 3162cfd into main Jun 3, 2024
11 checks passed
@garrison garrison deleted the batch-mode-correctly branch June 3, 2024 13:18
mergify bot pushed a commit that referenced this pull request Jun 3, 2024
* Use batch mode correctly in the tutorials

* Work around a qiskit-ibm-runtime bug

Qiskit/qiskit-ibm-runtime#1723
(cherry picked from commit 3162cfd)
garrison added a commit that referenced this pull request Jun 3, 2024
* Use batch mode correctly in the tutorials

* Work around a qiskit-ibm-runtime bug

Qiskit/qiskit-ibm-runtime#1723
(cherry picked from commit 3162cfd)

Co-authored-by: Jim Garrison <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation stable backport potential Suitable to be backported to most recent stable branch by Mergify
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants