-
Notifications
You must be signed in to change notification settings - Fork 139
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
Simple implementation of Stochastic Reconfiguration #5017
Simple implementation of Stochastic Reconfiguration #5017
Conversation
… stochastic_reconfig_krylov
Test this please |
Cody: Can we revisit the WIP label of this PR and get it merged? This addition is a great achievement -- several people have been able to successfully use it in real calculations. After fixing the conflict and making any other updates you wish, we can review and make a list of what needs addressing in future PRs. e.g. Some small documentation and a basic test to exercise the code paths. |
Glad to hear that people have tried it out successfully. I will fix the conflict. I might try to refactor part of it and make a smaller PR for the krylov solver which will be easier to write a test for. Then we can incorporate those changes into this optimizer and get it merged if that sounds good. |
Since people are using this, best to get it in mainline. So I prefer: fix, merge, & then to iterate testing+refactoring+documenting. |
Test this please |
Since it is a specific flavor of SR, could you make the enum and option name more specific? |
@camelto2 I think Ye has a point, but I'll leave it up to you whether to name now or in a later PR. Please leave a comment either way. This capability is obviously evolving and as you point out (thanks) e.g. the CG is worth both refining and abstracting. |
Test this please |
{"OneShiftOnly", OptimizerType::ONESHIFTONLY}, {"adaptive", OptimizerType::ADAPTIVE}, | ||
{"descent", OptimizerType::DESCENT}, {"hybrid", OptimizerType::HYBRID}, | ||
{"gradient_test", OptimizerType::GRADIENT_TEST}, | ||
{"stochastic_reconfiguration", OptimizerType::STOCHASTIC_RECONFIGURATION_CG}}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@camelto2 can we also rename the input to "sr_cg"?
Please review the developer documentation
on the wiki of this project that contains help and requirements.
Proposed changes
Wanted to out this up to get some eyes on it.
This implements a very simple version of stochastic reconfiguration. The benefit is that we avoid the <Psi_i | H | Psi_j > matrix elements which get costly for a large number of parameters. This stochastic reconfiguration approach basically solves -tau * h = S * dp for dp, where tau is a small projection time, h is the vector <Psi_i | H | Psi_0>, and S is the overlap matrix <Psi_i | Psi_j>. The simple approach would be to build S, invert, and solve for dp. A better method, employed here, is to use a conjugate gradient method to solve the linear equation above. This avoids having to explicitly build the entire S matrix, and only builds the S*z matrix-vector product at each iteration of the CG algorithm...essentially this is the "Accelerated" SR approach described in https://doi.org/10.1103/PhysRevB.85.045103, described in the text surrounding Eqn. 7.
Preliminary tests using this have allowed us to scale up 100,000+ variational parameters, which was simply not possible with the current implementation of one_shift_only and has a huge speedup over one_shift for large parameter counts.
This is still a WIP because there are a number of things to improve. A few things off the top of my head are
I'm going to be on leave for a few weeks, but I wanted to get this up to get some comments/suggestions. This seems to be the approach other QMC codes are using for large parameter count optimizations, so it would be nice to have something like this in the code. But I think it needs a lot of improvements.
What type(s) of changes does this code introduce?
Delete the items that do not apply
Does this introduce a breaking change?
What systems has this change been tested on?
Checklist
Update the following with a yes where the items apply. If you're unsure about any of them, don't hesitate to ask. This is
simply a reminder of what we are going to look for before merging your code.