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

Feature globally germ aware fpr #350

Merged
merged 71 commits into from
Oct 18, 2023
Merged

Conversation

coreyostrove
Copy link
Contributor

This PR includes a significant number of changes, primarily with regards to the experiment design code, as suggested by the name of the branch, but also with regards to a number of miscellaneous changes that were made in other parts of the codebase to serve projects that had been worked on while using this branch. Here is my best attempt at a summary, broken into categories:

  • Per-Germ Global Fiducial pair reduction: implementation of a new version of fiducial pair reduction outlined in this paper.
  • Fiducial selection updates
    • Performance improvements for deduping candidate fiducials for non-clifford gate sets
    • Refactors for candidate fiducial set generation
    • Clean-up line-label handling on empty fiducial
    • Various bugfixes
  • Germ selection bugfixes and minor updates:
    • Gate sets with statically parameterized gates
    • Memory efficient implementation of germ list completeness check
    • Better implicit model support/bugfixes
  • Fisher information
    • MPI-support
    • Addition of approximate fisher information
    • Option for more memory efficient implementation
    • Additional options for pre-computation/caching
  • Miscellaneous
    • Better reporting support for ModelTest protocols w/o gauge-optimization
    • Bugfix in distributed memory implementation of customsolve
    • Error generator plot bugfix when number of qubits>2
    • Add product method to MapForwardSimulator
    • Front load COPA layout construction and associated memory checks
    • Add a new method to StateSpace base class for retreiving a list of state space labels (implemented to address a bug that was in one of the fiducial selection routines, but should be useful more generally).

Unit tests have been added for new experiment design code and some existing coverage gaps filled. Updated Fidsel+Germsel and FPR tutorials to reflect these changes and highlight new capabilities.

Corey Ostrove added 30 commits March 28, 2023 13:49
Initial commit for the addition of a new per-germ global FPR algorithm for streamlining experiment designs. In this version of FPR we begin by taking an amplificationally complete set of germs and then identifying subset of amplified directions for each germ such that collectively we still have amplificational completeness (this will typically be fewer than all of the parameters amplified by a germ). We then pass this info on to an FPR routine that looks for a set of fiducial pairs that give us sensitivity to the specifically requested parameter directions.
Add a flag to the fisher info per circuit computation that makes the approximation of dropping the hessian term entirely.
Update the logging levels for certain output.
Add additional logging
Adds a new subset selection heuristics based on as result from Golub et. al from the 70s. Also adds a number of stability fixes related to the use of low-rank updates for updating the psuedoinverses in the update cache at each greedy step.
Adds functionality for precomputing the jacobians used in the per-germ global FPR scheme. I want to be able to use MPI for these while using native BLAS multithreading for other parts of the codebase, so adding this option for splitting this off looked to me to be the easiest way to able to have my cake and eat it too here.
Add support for passing in comm objects to the fisher information related functions in edesign tools.
This commit reimplements the calculation for the fisher information by L to address some buggy behavior observed in the plaquette based one wherein certain circuits that were indeed in the experiment design were nonetheless not appearing in any of the plaquettes or in additional_circuits. This itself is something we should track down, but for now this reimplements the calculation using circuit lists instead of the PlaquetteGridCircuitStructure approach. (it is incidentally much simpler too).
Add a list of lengths as an argument.
Adds some additional logging to temporarily_track_memory to indicate how much memory was requested for allocation.
The memory efficient mode avoids constructing the entire cache of per-ckt fisher information contributions at any one time and instead constructs it one chunk at a time using a user specified chunk size and then recycles the memory to keep the footprint down.
Fix an indentation error.
fix some missing plumbing for the kwargs in the fisher information code.
Adds additional logging about the progress of fisher information calculations.
This fixes a bug in how the circuits were being divided for memory efficiency in the fisher information code.
The fisher information matrices for 3-qubits are often large enough to exceed the default ~2Gb message buffer limit for MPI. I could figure out a chunking scheme to work around this, but for now we actually only need the fisher information on the base rank, so we can skip this broadcast for the time being.

