Re:Unit Testing Numerical Routines
by AlotOfReading on Sunday November 17, 2024 @12:02PM
(#42165274)
This is one of the reasons I argue that it's almost always better to prioritize speed and stability than accuracy specifically. No one actually knows what their thresholds are (including library authors), but the sky isn't falling despite that. Instabilities and nondeterminism will blow up a test suite pretty quickly though.
Re:Unit Testing Numerical Routines
by phdelightful on Sunday November 17, 2024 @01:50PM
(#42166038)
Yeah, we really just try to come up with very loose bounds since the analysis is hard. Even so, it does occasionally stop us from getting things way way wrong.
Re:Unit Testing Numerical Routines
by essexedwards on Sunday November 17, 2024 @03:09PM
(#42166745)
> No one actually knows what their thresholds are (including library authors)
If low-level numerical libraries provided documentation for their accuracy guarantees, it would make it easier to develop software on top of those libraries. I think numerical libraries should be doing this, when possible. It's already common for special-function (e.g. sin, cos, sqrt) libraries to specify their accuracy in ULPs. It's less common for linear algebra libraries to specify their accuracy, but it's still quite doable for BLAS-like operations.
Re:Unit Testing Numerical Routines
by AlotOfReading on Sunday November 17, 2024 @04:25PM
(#42167437)
What I'm trying to convey is that the required accuracies for the application are what's unclear. To give an example of a case where accuracy matters, I regularly catch computational geometry folks writing code that branches differently on positive, negative, and 0 results. That application implies 0.5 ulp, which obviously doesn't match the actual implementation accuracy even if it's properly specified, so there's usually a follow-up conversation trying to understand what they really need and helping them achieve it.
Presently, I am working on cuSPARSE and I'm very keen to improve its testing and correctness. I would appreciate anything more you can share about bugs you've seen in cuSPARSE. Feel free to email me, eedwards at nvidia.com