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

Interleaved RB #864

Merged
merged 32 commits into from
Aug 14, 2024
Merged

Interleaved RB #864

merged 32 commits into from
Aug 14, 2024

Conversation

Jacfomg
Copy link
Contributor

@Jacfomg Jacfomg commented May 21, 2024

1st draft for the interleaved RB. It seems to work but it needs qiboteam/qibolab#906

Checklist:

  • Reviewers confirm new code works as expected.
  • Tests are passing.
  • Coverage does not decrease.
  • Documentation is updated.
  • Compatibility with Qibo modules (Please edit this section if the current pull request is not compatible with the following branches).
    • Qibo: master
    • Qibolab: main
    • Qibolab_platforms_qrc: main

Copy link

codecov bot commented May 21, 2024

Codecov Report

Attention: Patch coverage is 98.41270% with 1 line in your changes missing coverage. Please review.

Project coverage is 97.50%. Comparing base (f348523) to head (667e954).
Report is 34 commits behind head on main.

Files Patch % Lines
...qibocal/protocols/randomized_benchmarking/utils.py 95.23% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #864      +/-   ##
==========================================
+ Coverage   97.48%   97.50%   +0.02%     
==========================================
  Files         122      123       +1     
  Lines        9650     9701      +51     
==========================================
+ Hits         9407     9459      +52     
+ Misses        243      242       -1     
Flag Coverage Δ
unittests 97.50% <98.41%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
src/qibocal/protocols/__init__.py 100.00% <100.00%> (ø)
...l/protocols/randomized_benchmarking/filtered_rb.py 96.87% <100.00%> (ø)
...l/protocols/randomized_benchmarking/standard_rb.py 98.59% <100.00%> (ø)
...rotocols/randomized_benchmarking/standard_rb_2q.py 100.00% <100.00%> (ø)
...ls/randomized_benchmarking/standard_rb_2q_inter.py 100.00% <100.00%> (ø)
...qibocal/protocols/randomized_benchmarking/utils.py 95.80% <95.23%> (-0.19%) ⬇️

... and 2 files with indirect coverage changes

@Jacfomg Jacfomg marked this pull request as ready for review May 22, 2024 13:35
qubits = data.pairs
results = fit(qubits, data)

# FIXME: I can only get the data.fidelity if there is an acquisition step
Copy link
Contributor

Choose a reason for hiding this comment

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

In which cases you don't have an acquisition step?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

when you just want to plot becuase you ran a new 2qRB but not interleaved for example

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't understand the problem here. Either you run a 2qRb or a 2qInterleavedR, no?

new_circuit = Circuit(nqubits)
if nqubits == 1:
new_circuit.add(new_layer)
elif nqubits == 2:
for gate in new_layer:
new_circuit.add(gate)

random_indexes.append(random_index)
# FIXME: General interleave
Copy link
Contributor

Choose a reason for hiding this comment

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

Raise a not supported error instead of a FIXME

Copy link
Contributor

Choose a reason for hiding this comment

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

+1

Comment on lines +740 to +743
interleaved_clifford = rb_gen.two_qubit_cliffords["13"]
interleaved_clifford_gate = clifford2gates(interleaved_clifford)
new_circuit.add(interleaved_clifford_gate)
random_indexes.append("13")
Copy link
Contributor

Choose a reason for hiding this comment

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

why not just create the CZ with Qibo ? Since the 2qRB files are merely one possibility, let's make every effort to separate the Qibocal library from them.

Copy link
Contributor

Choose a reason for hiding this comment

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

Indeed, here it should be better to create the CZ with Qibo

Base automatically changed from 2q_RB to main June 19, 2024 09:05
Copy link
Contributor

@Edoardo-Pedicillo Edoardo-Pedicillo left a comment

Choose a reason for hiding this comment

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

Thank @Jacfomg, just small comments

Copy link
Contributor

@Edoardo-Pedicillo Edoardo-Pedicillo left a comment

Choose a reason for hiding this comment

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

LGTM, please fix the conflicts

@andrea-pasquale andrea-pasquale added this to the Qibocal 0.0.11 milestone Jul 31, 2024
Copy link
Contributor

@andrea-pasquale andrea-pasquale left a comment

Choose a reason for hiding this comment

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

Thanks @Jacfomg, mostly it looks good to me.
There are some conversations that were resolved but the comments from the reviewer were not addressed.
Once we address the comment we can merge.
It would also nice to run a very short RB on hardware. You can use for example: qiboteam/qibolab_platforms_qrc#160

qubits = data.pairs
results = fit(qubits, data)

# FIXME: I can only get the data.fidelity if there is an acquisition step
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't understand the problem here. Either you run a 2qRb or a 2qInterleavedR, no?

src/qibocal/protocols/randomized_benchmarking/utils.py Outdated Show resolved Hide resolved
new_circuit = Circuit(nqubits)
if nqubits == 1:
new_circuit.add(new_layer)
elif nqubits == 2:
for gate in new_layer:
new_circuit.add(gate)

random_indexes.append(random_index)
# FIXME: General interleave
Copy link
Contributor

Choose a reason for hiding this comment

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

+1

Comment on lines +740 to +743
interleaved_clifford = rb_gen.two_qubit_cliffords["13"]
interleaved_clifford_gate = clifford2gates(interleaved_clifford)
new_circuit.add(interleaved_clifford_gate)
random_indexes.append("13")
Copy link
Contributor

Choose a reason for hiding this comment

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

Indeed, here it should be better to create the CZ with Qibo

@Jacfomg
Copy link
Contributor Author

Jacfomg commented Aug 7, 2024

Indeed, here it should be better to create the CZ with Qibo

Why, it would be the same. And we keep everything safe in case Qibo does something different for another gate.,

@Jacfomg
Copy link
Contributor Author

Jacfomg commented Aug 7, 2024

Also, for the general interleave what would be the interface for which clifford to interleave, a number from 0 to 11000 as a parameter ?

@andrea-pasquale
Copy link
Contributor

Also, for the general interleave what would be the interface for which clifford to interleave, a number from 0 to 11000 as a parameter ?

If the number is documented properly yes.

@andrea-pasquale
Copy link
Contributor

andrea-pasquale commented Aug 12, 2024

Also, for the general interleave what would be the interface for which clifford to interleave, a number from 0 to 11000 as a parameter ?

If the number is documented properly yes, generally the user could also pass a matrix and we can verify whether it is in the clifford group, right?
The problem with indices in general is that we are not following any specific convention, so running an interleaved RB on gate 123 doesn't tell much.

Copy link
Contributor

@andrea-pasquale andrea-pasquale 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 updates @Jacfomg.
I would like to see a short run on hardware to check that everything is working properly before merging.

@andrea-pasquale andrea-pasquale added this pull request to the merge queue Aug 14, 2024
Merged via the queue into main with commit 4007e14 Aug 14, 2024
21 checks passed
@andrea-pasquale andrea-pasquale deleted the 2q_rb_interleaved branch August 14, 2024 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants