00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef __SUPERLU_UTIL
00010 #define __SUPERLU_UTIL
00011
00012 #include <stdio.h>
00013 #include <stdlib.h>
00014 #include <string.h>
00015
00016
00017
00018 #ifndef USER_ABORT
00019 #define USER_ABORT(msg) superlu_abort_and_exit(msg)
00020 #endif
00021
00022 #define SUPERLU_ABORT(err_msg) \
00023 { char msg[256];\
00024 sprintf(msg,"%s at line %d in file %s\n",err_msg,__LINE__, __FILE__);\
00025 USER_ABORT(msg); }
00026
00027
00028 #ifndef USER_MALLOC
00029 #define USER_MALLOC(size) superlu_malloc(size)
00030 #endif
00031
00032 #define SUPERLU_MALLOC(size) USER_MALLOC(size)
00033
00034 #ifndef USER_FREE
00035 #define USER_FREE(addr) superlu_free(addr)
00036 #endif
00037
00038 #define SUPERLU_FREE(addr) USER_FREE(addr)
00039
00040 #define MAX(x, y) ( (x) > (y) ? (x) : (y) )
00041 #define MIN(x, y) ( (x) < (y) ? (x) : (y) )
00042 #define SUPERLU_MAX(x, y) ( (x) > (y) ? (x) : (y) )
00043 #define SUPERLU_MIN(x, y) ( (x) < (y) ? (x) : (y) )
00044
00045
00046
00047
00048 #define L_SUB_START(col) ( Lstore->rowind_colbeg[col] )
00049 #define L_SUB_END(col) ( Lstore->rowind_colend[col] )
00050 #define L_SUB(ptr) ( Lstore->rowind[ptr] )
00051 #define L_NZ_START(col) ( Lstore->nzval_colbeg[col] )
00052 #define L_NZ_END(col) ( Lstore->nzval_colend[col] )
00053 #define L_FST_SUPC(superno) ( Lstore->sup_to_colbeg[superno] )
00054 #define L_LAST_SUPC(superno) ( Lstore->sup_to_colend[superno] )
00055 #define U_NZ_START(col) ( Ustore->colbeg[col] )
00056 #define U_NZ_END(col) ( Ustore->colend[col] )
00057 #define U_SUB(ptr) ( Ustore->rowind[ptr] )
00058
00059 #define SUPER_REP(s) ( xsup_end[s]-1 )
00060 #define SUPER_FSUPC(s) ( xsup[s] )
00061 #define SINGLETON(s) ( (xsup_end[s] - xsup[s]) == 1 )
00062 #define ISPRUNED(j) ( ispruned[j] )
00063 #define STATE(j) ( pxgstrf_shared->pan_status[j].state )
00064 #define DADPANEL(j) ( etree[j + pxgstrf_shared->pan_status[j].size-1] )
00065
00066 #ifdef PROFILE
00067 #define TIC(t) t = SuperLU_timer_()
00068 #define TOC(t2, t1) t2 = SuperLU_timer_() - t1
00069 #else
00070 #define TIC(t)
00071 #define TOC(t2, t1)
00072 #endif
00073
00074
00075
00076
00077 #define EMPTY (-1)
00078 #define FALSE 0
00079 #define TRUE 1
00080
00081
00082
00083
00084 typedef enum {NO, YES} yes_no_t;
00085 typedef enum {NOTRANS, TRANS, CONJ} trans_t;
00086 typedef enum {DOFACT, EQUILIBRATE, FACTORED} fact_t;
00087 typedef enum {NATURAL, MMD_ATA, MMD_AT_PLUS_A, COLAMD,
00088 METIS_AT_PLUS_A, PARMETIS, MY_PERMC} colperm_t;
00089 typedef enum {NOEQUIL, ROW, COL, BOTH} equed_t;
00090 typedef enum {LUSUP, UCOL, LSUB, USUB} MemType;
00091
00092
00093
00094 #define NO_MARKER 3
00095
00096 #define LOCOL 70
00097 #define HICOL 78
00098 #define BADROW 44
00099 #define BADCOL 35
00100 #define BADPAN BADCOL
00101 #define BADREP 35
00102
00103
00104
00105
00106 typedef float flops_t;
00107 typedef unsigned char Logical;
00108
00109 #if ( MACH==DEC || MACH==PTHREAD )
00110 #include <pthread.h>
00111 typedef pthread_mutex_t mutex_t;
00112 #elif ( MACH==SGI || MACH==ORIGIN )
00113 typedef int mutex_t;
00114 #elif ( MACH==CRAY_PVP || MACH==OPENMP )
00115 typedef int mutex_t;
00116 #endif
00117
00118
00119 typedef enum {
00120 RELAX,
00121 COLPERM,
00122 ETREE,
00123 EQUIL,
00124 FINDDOMAIN,
00125 FACT,
00126 DFS,
00127 FLOAT,
00128 TRSV,
00129 GEMV,
00130 RCOND,
00131 TRISOLVE,
00132 SOLVE,
00133 REFINE,
00134 FERR,
00135 NPHASES
00136 } PhaseType;
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252 typedef struct {
00253 int_t nprocs;
00254 fact_t fact;
00255 trans_t trans;
00256 yes_no_t refact;
00257 int_t panel_size;
00258 int_t relax;
00259 double diag_pivot_thresh;
00260 double drop_tol;
00261 colperm_t ColPerm;
00262 yes_no_t usepr;
00263 yes_no_t SymmetricMode;
00264 yes_no_t PrintStat;
00265
00266
00267 int_t *perm_c;
00268 int_t *perm_r;
00269 void *work;
00270 int_t lwork;
00271
00272
00273
00274
00275
00276
00277 int_t *etree;
00278 int_t *colcnt_h;
00279 int_t *part_super_h;
00280 } superlumt_options_t;
00281
00282
00283
00284
00285
00286
00287 typedef struct {
00288 int_t panels;
00289 float fcops;
00290 double fctime;
00291 int_t skedwaits;
00292 double skedtime;
00293 double cs_time;
00294 double spintime;
00295 int_t pruned;
00296 int_t unpruned;
00297 } procstat_t;
00298
00299
00300
00301
00302 typedef struct {
00303 int_t size;
00304 int_t pnum;
00305 double starttime;
00306 double fctime;
00307 float flopcnt;
00308 int_t pipewaits;
00309 double spintime;
00310 } panstat_t;
00311
00312
00313 typedef enum {NOPIPE, DADPAN, PIPE} how_selected_t;
00314
00315
00316 typedef struct e_node {
00317 int_t size;
00318 void *mem;
00319 } ExpHeader;
00320
00321
00322 typedef struct {
00323 float for_lu;
00324 float total_needed;
00325 int_t expansions;
00326 } superlu_memusage_t;
00327
00328 typedef struct {
00329 flops_t flops;
00330 int_t nzs;
00331 double fctime;
00332 } stat_relax_t;
00333
00334 typedef struct {
00335 flops_t flops;
00336 int_t nzs;
00337 double fctime;
00338 } stat_col_t;
00339
00340 typedef struct {
00341 int_t ncols;
00342 flops_t flops;
00343 int_t nzs;
00344 double fctime;
00345 } stat_snode_t;
00346
00347
00348
00349
00350 typedef struct {
00351 float est;
00352 float pdiv;
00353 } cp_panel_t;
00354
00355 typedef struct {
00356 float eft;
00357 float pmod;
00358 } desc_eft_t;
00359
00360
00361 typedef struct {
00362 int_t *panel_histo;
00363 double *utime;
00364 flops_t *ops;
00365 procstat_t *procstat;
00366 panstat_t *panstat;
00367 int_t num_panels;
00368 float dom_flopcnt;
00369 float flops_last_P_panels;
00370
00371 stat_relax_t *stat_relax;
00372 stat_col_t *stat_col;
00373 stat_snode_t *stat_snode;
00374 int_t *panhows;
00375 cp_panel_t *cp_panel;
00376 desc_eft_t *desc_eft;
00377 int_t *cp_firstkid, *cp_nextkid;
00378 int_t *height;
00379 float *flops_by_height;
00380 } Gstat_t;
00381
00382 struct Branch {
00383 int_t root, first_desc, which_bin;
00384 struct Branch *next;
00385 };
00386
00387
00388 #if 0
00389
00390
00391 int_t no_panels;
00392 float sum_w;
00393 float sum_np_w;
00394 int_t max_np;
00395 int_t no_sups;
00396 float sum_sup;
00397 int_t max_sup;
00398 flops_t reuse_flops;
00399 float reuse_data;
00400
00401
00402 int_t num_blas;
00403 int_t max_blas_n;
00404 int_t min_blas_n;
00405 float sum_blas_n;
00406 int_t max_gemv_m;
00407 int_t min_gemv_m;
00408 float sum_gemv_m;
00409 int_t lda_blas_m;
00410 int_t lda_blas_n;
00411 flops_t *gemv_ops;
00412 flops_t *trsv_ops;
00413
00414 #define i_trsv_ops(i) trsv_ops[i]
00415 #define ij_gemv_ops(i,j) gemv_ops[j*lda_blas_m + i]
00416
00417 #endif
00418
00419
00420
00421
00422
00423
00424 #ifdef __cplusplus
00425 extern "C" {
00426 #endif
00427
00428 extern int xerbla_ (char *, int *);
00429 extern void superlu_abort_and_exit(char*);
00430 extern void *superlu_malloc (size_t);
00431 extern void superlu_free (void*);
00432 extern void PrintStat(Gstat_t *);
00433 extern int_t ParallelProfile(const int_t, const int_t, const int_t,
00434 const int_t procs, Gstat_t *);
00435
00436 #ifdef __cplusplus
00437 }
00438 #endif
00439
00440 #endif
00441