42 #ifndef TPETRA_MATRIXMATRIX_EXTRAKERNELS_DECL_HPP
43 #define TPETRA_MATRIXMATRIX_EXTRAKERNELS_DECL_HPP
49 namespace MatrixMatrix {
52 template <
typename View>
53 using UnmanagedView = Kokkos::View<
typename View::data_type
54 ,
typename View::array_layout
55 ,
typename View::device_type
56 ,
typename Kokkos::MemoryTraits< Kokkos::Unmanaged>
59 namespace ExtraKernels {
61 template<
class CrsMatrixType>
62 size_t C_estimate_nnz_per_row(CrsMatrixType & A, CrsMatrixType &B);
71 template<
class InColindArrayType,
72 class InValsArrayType,
76 void copy_out_from_thread_memory(
const OutColindType& thread_total_nnz,
77 const InColindArrayType& Incolind,
78 const InValsArrayType& Invals,
80 const double thread_chunk,
81 OutRowptrType& Outrowptr,
82 OutColindType& Outcolind,
83 OutValsType& Outvals);
86 #ifdef HAVE_TPETRA_INST_OPENMP
87 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class LocalOrdinalViewType>
88 static inline void mult_A_B_newmatrix_LowThreadGustavsonKernel(CrsMatrixStruct<Scalar, LocalOrdinal, GlobalOrdinal, Kokkos::Compat::KokkosOpenMPWrapperNode>& Aview,
89 CrsMatrixStruct<Scalar, LocalOrdinal, GlobalOrdinal, Kokkos::Compat::KokkosOpenMPWrapperNode>& Bview,
90 const LocalOrdinalViewType & Acol2Brow,
91 const LocalOrdinalViewType & Acol2Irow,
92 const LocalOrdinalViewType & Bcol2Ccol,
93 const LocalOrdinalViewType & Icol2Ccol,
94 CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Kokkos::Compat::KokkosOpenMPWrapperNode>& C,
95 Teuchos::RCP<
const Import<LocalOrdinal,GlobalOrdinal,Kokkos::Compat::KokkosOpenMPWrapperNode> > Cimport,
96 const std::string& label,
97 const Teuchos::RCP<Teuchos::ParameterList>& params);
99 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class LocalOrdinalViewType>
100 static inline void mult_A_B_reuse_LowThreadGustavsonKernel(CrsMatrixStruct<Scalar, LocalOrdinal, GlobalOrdinal, Kokkos::Compat::KokkosOpenMPWrapperNode>& Aview,
101 CrsMatrixStruct<Scalar, LocalOrdinal, GlobalOrdinal, Kokkos::Compat::KokkosOpenMPWrapperNode>& Bview,
102 const LocalOrdinalViewType & Acol2Brow,
103 const LocalOrdinalViewType & Acol2Irow,
104 const LocalOrdinalViewType & Bcol2Ccol,
105 const LocalOrdinalViewType & Icol2Ccol,
106 CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Kokkos::Compat::KokkosOpenMPWrapperNode>& C,
107 Teuchos::RCP<
const Import<LocalOrdinal,GlobalOrdinal,Kokkos::Compat::KokkosOpenMPWrapperNode> > Cimport,
108 const std::string& label,
109 const Teuchos::RCP<Teuchos::ParameterList>& params);
111 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class LocalOrdinalViewType>
112 static inline void jacobi_A_B_newmatrix_LowThreadGustavsonKernel(Scalar omega,
113 const Vector<Scalar,LocalOrdinal,GlobalOrdinal, Kokkos::Compat::KokkosOpenMPWrapperNode> & Dinv,
114 CrsMatrixStruct<Scalar, LocalOrdinal, GlobalOrdinal, Kokkos::Compat::KokkosOpenMPWrapperNode>& Aview,
115 CrsMatrixStruct<Scalar, LocalOrdinal, GlobalOrdinal, Kokkos::Compat::KokkosOpenMPWrapperNode>& Bview,
116 const LocalOrdinalViewType & Acol2Brow,
117 const LocalOrdinalViewType & Acol2Irow,
118 const LocalOrdinalViewType & Bcol2Ccol,
119 const LocalOrdinalViewType & Icol2Ccol,
120 CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Kokkos::Compat::KokkosOpenMPWrapperNode>& C,
121 Teuchos::RCP<
const Import<LocalOrdinal,GlobalOrdinal,Kokkos::Compat::KokkosOpenMPWrapperNode> > Cimport,
122 const std::string& label,
123 const Teuchos::RCP<Teuchos::ParameterList>& params);
125 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class LocalOrdinalViewType>
126 static inline void jacobi_A_B_reuse_LowThreadGustavsonKernel(Scalar omega,
127 const Vector<Scalar,LocalOrdinal,GlobalOrdinal, Kokkos::Compat::KokkosOpenMPWrapperNode> & Dinv,
128 CrsMatrixStruct<Scalar, LocalOrdinal, GlobalOrdinal, Kokkos::Compat::KokkosOpenMPWrapperNode>& Aview,
129 CrsMatrixStruct<Scalar, LocalOrdinal, GlobalOrdinal, Kokkos::Compat::KokkosOpenMPWrapperNode>& Bview,
130 const LocalOrdinalViewType & Acol2Brow,
131 const LocalOrdinalViewType & Acol2Irow,
132 const LocalOrdinalViewType & Bcol2Ccol,
133 const LocalOrdinalViewType & Icol2Ccol,
134 CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Kokkos::Compat::KokkosOpenMPWrapperNode>& C,
135 Teuchos::RCP<
const Import<LocalOrdinal,GlobalOrdinal,Kokkos::Compat::KokkosOpenMPWrapperNode> > Cimport,
136 const std::string& label,
137 const Teuchos::RCP<Teuchos::ParameterList>& params);
141 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node,
class LocalOrdinalViewType>
142 static inline void jacobi_A_B_newmatrix_MultiplyScaleAddKernel(Scalar omega,
143 const Vector<Scalar,LocalOrdinal,GlobalOrdinal, Node> & Dinv,
144 CrsMatrixStruct<Scalar, LocalOrdinal, GlobalOrdinal, Node>& Aview,
145 CrsMatrixStruct<Scalar, LocalOrdinal, GlobalOrdinal, Node>& Bview,
146 const LocalOrdinalViewType & Acol2rrow,
147 const LocalOrdinalViewType & Acol2Irow,
148 const LocalOrdinalViewType & Bcol2Ccol,
149 const LocalOrdinalViewType & Icol2Ccol,
150 CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>& C,
151 Teuchos::RCP<
const Import<LocalOrdinal,GlobalOrdinal,Node> > Cimport,
152 const std::string& label,
153 const Teuchos::RCP<Teuchos::ParameterList>& params);
157 #ifdef HAVE_TPETRA_INST_OPENMP
158 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class LocalOrdinalViewType>
159 static inline void mult_R_A_P_newmatrix_LowThreadGustavsonKernel(CrsMatrixStruct<Scalar, LocalOrdinal, GlobalOrdinal, Kokkos::Compat::KokkosOpenMPWrapperNode>& Rview,
160 CrsMatrixStruct<Scalar, LocalOrdinal, GlobalOrdinal, Kokkos::Compat::KokkosOpenMPWrapperNode>& Aview,
161 CrsMatrixStruct<Scalar, LocalOrdinal, GlobalOrdinal, Kokkos::Compat::KokkosOpenMPWrapperNode>& Pview,
162 const LocalOrdinalViewType & Acol2Prow,
163 const LocalOrdinalViewType & Acol2PIrow,
164 const LocalOrdinalViewType & Pcol2Accol,
165 const LocalOrdinalViewType & PIcol2Accol,
166 CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Kokkos::Compat::KokkosOpenMPWrapperNode>& Ac,
167 Teuchos::RCP<
const Import<LocalOrdinal,GlobalOrdinal,Kokkos::Compat::KokkosOpenMPWrapperNode> > Acimport,
168 const std::string& label = std::string(),
169 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);