This commit also adds some more progress logging the FIM term cache construction.
Typo fix in creation of verbosity printer
In some cases the lack of the line labels on the empty fiducial cause weirdness in the subsequent GST circuit creation. This adds some logic for adding back in line labels by looking at the qudit labels in the target model.
…ation for the fisher information. Also removes broken shared memory implementation of the calculations.
The greedy low-rank update implementation of germ selection ran into issues when encountering germs consisting of entirely parameter-less gates as this results in all zero jacobians (which the other implementations were able to handle gracefully but this implementation didn't). Of course, we don't really want to consider these types of germs in the first place as they are by definition insensitive to everything, so this adds logic to filter these out. Not perfect as this currently only works for explicit models (but then so does germ selection in general).
This shifts the construction of the COPA layouts for each iteration of a GST to before the actual optimization starts by using the ability of MDC stores to take a precomputed layout on construction. There are memory checks that happen at runtime when the layouts are constructed (which are a bit tricky to split off on their own since they depend heavily on the runtime environment) and this should make it easier to catch memory shortages before we get too deep into a run.
It looks like the choi eigenvalue related functions assume that a gate has access to a dense operator interface, which isn't true in general for CPTP model which derive instead from LinearOperators. A simple patch is to simply call to_dense (which most linear operator derivatives do have) since we only need the transfer matrix in the end.
Corey Ostrove added 6 commits September 14, 2023 15:32
Remove some unused/unneeded kwargs and variables.
Add some basic unit tests for the new per-germ global FPR scheme. At the moment this only tests for running to completion. Need to eventually assert correctness. Also adds coverage for new per-germ FPR greedy search heuristics which were added in 0.9.11 but didn't have tests covering them yet.
This commit adds additional unit tests for the fisher information calculations when doing an approximate fisher information calculation. This also fixes a few bugs revealed by the new and existing fisher information unit tests. Also includes a refactoring of this test module splitting up the three different parts of edesign tools into separate classes.
Cleans up some docstrings and moves diagnostic print statements to proper warnings.
Bug fixes related to edge cases revealed from updates to the tutorial notebooks. The first edge case had to do with changes to the generalized deduping routine when the construction of equivalence classes resulted in a single class. The second was due to the fact that the models in modelpacks use an ExplicitStateSpace for some reason, and this lacked a method/attribute similar to qudit_labels for QuditSpace objects. Added a new method to the base StateSpace class that travereses the tensor product blocks and concatenates a list of state space labels.
Update the experiment design tutorial notebooks to reflect some of the updated experiment design features/capabilities and plug a few gaps related to already existing functionality/best-practices.
Corey Ostrove added 2 commits September 16, 2023 23:35
Add an example notebook for using the fisher information to analyze the theoretical performance of experiment designs.
missing an underscore in module name.
@coreyostrove coreyostrove marked this pull request as ready for review September 17, 2023 05:41
@coreyostrove
Copy link
Contributor Author

Regarding the failing unit tests in the latest runs, looking at the errors I thought to myself 'how much do I want to bet they just released numpy 1.26?'. And lo and behold that is exactly what happened. It dropped on 9/16 and it looks like a few bits of previously deprecated code hit their expiry date.

@sserita
Copy link
Contributor

sserita commented Sep 19, 2023

Well gotta love that. How bad are the deprecations? Should we pin 1.25 for this PR, or just bite the bullet and update?

@sserita
Copy link
Contributor

sserita commented Sep 20, 2023

Never mind, found the few updates we should need for 1.26. I'll merge that into here once it passes on develop, and then we should be ready for review as normal.

@coreyostrove
Copy link
Contributor Author

You're the best, @sserita! Thanks for taking care of that!

@sserita
Copy link
Contributor

sserita commented Sep 20, 2023

Np, thanks for all your hard work on the branch so far. :) I'll take a look before our next dev meeting, and I think Erik had a few questions about what's in here too. But hopefully we can pull this in next week and you'll be off the hook for anything else for the next release (except maybe a review on my MCFE stuff). :P

Copy link
Contributor

@sserita sserita 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 great work as usual @coreyostrove. I have two main comments for you to address about the requirements.txt and the location of germ_set_spanning_vectors - the answer to both could be "no its fine, plz just approve". But I've also got a few minor typos to fix while it's bounced back to you... sorry for being annoying about those. :P

pygsti_new_fpr_requirements_04_24_2023.txt Outdated Show resolved Hide resolved
pygsti/algorithms/fiducialpairreduction.py Outdated Show resolved Hide resolved
pygsti/algorithms/fiducialpairreduction.py Outdated Show resolved Hide resolved
pygsti/algorithms/fiducialpairreduction.py Outdated Show resolved Hide resolved
pygsti/algorithms/germselection.py Show resolved Hide resolved
coreyostrove and others added 2 commits October 17, 2023 19:55
This was committed by accident. Removing.
@sserita sserita merged commit 5fd66bb into develop Oct 18, 2023
13 checks passed
@sserita sserita deleted the feature-globally-germ-aware-fpr branch October 18, 2023 15:22
@coreyostrove coreyostrove restored the feature-globally-germ-aware-fpr branch November 10, 2023 17:15
@coreyostrove coreyostrove deleted the feature-globally-germ-aware-fpr branch November 10, 2023 17:19
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.

None yet

2 participants