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
testing_cmain.c
Go to the documentation of this file.
1 
15 #include <stdlib.h>
16 #include <stdio.h>
17 #include <string.h>
18 #include <plasma.h>
19 #undef REAL
20 #define COMPLEX
21 #undef DOUBLE
22 #define SINGLE
23 #include "testing_cmain.h"
24 
25 int IONE = 1;
26 int ISEED[4] = {0,0,0,1}; /* initial seed for clarnv() */
27 
29 int side[2] = { PlasmaLeft, PlasmaRight };
33 int itype[3] = { 1, 2, 3 };
35 
36 char *formatstr[6]= { "CM", "RM", "CCRB", "CRRB", "RCRB", "RRRB"};
37 char *sidestr[2] = { "Left ", "Right" };
38 char *uplostr[2] = { "Upper", "Lower" };
39 char *diagstr[2] = { "NonUnit", "Unit " };
40 char *transstr[3] = { "N", "T", "H" };
41 char *itypestr[3] = { "inv(U')xAxinv(U) or inv(L)xAxinv(L')", "UxAxU' or L'xAxL", "UxAxU' or L'xAxL" };
42 char *storevstr[2] = { "Rowwise", "Columnwise" };
43 
44 #define map_cm(m, n, i, j) ((i) + (j) * (m))
45 #define map_rm(m, n, i, j) ((i) * (n) + (j))
46 
47 int map_CM( int m, int n, int mb, int nb, int i, int j) { return map_cm(m, n, i, j); }
48 int map_RM( int m, int n, int mb, int nb, int i, int j) { return map_rm(m, n, i, j); }
49 int map_CCRB(int m, int n, int mb, int nb, int i, int j) {
50  int m0 = m - m%mb;
51  int n0 = n - n%nb;
52  if ( j < n0 )
53  if (i < m0)
54  /* Case in A11 */
55  return ( map_cm( m/mb, n/nb, i/mb, j/nb )*mb*nb + map_cm( mb, nb, i%mb, j%nb) );
56  else
57  /* Case in A21 */
58  return ( m0*n0 + ( (j/nb) * (nb*(m%mb)) ) + map_cm( m%mb, nb, i%mb, j%nb) );
59  else
60  if (i < m0)
61  /* Case in A12 */
62  return ( m*n0 + ( (i/mb) * (mb*(n%nb)) ) + map_cm( mb, n%nb, i%mb, j%nb) );
63  else
64  /* Case in A22 */
65  return ( m*n0 + (n-n0)*m0 + map_cm( m%mb, n%nb, i%mb, j%nb) );
66 }
67 
68 int map_CRRB(int m, int n, int mb, int nb, int i, int j) {
69  int m0 = m - m%mb;
70  int n0 = n - n%nb;
71  if ( j < n0 )
72  if (i < m0)
73  /* Case in A11 */
74  return ( map_cm( m/mb, n/nb, i/mb, j/nb )*mb*nb + map_rm( mb, nb, i%mb, j%nb) );
75  else
76  /* Case in A21 */
77  return ( m0*n0 + ( (j/nb) * (nb*(m%mb)) ) + map_rm( m%mb, nb, i%mb, j%nb) );
78  else
79  if (i < m0)
80  /* Case in A12 */
81  return ( m*n0 + ( (i/mb) * (mb*(n%nb)) ) + map_rm( mb, n%nb, i%mb, j%nb) );
82  else
83  /* Case in A22 */
84  return ( m*n0 + (n-n0)*m0 + map_rm( m%mb, n%nb, i%mb, j%nb) );
85 }
86 
87 int map_RCRB(int m, int n, int mb, int nb, int i, int j) {
88  int m0 = m - m%mb;
89  int n0 = n - n%nb;
90  if ( j < n0 )
91  if (i < m0)
92  /* Case in A11 */
93  return ( map_rm( m/mb, n/nb, i/mb, j/nb )*mb*nb + map_cm( mb, nb, i%mb, j%nb) );
94  else
95  /* Case in A21 */
96  return ( m0*n + ( (j/nb) * (nb*(m%mb)) ) + map_cm( m%mb, nb, i%mb, j%nb) );
97  else
98  if (i < m0)
99  /* Case in A12 */
100  return ( m0*n0 + ( (i/mb) * (mb*(n%nb)) ) + map_cm( mb, n%nb, i%mb, j%nb) );
101  else
102  /* Case in A22 */
103  return ( m*n0 + (n-n0)*m0 + map_cm( m%mb, n%nb, i%mb, j%nb) );
104 }
105 
106 int map_RRRB(int m, int n, int mb, int nb, int i, int j) {
107  int m0 = m - m%mb;
108  int n0 = n - n%nb;
109  if ( j < n0 )
110  if (i < m0)
111  /* Case in A11 */
112  return ( map_rm( m/mb, n/nb, i/mb, j/nb )*mb*nb + map_rm( mb, nb, i%mb, j%nb) );
113  else
114  /* Case in A21 */
115  return ( m0*n + ( (j/nb) * (nb*(m%mb)) ) + map_rm( m%mb, nb, i%mb, j%nb) );
116  else
117  if (i < m0)
118  /* Case in A12 */
119  return ( m0*n0 + ( (i/mb) * (mb*(n%nb)) ) + map_rm( mb, n%nb, i%mb, j%nb) );
120  else
121  /* Case in A22 */
122  return ( m*n0 + (n-n0)*m0 + map_rm( m%mb, n%nb, i%mb, j%nb) );
123 }
124 
126 
127 int main (int argc, char **argv)
128 {
129  int ncores, sched;
130  int info;
131  char func[32];
132 
133  /* Check for number of arguments*/
134  if ( argc < 4) {
135  printf(" Proper Usage is : ./ctesting ncores sched FUNC ...\n"
136  " - ncores : number of cores \n"
137  " - sched : 0 for static, 1 for dynamic\n"
138  " - FUNC : name of function to test\n");
139  exit(1);
140  }
141 
142  sscanf( argv[1], "%d", &ncores );
143  sscanf( argv[2], "%d", &sched );
144  sscanf( argv[3], "%s", func );
145 
146  PLASMA_Init(ncores);
147  if ( sched == 0 )
149  else
151 
152  argc -= 4;
153  argv += 4;
154  info = 0;
155 
156  /*
157  * Norms
158  */
159  if ( strcmp(func, "LANGE") == 0 ) {
160  info = testing_clange( argc, argv );
161  /*
162  * Blas Level 3
163  */
164  } else if ( strcmp(func, "GEMM") == 0 ) {
165  info = testing_cgemm( argc, argv );
166 #ifdef COMPLEX
167  } else if ( strcmp(func, "HEMM") == 0 ) {
168  info = testing_chemm( argc, argv );
169  } else if ( strcmp(func, "HERK") == 0 ) {
170  info = testing_cherk( argc, argv );
171  } else if ( strcmp(func, "HER2K") == 0 ) {
172  info = testing_cher2k( argc, argv );
173 #endif
174  } else if ( strcmp(func, "SYMM") == 0 ) {
175  info = testing_csymm( argc, argv );
176  } else if ( strcmp(func, "SYRK") == 0 ) {
177  info = testing_csyrk( argc, argv );
178  } else if ( strcmp(func, "SYR2K") == 0 ) {
179  info = testing_csyr2k( argc, argv );
180  } else if ( strcmp(func, "TRMM") == 0 ) {
181  info = testing_ctrmm( argc, argv );
182  } else if ( strcmp(func, "TRSM") == 0 ) {
183  info = testing_ctrsm( argc, argv );
184  } else if ( strcmp(func, "PEMV") == 0 ) {
185  info = testing_cpemv( argc, argv );
186  /*
187  * Linear system
188  */
189  } else if ( strcmp(func, "POSV") == 0 ) {
190  info = testing_cposv( argc, argv );
191  } else if ( strcmp(func, "GELS") == 0 ) {
192  info = testing_cgels( argc, argv );
193  } else if ( strcmp(func, "GESV") == 0 ) {
194  info = testing_cgesv( argc, argv );
195  /*
196  * Matrix inversion
197  */
198  } else if ( strcmp(func, "POTRI") == 0 ) {
199  info = testing_cpotri( argc, argv );
200  } else if ( strcmp(func, "GETRI") == 0 ) {
201  info = testing_cgetri( argc, argv );
202  /*
203  * Eigenvalue Problems
204  */
205  } else if ( strcmp(func, "HEEV") == 0 ) {
206  info = testing_cheev( argc, argv );
207  } else if ( strcmp(func, "HEGV") == 0 ) {
208  info = testing_chegv( argc, argv );
209  } else if ( strcmp(func, "HEGST") == 0 ) {
210  info = testing_chegst( argc, argv );
211  /*
212  * Singular Value Decomposition
213  */
214  } else if ( strcmp(func, "GESVD") == 0 ) {
215  info = testing_cgesvd( argc, argv );
216 #ifdef DOUBLE
217  /*
218  * Mixed precision
219  */
220  } else if ( strcmp(func, "CPOSV") == 0 ) {
221  info = testing_ccposv( argc, argv );
222  } else if ( strcmp(func, "CGESV") == 0 ) {
223  info = testing_ccgesv( argc, argv );
224  } else if ( strcmp(func, "CUNGESV") == 0 ) {
225  info = testing_ccungesv( argc, argv );
226 #endif
227  /* Layout Transformation */
228  } else if ( strcmp(func, "GECFI") == 0 ) {
229  info = testing_cgecfi( argc, argv );
230  } else if ( strcmp(func, "GETMI") == 0 ) {
231  info = testing_cgetmi( argc, argv );
232  } else {
233  fprintf(stderr, "Function unknown\n");
234  }
235 
236  if ( info == -1 ) {
237  printf( "TESTING %s FAILED : incorrect number of arguments\n", func);
238  } else if ( info == -2 ) {
239  printf( "TESTING %s FAILED : not enough memory\n", func);
240  }
241 
242  PLASMA_Finalize();
243 
244  return EXIT_SUCCESS;
245 }