|
136 | 136 | "source": [
|
137 | 137 | "## Create a **Quantum Virtual Machine**\n",
|
138 | 138 | "\n",
|
139 |
| - "The following cell builds a Quantum Virtual Machine that mimics a particular Google quantum hardware device (currently Rainbow or Weber) using the following customizable steps: \n", |
| 139 | + "The following cell builds a Quantum Virtual Machine that mimics a particular Google quantum hardware device (currently Willow-pink, Rainbow or Weber) using the following customizable steps: \n", |
140 | 140 | "- Constructing a `cirq.NoiseModel` object from device calibration data saved in Cirq. See [Representing Noise](../noise/representing_noise.ipynb) for more on noise models. \n",
|
141 | 141 | "- Building a `qsimcirq.QsimSimulator` that uses this noise model. See [Noisy Simulation](./noisy_simulation.ipynb) and [Noise simulation with qsim](/qsim/tutorials/noisy_qsimcirq) for more. \n",
|
142 | 142 | "- Creating a `cirq.Device` that imposes the same constraints on circuits that the original device would. See [Devices](../hardware/devices.ipynb) for more on these constraint objects. \n",
|
|
154 | 154 | },
|
155 | 155 | "outputs": [],
|
156 | 156 | "source": [
|
157 |
| - "# @title Choose a processor (\"rainbow\" or \"weber\")\n", |
158 |
| - "processor_id = \"weber\" # @param {type:\"string\"}\n", |
| 157 | + "# @title Choose a processor (\"willow_pink\" or \"rainbow\" or \"weber\")\n", |
| 158 | + "# (see cirq_google.engine.list_virtual_processors() for available names)\n", |
| 159 | + "processor_id = \"willow_pink\" # @param {type:\"string\"}\n", |
159 | 160 | "\n",
|
160 | 161 | "# Construct a simulator with a noise model based on the specified processor.\n",
|
161 |
| - "cal = cirq_google.engine.load_median_device_calibration(processor_id)\n", |
162 | 162 | "noise_props = cirq_google.engine.load_device_noise_properties(processor_id)\n",
|
163 | 163 | "noise_model = cirq_google.NoiseModelFromGoogleNoiseProperties(noise_props)\n",
|
164 | 164 | "sim = qsimcirq.QSimSimulator(noise=noise_model)\n",
|
165 | 165 | "\n",
|
166 | 166 | "# Create a device from the public device description\n",
|
167 | 167 | "device = cirq_google.engine.create_device_from_processor_id(processor_id)\n",
|
| 168 | + "cal = cirq_google.engine.load_median_device_calibration(processor_id)\n", |
168 | 169 | "# Build the simulated local processor from the simulator and device.\n",
|
169 | 170 | "sim_processor = cirq_google.engine.SimulatedLocalProcessor(\n",
|
170 | 171 | " processor_id=processor_id, sampler=sim, device=device, calibrations={cal.timestamp // 1000: cal}\n",
|
|
193 | 194 | "- Is applied to qubits that exist on the device. \n",
|
194 | 195 | "- Respects the connectivity of qubits on the device.\n",
|
195 | 196 | "\n",
|
196 |
| - "Below is an example of a circuit that has the correct topology to be placed on the Weber device, and how it is prepared to be run on the QVM." |
| 197 | + "Below is an example of a circuit that has the correct topology to be placed on the Willow-pink device, and how it is prepared to be run on the QVM." |
197 | 198 | ]
|
198 | 199 | },
|
199 | 200 | {
|
|
245 | 246 | "source": [
|
246 | 247 | "### Transform the circuit \n",
|
247 | 248 | "\n",
|
248 |
| - "Before executing a circuit on (virtual) quantum hardware, the operations in the circuit need to be translated to use the types of gates the device supports. The `cirq.optimize_for_target_gateset` function does this for you, transforming the operations to use the `cirq.SqrtIswapTargetGateset`, which is supported by the Weber processor that this QVM is based on. Learn more about the gate set constraints of Google hardware at the [Hardware](../hardware) page." |
| 249 | + "Before executing a circuit on (virtual) quantum hardware, the operations in the circuit need to be translated to use the types of gates the device supports. The `cirq.optimize_for_target_gateset` function does this for you, transforming the operations to use the `cirq.CZTargetGateset`, which is supported by the Willow-pink processor that this QVM is based on. Learn more about the gate set constraints of Google hardware at the [Hardware](../hardware) page." |
249 | 250 | ]
|
250 | 251 | },
|
251 | 252 | {
|
|
256 | 257 | },
|
257 | 258 | "outputs": [],
|
258 | 259 | "source": [
|
259 |
| - "# Convert the gates in the GHZ circuit to the \"SqrtIswap\" gateset, which the device uses.\n", |
| 260 | + "# Convert the gates in the GHZ circuit to the \"CZ\" gateset, which the device uses.\n", |
260 | 261 | "translated_ghz_circuit = cirq.optimize_for_target_gateset(\n",
|
261 |
| - " ghz_circuit, context=cirq.TransformerContext(deep=True), gateset=cirq.SqrtIswapTargetGateset()\n", |
| 262 | + " ghz_circuit, context=cirq.TransformerContext(deep=True), gateset=cirq.CZTargetGateset()\n", |
262 | 263 | ")\n",
|
263 | 264 | "print(translated_ghz_circuit)"
|
264 | 265 | ]
|
|
271 | 272 | "source": [
|
272 | 273 | "### Choose qubits on the virtual device\n",
|
273 | 274 | "\n",
|
274 |
| - "Choose qubits on the device to execute your device ready circuit on. Look at the device map (as above) and choose a set of qubits that fit your circuit (eg a line or a block). The Rainbow and Weber devices have different topologies, some qubit maps may be possible on only one of these devices. As noted, the GHZ example circuit as constructed will fit on a 17 qubit chain of adjacent qubits on the device, so you only need to find this consecutive line of qubits. See [Qubit Picking](../hardware/qubit_picking.ipynb) for more advice and methods for selecting qubits. " |
| 275 | + "Choose qubits on the device to execute your device ready circuit on. Look at the device map (as above) and choose a set of qubits that fit your circuit (eg a line or a block). The Willow-pink, Rainbow and Weber devices have different topologies, some qubit maps may be possible on only one of these devices. As noted, the GHZ example circuit as constructed will fit on a 17 qubit chain of adjacent qubits on the device, so you only need to find this consecutive line of qubits. See [Qubit Picking](../hardware/qubit_picking.ipynb) for more advice and methods for selecting qubits. " |
275 | 276 | ]
|
276 | 277 | },
|
277 | 278 | {
|
|
284 | 285 | "source": [
|
285 | 286 | "# Choose qubits on the virtual device\n",
|
286 | 287 | "device_qubit_chain = [\n",
|
287 |
| - " cirq.GridQubit(5, 2),\n", |
288 |
| - " cirq.GridQubit(5, 3),\n", |
289 |
| - " cirq.GridQubit(4, 3),\n", |
290 |
| - " cirq.GridQubit(4, 2),\n", |
291 |
| - " cirq.GridQubit(4, 1),\n", |
292 |
| - " cirq.GridQubit(5, 1),\n", |
293 |
| - " cirq.GridQubit(6, 1),\n", |
294 |
| - " cirq.GridQubit(6, 2),\n", |
295 |
| - " cirq.GridQubit(6, 3),\n", |
296 |
| - " cirq.GridQubit(6, 4),\n", |
| 288 | + " cirq.GridQubit(5, 6),\n", |
| 289 | + " cirq.GridQubit(5, 7),\n", |
| 290 | + " cirq.GridQubit(4, 7),\n", |
| 291 | + " cirq.GridQubit(4, 6),\n", |
| 292 | + " cirq.GridQubit(4, 5),\n", |
| 293 | + " cirq.GridQubit(5, 5),\n", |
297 | 294 | " cirq.GridQubit(6, 5),\n",
|
298 |
| - " cirq.GridQubit(7, 5),\n", |
299 |
| - " cirq.GridQubit(8, 5),\n", |
300 |
| - " cirq.GridQubit(8, 4),\n", |
301 |
| - " cirq.GridQubit(8, 3),\n", |
302 |
| - " cirq.GridQubit(7, 3),\n", |
303 |
| - " cirq.GridQubit(7, 4),\n", |
| 295 | + " cirq.GridQubit(6, 6),\n", |
| 296 | + " cirq.GridQubit(6, 7),\n", |
| 297 | + " cirq.GridQubit(6, 8),\n", |
| 298 | + " cirq.GridQubit(6, 9),\n", |
| 299 | + " cirq.GridQubit(7, 9),\n", |
| 300 | + " cirq.GridQubit(8, 9),\n", |
| 301 | + " cirq.GridQubit(8, 8),\n", |
| 302 | + " cirq.GridQubit(8, 7),\n", |
| 303 | + " cirq.GridQubit(7, 7),\n", |
| 304 | + " cirq.GridQubit(7, 8),\n", |
304 | 305 | "]\n",
|
305 | 306 | "# Layout:\n",
|
306 | 307 | "#\n",
|
307 |
| - "# q(4, 1)───q(4, 2)───q(4, 3)\n", |
| 308 | + "# q(4, 5)───q(4, 6)───q(4, 7)\n", |
308 | 309 | "# │ │\n",
|
309 | 310 | "# │ │\n",
|
310 |
| - "# q(5, 1) q(5, 2)───q(5, 3)\n", |
| 311 | + "# q(5, 5) q(5, 6)───q(5, 7)\n", |
311 | 312 | "# │\n",
|
312 | 313 | "# │\n",
|
313 |
| - "# q(6, 1)───q(6, 2)───q(6, 3)───q(6, 4)───q(6, 5)\n", |
| 314 | + "# q(6, 5)───q(6, 6)───q(6, 7)───q(6, 8)───q(6, 9)\n", |
314 | 315 | "# │\n",
|
315 | 316 | "# │\n",
|
316 |
| - "# q(7, 3)───q(7, 4) q(7, 5)\n", |
| 317 | + "# q(7, 7)───q(7, 8) q(7, 9)\n", |
317 | 318 | "# │ │\n",
|
318 | 319 | "# │ │\n",
|
319 |
| - "# q(8, 3)───q(8, 4)───q(8, 5)" |
| 320 | + "# q(8, 7)───q(8, 8)───q(8, 9)" |
320 | 321 | ]
|
321 | 322 | },
|
322 | 323 | {
|
|
0 commit comments