Skip to content

Commit 69cb9f3

Browse files
Merge pull request #659 from eliottrosenberg/eliottrosenbrg/gpu_docs2
Add note to example about using with cuQuantum Appliance
2 parents 0f75bd9 + f0b5660 commit 69cb9f3

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

docs/tutorials/gcp_gpu.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,8 @@ the code directly into the REPL, or paste the code in a file. See the documentat
190190
[here](https://quantumai.google/reference/python/qsimcirq/QSimOptions) for Options 1
191191
and 2 or [here](https://docs.nvidia.com/cuda/cuquantum/appliance/cirq.html) for Option 3.
192192
Make sure to change `xx` to 0 for Option 1, 1 for Option 2, or the number of GPUs for
193-
Option 3.
193+
Option 3. For option 3, note that `QSimOptions` has a `disable_gpu` flag instead of a
194+
`use_gpu` flag.
194195

195196
```
196197
# Import Cirq and qsim
@@ -202,8 +203,10 @@ q0, q1 = cirq.LineQubit.range(2)
202203
circuit = cirq.Circuit(cirq.H(q0), cirq.CX(q0, q1))
203204
204205
# Instantiate a simulator that uses the GPU
205-
# xx = 0 for Option 1, 1 for Option 2, or the number of GPUs for Option 3.
206-
gpu_options = qsimcirq.QSimOptions(use_gpu=True, gpu_mode = xx, max_fused_gate_size=4)
206+
# Option 1 (mode=0) or Option 2 (mode=1)
207+
gpu_options = qsimcirq.QSimOptions(use_gpu=True, gpu_mode = mode, max_fused_gate_size=4)
208+
# Option 3 (number of GPUs = `num_gpus`)
209+
gpu_options = qsimcirq.QSimOptions(disable_gpu=False, gpu_mode = num_gpus, max_fused_gate_size=4)
207210
qsim_simulator = qsimcirq.QSimSimulator(qsim_options=gpu_options)
208211
209212
# Run the simulation

0 commit comments

Comments
 (0)