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

Had to turn off fastmath for nbrk_ode #24

Closed
jrenaud90 opened this issue Mar 28, 2023 · 2 comments
Closed

Had to turn off fastmath for nbrk_ode #24

jrenaud90 opened this issue Mar 28, 2023 · 2 comments
Labels
bug Something isn't working help wanted Extra attention is needed nbrk_ode An issue with the Numba solver performance Issues related to improving performance

Comments

@jrenaud90
Copy link
Owner

jrenaud90 commented Mar 28, 2023

Prior to v0.5.0, numba's fastmath variable was turned on for nbrk_ode. With the fix to issue #20 in PR #23 we noticed that the standard set of tests would fail on MacOS and Ubuntu systems. It was very random, even rerunning a test without a change in code could cause different results.
Some consistent findings:

  • Tests never failed on Windows.
  • More tests would fail on MacOS vs. Ubuntu.
  • Setting fastmath=False (in CyRK.nb.nbrk at the njit decorator) allowed tests to pass.

PR #23 changed the way minimum step size was calculated. Prior to this change it was set to:

10 * np.finfo(np.float64).eps

now it is set, correctly, to

10. * abs(np.nextafter(t, direction * np.inf) - t)

For small t this value is quite small (5e-323 vs. a EPS of ~1e-16). I believe there is something not playing well between this small value floating around (pun) while fastmath is on. At least on some operating systems.

It is more important that the step size is set correctly so, as of 0.5.0, fastmath is turned off for nbrk_ode there is a slight performance hit with this change.

@jrenaud90 jrenaud90 added bug Something isn't working help wanted Extra attention is needed nbrk_ode An issue with the Numba solver performance Issues related to improving performance labels Mar 29, 2023
@jrenaud90
Copy link
Owner Author

It varies quite a bit, but this action looks like it hurt nbrk_odes performance by about 3--5% It is still consistently faster than cyrk_ode (by around 3--5x) and scipy (by around 10--100x).

jrenaud90 added a commit that referenced this issue Mar 29, 2023
* Fixed min step bug in `nbrk_ode` and `cyrk_ode` (Fixes Issue #20)
* Minor performance improvements for `cyrk_ode`
* Removed fastmath for `nbrk_ode` (Created Issue #24)
@jrenaud90
Copy link
Owner Author

At this point the numba solver is feature complete unless there turns out to be major demand for it. I will continue to maintain the current nbrk but do not intend to expand its abilities at this time.

@jrenaud90 jrenaud90 closed this as not planned Won't fix, can't repro, duplicate, stale May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed nbrk_ode An issue with the Numba solver performance Issues related to improving performance
Projects
None yet
Development

No branches or pull requests

1 participant