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
timing.h
Go to the documentation of this file.
1 #ifndef IPARAM_H
2 #define IPARAM_H
3 
4 typedef double real_Double_t;
5 
6 enum iparam_t {
7  IPARAM_THRDNBR, /* Number of cores */
8  IPARAM_THRDNBR_SUBGRP, /* Number of cores in a subgroup (NUMA node) */
9  IPARAM_SCHEDULER, /* What scheduler do we choose (dyn, stat) */
10  IPARAM_M, /* Number of rows of the matrix */
11  IPARAM_N, /* Number of columns of the matrix */
12  IPARAM_K, /* RHS or K */
13  IPARAM_LDA, /* Leading dimension of A */
14  IPARAM_LDB, /* Leading dimension of B */
15  IPARAM_LDC, /* Leading dimension of C */
16  IPARAM_IB, /* Inner-blocking size */
17  IPARAM_NB, /* Number of columns in a tile */
18  IPARAM_MB, /* Number of rows in a tile */
19  IPARAM_NITER, /* Number of iteration of each test */
20  IPARAM_WARMUP, /* Run one test to load dynamic libraries */
21  IPARAM_CHECK, /* Checking activated or not */
22  IPARAM_VERBOSE, /* How much noise do we want? */
23  IPARAM_AUTOTUNING, /* Disable/enable autotuning */
24  IPARAM_INPUTFMT, /* Input format (Use only for getmi/gecfi) */
25  IPARAM_OUTPUTFMT, /* Output format (Use only for getmi/gecfi) */
26  IPARAM_TRACE, /* Generate trace on the first non warmup run */
27  IPARAM_DAG, /* Do we require to output the DOT file? */
28  IPARAM_ASYNC, /* Asynchronous calls */
29  IPARAM_MX, /* */
30  IPARAM_NX, /* */
31  IPARAM_RHBLK, /* Householder reduction parameter for QR/LQ */
33 };
34 
42 };
43 
44 #define PASTE_CODE_IPARAM_LOCALS(iparam) \
45  double t; \
46  int64_t M = iparam[IPARAM_M]; \
47  int64_t N = iparam[IPARAM_N]; \
48  int64_t K = iparam[IPARAM_K]; \
49  int64_t NRHS = K; \
50  int64_t LDA = max(M, iparam[IPARAM_LDA]); \
51  int64_t LDB = max(N, iparam[IPARAM_LDB]); \
52  int64_t LDC = max(K, iparam[IPARAM_LDC]); \
53  int64_t IB = iparam[IPARAM_IB]; \
54  int64_t MB = iparam[IPARAM_MB]; \
55  int64_t NB = iparam[IPARAM_NB]; \
56  int64_t MT = (M%MB==0) ? (M/MB) : (M/MB+1); \
57  int64_t NT = (N%NB==0) ? (N/NB) : (N/NB+1); \
58  int check = iparam[IPARAM_CHECK]; \
59  int loud = iparam[IPARAM_VERBOSE]; \
60  (void)M;(void)N;(void)K;(void)NRHS; \
61  (void)LDA;(void)LDB;(void)LDC; \
62  (void)IB;(void)MB;(void)NB;(void)MT;(void)NT; \
63  (void)check;(void)loud;
64 
65 /* Paste code to allocate a matrix in desc if cond_init is true */
66 #define PASTE_CODE_ALLOCATE_MATRIX_TILE(_desc_, _cond_, _type_, _type2_, _lda_, _m_, _n_) \
67  PLASMA_desc *_desc_ = NULL; \
68  if( _cond_ ) { \
69  _type_ *ptr = NULL; \
70  ptr = (_type_*)malloc( (_lda_) * (_n_) * sizeof(_type_) ); \
71  if ( ! ptr ) { \
72  fprintf(stderr, "Our of Memory for %s\n", #_desc_); \
73  return -1; \
74  } \
75  PLASMA_Desc_Create(&(_desc_), ptr, _type2_, MB, NB, MB*NB, _lda_, _n_, 0, 0, _m_, _n_); \
76  }
77 
78 #define PASTE_CODE_FREE_MATRIX(_desc_) \
79  if ( _desc_ != NULL ) { \
80  free(_desc_->mat); \
81  } \
82  PLASMA_Desc_Destroy( &_desc_ );
83 
84 #define PASTE_TILE_TO_LAPACK(_desc_, _name_, _cond_, _type_, _lda_, _n_) \
85  _type_ *_name_ = NULL; \
86  if ( _cond_ ) { \
87  _name_ = (_type_*)malloc( (_lda_) * (_n_) * sizeof(_type_)); \
88  if ( ! _name_ ) { \
89  fprintf(stderr, "Our of Memory for %s\n", #_name_); \
90  return -1; \
91  } \
92  PLASMA_Tile_to_Lapack(_desc_, (void*)_name_, _lda_); \
93  }
94 
95 #define PASTE_CODE_ALLOCATE_MATRIX(_name_, _cond_, _type_, _lda_, _n_) \
96  _type_ *_name_ = NULL; \
97  if( _cond_ ) { \
98  _name_ = (_type_*)malloc( (_lda_) * (_n_) * sizeof(_type_) ); \
99  if ( ! _name_ ) { \
100  fprintf(stderr, "Our of Memory for %s\n", #_name_); \
101  return -1; \
102  } \
103  }
104 
105 #define PASTE_CODE_ALLOCATE_COPY(_name_, _cond_, _type_, _orig_, _lda_, _n_) \
106  _type_ *_name_ = NULL; \
107  if( _cond_ ) { \
108  _name_ = (_type_*)malloc( (_lda_) * (_n_) * sizeof(_type_) ); \
109  if ( ! _name_ ) { \
110  fprintf(stderr, "Our of Memory for %s\n", #_name_); \
111  return -1; \
112  } \
113  memcpy(_name_, _orig_, (_lda_) * (_n_) * sizeof(_type_) ); \
114  }
115 
116 /*********************
117  *
118  * Macro for trace generation
119  *
120  */
121 #if defined(PLASMA_EZTRACE)
122 #define START_TRACING() \
123  if(iparam[IPARAM_TRACE] == 2) \
124  eztrace_start();
125 
126 #define STOP_TRACING() \
127  if(iparam[IPARAM_TRACE] == 2) \
128  eztrace_stop();
129 
130 #else /* defined(PLASMA_TRACE) */
131 
132 #define START_TRACING() \
133  if( 0 ) {};
134 
135 #define STOP_TRACING() \
136  if( 0 ) {};
137 
138 #endif /* defined(PLASMA_TRACE) */
139 
140 /*********************
141  *
142  * Macro for DAG generation
143  *
144  */
145 #define START_DAG() \
146  if ( iparam[IPARAM_DAG] == 2 ) \
147  PLASMA_Enable(PLASMA_DAG);
148 
149 #define STOP_DAG() \
150  if ( iparam[IPARAM_DAG] == 2 ) \
151  PLASMA_Disable(PLASMA_DAG);
152 
153 /*********************
154  *
155  * General Macros for timing
156  *
157  */
158 #define START_TIMING() \
159  START_DAG(); \
160  START_TRACING(); \
161  t = -cWtime();
162 
163 #define STOP_TIMING() \
164  t += cWtime(); \
165  STOP_TRACING(); \
166  STOP_DAG(); \
167  *t_ = t;
168 
169 #endif /* IPARAM_H */