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

Add parallel randomized benchmarking #6382

Merged
merged 21 commits into from
Dec 19, 2023

Conversation

eliottrosenberg
Copy link
Collaborator

No description provided.

Copy link

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.

@@ -230,6 +230,70 @@ def single_qubit_randomized_benchmarking(
return RandomizedBenchMarkResult(num_clifford_range, gnd_probs)


def parallel_single_qubit_randomized_benchmarking(
sampler: 'cirq.Sampler',
use_xy_basis: bool = True,
Copy link
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
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.

@eliottrosenberg
Copy link
Collaborator Author

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

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

@@ -230,6 +230,63 @@ def single_qubit_randomized_benchmarking(
return RandomizedBenchMarkResult(num_clifford_range, gnd_probs)


def parallel_single_qubit_randomized_benchmarking(
Copy link
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
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
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

for num_cfds in num_clifford_range:
excited_probs_l = []
# create circuits
circuits_all = []
Copy link
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
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.

@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