-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[XEB] Support parallel execution #3760
Conversation
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
The tutorials look good, and I suggest that we create entries into the book.yaml so they show up on the documentation site. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
address some of the comments
Args: | ||
wide_circuit: The zipped circuit on all pairs | ||
pairs: The pairs of qubits operated on in the wide circuit. | ||
layer_i: The index of the GridInteractionLayer to which the pairs correspond. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might become clear in a following PR, but let me try to explain and then I'll think about how to make it clearer in code.
The primary idea is that you have a number of different moments that define the spacial layout of simultaneous two-qubit gates. The essential essence of each of those moments/layers is just the list of pairs, here as pairs
. Indeed, pairs
(and the circuit) is really the only essential part of this dataclass. The other attributes are metadata to maintain the provenance of the particular set of pairs.
Previous XEB implementations relied heavily on these GridInteractionLayer
objects to semi-implicitly define the set of pairs by making several assumptions (like you're operating on a nice grid, all the couplings on the grid work, you'll be using the whole device and/or the calling function will downsample only the pairs that actually exist). So in traditional XEB there are always four layers (one for each of the N, S, E, W set of pairs) and they're represented by these objects.
Of course, for the calibration API we re-purpose cirq.Moment
as a "layer". What you'll see in a following PR is that these fields will either contain a GridInteractionLayer
, a Moment
, or even None
since it's just metadata that doesn't really matter as long as you fill in pairs
.
layer_i
and combination_i
are just propagated through to be part of the result object. Let me see if I can clarify that
Args: | ||
wide_circuit: The zipped circuit on all pairs | ||
pairs: The pairs of qubits operated on in the wide circuit. | ||
layer_i: The index of the GridInteractionLayer to which the pairs correspond. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm changing the docstrings to be more clear about what layer_i
and combination_i
are. I've added a note to both that they don't modify any behavior, but are just propagated to the output. I'm also re-ordering the fields in this dataclass to put them last, because they are less important. I've added a note to combination
that it's important to be able to "unzip" the circuit.
Matthew, are you still working on the changes or this is ready for next round of review? |
Ready for review! I think I've addressed everything |
# Slicing creates a copy, although this isn't documented | ||
prepared_circuit = zipped_circuit.wide_circuit[:circuit_depth] | ||
for pair_i, pair in enumerate(zipped_circuit.pairs): | ||
prepared_circuit += ops.measure(*pair, key=str(pair_i)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you checked if this aligns all the measurements in one moment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for the current code, it should just because these are dense circuits by construction; but I've changed it to add the measure operations in one moment. Good spot!
back at you @mrwojtek ! |
Automerge cancelled: Merging is blocked (I don't understand why). |
This PR is purely moving things around (on top of #3760) with one exception noted inline. - `random_quantum_circuit_generation` -- left alone; this is a well-scoped file - `xeb_sampling` - functionality related to sampling random circuits efficiently (for xeb) - `xeb_simulation` - functionality related to simulating 2-qubit circuits at various depths (for xeb) efficiently using multiprocessing - `xeb_fitting` - functionality related to using xeb to characterize gates by fitting parameters.
Support parallel execution of XEB circuits.
characterize_phased_fsim_parameters_with_xeb
on the code in this PR, it will find only one set of angles that works for the average of all pairs. I've split up the modifications to that half of the code-base into a subsequent PR.This can be reviewed independently of #3753