39 USAGE(
"GEMM",
"alpha beta M N K LDA LDB LDC",
40 " - alpha : alpha coefficient\n"
41 " - beta : beta coefficient\n"
42 " - M : number of rows of matrices A and C\n"
43 " - N : number of columns of matrices B and C\n"
44 " - K : number of columns of matrix A / number of rows of matrix B\n"
45 " - LDA : leading dimension of matrix A\n"
46 " - LDB : leading dimension of matrix B\n"
47 " - LDC : leading dimension of matrix C\n");
53 int M = atoi(argv[2]);
54 int N = atoi(argv[3]);
55 int K = atoi(argv[4]);
56 int LDA = atoi(argv[5]);
57 int LDB = atoi(argv[6]);
58 int LDC = atoi(argv[7]);
63 int LDAxK = LDA*
max(M,K);
64 int LDBxN = LDB*
max(K,N);
74 if ((!A)||(!
B)||(!Cinit)||(!Cfinal)){
75 printf(
"Out of Memory \n ");
79 eps = LAPACKE_slamch_work(
'e');
82 printf(
"------ TESTS FOR PLASMA CGEMM ROUTINE ------- \n");
83 printf(
" Size of the Matrix %d by %d\n", M, N);
85 printf(
" The matrix A is randomly generated for each test.\n");
86 printf(
"============\n");
87 printf(
" The relative machine precision (eps) is to be %e \n",eps);
88 printf(
" Computational tests pass if scaled residuals are less than 10.\n");
95 LAPACKE_clarnv_work(
IONE,
ISEED, LDAxK, A);
96 LAPACKE_clarnv_work(
IONE,
ISEED, LDBxN, B);
97 LAPACKE_clarnv_work(
IONE,
ISEED, LDCxN, C);
100 for (ta=0; ta<3; ta++) {
101 for (tb=0; tb<3; tb++) {
103 for (ta=0; ta<2; ta++) {
104 for (tb=0; tb<2; tb++) {
106 for ( i = 0; i < M; i++)
107 for ( j = 0; j < N; j++)
108 Cinit[LDC*j+i] = C[LDC*j+i];
109 for ( i = 0; i < M; i++)
110 for ( j = 0; j < N; j++)
111 Cfinal[LDC*j+i] = C[LDC*j+i];
114 PLASMA_cgemm(
trans[ta],
trans[tb], M, N, K, alpha, A, LDA, B, LDB, beta, Cfinal, LDC);
118 alpha, A, LDA, B, LDB, beta, Cinit, Cfinal, LDC);
120 if (info_solution == 0) {
121 printf(
"***************************************************\n");
122 printf(
" ---- TESTING CGEMM (%s, %s) ............... PASSED !\n",
transstr[ta],
transstr[tb]);
123 printf(
"***************************************************\n");
126 printf(
"************************************************\n");
127 printf(
" - TESTING CGEMM (%s, %s) ... FAILED !\n",
transstr[ta],
transstr[tb]);
128 printf(
"************************************************\n");
135 free(A); free(B); free(C);
136 free(Cinit); free(Cfinal);
151 float Anorm, Bnorm, Cinitnorm, Cplasmanorm, Clapacknorm, Rnorm, result;
155 float *work = (
float *)malloc(
max(K,
max(M, N))*
sizeof(float));
185 eps = LAPACKE_slamch_work(
'e');
187 printf(
"Rnorm %e, Anorm %e, Bnorm %e, Cinitnorm %e, Cplasmanorm %e, Clapacknorm %e\n",
188 Rnorm, Anorm, Bnorm, Cinitnorm, Cplasmanorm, Clapacknorm);
190 result = Rnorm / ((Anorm + Bnorm + Cinitnorm) * N * eps);
191 printf(
"============\n");
192 printf(
"Checking the norm of the difference against reference CGEMM \n");
193 printf(
"-- ||Cplasma - Clapack||_oo/((||A||_oo+||B||_oo+||C||_oo).N.eps) = %e \n",
196 if ( isnan(Rnorm) || isinf(Rnorm) || isnan(result) || isinf(result) || (result > 10.0) ) {
197 printf(
"-- The solution is suspicious ! \n");
201 printf(
"-- The solution is CORRECT ! \n");
207 return info_solution;