Skip to content

Commit

Permalink
Use batch mode correctly in the tutorials (#616) (#619)
Browse files Browse the repository at this point in the history
* 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 <garrison@ibm.com>
  • Loading branch information
mergify[bot] and garrison committed Jun 3, 2024
1 parent b15064b commit d234f03
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -314,11 +314,10 @@
"source": [
"from qiskit_ibm_runtime import SamplerV2, Batch\n",
"\n",
"# Set up the Qiskit Runtime Sampler primitive\n",
"sampler = SamplerV2(backend=backend)\n",
"\n",
"# Submit each partition's subexperiments as a single batch\n",
"with Batch(backend=backend):\n",
"# Submit each partition's subexperiments to the Qiskit Runtime Sampler\n",
"# primitive, in a single batch so that the jobs will run back-to-back.\n",
"with Batch(backend=backend) as batch:\n",
" sampler = SamplerV2(session=batch)\n",
" jobs = {\n",
" label: sampler.run(subsystem_subexpts, shots=2**12)\n",
" for label, subsystem_subexpts in isa_subexperiments.items()\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -408,11 +408,10 @@
"source": [
"from qiskit_ibm_runtime import SamplerV2, Batch\n",
"\n",
"# Set up the Qiskit Runtime Sampler primitive\n",
"sampler = SamplerV2(backend=backend)\n",
"\n",
"# Submit each partition's subexperiments as a single batch\n",
"with Batch(backend=backend):\n",
"# Submit each partition's subexperiments to the Qiskit Runtime Sampler\n",
"# primitive, in a single batch so that the jobs will run back-to-back.\n",
"with Batch(backend=backend) as batch:\n",
" sampler = SamplerV2(session=batch)\n",
" jobs = {\n",
" label: sampler.run(subsystem_subexpts, shots=2**12)\n",
" for label, subsystem_subexpts in isa_subexperiments.items()\n",
Expand Down

0 comments on commit d234f03

Please sign in to comment.