PLASMA  2.4.5
PLASMA - Parallel Linear Algebra for Scalable Multi-core Architectures
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
time_dgesv.c
Go to the documentation of this file.
1 
6 #define _TYPE double
7 #define _PREC double
8 #define _LAMCH LAPACKE_dlamch_work
9 
10 #define _NAME "PLASMA_dgesv"
11 /* See Lawn 41 page 120 */
12 #define _FMULS (FMULS_GETRF( N, N ) + FMULS_GETRS( N, NRHS ))
13 #define _FADDS (FADDS_GETRF( N, N ) + FADDS_GETRS( N, NRHS ))
14 
15 #include "./timing.c"
16 
17 static int
18 RunTest(int *iparam, double *dparam, real_Double_t *t_)
19 {
20  PASTE_CODE_IPARAM_LOCALS( iparam );
21 
22  if ( M != N ) {
23  fprintf(stderr, "This timing works only with M == N\n");
24  return -1;
25  }
26 
27  /* Allocate Data */
28  PASTE_CODE_ALLOCATE_MATRIX( A, 1, double, LDA, N );
29  PASTE_CODE_ALLOCATE_MATRIX( X, 1, double, LDB, NRHS );
30  PASTE_CODE_ALLOCATE_MATRIX( piv, 1, int, N, 1 );
31 
32  /* Initialiaze Data */
33  PLASMA_dplrnt( N, N, A, LDA, 51 );
34  PLASMA_dplrnt( N, NRHS, X, LDB, 5673 );
35 
36  /* Save A and b */
37  PASTE_CODE_ALLOCATE_COPY( Acpy, check, double, A, LDA, N );
38  PASTE_CODE_ALLOCATE_COPY( B, check, double, X, LDB, NRHS );
39 
40  START_TIMING();
41  PLASMA_dgesv( N, NRHS, A, N, piv, X, LDB );
42  STOP_TIMING();
43 
44  /* Check the solution */
45  if (check)
46  {
47  dparam[IPARAM_RES] = d_check_solution(N, N, NRHS, Acpy, LDA, B, X, LDB,
48  &(dparam[IPARAM_ANORM]),
49  &(dparam[IPARAM_BNORM]),
50  &(dparam[IPARAM_XNORM]));
51  free(Acpy); free(B);
52  }
53 
54  free( piv );
55  free( X );
56  free( A );
57 
58  return 0;
59 }