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

Optimize the fit gradients #729

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

HanatoK
Copy link
Member

@HanatoK HanatoK commented Oct 15, 2024

  • Save the unrotated positions. This can avoid rotating the positions again in calc_fit_forces_impl;
  • Determine dl, dq or ds by compile-time template options;
  • Only call calc_fit_gradients when atom groups have explicit gradients;
  • Simplify and inline cvm::quaternion::position_derivative_inner.

This PR should be only marked as ready after #713 is merged.

@HanatoK HanatoK force-pushed the optimize_fit_gradients branch 2 times, most recently from 09def4b to 2da467b Compare October 16, 2024 14:09
@giacomofiorin
Copy link
Member

@HanatoK We don't currently have a CI job with Intel, but that compiler uses restrict (as well as PGI pre-NVIDIA). See the following from the LAMMPS headers:
https://github.com/lammps/lammps/blob/59bbc5bcc1104bdb4fb45107cd65b5d4d76dbc00/src/lmptype.h#L342-L348

@HanatoK
Copy link
Member Author

HanatoK commented Oct 16, 2024

@HanatoK We don't currently have a CI job with Intel, but that compiler uses restrict (as well as PGI pre-NVIDIA). See the following from the LAMMPS headers: https://github.com/lammps/lammps/blob/59bbc5bcc1104bdb4fb45107cd65b5d4d76dbc00/src/lmptype.h#L342-L348

Thanks! I will try using the same way to apply __restrict.

@giacomofiorin
Copy link
Member

@HanatoK We don't currently have a CI job with Intel, but that compiler uses restrict (as well as PGI pre-NVIDIA). See the following from the LAMMPS headers: https://github.com/lammps/lammps/blob/59bbc5bcc1104bdb4fb45107cd65b5d4d76dbc00/src/lmptype.h#L342-L348

Thanks! I will try using the same way to apply __restrict.

Awesome! I added an Intel oneAPI CI job in the meantime, which is overkill for just this PR but definitely was a missing feature otherwise.

@HanatoK
Copy link
Member Author

HanatoK commented Oct 17, 2024

I think it is better to document how the fit gradients are computed so I tried my best to improve the doxygen documentation in 2d353eb. I know the SI of the new Colvars paper includes the computation but that is too simplified and not quite informative.

@HanatoK HanatoK marked this pull request as ready for review October 17, 2024 22:11
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.

2 participants