-
Notifications
You must be signed in to change notification settings - Fork 19
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
Feature/2q rb #239
base: main
Are you sure you want to change the base?
Feature/2q rb #239
Conversation
Please add again cirq as a dependency, I want to see what is failing, I am positive we can fix it. |
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 only went over the readme
README.md
Outdated
Note that in order to run 2-Qubit Randomized Benchmarking, you need to install using | ||
```bash | ||
pip install --upgrade qualang-tools[two-qubit-rb] | ||
# Install cirq separately, since it only works with python==3.10 and can't be listed as a dependency |
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.
Please add it as an optional dependency, we would make it work.
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 managed to fix it, but as mentioned in the updated PR description, cirq
will only install as a dependency when python>=3.10. Otherwise, it will be ignored and have to be pip installed manually. Do you think this is sufficient?
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.
Actually, poetry install
is only working when in Python >3.10, it runs into some other issue on Python 3.8. looking into it.
@@ -68,6 +68,13 @@ Note that in order use the `Interactive Plot Library`, you need to install using | |||
pip install --upgrade qualang-tools[interplot] |
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.
Can you go ahead and update all of the optional dependencies? many are missing, and config builder is deprecated.
We can also decide to decide not listing specific ones, and just mention that in some cases it is needed (and mention it in the internal readmes)
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.
Added the Data Handler, which was missing, and added a node that the config builder is deprecated. You said many are missing- did I miss any?
@@ -0,0 +1,192 @@ | |||
# Two-Qubit Randomized Benchmarking | |||
## Introduction | |||
Two-Qubit Randomized Benchmarking (RB) has become a popular protocol that allows to experimentally quantify the performance of a quantum processor by applying sequences of randomly sampled Clifford gates and measuring the average error rate. Due to its universality it has been implemented in various qubit platforms such as trapped-ions [^1], NMR [^2], spin [^3] and superconducting qubits [^4]. Two-Qubit RB can be challenging to implement with state-of-the-art control electronics because of the necessity to sample from a large Clifford gate set. The Clifford group consists of 11520 operations [^4] and contains the single qubit Clifford operations (576), the CNOT-like class (5184), the iSWAP-like class (5184) and the SWAP-like class (576). In this use-case example we introduce an implementation on the OPX+ {'client': '1.1.3', 'server': '2.60-5ba458f'} using the current version (2023, July) of the generic `TwoQubitRb` class. The implementation exploits the [baking](https://github.com/qua-platform/py-qua-tools/blob/main/qualang_tools/bakery/README.md) tool to generate the individual Clifford operations. The class then uses the [Input Stream](https://docs.quantum-machines.co/0.1/qm-qua-sdk/docs/Guides/features/?h=declare_input_stream#input-streams) feature to send a string of Clifford indices to the OPX that represent the executed gate sequence which is terminated with the inverse operation. The execution is based on the [Switch Case](https://docs.quantum-machines.co/0.1/qm-qua-sdk/docs/Guides/features/?h=switch#switch-case) flow control of QUA, which sets the current minimal gate duration limit to 40 ns. <!--The inverse is calculated in Python using Clifford tableaus. An updated version of the TwoQubitRb class can be found in the [py-qua-tools](https://github.com/qua-platform/py-qua-tools) repository.--> |
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.
Please remove this: OPX+ {'client': '1.1.3', 'server': '2.60-5ba458f'}
- At a minimum, just write
qm-qua=1.1.3, QOP=2.2.0
- Since this is no longer a usecase, I would remove it and make sure it works with the latest qm-qua and QOP (OPX+ & OPX1000), and if it doesn't, note it.
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.
Link to input stream (and other docs) needs to be updated with latest
instead of 0.1
.
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.
Last sentence needs to be removed
## Experimental Setup | ||
<img align="right" width="400" src="setup.png"> | ||
|
||
The use-case in this example is tailored for a superconducting quantum processor using flux-tunable transmon qubits, where we focus on a subset of two qubits that are capacitively coupled to each other. Single qubit operations are controlled by sending microwave pulses through a xy-line that is capacitively coupled to the individual qubits. The two-qubit gate is implemented by a controlled-Z (CZ) gate utilizing fast-flux pulses to rapidly change the qubit frequencies. One important experiment on the way of tuning up a CZ gate is the flux-pulse calibration that yield qubit state oscillations depending on the pulse parameters. This experiment was performed and presented in the use-case [Two-Qubit Gate Optimization](https://github.com/qua-platform/qua-libs/tree/2qb-RB-usecase/Quantum-Control-Applications/Superconducting/Multiple%20Flux%20Tunable%20Transmons/Use%20Case%201%20-%20Two%20qubit%20gate%20optimization%20with%20cryoscope). |
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.
Needs to be edited, it's not a use-case
2. Use minimal OPX resources within the compiled program, | ||
|
||
each Clifford is decomposed into two commands (out of 736 total). | ||
Every command is [baked](https://github.com/qua-platform/py-qua-tools/blob/main/qualang_tools/bakery/README.md) as a pulse in advance, loaded onto the OPX, and can be addressed according to its "command id", which is an index from 0 to 735. Thus, when a random sequence is generated, it is [streamed as input](https://docs.quantum-machines.co/1.1.7/qm-qua-sdk/docs/Guides/features/?h=input+stream#input-streams) into the OPX as *2 x (circuit_depth + 1)* command IDs. Once the program receives the input stream, it is fed into a loop of switch cases, which plays the pulse corresponding to the command ID. |
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.
change documentation link to latest
#### How are all the 11,520 2Q Cliffords loaded onto the OPX? | ||
In order to both: | ||
1. Efficiently generate random two-qubit clifford sequences and the recovery gate | ||
2. Use minimal OPX resources within the compiled program, |
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.
,
at the end?
Each two-qubit Clifford can be decomposed into 1/720 symplectic gates (commands 0-719), followed by 1/16 Pauli gates (commands 720-735). | ||
|
||
#### Why use commands instead of baking all the Cliffords? | ||
It would cost too much waveform memory to pre-upload all 11,520 two-qubit Clifford gates onto the OPX. Ideally, we could just bake all possible single-qubit and two-qubit gates, and this would be the most memory-friendly and efficient way to reconstruct 2Q Cliffords on the fly. However, the real-time switch-case on the OPX has a certain latency, which can be greater than the duration of a single gate, leading to gaps between consecutive gates. Therefore, the extended length of a "command" and smaller volume of commands compared with the two-qubit Cliffords provide an efficient middle-ground for navigating the OPX's unique constraints. |
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.
Now that it is 16ns, is it still true?
Well obviously, in some cases people go lower, but this is not common...
In any case, please edit it to make it more friendly to the OPX+ :)
Overview
Migrated 2Q RB from qua-libs, to go under
qualang_tools/characterization/two_qubit_rb
adding to the README and CHANGELOG, and fixing formatting. I added the modulecharacterization
module in preparation for XEB which might come soon too.Cirq Dependency
IssueThere is an issue with adding cirq as a dependency, since cirq requires python>=3.10, but qualang_tools supports >=3.8.I added
two_qubit_rb
as an optional dependency, i.e.,pip install qualang_tools[two_qubit_rb],
but this doesn't help the situation.So, the cirq import is always performed with a graceful ImportError indicating the correct version to install.cirq
is now installed with thetwo-qubit-rb
extra when the python version is >3.10, as guaranteed by the following lines in the pyproject.toml:I verified that
cirq
will be installed when running:I have a regression test which creates a TwoQubitRb instance and uses it to generate some sequences, verifying that they are valid. But, this will not be auto-tested sincecirq
is a required dependency, and therefore I'm forced to skip this test.