-
Notifications
You must be signed in to change notification settings - Fork 1
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
Grid-searching based tuning scheme #110
Comments
Did you 76 minutes its a lot. But what would be the time for lets say one structure of around 1k atoms? |
I just checked their code, the density here is a line density of the mesh points, like the reciprocal of our
In their code, they simply set it as maximally 512 grid points along one dimension.
For 1k atoms, to reach an accuracy of 1e-7, it costs ~1 min. I just made some optimization to it, |
Okay 512 sounds reasonable! And 1 min is fine for the beginning. I assume on a CPU? We can try to optimize this further. |
Yes on a CPU |
This is inspired by the
ESPResSo
tuning code. In their tuning code, they take the running time into account (which we have not yet). Their code combines grid-search (for the mesh density and the interpolation order) and handcraft (for the smearing and the real space cutoff) together. Basically, what they have done is:mesh_density
iteratively from small to large in a certain range(m_mesh_density_min, m_mesh_density_max)
.https://github.com/espressomd/espresso/blob/a8a00a06e4eb8b0726a318739d069e379619e400/src/core/electrostatics/p3m.cpp#L715-L754
mesh_density
, iteratecao
(charge assignment order, ourinterpolation_nodes
) from low to high. https://github.com/espressomd/espresso/blob/a8a00a06e4eb8b0726a318739d069e379619e400/src/core/p3m/TuningAlgorithm.cpp#L228-L326(mesh_density, cao)
, bisectionly searchr_cut_iL
https://github.com/espressomd/espresso/blob/a8a00a06e4eb8b0726a318739d069e379619e400/src/core/p3m/TuningAlgorithm.cpp#L155-L168
and calculate an
alpha_L
(oursmearing
) according to the real space error and the desired accuracyhttps://github.com/espressomd/espresso/blob/a8a00a06e4eb8b0726a318739d069e379619e400/src/core/electrostatics/p3m.cpp#L646-L655
(mesh_density, cao, r_cut_iL, alpha_L)
, initialize P3M, run the calculation and record the calculation time.There are some complicated exit conditions for the loops in 1 and 2, in order to shrink the size of the search space. The methods in 3 look like heuristic, and perhaps we can replace them with gradient-based optimization. For our case, we can grid-search each possible
(mesh_spacing, interpolation_nodes)
, and use Adam optimizer to get(smearing, rc_cutoff)
. And for each possible parameter, we can do the calculation, record the time, and finally return a parameter pair with the shortest time.I have already tried this for PME and here is the result, but I forgot to record the calculation time. One other problem is that the tuning time is very long. It took the computer 76 min to get all the results below (7 * 8 = 56 cases, avg. 1.4 min/case), so we may introduce some rules to help reduce the scale of searching.
The text was updated successfully, but these errors were encountered: