| 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_TRSM_DECL_HPP |
| 17 |
#define KOKKOSBATCHED_TRSM_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 ArgSide, typename ArgUplo, typename ArgTrans, typename ArgDiag, typename ArgAlgo> |
| 27 |
struct SerialTrsm { |
| 28 |
template <typename ScalarType, typename AViewType, typename BViewType> |
| 29 |
KOKKOS_INLINE_FUNCTION static int invoke(const ScalarType alpha, const AViewType &A, const BViewType &B); |
| 30 |
}; |
| 31 |
|
| 32 |
template <typename MemberType, typename ArgSide, typename ArgUplo, typename ArgTrans, typename ArgDiag, |
| 33 |
typename ArgAlgo> |
| 34 |
struct TeamTrsm { |
| 35 |
template <typename ScalarType, typename AViewType, typename BViewType> |
| 36 |
KOKKOS_INLINE_FUNCTION static int invoke(const MemberType &member, const ScalarType alpha, const AViewType &A, |
| 37 |
const BViewType &B); |
| 38 |
}; |
| 39 |
|
| 40 |
template <typename MemberType, typename ArgSide, typename ArgUplo, typename ArgTrans, typename ArgDiag, |
| 41 |
typename ArgAlgo> |
| 42 |
struct TeamVectorTrsm { |
| 43 |
template <typename ScalarType, typename AViewType, typename BViewType> |
| 44 |
KOKKOS_INLINE_FUNCTION static int invoke(const MemberType &member, const ScalarType alpha, const AViewType &A, |
| 45 |
const BViewType &B); |
| 46 |
}; |
| 47 |
|
| 48 |
/// |
| 49 |
/// Selective Interface |
| 50 |
/// |
| 51 |
template <typename MemberType, typename ArgSide, typename ArgUplo, typename ArgTrans, typename ArgDiag, |
| 52 |
typename ArgMode, typename ArgAlgo> |
| 53 |
struct Trsm { |
| 54 |
template <typename ScalarType, typename AViewType, typename BViewType> |
| 55 |
KOKKOS_FORCEINLINE_FUNCTION static int invoke(const MemberType &member, const ScalarType alpha, const AViewType &A, |
| 56 |
const BViewType &B) { |
| 57 |
int r_val = 0; |
| 58 |
if (std::is_same<ArgMode, Mode::Serial>::value) { |
| 59 |
r_val = SerialTrsm<ArgSide, ArgUplo, ArgTrans, ArgDiag, ArgAlgo>::invoke(alpha, A, B); |
| 60 |
} else if (std::is_same<ArgMode, Mode::Team>::value) { |
| 61 |
r_val = TeamTrsm<MemberType, ArgSide, ArgUplo, ArgTrans, ArgDiag, ArgAlgo>::invoke(member, alpha, A, B); |
| 62 |
} |
| 63 |
return r_val; |
| 64 |
} |
| 65 |
}; |
| 66 |
|
| 67 |
} // namespace KokkosBatched |
| 68 |
|
| 69 |
#include "KokkosBatched_Trsm_Serial_Impl.hpp" |
| 70 |
#include "KokkosBatched_Trsm_Team_Impl.hpp" |
| 71 |
#include "KokkosBatched_Trsm_TeamVector_Impl.hpp" |
| 72 |
|
| 73 |
#endif |