|
96 | 96 | "This guide is split into three parts:\n", |
97 | 97 | "* Getting your circuit to run\n", |
98 | 98 | "* Making it run faster\n", |
| 99 | + "* Running it without keeping your laptop online\n", |
99 | 100 | "* Lowering error" |
100 | 101 | ] |
101 | 102 | }, |
|
112 | 113 | "gates will immediately cause a circuit to fail.\n", |
113 | 114 | "\n", |
114 | 115 | "Validating a circuit with a device, such as\n", |
115 | | - "`cg.Sycamore.validate_circuit(circuit)` will test a lot of these\n", |
| 116 | + "`cg.Willow105.validate_circuit(circuit)` will test a lot of these\n", |
116 | 117 | "conditions. Calling the `validate_circuit` function will work with any\n", |
117 | 118 | "device, including those retrieved directly from the API using the\n", |
118 | 119 | "[engine object](./specification.md#conversion-to-cirq.device), which can help\n", |
119 | 120 | "identify any qubits used in the circuit that have been disabled on the actual\n", |
120 | | - "device." |
| 121 | + "device. Sometimes, a pair of qubits may not have a gate calibrated between them\n", |
| 122 | + "even though the device object shows them as coupled. One way to see which pairs\n", |
| 123 | + "of adjacent qubits do not support gates between them is by checking the two-qubit\n", |
| 124 | + "XEB metrics, which can be found in the web UI\n", |
| 125 | + "([engine.quantumai.google](https://quantumai.engine.google)), where unsupported\n", |
| 126 | + "pairs of qubits will show as grey and be missing two-qubit metrics. These pairs of\n", |
| 127 | + "qubits will also be missing metrics in `engine.get_config(...).calibration`.\n", |
| 128 | + "\n", |
| 129 | + "Circuits containing gates other than CZ and single-qubit microwave gates may require\n", |
| 130 | + "special internal calibration. For example, if you intend to use cphase gates, physical\n", |
| 131 | + "Z gates, analog circuits, etc., you should discuss this with the Google support team\n", |
| 132 | + "to make sure the necessary calibrations and benchmarks are performed. Circuits containing\n", |
| 133 | + "classically-conditioned operations are not currently supported." |
121 | 134 | ] |
122 | 135 | }, |
123 | 136 | { |
|
250 | 263 | "id": "0e58b5ded5cb" |
251 | 264 | }, |
252 | 265 | "source": [ |
253 | | - "### Use sweeps when possible\n", |
| 266 | + "### Use sweeps or batches when possible\n", |
| 267 | + "\n", |
| 268 | + "#### Sweeps:\n", |
254 | 269 | "\n", |
255 | 270 | "Round trip network time to and from the engine typically adds latency on the order of a second\n", |
256 | 271 | "to the overall computation time. Reducing the number of trips and allowing the engine to\n", |
|
315 | 330 | "id": "114fb6c6b766" |
316 | 331 | }, |
317 | 332 | "source": [ |
318 | | - "### Use batches if sweeps are not possible\n", |
| 333 | + "#### Batches:\n", |
319 | 334 | "\n", |
320 | 335 | "The sampler has a method called `run_batch()` that can be used to send multiple\n", |
321 | 336 | "circuits in a single request. This can be used to increase the efficiency\n", |
322 | 337 | "of your program so that more repetitions are completed per second.\n", |
323 | 338 | "\n", |
324 | | - "The circuits that are grouped into the same batch must\n", |
325 | | - "measure the same qubits and have the same number of repetitions for each\n", |
326 | | - "circuit. Otherwise, the circuits will not be batched together\n", |
327 | | - "on the device, and there will be no gain in efficiency." |
| 339 | + "By default, `run_batch` will create one job per circuit. It is also possible to\n", |
| 340 | + "pack multiple circuits into a job by specifying `jobs_per_batch` when loading the\n", |
| 341 | + "sampler using [`cirq_google.engine.ProcessorSampler(..., jobs_per_batch=...)`](https://quantumai.google/reference/python/cirq_google/engine/ProcessorSampler)." |
328 | 342 | ] |
329 | 343 | }, |
330 | 344 | { |
|
371 | 385 | "print(list(flat_sweep.param_tuples()))" |
372 | 386 | ] |
373 | 387 | }, |
| 388 | + { |
| 389 | + "cell_type": "markdown", |
| 390 | + "metadata": { |
| 391 | + "id": "3e442c11d381" |
| 392 | + }, |
| 393 | + "source": [ |
| 394 | + "## Running circuits without keeping your laptop online\n", |
| 395 | + "\n", |
| 396 | + "One can create an\n", |
| 397 | + "[`EngineProgram`](https://quantumai.google/reference/python/cirq_google/engine/EngineProgram)\n", |
| 398 | + "using\n", |
| 399 | + "[`engine.create_program`](https://quantumai.google/reference/python/cirq_google/engine/Engine#create_program).\n", |
| 400 | + "You can pass either a circuit or a list of circuits to this method, and you\n", |
| 401 | + "can optionally specify a program ID, description, and labels. After running\n", |
| 402 | + "this, the program should appear in the\n", |
| 403 | + "[\"Programs\" tab](https://console.cloud.google.com/quantum/programs) of the older web UI.\n", |
| 404 | + "\n", |
| 405 | + "You can then run a program using\n", |
| 406 | + "[`program.run()`](https://quantumai.google/reference/python/cirq_google/engine/EngineProgram#run)\n", |
| 407 | + "or\n", |
| 408 | + "[`program.run_sweep()`](https://quantumai.google/reference/python/cirq_google/engine/EngineProgram#run_sweep),\n", |
| 409 | + "which returns an [`EngineJob`](https://quantumai.google/reference/python/cirq_google/engine/EngineJob),\n", |
| 410 | + "which you can query for its status (`job.status()`) and its results (`job.results()`).\n", |
| 411 | + "Jobs can be named by specifying a `job_id` at the `program.run()` or `program.run_sweep()` step and can be retrived later\n", |
| 412 | + "using `job = engine.get_program(program_id).get_job(job_id)`. Jobs appear in the\n", |
| 413 | + "[jobs tab](https://console.cloud.google.com/quantum/jobs) of the older UI and the programs/jobs\n", |
| 414 | + "tab of the [new UI](https://engine.quantumai.google/program). Corresponding calibration metrics\n", |
| 415 | + "can be viewed using `job.get_config().calibration`. See the\n", |
| 416 | + "[calibration metrics tutorial](https://quantumai.google/cirq/google/calibration) for more details." |
| 417 | + ] |
| 418 | + }, |
374 | 419 | { |
375 | 420 | "cell_type": "markdown", |
376 | 421 | "metadata": { |
|
413 | 458 | "measuring all qubits with a single gate or by adding\n", |
414 | 459 | "the measurement gate after all optimizers have run.\n", |
415 | 460 | "\n", |
416 | | - "Currently, only terminal measurements are supported by the hardware. If you\n", |
417 | | - "absolutely need intermediate measurements for your application, reach out to\n", |
| 461 | + "If you need intermediate measurements for your application, reach out to\n", |
418 | 462 | "your Google sponsor to see if they can help devise a proper circuit using\n", |
419 | 463 | "intermediate measurements.\n", |
420 | 464 | "\n", |
|
425 | 469 | "[Spin Echo](https://en.wikipedia.org/wiki/Spin_echo) into your circuit onto\n", |
426 | 470 | "qubits that have long idle periods, such as a pair\n", |
427 | 471 | "of involutions, such as two successive Pauli Y gates, will generally increase\n", |
428 | | - "performance of the circuit.\n", |
| 472 | + "performance of the circuit. This can be done using\n", |
| 473 | + "[`cirq.add_dynamical_decoupling`](https://quantumai.google/reference/python/cirq/add_dynamical_decoupling).\n", |
429 | 474 | "\n", |
430 | 475 | "Be aware that this should be done after calling\n", |
431 | 476 | "`cirq.optimize_for_target_gateset`, since this function will 'optimize'\n", |
|
470 | 515 | "calibration procedure. These metrics can be used as a baseline to evaluate\n", |
471 | 516 | "circuit performance or identify outliers to avoid. This data can be inspected\n", |
472 | 517 | "programmatically by retrieving metrics from the [API](calibration.md) or\n", |
473 | | - "[visually by applying a cirq.Heatmap](../tutorials/google/visualizing_calibration_metrics.ipynb)\n", |
474 | | - "to that data or by using the built-in\n", |
475 | | - "heatmaps in the Cloud console page for the processor. Note that, since this\n", |
476 | | - "data is only taken during calibration (e.g. at most daily), drifts and other\n", |
477 | | - "concerns may affect the values significantly, so these metrics should only be\n", |
478 | | - "used as a first approximation. There is no substitute for actually running characterizations\n", |
479 | | - "on the device.\n", |
| 518 | + "using the [web UI](https://engine.quantumai.google).\n", |
480 | 519 | "* Loschmidt echo: Running a small circuit on a string of qubits and then\n", |
481 | 520 | "applying the circuit's inverse can be used as a quick but effective way to\n", |
482 | 521 | "judge qubit quality. See\n", |
|
0 commit comments