From 736990d421f8da020b7311c0014ba5bc8ffc33c0 Mon Sep 17 00:00:00 2001 From: eliottrosenberg <61400172+eliottrosenberg@users.noreply.github.com> Date: Mon, 12 Feb 2024 15:56:51 -0500 Subject: [PATCH 1/2] Update example --- docs/tutorials/gcp_gpu.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/tutorials/gcp_gpu.md b/docs/tutorials/gcp_gpu.md index 5669e39c..3e51f623 100644 --- a/docs/tutorials/gcp_gpu.md +++ b/docs/tutorials/gcp_gpu.md @@ -190,7 +190,8 @@ the code directly into the REPL, or paste the code in a file. See the documentat [here](https://quantumai.google/reference/python/qsimcirq/QSimOptions) for Options 1 and 2 or [here](https://docs.nvidia.com/cuda/cuquantum/appliance/cirq.html) for Option 3. Make sure to change `xx` to 0 for Option 1, 1 for Option 2, or the number of GPUs for -Option 3. +Option 3. For option 3, note that `QSimOptions` has a `disable_gpu` flag instead of a +`use_gpu` flag. ``` # Import Cirq and qsim @@ -203,6 +204,7 @@ circuit = cirq.Circuit(cirq.H(q0), cirq.CX(q0, q1)) # Instantiate a simulator that uses the GPU # xx = 0 for Option 1, 1 for Option 2, or the number of GPUs for Option 3. +# Important: If you are using cuQuantum Appliance (option 3), change `use_gpu=True` to `disable_gpu=False`. gpu_options = qsimcirq.QSimOptions(use_gpu=True, gpu_mode = xx, max_fused_gate_size=4) qsim_simulator = qsimcirq.QSimSimulator(qsim_options=gpu_options) From f0b56608374ab279317a43be07a3b1757a63317a Mon Sep 17 00:00:00 2001 From: eliottrosenberg <61400172+eliottrosenberg@users.noreply.github.com> Date: Mon, 12 Feb 2024 16:19:58 -0500 Subject: [PATCH 2/2] suggestion from Orion --- docs/tutorials/gcp_gpu.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/tutorials/gcp_gpu.md b/docs/tutorials/gcp_gpu.md index 3e51f623..ae84f175 100644 --- a/docs/tutorials/gcp_gpu.md +++ b/docs/tutorials/gcp_gpu.md @@ -203,9 +203,10 @@ q0, q1 = cirq.LineQubit.range(2) circuit = cirq.Circuit(cirq.H(q0), cirq.CX(q0, q1)) # Instantiate a simulator that uses the GPU -# xx = 0 for Option 1, 1 for Option 2, or the number of GPUs for Option 3. -# Important: If you are using cuQuantum Appliance (option 3), change `use_gpu=True` to `disable_gpu=False`. -gpu_options = qsimcirq.QSimOptions(use_gpu=True, gpu_mode = xx, max_fused_gate_size=4) +# Option 1 (mode=0) or Option 2 (mode=1) +gpu_options = qsimcirq.QSimOptions(use_gpu=True, gpu_mode = mode, max_fused_gate_size=4) +# Option 3 (number of GPUs = `num_gpus`) +gpu_options = qsimcirq.QSimOptions(disable_gpu=False, gpu_mode = num_gpus, max_fused_gate_size=4) qsim_simulator = qsimcirq.QSimSimulator(qsim_options=gpu_options) # Run the simulation