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

Some precision improvements for serial kernels #518

Closed
wants to merge 5 commits into from

Conversation

ptim0626
Copy link
Contributor

@ptim0626 ptim0626 commented Dec 4, 2023

This PR contains several fixes that improve the precision in some serial kernels to match those in the normal implementation.

  • the same epsilon is used to avoid division by zero, as in here
  • use PtyPy's abs2 to calculate af
  • do not re-calculate af by fdev + mag, but storing it
  • use the exact same formula to propagate as in here

The operations above are mathematically the same before and after the changes, but associative property does not generally hold for floating-point arithmetic, so the above changes ensure the implementation in serial kernels can get the same precision with the normal implementation.

EDIT: Memory is probably more important than precision here, so we don't use additional storage for af.

@ptim0626
Copy link
Contributor Author

ptim0626 commented Feb 1, 2024

Close for now as each of the suggestions needs to be further investigated, will be addressed separately.

@ptim0626 ptim0626 closed this Feb 1, 2024
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.

1 participant