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

Forcefield params do not match between CPU and GPU #535

Merged
merged 2 commits into from
Dec 13, 2024

Conversation

LSchwiebert
Copy link
Collaborator

The CPU and GPU can have different values for alpha^2. The reason is that the CPU apparently calculates a more accurate value of alpha^2 by using an intermediate value of alpha that is accurate to more than 64 bits, which it then squares.

To resolve this problem, the code has been changed to add new variables, gpu_alphaSq, gpu_rCutSq, and gpu_rCutCoulombSq, that are passed to the GPU, so the GPU uses the same values as the CPU for these variables. This also reduces the amount of computation, as we remove a multiplication each time we need the value of alpha^2.

The code is also updated to use the new alpha^2 value instead of recalculating it.

Unfortunately, the code also includes some reformatting of some files using clang-format, so the patch is larger than needed to resolve this issue.

Copy link
Collaborator

@jpotoff jpotoff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@HamiedAsadi HamiedAsadi merged commit a27ca12 into development Dec 13, 2024
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants