kokkos / kokkos-kernels

Kokkos C++ Performance Portability Programming Ecosystem: Math Kernels - Provides BLAS, Sparse BLAS and Graph Kernels
Other
310 stars 98 forks source link

Batched Serial Eigendecomposition #873

Open sslattery opened 3 years ago

sslattery commented 3 years ago

Looking at the eigendecomposition code here: https://github.com/kokkos/kokkos-kernels/blob/f64b1c57f52989600fe75c1dad2fdcd0d4323528/src/batched/KokkosBatched_Eigendecomposition_Serial_Internal.hpp#L24 the device code path is commented out per #749.

What is the state of the device code path without MKL (e.g. the general code path starting here: https://github.com/kokkos/kokkos-kernels/blob/f64b1c57f52989600fe75c1dad2fdcd0d4323528/src/batched/KokkosBatched_Eigendecomposition_Serial_Internal.hpp#L123

Is MKL the only issue or does this code path also need testing before it is available on device?

sslattery commented 3 years ago

@kyungjoo-kim Curious on your thoughts on this one - the general non-MKL eigendecomposition code path would be very useful on device and host

sslattery commented 3 years ago

@srajama1 Who is best to help out with this one?

srajama1 commented 3 years ago

@vqd8a can you take this question ?

vqd8a commented 3 years ago

@srajama1 Yes, sure. @sslattery I will try to get back to you asap. Thanks.

sslattery commented 3 years ago

@vqd8a any updates?

vqd8a commented 3 years ago

@sslattery So sorry, I have not had time for it over the past few days. Let me look at it this week.

terwin commented 3 years ago

Uncommenting the code, I get incorrect results for the following matrix:

A = { { 0.5, 0.0, 2.5 , 0.0, 0.0 },
      { 0.0, 0.5, 0.0 , 0.0, 0.0 },
      { 0.0, 0.0, 0.5 , 0.0, 0.4 },
      { 0.0, 0.0, 0.0 , 0.5, 0.0 },
      { 0.0, 0.0, 1.05, 0.0, 0.5 } };

This matrix has all real eigenvalues, but the kernel is returning one pair of complex eigenvalues.

vqd8a commented 3 years ago

@sslattery @terwin Sorry for my late reply. Please see Kyungjoo's answers in https://github.com/kokkos/kokkos-kernels/issues/905. The device code path was commented out because it is not stable. Please let me know if you need Eigendecomposition or just SVD? If it is just SVD, @brian-kelley will add a team/serial SVD in https://github.com/kokkos/kokkos-kernels/issues/909. But if it necessary, I can look into improving the stability of the device code of Eigendecomposition.

sslattery commented 3 years ago

@vqd8a The general eigendecomposition is the most critical for us right now. An SVD is also important for us but second in priority. Thanks!

sslattery commented 3 years ago

@vqd8a Also note that it is critical for us to have a fully templated code path and therefore the internal implementation rather than those that called MKL or LAPACK were necessary for us.

vqd8a commented 3 years ago

@sslattery Thanks for letting me know. I will work on the general eigendecomposition.