Fix spline jastrow#4828
Conversation
prckent
left a comment
There was a problem hiding this comment.
Interesting!
Please give more of the backstory here: what is causing the invalid access, and how come we did not notice the problem before now? How could we avoid such things in future/catch other similar issues that might be lurking in the code today?
abf9264 to
779a9ac
Compare
|
A simple example. |
I am thinking about options to catch these, both in the code we already have, and in future:
Your thoughts? |
|
|
2 is better but, Any function that converts from a float type to an index type and doesn't have a unit test that checks the out of bounds edge cases is a completely unsafe choice by both the reviewer and the author. The sort of thing that gets blue collar folks fired on the spot. Like ignoring LOTO or running CNC machines with the safetyshields removed. |
|
The other problem here was that this logic was hiding in a too large function so it escaped consideration for unit testing. If the behavior of a code fragment is important enough it should get factored out into something testable. |
|
Seems that a minimal test improvement would be evaluating a r=-delta, 0,delta, cutoff-delta, cutoff, cutoff+delta. Where delta = a few epsilon. I note that the "API" for the spline functor and nearby Jastrow factors does not say what the expectations are for the inputs. After this testing is done we can make an issue/task for someone else. Besides this we also need some extensive asan runs. The issue is then noticing the asan failure amidst statistical failures (== motivation to improve the statistical checks). Presumably this has been hitting production runs, although in very subtle ways to not be caught by now. |
prckent
left a comment
There was a problem hiding this comment.
I made an issue so we can merge this fix as is.
The merge-base changed after approval.
The merge-base changed after approval.
|
Test this please |
Proposed changes
Review after #4827
Fix https://cdash.qmcpack.org/CDash/testDetails.php?test=28505916&build=446393
It was caused by NaN due to out-of-bound access when accessing 1D spline coefficients in Jastrow.
What type(s) of changes does this code introduce?
Does this introduce a breaking change?
What systems has this change been tested on?
bora
Checklist