1 #include "../../../../include/monolish_blas.hpp"
2 #include "../../../internal/monolish_internal.hpp"
18 const double *Ad = A.
val.data();
19 const double *Bd = B.
val.data();
20 double *Cd = C.
val.data();
26 const double alpha = 1.0;
27 const double beta = 0.0;
32 internal::check_CUDA(cublasCreate(&h));
33 #pragma omp target data use_device_ptr(Ad, Bd, Cd)
36 internal::check_CUDA(cublasDgemm(h, CUBLAS_OP_N, CUBLAS_OP_N, n, m, k,
37 &alpha, Bd, n, Ad, k, &beta, Cd, n));
41 throw std::runtime_error(
"error USE_GPU is false, but gpu_status == true");
44 cblas_dgemm(CblasRowMajor, CblasNoTrans, CblasNoTrans, m, n, k, alpha, Ad,
45 k, Bd, n, beta, Cd, n);
62 const float *Ad = A.
val.data();
63 const float *Bd = B.
val.data();
64 float *Cd = C.
val.data();
70 const float alpha = 1.0;
71 const float beta = 0.0;
76 internal::check_CUDA(cublasCreate(&h));
77 #pragma omp target data use_device_ptr(Ad, Bd, Cd)
80 internal::check_CUDA(cublasSgemm(h, CUBLAS_OP_N, CUBLAS_OP_N, n, m, k,
81 &alpha, Bd, n, Ad, k, &beta, Cd, n));
85 throw std::runtime_error(
"error USE_GPU is false, but gpu_status == true");
88 cblas_sgemm(CblasRowMajor, CblasNoTrans, CblasNoTrans, m, n, k, alpha, Ad,
89 k, Bd, n, beta, Cd, n);