Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[XEB] Optimize/characterize by pair (#3795)
Add a new method to perform optimization of angles (aka characterization) by pair. This is essential for "parallel" XEB. At it's heart, this is simply a "groupby" operation on the dataframe before calling the characterize function. There are additional code changes: - Lots of boilerplate for making a "closure class" so we can optimize by pair in parallel. This is an embarrassingly parallel operation, and it's important when doing very "wide" (i.e. lots of pairs) calibrations. - The least-squares estimation of individual (one pair, one cycle depth) fidelities involved using pandas `apply`, which turned out to be very slow! I profiled the `benchmark` function on a test workflow. It was taking 7.87 seconds, of which 5.3s were cumulative inside the apply function. The rest of it involved simulating the many circuits. `benchmark_...` is called during the optimization's objective function so it's performance critical. With the change, the call was a total of 2.5s and the least-squares estimation no longer appeared in the top many cumulative-time profiling calls. - Bug fix if you tried to do parallel XEB on a device that couldn't do all four layers. With added test. - The result of the `characterize_..` function has been beefed up to be a dataclass with more fields. Not only do you get the optimization results, but a nicer dictionary of angles and a dataframe of the refit fidelities. This simplifies one of the older notebooks. This data is also per-pair so you can do parallel xeb effectively - An exponential decay fitting function, taken from `experiments.cross_entropy_benchmarking`, which will be deprecated, #3775 - Some helpful pandas magic wrapped with nice function names to simplify plotting
- Loading branch information
1 parent
e3c673f
commit 9ab0f6d
Showing
9 changed files
with
685 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.