Skip to content

Add parallel randomized benchmarking#6382

Merged
NoureldinYosri merged 21 commits intoquantumlib:mainfrom
eliottrosenberg:main
Dec 19, 2023
Merged

Add parallel randomized benchmarking#6382
NoureldinYosri merged 21 commits intoquantumlib:mainfrom
eliottrosenberg:main

Conversation

@eliottrosenberg
Copy link
Copy Markdown
Collaborator

No description provided.

@codecov
Copy link
Copy Markdown

codecov bot commented Dec 14, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (2f3c1e2) 97.81% compared to head (9980416) 97.81%.
Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6382   +/-   ##
=======================================
  Coverage   97.81%   97.81%           
=======================================
  Files        1111     1111           
  Lines       96951    97037   +86     
=======================================
+ Hits        94828    94914   +86     
  Misses       2123     2123           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Comment thread cirq-core/cirq/experiments/qubit_characterizations.py Outdated
Comment thread cirq-core/cirq/experiments/qubit_characterizations.py Outdated

def parallel_single_qubit_randomized_benchmarking(
sampler: 'cirq.Sampler',
use_xy_basis: bool = True,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is there a reason this is before the kwargs cut-off?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I was following the same format as in single_qubit_randomized_benchmarking() in the same file, but I can change it.

Comment thread cirq-core/cirq/experiments/qubit_characterizations.py Outdated
Comment thread cirq-core/cirq/experiments/qubit_characterizations.py Outdated
Comment thread cirq-core/cirq/experiments/qubit_characterizations.py Outdated
Comment thread cirq-core/cirq/experiments/qubit_characterizations.py Outdated
Comment thread cirq-core/cirq/experiments/qubit_characterizations.py Outdated
Comment thread cirq-core/cirq/experiments/qubit_characterizations.py Outdated
Comment thread cirq-core/cirq/experiments/qubit_characterizations.py Outdated
@eliottrosenberg
Copy link
Copy Markdown
Collaborator Author

Thanks for the code reviews, @NoureldinYosri @dstrain115, and @maffoo!

Comment thread cirq-core/cirq/experiments/qubit_characterizations.py Outdated
Comment thread cirq-core/cirq/experiments/qubit_characterizations.py Outdated
Copy link
Copy Markdown
Collaborator

@NoureldinYosri NoureldinYosri left a comment

Choose a reason for hiding this comment

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

LGTM. pending review from @dstrain115 and @maffoo

return RandomizedBenchMarkResult(num_clifford_range, gnd_probs)


def parallel_single_qubit_randomized_benchmarking(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

OOC, would it be possible to put this in the existing single_qubit_randomized_benchmarking module? Seems like it's basically the same thing and there could be opportunities for code reuse. The fact that one is running in parallel on multiple qubits is a minor details (the existing single-qubit code could just become a special case of the parallel code).

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Ok, I changed it so that single_qubit_randomized_benchmarking is now a wrapper for parallel_single_qubit_randomized_benchmarking. What do you think?

Copy link
Copy Markdown
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.

Minor comments, then LGTM

Comment thread cirq-core/cirq/experiments/qubit_characterizations.py
Comment thread cirq-core/cirq/experiments/qubit_characterizations.py
for num_cfds in num_clifford_range:
excited_probs_l = []
# create circuits
circuits_all = []
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: call this circuits and add a type annotation

Suggested change
circuits_all = []
circuits: list[`cirq.AbstractCircuit`] = []

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I don't think I should call this circuits because earlier in the file, there is from cirq import circuits.

Comment thread cirq-core/cirq/experiments/qubit_characterizations.py Outdated
Comment thread cirq-core/cirq/experiments/qubit_characterizations.py Outdated
Comment thread cirq-core/cirq/experiments/qubit_characterizations.py Outdated
Comment thread cirq-core/cirq/experiments/qubit_characterizations.py Outdated
@NoureldinYosri NoureldinYosri merged commit 1961207 into quantumlib:main Dec 19, 2023
@eliottrosenberg eliottrosenberg deleted the main branch December 19, 2023 05:31
harry-phasecraft pushed a commit to PhaseCraft/Cirq that referenced this pull request Oct 31, 2024
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