-
Notifications
You must be signed in to change notification settings - Fork 142
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
OneShiftOnly should abort when cost function is provided #1494
Comments
Good point. Is there not a more general issue of optimizers appearing to accept parameters that are actually unused? |
Yes, there is. It's just that the cost function is presented as a general feature in the manual (see XML blocks there combining cost and OneShiftOnly), and so I fully expected cost to be compatible with OneShiftOnly. The optimizer silently ignoring your request to optimize the variance is like DMC ignoring all walker input, i.e. it is a big enough issue to require its own fix. |
Another way to implement this in OneShiftOnly would be to abort if the cost function is not pure energy minimization. The cost function used for monitoring should not recycle the default one used for optimization. This is an important restriction since it implies that if OneShiftOnly is similarly robust to other pure energy minimizers, then it should only be used from a reasonably good starting point. |
It is funny that when proposing a new set of parameters, all the optimizers do energy minimization with linear method. After that, cost function is used to gate the final target. For me, this logic is broken but it can work to some extend. |
Hi @jtkrogel and @prckent ,
I found the point very cryptical, especially in view of the fact that in the input example at page 124 of manual v3.6.0 there is the definition of the cost function and of MinMethod=OneShiftOnly. I would find useful if the manual would provide some proper reference at the beginning of both the OneShiftOnly and the adaptive MinMethods. The description of the methods in the manual is very shallow and it would be useful to know where to find more details. Anyway, I am doing some tests comparing old results I obtained with CASINO with results I get from QMCPACK. In CASINO I was used to optimize the Jastrow by minimizing the variance.
Is there something wrong in this input? By the way, it is not very clear to me if, when and where I should write |
For the CUDA build, it is still recommended ot leave gpu="yes". However I noticed that if you put gpu="no" the code will crash in some cases. We are working on a new GPU implementation in which both yes and no will be maintained and tested. |
@zenandrea If you do not put Jastrow, does the VMC variance agree? |
@ye-luo Thanks for the quick response.
Do you mean that it is recommended to leave or do not leave gpu="yes" in the qmc attribute? Then, let me check if I got the correct behavior reading the manual: Is that correct? If yes, is the default value "yes" for the CUDA case and "no" for the CPU-only case? In which cases should I run the CUDA version with gpu="no"? Why not running instead the AoS or the SoA versions straight away? Moreover, I see that there is the flag |
Comment: the CUDA code largely ignores the gpu="yes" or "no" tag, and always uses the GPU. In future this will be respected, so is worth including. While we want to do this ASAP, realistically the new GPU version is a long way off. Short version: don't worry about the gpu flag now. |
Leaving gpu="yes" or not in the input file doesn't matter really, just don't put "no". I did see runs crash if I put gpu="no" somewhere and ran the CUDA code.
Correct. This was intended originally to allow users select using GPU or not via input.
If you use CUDA verion, you should not use gpu="no". If you only need CPU, just run SoA or AoS.
As I explained above, you may have GPU acceleration for many pieces of code and controllable from input, you will see the same amount of gpu="yes/no" in the input file. |
@ye-luo many thanks. You also asked the difference between QMCPACK and CASINO if I have no Jastrow.
It seems that the agreement is good. |
@ye-luo
where the cost function seems to be the energy, and not something related with the variance,
|
It is true. The adaptive optimizer is also targeting energy just like the OneShiftOnly. |
If you only include 1 and 2 body, does the energy and variance agree between CASINO and QMCPACK? |
@zenandrea You could consider using the quartic optimizer. It does respect the cost function (you can perform variance minimization with it) and it is still the primary optimizer that I use in production. You could try optimization blocks like the following:
|
Well, no. But I guess it might be because I never performed a proper variance minimization in QMCPACK. With J2 and same cutoffs and number of parameters I get: CASINO: QMCPACK: So, QMCPACK is lower in energy, CASINO in variance. |
I got the following: |
I was running on 128 nodes of Titan with the following optimization blocks. I first optimize J1 and J2. Then J3 is included with empty coefficients (namely zero).
|
@ye-luo , are there the results for J123? Well, if our orbitals are different, a little difference in the energy can be expected. I do not know if our Jastrow is exactly the same.
As you can see, I allow only J2 to make a difference between up and down electrons. |
I would like to revive this to mention that I agree with the original suggestion that having qmcpack abort when the user specifies a cost function that is not pure energy minimization when using oneshiftonly is needed. I was caught by this myself recently. Additionally, as mentioned, the input example in the manual within "Wavefunction optimization" shows both a variance cost and oneshiftonly which is misleading. |
The OneShiftOnly optimizer minimizes only the total energy and is not capable of variance minimization, or minimization of mixtures of energy and variance.
Additionally, the default cost function (0.9
*
energy+0.1*
unreweightedvariance) is used by OneShiftOnly for reporting purposes to alert the user if the variance component is getting out of hand (reported cost function in log output is different than just pure total energy, but this a feature intended by @ye-luo and so not a bug in itself).Due to the above, OneShiftOnly should abort if any cost function is provided by the user, with a message explaining that it 1) cannot accept cost function input and 2) only performs energy minimization.
The text was updated successfully, but these errors were encountered: