00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef __SLU_MT_CDEFS
00014 #define __SLU_MT_CDEFS
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #if defined ( _SOLARIS )
00026 #include <thread.h>
00027 #include <sched.h>
00028 #elif defined( _DEC )
00029 #include <pthread.h>
00030 #include <unistd.h>
00031 #include <sys/mman.h>
00032 #elif defined ( _OPENMP )
00033 #include <omp.h>
00034 #elif defined ( _PTHREAD )
00035 #include <pthread.h>
00036 #elif defined ( _CRAY )
00037 #include <fortran.h>
00038 #include <string.h>
00039 #endif
00040
00041
00042 #ifdef _LONGINT
00043 typedef long long int int_t;
00044 #define IFMT "%lld"
00045 #else
00046 typedef int int_t;
00047 #define IFMT "%8d"
00048 #endif
00049
00050 #include "slu_mt_machines.h"
00051 #include "slu_mt_Cnames.h"
00052 #include "supermatrix.h"
00053 #include "slu_mt_util.h"
00054 #include "pxgstrf_synch.h"
00055
00056 #include "slu_scomplex.h"
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149 typedef struct {
00150 int_t *xsup;
00151 int_t *xsup_end;
00152 int_t *supno;
00153 int_t *lsub;
00154 int_t *xlsub;
00155 int_t *xlsub_end;
00156 complex *lusup;
00157 int_t *xlusup;
00158 int_t *xlusup_end;
00159 complex *ucol;
00160 int_t *usub;
00161 int_t *xusub;
00162 int_t *xusub_end;
00163 int_t nsuper;
00164 int_t nextl;
00165 int_t nextu;
00166 int_t nextlu;
00167 int_t nzlmax;
00168 int_t nzumax;
00169 int_t nzlumax;
00170
00171
00172
00173 int_t *map_in_sup;
00174
00175
00176
00177
00178
00179
00180
00181
00182 int_t dynamic_snode_bound;
00183
00184 } GlobalLU_t;
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194 typedef struct {
00195
00196
00197
00198 volatile int_t tasks_remain;
00199 int_t num_splits;
00200 queue_t taskq;
00201 mutex_t *lu_locks;
00202 volatile int_t *spin_locks;
00203 pan_status_t *pan_status;
00204 int_t *fb_cols;
00205
00206 int_t *inv_perm_c;
00207 int_t *inv_perm_r;
00208 int_t *xprune;
00209 int_t *ispruned;
00210 SuperMatrix *A;
00211 GlobalLU_t *Glu;
00212 Gstat_t *Gstat;
00213 int_t *info;
00214 } pxgstrf_shared_t;
00215
00216
00217 typedef struct {
00218 int_t pnum;
00219 int_t info;
00220 superlumt_options_t *superlumt_options;
00221 pxgstrf_shared_t *pxgstrf_shared;
00222 } pcgstrf_threadarg_t;
00223
00224
00225
00226
00227
00228
00229 #ifdef __cplusplus
00230 extern "C" {
00231 #endif
00232
00233
00234
00235
00236
00237 extern void
00238 pcgssv(int_t, SuperMatrix *, int_t *, int_t *, SuperMatrix *, SuperMatrix *,
00239 SuperMatrix *, int_t *);
00240 extern void
00241 pcgssvx(int_t, superlumt_options_t *, SuperMatrix *, int_t *, int_t *,
00242 equed_t *, float *, float *, SuperMatrix *, SuperMatrix *,
00243 SuperMatrix *, SuperMatrix *,
00244 float *, float *, float *, float *, superlu_memusage_t *,
00245 int_t *);
00246
00247
00248
00249
00250 extern void cgsequ (SuperMatrix *, float *, float *, float *,
00251 float *, float *, int_t *);
00252 extern void claqgs (SuperMatrix *, float *, float *, float,
00253 float, float, equed_t *);
00254 extern void cgscon (char *, SuperMatrix *, SuperMatrix *,
00255 float, float *, int_t *);
00256 extern float cPivotGrowth(int_t, SuperMatrix *, int_t *,
00257 SuperMatrix *, SuperMatrix *);
00258 extern void cgsrfs (trans_t, SuperMatrix *, SuperMatrix *, SuperMatrix *,
00259 int_t *, int_t *, equed_t, float *, float *, SuperMatrix *,
00260 SuperMatrix *, float *, float *, Gstat_t *, int_t *);
00261 extern int_t sp_ctrsv (char *, char *, char *, SuperMatrix *, SuperMatrix *,
00262 complex *, int_t *);
00263 extern int_t sp_cgemv (char *, complex, SuperMatrix *, complex *,
00264 int_t, complex, complex *, int_t);
00265 extern int_t sp_cgemm (char *, int_t, int_t, int_t, complex, SuperMatrix *,
00266 complex *, int_t, complex, complex *, int_t);
00267
00268
00269
00270
00271 extern void pxgstrf_scheduler (const int_t, const int_t, const int_t *,
00272 int_t *, int_t *, pxgstrf_shared_t *);
00273 extern int_t cParallelInit (int_t, pxgstrf_relax_t *, superlumt_options_t *,
00274 pxgstrf_shared_t *);
00275 extern int_t ParallelFinalize ();
00276 extern void pcgstrf_StackFree ();
00277 extern int_t queue_init (queue_t *, int_t);
00278 extern int_t queue_destroy (queue_t *);
00279 extern int_t EnqueueRelaxSnode (queue_t *, int_t, pxgstrf_relax_t *,
00280 pxgstrf_shared_t *);
00281 extern int_t EnqueueDomains(queue_t *, struct Branch *, pxgstrf_shared_t *);
00282 extern int_t Enqueue (queue_t *, qitem_t);
00283 extern int_t Dequeue (queue_t *, qitem_t *);
00284 extern int_t NewNsuper (const int_t, pxgstrf_shared_t *, int_t *);
00285 extern int_t lockon(int_t *);
00286 extern void PartDomains(const int_t, const float, SuperMatrix *, int_t *, int_t *);
00287
00288 extern void
00289 cCreate_CompCol_Matrix(SuperMatrix *, int_t, int_t, int_t, complex *,
00290 int_t *, int_t *, Stype_t, Dtype_t, Mtype_t);
00291 void
00292 cCreate_CompCol_Permuted(SuperMatrix *, int_t, int_t, int_t, complex *, int_t *,
00293 int_t *, int_t *, Stype_t, Dtype_t, Mtype_t);
00294 extern void
00295 cCopy_CompCol_Matrix(SuperMatrix *, SuperMatrix *);
00296 extern void
00297 cCreate_Dense_Matrix(SuperMatrix *, int_t, int_t, complex *, int_t,
00298 Stype_t, Dtype_t, Mtype_t);
00299 extern void
00300 cCreate_SuperNode_Matrix(SuperMatrix *, int_t, int_t, int_t, complex *, int_t *, int_t *,
00301 int_t *, int_t *, int_t *, Stype_t, Dtype_t, Mtype_t);
00302 extern void
00303 cCreate_SuperNode_Permuted(SuperMatrix *, int_t, int_t, int_t, complex *,
00304 int_t *, int_t *, int_t *, int_t *, int_t *, int_t *,
00305 int_t *, int_t *, Stype_t, Dtype_t, Mtype_t);
00306 extern void
00307 cCopy_Dense_Matrix(int_t, int_t, complex *, int_t, complex *, int_t);
00308
00309 extern void Destroy_SuperMatrix_Store(SuperMatrix *);
00310 extern void Destroy_CompCol_Matrix(SuperMatrix *);
00311 extern void Destroy_CompCol_Permuted(SuperMatrix *);
00312 extern void Destroy_CompCol_NCP(SuperMatrix *);
00313 extern void Destroy_SuperNode_Matrix(SuperMatrix *);
00314 extern void Destroy_SuperNode_SCP(SuperMatrix *);
00315
00316 extern void callocateA (int_t, int_t, complex **, int_t **, int_t **);
00317 extern void StatAlloc (const int_t, const int_t, const int_t, const int_t, Gstat_t*);
00318 extern void StatInit (const int_t, const int_t, Gstat_t*);
00319 extern void StatFree (Gstat_t*);
00320 extern void get_perm_c(int_t, SuperMatrix *, int_t *);
00321 extern void csp_colorder (SuperMatrix *, int_t *, superlumt_options_t *,
00322 SuperMatrix *);
00323 extern int_t sp_coletree (int_t *, int_t *, int_t *, int_t, int_t, int_t *);
00324 extern int_t cPresetMap (const int_t, SuperMatrix *, pxgstrf_relax_t *,
00325 superlumt_options_t *, GlobalLU_t *);
00326 extern int_t qrnzcnt (int_t, int_t, int_t *, int_t *, int_t *, int_t *, int_t *, int_t *,
00327 int_t *, int_t *, int_t *, int_t *);
00328 extern int_t DynamicSetMap(const int_t, const int_t, const int_t, pxgstrf_shared_t*);
00329 extern void pcgstrf (superlumt_options_t *, SuperMatrix *, int_t *,
00330 SuperMatrix *, SuperMatrix *, Gstat_t *, int_t *);
00331 extern void pcgstrf_init (int_t, fact_t, trans_t, yes_no_t, int_t, int_t, float, yes_no_t, double,
00332 int_t *, int_t *, void *, int_t, SuperMatrix *,
00333 SuperMatrix *, superlumt_options_t *, Gstat_t *);
00334 extern pcgstrf_threadarg_t*
00335 pcgstrf_thread_init (SuperMatrix *, SuperMatrix *, SuperMatrix *,
00336 superlumt_options_t*, pxgstrf_shared_t*, Gstat_t*, int_t*);
00337 extern void
00338 pcgstrf_thread_finalize (pcgstrf_threadarg_t *, pxgstrf_shared_t *,
00339 SuperMatrix *, int_t *, SuperMatrix *, SuperMatrix *);
00340 extern void pcgstrf_finalize(superlumt_options_t *, SuperMatrix *);
00341 extern void pxgstrf_finalize(superlumt_options_t *, SuperMatrix *);
00342 extern void pcgstrf_relax_snode (const int_t, superlumt_options_t *,
00343 pxgstrf_relax_t *);
00344 extern int_t
00345 pcgstrf_factor_snode (const int_t, const int_t, SuperMatrix *, const float,
00346 yes_no_t *, int_t *, int_t *, int_t*, int_t*, int_t*, int_t*,
00347 complex *, complex *, pxgstrf_shared_t *, int_t *);
00348 extern void
00349 pxgstrf_mark_busy_descends (int_t, int_t, int_t *, pxgstrf_shared_t *, int_t *, int_t *);
00350 extern int_t pcgstrf_snode_dfs (const int_t, const int_t, const int_t, const int_t *,
00351 const int_t *, const int_t *, int_t*, int_t *, int_t *,
00352 pxgstrf_shared_t *);
00353 extern int_t pcgstrf_snode_bmod (const int_t, const int_t, const int_t, const int_t,
00354 complex *, complex *, GlobalLU_t*, Gstat_t*);
00355 extern void pcgstrf_panel_dfs (const int_t, const int_t, const int_t, const int_t,
00356 SuperMatrix *, int_t*, int_t*, int_t*, int_t*, int_t*,
00357 int_t*, int_t*, int_t*, int_t*, int_t*, int_t*, int_t*, int_t*,
00358 complex*, GlobalLU_t *);
00359 extern void pcgstrf_panel_bmod (const int_t, const int_t, const int_t, const int_t,
00360 const int_t, int_t*, int_t*, int_t*, int_t*, int_t*, int_t*,
00361 int_t*, int_t*, complex*, complex*,
00362 pxgstrf_shared_t *);
00363 extern void pcgstrf_bmod1D (const int_t, const int_t, const int_t, const int_t,
00364 const int_t, const int_t, const int_t, int_t, int_t,
00365 int_t *, int_t *, int_t *, int_t *, complex *, complex *,
00366 GlobalLU_t *, Gstat_t *);
00367 extern void pcgstrf_bmod2D (const int_t, const int_t, const int_t, const int_t,
00368 const int_t, const int_t, const int_t, int_t, int_t,
00369 int_t *, int_t *, int_t *, int_t *, complex *, complex *,
00370 GlobalLU_t *, Gstat_t *);
00371 extern void pcgstrf_bmod1D_mv2 (const int_t, const int_t, const int_t, const int_t,
00372 const int_t, const int_t, const int_t, int_t, int_t,
00373 int_t *, int_t *, int_t *, int_t *, complex *,
00374 complex *, GlobalLU_t *, Gstat_t *);
00375 extern void pcgstrf_bmod2D_mv2 (const int_t, const int_t, const int_t, const int_t,
00376 const int_t, const int_t, const int_t, int_t, int_t,
00377 int_t *, int_t *, int_t *, int_t *, complex *, complex *,
00378 GlobalLU_t *, Gstat_t *);
00379 extern void pxgstrf_super_bnd_dfs (const int_t, const int_t, const int_t,
00380 const int_t, const int_t, SuperMatrix*,
00381 int_t*, int_t*, int_t*, int_t *, int_t *, int_t *,
00382 int_t *, pxgstrf_shared_t *);
00383 extern int_t pcgstrf_column_dfs(const int_t, const int_t, const int_t, const int_t,
00384 int_t*, int_t*, int_t*, int_t, int_t*, int_t*, int_t*, int_t*,
00385 int_t *, int_t *, int_t *, int_t *, pxgstrf_shared_t *);
00386 extern int_t pcgstrf_column_bmod(const int_t, const int_t, const int_t, const int_t,
00387 int_t*, int_t*, complex*, complex*,
00388 pxgstrf_shared_t *, Gstat_t *);
00389 extern int_t pcgstrf_pivotL (const int_t, const int_t, const float, yes_no_t*,
00390 int_t*, int_t*, int_t*, int_t*, GlobalLU_t*, Gstat_t*);
00391 extern int_t pcgstrf_copy_to_ucol (const int_t, const int_t, const int_t, const int_t *,
00392 const int_t *, const int_t *, complex*,
00393 pxgstrf_shared_t*);
00394 extern void pxgstrf_pruneL (const int_t, const int_t *, const int_t, const int_t,
00395 const int_t *, const int_t *, int_t*, int_t *,
00396 GlobalLU_t *);
00397 extern void pxgstrf_resetrep_col (const int_t, const int_t *, int_t *);
00398 extern void countnz (const int_t, int_t*, int_t *, int_t *, GlobalLU_t *);
00399 extern void fixupL (const int_t, const int_t *, GlobalLU_t *);
00400 extern void compressSUP (const int_t, GlobalLU_t *);
00401 extern int_t spcoletree (int_t *, int_t *, int_t *, int_t, int_t, int_t *);
00402 extern int_t *TreePostorder (int_t, int_t *);
00403 extern void creadmt (int_t *, int_t *, int_t *, complex **, int_t **, int_t **);
00404 extern void creadhb (int_t *, int_t *, int_t *, complex **, int_t **, int_t **);
00405 extern void cGenXtrue (int_t, int_t, complex *, int_t);
00406 extern void cFillRHS (trans_t, int_t, complex *, int_t,
00407 SuperMatrix *, SuperMatrix *);
00408 extern void cgstrs (trans_t, SuperMatrix *, SuperMatrix*,
00409 int_t*, int_t*, SuperMatrix*, Gstat_t *, int_t *);
00410 extern void clsolve (int_t, int_t, complex *, complex *);
00411 extern void cusolve (int_t, int_t, complex *, complex *);
00412 extern void cmatvec (int_t, int_t, int_t, complex *, complex *, complex *);
00413
00414
00415
00416
00417
00418 extern int cgemm_(char*, char*, int*, int*, int*, complex*,
00419 complex*, int*, complex*, int*, complex*,
00420 complex*, int*);
00421 extern int ctrsm_(char*, char*, char*, char*, int*, int*, complex*,
00422 complex*, int*, complex*, int*);
00423 extern int ctrsv_(char*, char*, char*, int*, complex*, int*,
00424 complex*, int*);
00425 extern int cgemv_(char*, int*, int*, complex*, complex*,
00426 int*, complex*, int*, complex*, complex*, int*);
00427
00428
00429
00430
00431 extern float pcgstrf_MemInit (int_t, int_t, superlumt_options_t *,
00432 SuperMatrix *, SuperMatrix *, GlobalLU_t *);
00433 extern float pcgstrf_memory_use(const int_t, const int_t, const int_t);
00434 extern int_t pcgstrf_WorkInit (int_t, int_t, int_t **, complex **);
00435 extern void pxgstrf_SetIWork (int_t, int_t, int_t *, int_t **, int_t **, int_t **,
00436 int_t **, int_t **, int_t **, int_t **);
00437 extern void pcgstrf_SetRWork (int_t, int_t, complex *, complex **, complex **);
00438 extern void pcgstrf_WorkFree (int_t *, complex *, GlobalLU_t *);
00439 extern int_t pcgstrf_MemXpand (int_t, int_t, MemType, int_t *, GlobalLU_t *);
00440
00441 extern int_t *intMalloc (int_t);
00442 extern int_t *intCalloc (int_t);
00443 extern complex *complexMalloc(int_t);
00444 extern complex *complexCalloc(int_t);
00445 extern int_t memory_usage ();
00446 extern int_t superlu_cQuerySpace (int_t, SuperMatrix *, SuperMatrix *, int_t,
00447 superlu_memusage_t *);
00448 extern int_t Glu_alloc (const int_t, const int_t, const int_t, const MemType,
00449 int_t *, pxgstrf_shared_t *);
00450
00451
00452
00453
00454 extern double SuperLU_timer_();
00455 extern int_t sp_ienv(int_t);
00456 extern double slamch_();
00457 extern int lsame_(char *, char *);
00458 extern int xerbla_(char *, int *);
00459 extern void superlu_abort_and_exit(char *);
00460 extern void ifill(int_t *, int_t, int_t);
00461 extern void cfill(complex *, int_t, complex);
00462 extern void cinf_norm_error(int_t, SuperMatrix *, complex *);
00463 extern void dstat_allocate(int_t);
00464 extern void snode_profile(int_t, int_t *);
00465 extern void super_stats(int_t, int_t *, int_t *);
00466 extern void panel_stats(int_t, int_t, int_t *, Gstat_t *);
00467 extern void PrintSumm(char *, int_t, int_t, int_t);
00468 extern void cPrintPerf(SuperMatrix *, SuperMatrix *, superlu_memusage_t *,
00469 float, float, float *, float *, char *,
00470 Gstat_t *);
00471 extern void cCompRow_to_CompCol(int_t m, int_t n, int_t nnz,
00472 complex *a, int_t *colind, int_t *rowptr,
00473 complex **at, int_t **rowind, int_t **colptr);
00474
00475
00476
00477
00478
00479 extern void print_lu_col(int_t, char *, int_t, int_t, int_t, int_t *, GlobalLU_t *);
00480 extern void print_panel_seg(int_t, int_t, int_t, int_t, int_t *, int_t *);
00481 extern void ccheck_zero_vec(int_t, char *, int_t, complex *);
00482 extern void check_repfnz(int_t, int_t, int_t, int_t *);
00483
00484 #ifdef __cplusplus
00485 }
00486 #endif
00487
00488
00489 #endif
00490