mirror of
https://gitlab.com/scemama/qp_plugins_scemama.git
synced 2024-11-09 07:33:41 +01:00
Compare commits
No commits in common. "4d2adddbd9d6547999ad330245dca463ab806300" and "29903111f4169e0d019f56e0cdc242e32d931ce7" have entirely different histories.
4d2adddbd9
...
29903111f4
@ -5,7 +5,6 @@
|
|||||||
#include <cublas_v2.h>
|
#include <cublas_v2.h>
|
||||||
#include <cuda_runtime.h>
|
#include <cuda_runtime.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include "gpu.h"
|
|
||||||
|
|
||||||
#define BLOCK_SIZE 16
|
#define BLOCK_SIZE 16
|
||||||
|
|
||||||
@ -28,13 +27,13 @@ void gpu_dgemm(char transa, char transb, int m, int n, int k, double alpha,
|
|||||||
cublasOperation_t ta, tb;
|
cublasOperation_t ta, tb;
|
||||||
|
|
||||||
if (transa == 'N') {
|
if (transa == 'N') {
|
||||||
cudaStat = gpu_malloc((void**)&d_A, (size_t) lda*k*sizeof(double));
|
cudaStat = cudaMalloc((void**)&d_A, (size_t) lda*k*sizeof(double));
|
||||||
assert(cudaStat == cudaSuccess);
|
assert(cudaStat == cudaSuccess);
|
||||||
cudaStat = cublasSetMatrix(m, k, sizeof(double), A, lda, d_A, lda);
|
cudaStat = cublasSetMatrix(m, k, sizeof(double), A, lda, d_A, lda);
|
||||||
assert(cudaStat == cudaSuccess);
|
assert(cudaStat == cudaSuccess);
|
||||||
ta = CUBLAS_OP_N;
|
ta = CUBLAS_OP_N;
|
||||||
} else {
|
} else {
|
||||||
cudaStat = gpu_malloc((void**)&d_A, (size_t) lda*m*sizeof(double));
|
cudaStat = cudaMalloc((void**)&d_A, (size_t) lda*m*sizeof(double));
|
||||||
assert(cudaStat == cudaSuccess);
|
assert(cudaStat == cudaSuccess);
|
||||||
cudaStat = cublasSetMatrix(k, m, sizeof(double), A, lda, d_A, lda);
|
cudaStat = cublasSetMatrix(k, m, sizeof(double), A, lda, d_A, lda);
|
||||||
assert(cudaStat == cudaSuccess);
|
assert(cudaStat == cudaSuccess);
|
||||||
@ -42,20 +41,20 @@ void gpu_dgemm(char transa, char transb, int m, int n, int k, double alpha,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (transb == 'N') {
|
if (transb == 'N') {
|
||||||
cudaStat = gpu_malloc((void**)&d_B, (size_t) ldb*n*sizeof(double));
|
cudaStat = cudaMalloc((void**)&d_B, (size_t) ldb*n*sizeof(double));
|
||||||
assert(cudaStat == cudaSuccess);
|
assert(cudaStat == cudaSuccess);
|
||||||
cudaStat = cublasSetMatrix(k, n, sizeof(double), B, ldb, d_B, ldb);
|
cudaStat = cublasSetMatrix(k, n, sizeof(double), B, ldb, d_B, ldb);
|
||||||
assert(cudaStat == cudaSuccess);
|
assert(cudaStat == cudaSuccess);
|
||||||
tb = CUBLAS_OP_N;
|
tb = CUBLAS_OP_N;
|
||||||
} else {
|
} else {
|
||||||
cudaStat = gpu_malloc((void**)&d_B, (size_t) ldb*k*sizeof(double));
|
cudaStat = cudaMalloc((void**)&d_B, (size_t) ldb*k*sizeof(double));
|
||||||
assert(cudaStat == cudaSuccess);
|
assert(cudaStat == cudaSuccess);
|
||||||
cudaStat = cublasSetMatrix(n, k, sizeof(double), B, ldb, d_B, ldb);
|
cudaStat = cublasSetMatrix(n, k, sizeof(double), B, ldb, d_B, ldb);
|
||||||
assert(cudaStat == cudaSuccess);
|
assert(cudaStat == cudaSuccess);
|
||||||
tb = CUBLAS_OP_T;
|
tb = CUBLAS_OP_T;
|
||||||
}
|
}
|
||||||
|
|
||||||
cudaStat = gpu_malloc((void**)&d_C, (size_t) ldc*n*sizeof(double));
|
cudaStat = cudaMalloc((void**)&d_C, (size_t) ldc*n*sizeof(double));
|
||||||
assert(cudaStat == cudaSuccess);
|
assert(cudaStat == cudaSuccess);
|
||||||
if (beta != 0.) {
|
if (beta != 0.) {
|
||||||
cudaStat = cublasSetMatrix(m, n, sizeof(double), C, ldc, d_C, ldc);
|
cudaStat = cublasSetMatrix(m, n, sizeof(double), C, ldc, d_C, ldc);
|
||||||
|
Loading…
Reference in New Issue
Block a user