-
Notifications
You must be signed in to change notification settings - Fork 436
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
adjacent_difference should not allow running with source being the same as destination #6890
adjacent_difference should not allow running with source being the same as destination #6890
Comments
Does this still generate the correct result? Is it a problem if the |
No, it does not generate correct result. It would be impossible to do that without duplicating the view, which it does not do. For view [2, 4, 6, 8, 10], the currently produced result in Serial is [2, 2, 4, 4, 6]. |
on https://en.cppreference.com/w/cpp/algorithm/adjacent_difference |
It does say
Look at Andrey waving the Bible. The current draft has the same paragraph as in cppreference but it also has this remark https://eel.is/c++draft/adjacent.difference#8 that clearly spell out what the precondition involves. |
Yes right, I was just surprised the other part of the condition was missing |
What do you mean when you say "the other part of the condition [is] missing"?
I expected that the fact the ranges cannot overlap was covered by the part of the clause I highlighted above. |
I think what you highlight refers to what requirements "op" should have and so what it should do or not doto its arguments. How the result of op is used is a different thing IMO. |
In any case, why would it be written so explicitly in working draft but so cryptically in the user documentation? |
In any case, it is the responsibility of the user to ensure the preconditions. Here the standard makes no provision for the implementation of In order to be a good citizen, Kokkos can try to check the precondition at runtime in certain simple cases and in debug mode ( Cf. @yasahi-hpc PR ), but this is just a nicety and goes beyond what the standard mandates. |
Sure. I do think it falls under the same concept as checking array bounds: a helpful utility to detect errors at early stage. |
Definitely |
Right now, it is possible to run
Kokkos::Experimental::adjacent_difference(space, view, view);
According to the standard, it should not be possible.
Affects all Kokkos versions I tried.
The text was updated successfully, but these errors were encountered: