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

Create a workflow to perform FSim based z-phase calibration #6568

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

NoureldinYosri
Copy link
Collaborator

No description provided.

Copy link
Collaborator

@eliottrosenberg eliottrosenberg left a comment

Choose a reason for hiding this comment

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

This is a great start, Nour!! Thanks for all of your amazing work.

) -> Tuple[xeb_fitting.XEBCharacterizationResult]:
"""Perform z-phase calibration for fermionic gates.

For a given fermionic two-qubit gate we assume an error model that can be described
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same comment as above.

atol: float = 1e-3,
pool: Optional[Union[multiprocessing.Pool, concurrent.futures.ThreadPoolExecutor]] = None,
) -> Tuple[xeb_fitting.XEBCharacterizationResult]:
"""Perform z-phase calibration for fermionic gates.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's call it a "number-conserving two-qubit gate" instead of a "fermionic two-qubit gate"

1: ───Rz(b)───two_qubit_gate───Rz(d)───
for some angles a, b, c, and d.

Since the two-qubit gate is a fermionic-gate, it can be represented by an FSimGate and the
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same comment as above.

Comment on lines +510 to +516
results = xeb_utils.execute_with_progress_par(
closure,
subselected_dfs,
pool=pool,
progress_bar=tqdm.tqdm,
desc='characterize fsim parameters',
)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This step took 30 minutes to run when I tested it (colab). I know that the gate_cal_and_checks code is also slow like this, but the internal XEB calibration is fast, so hopefully there is a way to make this faster.

Comment on lines +148 to +149
options: The XEB-fitting options. If None, calibrate all 5 PhasedFSimGate parameters,
using the representation of a two-qubit gate as an FSimGate for the initial guess.
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think the default behavior should be to characterize the three $\Delta$ angles and leave $\theta$ and $\phi$ fixed.

Comment on lines +148 to +149
options: The XEB-fitting options. If None, calibrate all 5 PhasedFSimGate parameters,
using the representation of a two-qubit gate as an FSimGate for the initial guess.
Copy link
Collaborator

Choose a reason for hiding this comment

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

I tried this out, and it didn't seem to characterize any of the angles (colab).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed, it should work now

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

btw to speed things up, run the calibration method in a multiprocessing pool e.g.

with mulitprocessing.Pool(10) as pool:
    result_zphase = cirq.experiments.calibrate_z_phases(sampler, qubits, pool=pool)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Could we make it create a pool by default?

@eliottrosenberg
Copy link
Collaborator

This should probably go in a separate PR, but I think the next step after this is to write a transformer that replaces the two-qubit gates in a circuit with ones that correct for these z-phases.

@CirqBot CirqBot added the size: L 250< lines changed <1000 label May 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size: L 250< lines changed <1000
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants