-
Notifications
You must be signed in to change notification settings - Fork 99
BLAS 3::trsm
Vinh Dang edited this page Feb 18, 2020
·
20 revisions
Header File: KokkosBlas3_trsm.hpp
Usage: KokkosBlas::trsm(side, uplo, trans, diag, alpha, A, B);
Triangular linear system solve with multiple right-hand-sides: op(A)*X = alpha*B
or X*op(A) = alpha*B
op(A)*X = alpha*B
if side
== "L" or "l"
X*op(A) = alpha*B
if side
== "R" or "r"
template<class AViewType,
class BViewType,
class CViewType>
void
gemm (const char transA[],
const char transB[],
typename AViewType::const_value_type& alpha,
const AViewType& A,
const BViewType& B,
typename CViewType::const_value_type& beta,
const CViewType& C)
- AViewType: 2-D
Kokkos::View
- BViewType: 2-D
Kokkos::View
- CViewType: Nonconst 2-D
Kokkos::View
- transA [in] "N" for non-transpose, "T" for transpose, "C" for conjugate transpose. All characters after the first are ignored. This works just like the BLAS routines.
- transB [in] "N" for non-transpose, "T" for transpose, "C" for conjugate transpose. All characters after the first are ignored. This works just like the BLAS routines.
- alpha [in] Input coefficient of A*x
- A [in] Input matrix, as a 2-D Kokkos::View
- B [in] Input matrix, as a 2-D Kokkos::View
- beta [in] Input coefficient of C
- C [in/out] Output vector, as a nonconst 2-D Kokkos::View
- For a given mode, the dimensions of the matrices must align as necessary for matrix multiplication
#include<Kokkos_Core.hpp>
#include<KokkosBlas3_gemm.hpp>
int main(int argc, char* argv[]) {
Kokkos::initialize();
int M = atoi(argv[1]);
int N = atoi(argv[2]);
Kokkos::View<double**> A("A",M,N);
Kokkos::View<double**> B("B",N,M);
Kokkos::View<double**> C("C",M,M);
Kokkos::deep_copy(A,1.0);
Kokkos::deep_copy(B,2.0);
const double alpha = double(1.0);
const double beta = double(0.0);
KokkosBlas::gemm("N","N",alpha,A,B,beta,C);
Kokkos::finalize();
}