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

Abs does == of views of type different types #252

Open
csiefer2 opened this issue Jun 6, 2018 · 4 comments
Open

Abs does == of views of type different types #252

csiefer2 opened this issue Jun 6, 2018 · 4 comments
Assignees
Labels

Comments

@csiefer2
Copy link
Contributor

csiefer2 commented Jun 6, 2018

In Trilinos' KokkosBlas1_abs_impl.hpp:228 V_Abs_generic checks for equivalence views of two different types with an == . This is no bueno.

trilinos/Trilinos#2894

@crtrott
Copy link
Member

crtrott commented Jun 6, 2018

I was first wondering how the heck this could drop through our testing framework. Turns out we run a unit test where BOTH the input and output for the function are of the same scalar type. I.e. we run something like

View<complex<double>*> r("R",N);
View<complex<double>*> a("A",N);
abs(r,a);

@crtrott crtrott added the bug label Jun 6, 2018
@crtrott
Copy link
Member

crtrott commented Jun 6, 2018

We can do a simple fix and use something like the following instead of the current comparison:

if(std::is_same<X::array_layout,A::array_layout>::value &&
   std::is_same<X::memory_space,A::memory_space>::value &&
   ( (void*) (x.data()) == (void*) (a.data()) ) &&
   (x.extent(0) == a.extent(0)) )

@mhoemmen
Copy link
Contributor

mhoemmen commented Jun 6, 2018

@crtrott If the pointers are the same but the extents aren't, you're kind of in trouble :-D

@crtrott
Copy link
Member

crtrott commented Jun 7, 2018

Actually you are right that extent comparison is probably intercepted somewhere else.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants