Debian Codegraph @

packages/kokkos-kernels/batched/dense/src/KokkosBatched_ApplyQ_Decl.hpp

raw
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_APPLY_Q_DECL_HPP
17 #define KOKKOSBATCHED_APPLY_Q_DECL_HPP
18
19 /// \author Kyungjoo Kim ([email protected])
20
21 #include "KokkosBatched_Util.hpp"
22
23 namespace KokkosBatched {
24
25 ///
26 /// Serial ApplyQ
27 ///
28
29 template <typename ArgSide, typename ArgTrans, typename ArgAlgo>
30 struct SerialApplyQ {
31 template <typename AViewType, typename tViewType, typename BViewType, typename wViewType>
32 KOKKOS_INLINE_FUNCTION static int invoke(const AViewType &A, const tViewType &t, const BViewType &B,
33 const wViewType &w);
34 };
35
36 ///
37 /// Team ApplyQ
38 ///
39
40 template <typename MemberType, typename ArgSide, typename ArgTrans, typename ArgAlgo>
41 struct TeamApplyQ {
42 template <typename AViewType, typename tViewType, typename BViewType, typename wViewType>
43 KOKKOS_INLINE_FUNCTION static int invoke(const MemberType &member, const AViewType &A, const tViewType &t,
44 const BViewType &B, const wViewType &w);
45 };
46
47 ///
48 /// TeamVector ApplyQ
49 ///
50
51 template <typename MemberType, typename ArgSide, typename ArgTrans, typename ArgAlgo>
52 struct TeamVectorApplyQ {
53 template <typename AViewType, typename tViewType, typename BViewType, typename wViewType>
54 KOKKOS_INLINE_FUNCTION static int invoke(const MemberType &member, const AViewType &A, const tViewType &t,
55 const BViewType &B, const wViewType &w);
56 };
57
58 ///
59 /// Selective Interface
60 ///
61 template <typename MemberType, typename ArgSide, typename ArgTrans, typename ArgMode, typename ArgAlgo>
62 struct ApplyQ {
63 template <typename AViewType, typename tViewType, typename BViewType, typename wViewType>
64 KOKKOS_FORCEINLINE_FUNCTION static int invoke(const MemberType &member, const AViewType &A, const tViewType &t,
65 const BViewType &B, const wViewType &w) {
66 int r_val = 0;
67 if (std::is_same<ArgMode, Mode::Serial>::value) {
68 r_val = SerialApplyQ<ArgSide, ArgTrans, ArgAlgo>::invoke(A, t, B, w);
69 } else if (std::is_same<ArgMode, Mode::Team>::value) {
70 r_val = TeamApplyQ<MemberType, ArgSide, ArgTrans, ArgAlgo>::invoke(member, A, t, B, w);
71 } else if (std::is_same<ArgMode, Mode::Team>::value) {
72 r_val = TeamVectorApplyQ<MemberType, ArgSide, ArgTrans, ArgAlgo>::invoke(member, A, t, B, w);
73 }
74 return r_val;
75 }
76 };
77
78 } // namespace KokkosBatched
79
80 #include "KokkosBatched_ApplyQ_Serial_Impl.hpp"
81 #include "KokkosBatched_ApplyQ_TeamVector_Impl.hpp"
82
83 #endif