| 1 |
//@HEADER |
| 2 |
// ************************************************************************ |
| 3 |
// |
| 4 |
// Kokkos v. 4.0 |
| 5 |
// Copyright (2022) National Technology & Engineering |
| 6 |
// Solutions of Sandia, LLC (NTESS). |
| 7 |
// |
| 8 |
// Under the terms of Contract DE-NA0003525 with NTESS, |
| 9 |
// the U.S. Government retains certain rights in this software. |
| 10 |
// |
| 11 |
// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. |
| 12 |
// See https://kokkos.org/LICENSE for license information. |
| 13 |
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 14 |
// |
| 15 |
//@HEADER |
| 16 |
#ifndef KOKKOSBATCHED_LU_DECL_HPP |
| 17 |
#define KOKKOSBATCHED_LU_DECL_HPP |
| 18 |
|
| 19 |
/// \author Kyungjoo Kim ([email protected]) |
| 20 |
|
| 21 |
#include "KokkosBatched_Util.hpp" |
| 22 |
#include "KokkosBatched_Vector.hpp" |
| 23 |
|
| 24 |
namespace KokkosBatched { |
| 25 |
|
| 26 |
template <typename ArgAlgo> |
| 27 |
struct SerialLU { |
| 28 |
// no piv version |
| 29 |
template <typename AViewType> |
| 30 |
KOKKOS_INLINE_FUNCTION static int invoke( |
| 31 |
const AViewType &A, const typename MagnitudeScalarType<typename AViewType::non_const_value_type>::type tiny = 0); |
| 32 |
}; |
| 33 |
|
| 34 |
template <typename MemberType, typename ArgAlgo> |
| 35 |
struct TeamLU { |
| 36 |
// no piv version |
| 37 |
template <typename AViewType> |
| 38 |
KOKKOS_INLINE_FUNCTION static int invoke( |
| 39 |
const MemberType &member, const AViewType &A, |
| 40 |
const typename MagnitudeScalarType<typename AViewType::non_const_value_type>::type tiny = 0); |
| 41 |
}; |
| 42 |
|
| 43 |
/// |
| 44 |
/// Selective Interface |
| 45 |
/// |
| 46 |
template <typename MemberType, typename ArgMode, typename ArgAlgo> |
| 47 |
struct LU { |
| 48 |
// no piv version |
| 49 |
template <typename AViewType> |
| 50 |
KOKKOS_FORCEINLINE_FUNCTION static int invoke( |
| 51 |
const MemberType &member, const AViewType &A, |
| 52 |
const typename MagnitudeScalarType<typename AViewType::non_const_value_type>::type tiny = 0) { |
| 53 |
int r_val = 0; |
| 54 |
if (std::is_same<ArgMode, Mode::Serial>::value) { |
| 55 |
r_val = SerialLU<ArgAlgo>::invoke(A, tiny); |
| 56 |
} else if (std::is_same<ArgMode, Mode::Team>::value) { |
| 57 |
r_val = TeamLU<MemberType, ArgAlgo>::invoke(member, A, tiny); |
| 58 |
} |
| 59 |
return r_val; |
| 60 |
} |
| 61 |
}; |
| 62 |
|
| 63 |
} // namespace KokkosBatched |
| 64 |
|
| 65 |
#include "KokkosBatched_LU_Serial_Impl.hpp" |
| 66 |
#include "KokkosBatched_LU_Team_Impl.hpp" |
| 67 |
|
| 68 |
#endif |