44 #ifndef TPETRA_DETAILS_LIBGEMM_HPP 45 #define TPETRA_DETAILS_LIBGEMM_HPP 59 #include "TpetraCore_config.h" 70 template<
class ViewType1,
73 class CoefficientType,
76 typedef typename ViewType1::non_const_value_type scalar_type;
77 typedef typename std::decay<CoefficientType>::type coeff_type;
78 typedef typename std::decay<IndexType>::type index_type;
87 static constexpr
bool value =
88 std::is_same<scalar_type, typename ViewType2::non_const_value_type>::value &&
89 std::is_same<scalar_type, typename ViewType3::non_const_value_type>::value &&
90 std::is_same<scalar_type, coeff_type>::value &&
95 std::is_same<index_type, int>::value;
102 cgemm (
const char char_transA,
103 const char char_transB,
107 const ::Kokkos::complex<float>& alpha,
108 const ::Kokkos::complex<float> A[],
110 const ::Kokkos::complex<float> B[],
112 const ::Kokkos::complex<float>& beta,
113 ::Kokkos::complex<float> C[],
118 dgemm (
const char char_transA,
119 const char char_transB,
134 sgemm (
const char char_transA,
135 const char char_transB,
150 zgemm (
const char char_transA,
151 const char char_transB,
155 const ::Kokkos::complex<double>& alpha,
156 const ::Kokkos::complex<double> A[],
158 const ::Kokkos::complex<double> B[],
160 const ::Kokkos::complex<double>& beta,
161 ::Kokkos::complex<double> C[],
166 template<
class ScalarType>
struct Gemm {};
169 struct Gemm< ::Kokkos::complex<float> > {
170 typedef ::Kokkos::complex<float> scalar_type;
173 gemm (
const char transA,
178 const scalar_type& alpha,
179 const scalar_type A[],
181 const scalar_type B[],
183 const scalar_type& beta,
187 return cgemm (transA, transB, m, n, k, alpha, A, lda, B, ldb, beta, C, ldc);
192 struct Gemm<double> {
193 typedef double scalar_type;
196 gemm (
const char transA,
201 const scalar_type& alpha,
202 const scalar_type A[],
204 const scalar_type B[],
206 const scalar_type& beta,
210 return dgemm (transA, transB, m, n, k, alpha, A, lda, B, ldb, beta, C, ldc);
216 typedef float scalar_type;
219 gemm (
const char transA,
224 const scalar_type& alpha,
225 const scalar_type A[],
227 const scalar_type B[],
229 const scalar_type& beta,
233 return sgemm (transA, transB, m, n, k, alpha, A, lda, B, ldb, beta, C, ldc);
238 struct Gemm< ::Kokkos::complex<double> > {
239 typedef ::Kokkos::complex<double> scalar_type;
242 gemm (
const char transA,
247 const scalar_type& alpha,
248 const scalar_type A[],
250 const scalar_type B[],
252 const scalar_type& beta,
256 return zgemm (transA, transB, m, n, k, alpha, A, lda, B, ldb, beta, C, ldc);
262 template<
class ViewType1,
265 class CoefficientType>
267 gemm (
const char transA,
269 const CoefficientType& alpha,
272 const CoefficientType& beta,
275 typedef CoefficientType scalar_type;
277 typedef int index_type;
279 const index_type lda = getStride2DView<ViewType1, index_type> (A);
280 const index_type ldb = getStride2DView<ViewType2, index_type> (B);
281 const index_type ldc = getStride2DView<ViewType3, index_type> (C);
283 const index_type m =
static_cast<index_type
> (C.dimension_0 ());
284 const index_type n =
static_cast<index_type
> (C.dimension_1 ());
285 const bool noTransA = (transA ==
'N' || transA ==
'n');
286 const index_type k =
static_cast<index_type
> (noTransA ?
289 impl_type::gemm (transA, transB, m, n, k,
290 alpha, A.data (), lda,
292 beta, C.data (), ldc);
300 #endif // TPETRA_DETAILS_LIBGEMM_HPP Namespace Tpetra contains the class and methods constituting the Tpetra library.
Type traits for Tpetra's BLAS wrappers; an implementation detail of Tpetra::MultiVector.
Implementation details of Tpetra.
Do BLAS libraries (all that are compliant with the BLAS Standard) support the given "scalar" (matrix ...
For this set of template parameters, can we implement Gemm (see below) using any compliant BLAS libra...
Wrapper for the above wrappers, templated on scalar type (the type of each entry in the matrices)...
Do BLAS libraries (all that are compliant with the BLAS Standard) support the given Kokkos array layo...