Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add documentation for cirq.google devices #2636

Merged
merged 6 commits into from
Dec 17, 2019

Conversation

dstrain115
Copy link
Collaborator

  • Add sub-directory for Google-specific documentation.
  • Add documentation explaining grid devices, best practices.
  • Add documentation about Sycamore, Bristlecone, and Foxtail.

- Add sub-directory for Google-specific documentation.
- Add documentation explaining grid devices, best practices.
- Add documentation about Sycamore, Bristlecone, and Foxtail.
@googlebot googlebot added the cla: yes Makes googlebot stop complaining. label Dec 11, 2019
@dstrain115
Copy link
Collaborator Author

Ping. This is documentation and should be easy to review!

Measurement takes much longer than other gates. Currently, the only supported
configuration is to have terminal measurement in the final moment of a circuit.

Most devices have a limited number of gates that can applied to the device. Gates not
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"number of gates" here might be confused with how many gates can be applied in succession in a given circuit. Might be better to say "set of gates". Could separately note that there is also an overall restriction on the length of the circuit.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing "be"

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

applied on the device? applied with the device? "to" sounds ood

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.


### Use built-in optimizers as a first pass

Using built-in optimizers will allow you to compile to the correct . As they are
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"to the correct gate set"?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


Using built-in optimizers will allow you to compile to the correct . As they are
automated solutions, they will not always perform as well as a hand-crafted solution, but
it provides a good starting point for creating a circuit that is likely to run successfully
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: "but they provide..."

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

### Good moment structure

In an attempt to fulfill the user's desire, quantum devices will respect the moment
structure of circuits to the greatest extent possible.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might want to specify what this means, e.g. "All gates in a moment will be executed at the same on hardware, after all gates in the previous moment and before any gates in the next moment."

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.


## General limitations

Qubits on Google devices are laid out in a grid structure. Connectivity is limited to
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: One space after period throughout (so says the chicago manual of style, anyway :-))

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use two spaces in a monospaced font, as it provides visual separation between sentences. The trouble began when people stopped using typewriters and started using word processors with variable-width fonts and continued to use two spaces.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was always taught to use two spaces, but I changed it to one space.


### Keep qubits busy

Qubits that remain idle for long periods tend to dephase and decoher. Inserting a
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: "decohere"

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

