-
Notifications
You must be signed in to change notification settings - Fork 99
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
batched_lu_serial: fix for ambiguous ? operation error #512
Conversation
Detected during Trilinos integration testing.
@kyungjoo-kim @brian-kelley or @srajama1 do any of you have a moment to review? Single line change for issue that came up during integration testing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do the types of tiny and -tiny not match? It's not just the lack of const on -tiny, since the fix also selects either tiny or mst(-tiny) (const vs. non-const).
@@ -37,7 +37,8 @@ namespace KokkosBatched { | |||
const int k = (m < n ? m : n); | |||
if (k <= 0) return 0; | |||
|
|||
const auto abs_tiny = tiny > 0 ? tiny : -tiny; | |||
using mst = typename MagnitudeScalarType<ValueType>::type; | |||
const auto abs_tiny = tiny > 0 ? tiny : mst(-tiny); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could the issue be that tiny
has an unsigned integer type?
@brian-kelley @mhoemmen the issue occurred with Sacado due to some nuances of expression templates, here's the sample error code snip:
I'm adding Eric @etphipp if more detailed explanation is needed. |
@ndellingwood OK, that makes sense. @etphipp Does Sacado provide specializations for Kokkos::ArithTraits? If it does, maybe we should use the |
@etphipp does Sacado have specializations of ArithTraits so that would allow for use of |
@ndellingwood wrote:
Ah, that has bitten me before. |
@brian-kelley is it okay if we go ahead with this PR, and later I can submit new PR to replace with ArithTraits if it turns out there are ArithTraits specializations to support the failing case? |
Thanks @brian-kelley ! |
@ndellingwood Of course, I mainly just wanted to understand what was happening and it makes sense. |
Yes there is an ArithTraits specialization for this scalar type. Note that I was thinking yesterday that there might be a way for me fix these kinds of problems without having to put in the explicit conversion for |
@ndellingwood Would you please tell me where we see this error ? So far the function is used in ifpack2 block tridiag and I isolate sacado instanciation to avoid ETI with the type. Thus, this means that the code is used in other packages. |
@kyungjoo-kim here is a more verbose copy of the error message that occurred during Trilinos integration testing:
|
Oh.... I see it. @etphipp Is it safe to naively use temporal sacado variables inside of a functor ? KokkosKernels might use temporal variables without special constructors, which might not be working with DFAD types (SFAD should be fine and this MP Vector is also fine). Do we have Trilinos level cmake option to detect compatibility of ETI types ? |
It is always safe to use a temporary with any Sacado/Stokhos scalar type. It would be pretty much impossible to write complex kernels without temporaries! That being said, I am about to push a PR for Sacado/Stokhos that makes this particular change unnecessary (although there are still situations where an explicit conversion is needed because of limitations of the standard). |
Detected during Trilinos integration testing.