MAGMA  1.2.0
MatrixAlgebraonGPUandMulticoreArchitectures
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
time_zposv_tile.c
Go to the documentation of this file.
1 
6 #define _TYPE PLASMA_Complex64_t
7 #define _PREC double
8 #define _LAMCH LAPACKE_dlamch_work
9 
10 #define _NAME "PLASMA_zposv_Tile"
11 /* See Lawn 41 page 120 */
12 #define _FMULS (n * (1.0 / 6.0 * n + nrhs + 0.5) * n)
13 #define _FADDS (n * (1.0 / 6.0 * n + nrhs ) * n)
14 
15 #include "./timing.c"
16 
17 static int
18 RunTest(int *iparam, double *dparam, real_Double_t *t_)
19 {
20  PLASMA_Complex64_t *A, *AT, *b, *bT, *x;
21  real_Double_t t;
22  magma_desc_t *descA, *descB;
23  int nb, nb2, nt;
24  int n = iparam[TIMING_N];
25  int nrhs = iparam[TIMING_NRHS];
26  int check = iparam[TIMING_CHECK];
27  int lda = n;
28  int ldb = n;
29 
30  nb = iparam[TIMING_NB];
31  nb2 = nb * nb;
32  nt = n / nb + ((n % nb == 0) ? 0 : 1);
33 
34  /* Allocate Data */
35  AT = (PLASMA_Complex64_t *)malloc(nt*nt*nb2*sizeof(PLASMA_Complex64_t));
36  bT = (PLASMA_Complex64_t *)malloc(nt*nb2 *sizeof(PLASMA_Complex64_t));
37 
38  /* Check if unable to allocate memory */
39  if ( (!AT) || (!bT) ) {
40  printf("Out of Memory \n ");
41  exit(0);
42  }
43 
44  /* Initialize AT and bT for Symmetric Positif Matrix */
45  MAGMA_Desc_Create(&descA, AT, PlasmaComplexDouble, nb, nb, nb*nb, n, n, 0, 0, n, n);
46  MAGMA_Desc_Create(&descB, bT, PlasmaComplexDouble, nb, nb, nb*nb, n, nrhs, 0, 0, n, nrhs);
47  MAGMA_zplghe_Tile((double)n, descA, 51 );
48  LAPACKE_zlarnv_work(1, ISEED, nt*nb2, bT);
49 
50  /* Save AT and bT in lapack layout for check */
51  if ( check ) {
52  A = (PLASMA_Complex64_t *)malloc(lda*n *sizeof(PLASMA_Complex64_t));
53  b = (PLASMA_Complex64_t *)malloc(ldb*nrhs *sizeof(PLASMA_Complex64_t));
54  MAGMA_zTile_to_Lapack(descA, (void*)A, n);
55  MAGMA_zTile_to_Lapack(descB, (void*)b, n);
56  }
57 
58  /* PLASMA ZPOSV */
59  /* if (iparam[TIMING_BOUND]) */
60  /* starpu_bound_start(iparam[TIMING_BOUNDDEPS],iparam[TIMING_BOUNDDEPSPRIO]); */
61  t = -cWtime();
62  MAGMA_zposv_Tile(PlasmaUpper, descA, descB);
63  t += cWtime();
64  /* if (iparam[TIMING_BOUND]) */
65  /* starpu_bound_stop(); */
66  *t_ = t;
67 
68  /* Check the solution */
69  if (check)
70  {
71  x = (PLASMA_Complex64_t *)malloc(ldb*nrhs *sizeof(PLASMA_Complex64_t));
72  MAGMA_zTile_to_Lapack(descB, (void*)x, n);
73 
74  dparam[TIMING_RES] = zcheck_solution(n, n, nrhs, A, lda, b, x, ldb,
75  &(dparam[TIMING_ANORM]), &(dparam[TIMING_BNORM]),
76  &(dparam[TIMING_XNORM]));
77  free(A); free(b); free(x);
78  }
79 
80  MAGMA_Desc_Destroy(&descA);
81  MAGMA_Desc_Destroy(&descB);
82 
83  free(AT); free(bT);
84 
85  return 0;
86 }