```

It can be accessing by using `cirq.google.Sycamore`. This device has two possible
two-qubits that can be used.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"two-qubit gates"

7 --EFGHIJKL--
8 ---GHIJKL---
9 ----IJKL----
0 -----KL-----
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

last row number should be 10

In the current NISQ (noisy intermediate scale quantum) era, gates and devices still
have significant error. Both gate errors and T1 decay rate can cause long circuits
to have noise that overwhelms any signal in the circuit. Also, circuits that are
much too long can even be rejected due to various limits in the system.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest describing the overall circuit length limit separately, e.g. in the section above on "General Limitations". Here can just talk about the coherence limit, which is typically more restrictive.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved this up to general limitation and modified the wording a bit. Let me know if you think it is okay.

Since quantum hardware is an active area of research, hardware specifications and best
practices are constantly evolving in an attempt to continuously improve performance.
While this information should be a solid base for beginning your quantum application,
please work with your Google sponsor to obtain the latest information on devices that
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is "Google sponsor" the terminology we're using?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think so? We'll probably need to revamp this as we determine the process a bit better. Did you have a suggestion on how to change this, or do you think it's okay to leave as it for now?


## General limitations

Qubits on Google devices are laid out in a grid structure. Connectivity is limited to
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use two spaces in a monospaced font, as it provides visual separation between sentences. The trouble began when people stopped using typewriters and started using word processors with variable-width fonts and continued to use two spaces.

Measurement takes much longer than other gates. Currently, the only supported
configuration is to have terminal measurement in the final moment of a circuit.

Most devices have a limited number of gates that can applied to the device. Gates not
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing "be"

Measurement takes much longer than other gates. Currently, the only supported
configuration is to have terminal measurement in the final moment of a circuit.

Most devices have a limited number of gates that can applied to the device. Gates not
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

applied on the device? applied with the device? "to" sounds ood

Using built-in optimizers will allow you to compile to the correct . As they are
automated solutions, they will not always perform as well as a hand-crafted solution, but
it provides a good starting point for creating a circuit that is likely to run successfully
on hardware.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

put something that no matter which optimizers you use; you should inspect your circuit to make sure nothing crazy is happening

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

To this end, it is important that the moment structure of the circuit is kept as
short and concise as possible. The length of a moment will generally be the length
of the longest gate in the moment, so keeping gates with similar durations together
will generally benefit the performance.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"help performance"

it benefits the user. performance don't care

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to "...keeping gates with similar durations together
will shorten the duration of the circuit and likely reduce the noise incurred"

will generally benefit the performance.

In particular, keep measurement gates in the same moment and make sure that any
circuit optimizers run do not alter this by pushing measurements forward. This
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nix "run"

In particular, keep measurement gates in the same moment and make sure that any
circuit optimizers run do not alter this by pushing measurements forward. This
behavior can be avoided by measuring all qubits with a single gate or by adding
the measurement gate after all optimizers have run.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

link to a github issue to provide better utilities for this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which github issue? Did you want me to add an example of cirq.measure for different qubits? Or appending the circuit with an insert strategy?


The recommended gate depths vary significantly with the structure of the circuit itself
and will likely increase as the devices improve. However, circuits with more than
50 moments will generally struggle to retain any information.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this true?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I don't think it is)

Performance generally depends on width * depth

A rough guide can be found by multiplying together gate fidelities to get a sense for the probability of success for an algorithm. For example, if you have 20 moments on 20 qubits, you can roughly estimate circuit fidelity as (0.995)^(20*20)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. This is much more precise. I'll link to calibration metrics once we release them.


Devices generally operate in the Z basis, so that rotations around the Z axis will become
book-keeping measures rather than physical operations on the device. These operations
should be aggregated into their own moment, if possible.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

open or link to github issue requesting better cirq features to do this

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have an internal bug for this, but no cirq issue. I am going to punt on creating a GH issue for this until we decide what we want. I want to keep general advice separate from creating automated functionality to do these optimizations.

Copy link
Collaborator Author

@dstrain115 dstrain115 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the detailed comments! Please take another look when you get a chance.

To this end, it is important that the moment structure of the circuit is kept as
short and concise as possible. The length of a moment will generally be the length
of the longest gate in the moment, so keeping gates with similar durations together
will generally benefit the performance.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to "...keeping gates with similar durations together
will shorten the duration of the circuit and likely reduce the noise incurred"


## General limitations

Qubits on Google devices are laid out in a grid structure. Connectivity is limited to
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was always taught to use two spaces, but I changed it to one space.

Measurement takes much longer than other gates. Currently, the only supported
configuration is to have terminal measurement in the final moment of a circuit.

Most devices have a limited number of gates that can applied to the device. Gates not
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.


### Use built-in optimizers as a first pass

Using built-in optimizers will allow you to compile to the correct . As they are
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


Using built-in optimizers will allow you to compile to the correct . As they are
automated solutions, they will not always perform as well as a hand-crafted solution, but
it provides a good starting point for creating a circuit that is likely to run successfully
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

In particular, keep measurement gates in the same moment and make sure that any
circuit optimizers run do not alter this by pushing measurements forward. This
behavior can be avoided by measuring all qubits with a single gate or by adding
the measurement gate after all optimizers have run.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which github issue? Did you want me to add an example of cirq.measure for different qubits? Or appending the circuit with an insert strategy?


### Keep qubits busy

Qubits that remain idle for long periods tend to dephase and decoher. Inserting a
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

In the current NISQ (noisy intermediate scale quantum) era, gates and devices still
have significant error. Both gate errors and T1 decay rate can cause long circuits
to have noise that overwhelms any signal in the circuit. Also, circuits that are
much too long can even be rejected due to various limits in the system.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved this up to general limitation and modified the wording a bit. Let me know if you think it is okay.


The recommended gate depths vary significantly with the structure of the circuit itself
and will likely increase as the devices improve. However, circuits with more than
50 moments will generally struggle to retain any information.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. This is much more precise. I'll link to calibration metrics once we release them.


Devices generally operate in the Z basis, so that rotations around the Z axis will become
book-keeping measures rather than physical operations on the device. These operations
should be aggregated into their own moment, if possible.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have an internal bug for this, but no cirq issue. I am going to punt on creating a GH issue for this until we decide what we want. I want to keep general advice separate from creating automated functionality to do these optimizations.

Copy link
Collaborator

@mpharrigan mpharrigan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

Copy link
Contributor

@maffoo maffoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dstrain115 dstrain115 merged commit 7fb1a49 into quantumlib:master Dec 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Makes googlebot stop complaining.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants