27 double alpha,
double *
A,
int LDA,
28 double beta,
double *Cref,
double *Cplasma,
int LDC);
35 USAGE(
"SYRK",
"alpha beta M N LDA LDC",
36 " - alpha : alpha coefficient\n"
37 " - beta : beta coefficient\n"
38 " - N : number of columns and rows of matrix C and number of row of matrix A\n"
39 " - K : number of columns of matrix A\n"
40 " - LDA : leading dimension of matrix A\n"
41 " - LDC : leading dimension of matrix C\n");
45 double alpha = (double) atol(argv[0]);
46 double beta = (double) atol(argv[1]);
47 int N = atoi(argv[2]);
48 int K = atoi(argv[3]);
49 int LDA = atoi(argv[4]);
50 int LDC = atoi(argv[5]);
51 int NKmax =
max(N, K);
56 size_t LDAxK = LDA*NKmax;
59 double *
A = (
double *)malloc(LDAxK*
sizeof(
double));
60 double *
C = (
double *)malloc(LDCxN*
sizeof(
double));
61 double *Cinit = (
double *)malloc(LDCxN*
sizeof(
double));
62 double *Cfinal = (
double *)malloc(LDCxN*
sizeof(
double));
65 if ( (!A) || (!Cinit) || (!Cfinal) ){
66 printf(
"Out of Memory \n ");
70 eps = LAPACKE_dlamch_work(
'e');
73 printf(
"------ TESTS FOR PLASMA DSYRK ROUTINE ------- \n");
74 printf(
" Size of the Matrix A %d by %d\n", N, K);
76 printf(
" The matrix A is randomly generated for each test.\n");
77 printf(
"============\n");
78 printf(
" The relative machine precision (eps) is to be %e \n",eps);
79 printf(
" Computational tests pass if scaled residuals are less than 10.\n");
86 LAPACKE_dlarnv_work(
IONE,
ISEED, LDAxK, A);
93 memcpy(Cinit, C, LDCxN*
sizeof(
double));
94 memcpy(Cfinal, C, LDCxN*
sizeof(
double));
101 alpha, A, LDA, beta, Cinit, Cfinal, LDC);
103 if (info_solution == 0) {
104 printf(
"***************************************************\n");
105 printf(
" ---- TESTING DSYRK (%5s, %s) ........... PASSED !\n",
uplostr[u],
transstr[t]);
106 printf(
"***************************************************\n");
109 printf(
"************************************************\n");
110 printf(
" - TESTING DSYRK (%5s, %s) ... FAILED !\n",
uplostr[u],
transstr[t]);
111 printf(
"************************************************\n");
117 free(Cinit); free(Cfinal);
127 double alpha,
double *
A,
int LDA,
128 double beta,
double *Cref,
double *Cplasma,
int LDC)
131 double Anorm, Cinitnorm, Cplasmanorm, Clapacknorm, Rnorm;
135 double *work = (
double *)malloc(
max(N, K)*
sizeof(double));
145 N, K, (alpha), A, LDA, (beta), Cref, LDC);
149 cblas_daxpy(LDC*N, (beta_const), Cplasma, 1, Cref, 1);
153 eps = LAPACKE_dlamch_work(
'e');
155 printf(
"Rnorm %e, Anorm %e, Cinitnorm %e, Cplasmanorm %e, Clapacknorm %e\n",
156 Rnorm, Anorm, Cinitnorm, Cplasmanorm, Clapacknorm);
158 result = Rnorm / ((Anorm + Cinitnorm) * N * eps);
160 printf(
"============\n");
161 printf(
"Checking the norm of the difference against reference DSYRK \n");
162 printf(
"-- ||Cplasma - Clapack||_oo/((||A||_oo+||C||_oo).N.eps) = %e \n", result);
164 if ( isinf(Clapacknorm) || isinf(Cplasmanorm) || isnan(result) || isinf(result) || (result > 10.0) ) {
165 printf(
"-- The solution is suspicious ! \n");
169 printf(
"-- The solution is CORRECT ! \n");
175 return info_solution;