45 #include "Kokkos_Macros.hpp" 46 #ifdef KOKKOS_ENABLE_CUDA 48 #endif // KOKKOS_ENABLE_CUDA 59 cgemm (
const char transA,
64 const Kokkos::complex<float>& alpha,
65 const Kokkos::complex<float> A[],
67 const Kokkos::complex<float> B[],
69 const Kokkos::complex<float>& beta,
70 Kokkos::complex<float> C[],
73 #ifdef KOKKOS_ENABLE_CUDA 74 const cuComplex alpha_c = make_cuFloatComplex (alpha.real (), alpha.imag ());
75 const cuComplex beta_c = make_cuFloatComplex (beta.real (), beta.imag ());
76 cublasCgemm (transA, transB,
78 alpha_c, reinterpret_cast<const cuComplex*> (A), lda,
79 reinterpret_cast<const cuComplex*> (B), ldb,
80 beta_c, reinterpret_cast<cuComplex*> (C), ldc);
81 cublasStatus info = cublasGetError ();
82 if (info != CUBLAS_STATUS_SUCCESS) {
83 std::ostringstream err;
84 err <<
"cublasCgemm failed with status " << info <<
".";
85 throw std::runtime_error (err.str ());
87 #else // NOT KOKKOS_ENABLE_CUDA 88 throw std::runtime_error (
"You must enable CUDA in your Trilinos build in " 89 "order to invoke cuBLAS functions in Tpetra.");
90 #endif // KOKKOS_ENABLE_CUDA 94 dgemm (
const char char_transA,
95 const char char_transB,
108 #ifdef KOKKOS_ENABLE_CUDA 109 ::cublasDgemm (char_transA, char_transB, m, n, k,
110 alpha, A, lda, B, ldb, beta, C, ldc);
111 cublasStatus info = cublasGetError ();
112 if (info != CUBLAS_STATUS_SUCCESS) {
113 std::ostringstream err;
114 err <<
"cublasDgemm failed with status " << info <<
".";
115 throw std::runtime_error (err.str ());
117 #else // NOT KOKKOS_ENABLE_CUDA 118 throw std::runtime_error (
"You must enable CUDA in your Trilinos build in " 119 "order to invoke cuBLAS functions in Tpetra.");
120 #endif // KOKKOS_ENABLE_CUDA 124 sgemm (
const char char_transA,
125 const char char_transB,
138 #ifdef KOKKOS_ENABLE_CUDA 139 ::cublasSgemm (char_transA, char_transB, m, n, k,
140 alpha, A, lda, B, ldb, beta, C, ldc);
141 cublasStatus info = cublasGetError ();
142 if (info != CUBLAS_STATUS_SUCCESS) {
143 std::ostringstream err;
144 err <<
"cublasSgemm failed with status " << info <<
".";
145 throw std::runtime_error (err.str ());
147 #else // NOT KOKKOS_ENABLE_CUDA 148 throw std::runtime_error (
"You must enable CUDA in your Trilinos build in " 149 "order to invoke cuBLAS functions in Tpetra.");
150 #endif // KOKKOS_ENABLE_CUDA 154 zgemm (
const char transA,
159 const Kokkos::complex<double>& alpha,
160 const Kokkos::complex<double> A[],
162 const Kokkos::complex<double> B[],
164 const Kokkos::complex<double>& beta,
165 Kokkos::complex<double> C[],
168 #ifdef KOKKOS_ENABLE_CUDA 169 const cuDoubleComplex alpha_c =
170 make_cuDoubleComplex (alpha.real (), alpha.imag ());
171 const cuDoubleComplex beta_c =
172 make_cuDoubleComplex (beta.real (), beta.imag ());
173 cublasZgemm (transA, transB,
175 alpha_c, reinterpret_cast<const cuDoubleComplex*> (A), lda,
176 reinterpret_cast<const cuDoubleComplex*> (B), ldb,
177 beta_c, reinterpret_cast<cuDoubleComplex*> (C), ldc);
178 cublasStatus info = cublasGetError ();
179 if (info != CUBLAS_STATUS_SUCCESS) {
180 std::ostringstream err;
181 err <<
"cublasCgemm failed with status " << info <<
".";
182 throw std::runtime_error (err.str ());
184 #else // NOT KOKKOS_ENABLE_CUDA 185 throw std::runtime_error (
"You must enable CUDA in your Trilinos build in " 186 "order to invoke cuBLAS functions in Tpetra.");
187 #endif // KOKKOS_ENABLE_CUDA Namespace Tpetra contains the class and methods constituting the Tpetra library.
Implementation details of Tpetra.
Implementation detail of Tpetra::MultiVector.