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

Fix default wire mapping and QPU program compilation and add support for parallel execution #124

Closed

Conversation

MarquessV
Copy link
Contributor

@MarquessV MarquessV commented Feb 16, 2023

This addresses #123 in a 3 ways:

  1. Default wire mapping behavior

By default, we were using [0, n) as the wire numbers for an n-qubit device, but qubits on a real QPU aren't always addressed in this way. Instead, we let pyQuil tell us what the qubits on the device are and build the wire map from that. By default, the user wire labels will map to a device wire label 1-to-1, that way users who want to address them, can do so using the values directly from the our QPU topology metrics and diagrams.

  1. Qubit measurement

Measurements will now use the wire mapping to generate MEASURE statements for every Qubit to readout instead of assuming [0, n). Like (1), this is important for real QPUs, which don't always address qubits sequentially.

  1. Use protoquil for program compilation targeting QPUs

By default a program compiled by quilc will use the full quil spec to generate native quil. However, not everything in the quil spec is supported by our QPUs, so quilc also supports building a program using protoquil, a subset of quil that is compatible with a QPU.

Our QPU devices now set the protoquil flag when compiling to avoid generating a program that might not run on a real QPU.

This also adds support for parallel execution using threadpools to run jobs in parallel. This works for both the QVM and QPU device and can greatly improve execution speed.

pennylane_rigetti/qc.py Show resolved Hide resolved
pennylane_rigetti/qc.py Outdated Show resolved Hide resolved
@MarquessV
Copy link
Contributor Author

@AlbertMitjans Can you take a look at this? Thanks! 😄

@MarquessV MarquessV marked this pull request as ready for review February 16, 2023 20:51
@MarquessV MarquessV changed the title Fix default wire mapping and QPU program compilation Fix default wire mapping and QPU program compilation and add support for parallel execution Sep 19, 2023
@albi3ro albi3ro self-requested a review September 20, 2023 13:57
qubits as numbers or strings (i.e., ``['q1', ..., 'qN']``).
The number of labels must match the number of qubits accessible on the backend.
If not provided, qubits are addressed as consecutive integers ``[0, 1, ...]``, and their number
is inferred from the backend.
If not provided, qubits are addressed by the backend.
Copy link
Contributor

Choose a reason for hiding this comment

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

To make sure I understand, does this mean that the user can pass any wires and they'll be mapped to the device wires, or that the user must use the appropriate wires for the device?

@MarquessV
Copy link
Contributor Author

Per offline discussion, closing this in favorite of separate PRs for the wire mapping fix and the parallel processing improvement.

@MarquessV MarquessV closed this Nov 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants