Skip to content

Commit

Permalink
Benchmarking Gemm
Browse files Browse the repository at this point in the history
  • Loading branch information
SGo-Go committed Nov 4, 2013
1 parent 672cafb commit f1cd9b3
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
27 changes: 27 additions & 0 deletions bench/hybrid/hybrid_bench.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ int process(int threads, int tests, int n_process, int L_first)
scalar_t *A = 0, *tau = 0;
scalar_t *hA = 0;

#ifdef BENCH_GEMM
scalar_t *dX, *dW, *dQ;
int lddq, ldbottom;
#endif

/************************************************************
* Define matrix sizes for benchmarking
************************************************************/
Expand Down Expand Up @@ -112,10 +117,21 @@ int process(int threads, int tests, int n_process, int L_first)
hA = A;
#endif

#ifdef BENCH_GEMM
lddq = GET_LD_DEV(2*n); ldbottom = GET_LD_DEV(L*n);

dQ = dwork;
dW = dwork + 2*n*lddq;
dX = dwork + 2*n*lddq + 2*n*ldbottom;
#endif

/************************************************************
* Title string in tabular output
************************************************************/
MESSAGE(FORMAT_TITLE_SIZE" " );
#ifdef BENCH_GEMM
MESSAGE(FORMAT_TITLE_PARAM(GEMM_GPU)" ");
#endif
MESSAGE(FORMAT_TITLE_PARAM(BSOFTRI_HYB)" ");
MESSAGE(FORMAT_TITLE_PARAM(BSOI_HYB)" ");
#ifdef BENCH_CPU_BSOFI
Expand All @@ -136,6 +152,17 @@ int process(int threads, int tests, int n_process, int L_first)
MATR_INIT(n, L, A, lda);
MESSAGE( FORMAT_SIZE " ", n, L);

/********************* bench xGEMM ************************/
#ifdef BENCH_GEMM
cudaDeviceSynchronize();
BENCH((FLOPS_DGEMM((double)L*n, (double)2*n, (double)n)),
cublasXgemm ('N', 'T', L*n, 2*n, n, 1,
dW, ldbottom,
dQ, lddq, 0,
dX, ldbottom);
cudaDeviceSynchronize());
#endif

/********************* CPU bench ****************************/
#ifdef BENCH_CPU_BSOFI
lapackXlacpy('A', N, N, A, lda, hA, lda);
Expand Down
2 changes: 2 additions & 0 deletions bench/hybrid/setup.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
/** Output control: report or console (console is default) */
#define MAKE_BENCH_REPORT

#define BENCH_GEMM

/** Control if CPU routines benchmarking */
/* #define BENCH_CPU_BSOFI */
#undef BENCH_CPU_BSOFI
Expand Down

0 comments on commit f1cd9b3

Please sign in to comment.