00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef __SLU_MT_DDEFS
00014 #define __SLU_MT_DDEFS
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
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 typedef struct {
00149 int_t *xsup;
00150 int_t *xsup_end;
00151 int_t *supno;
00152 int_t *lsub;
00153 int_t *xlsub;
00154 int_t *xlsub_end;
00155 double *lusup;
00156 int_t *xlusup;
00157 int_t *xlusup_end;
00158 double *ucol;
00159 int_t *usub;
00160 int_t *xusub;
00161 int_t *xusub_end;
00162 int_t nsuper;
00163 int_t nextl;
00164 int_t nextu;
00165 int_t nextlu;
00166 int_t nzlmax;
00167 int_t nzumax;
00168 int_t nzlumax;
00169
00170
00171
00172 int_t *map_in_sup;
00173
00174
00175
00176
00177
00178
00179
00180
00181 int_t dynamic_snode_bound;
00182
00183 } GlobalLU_t;
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193 typedef struct {
00194
00195
00196
00197 volatile int_t tasks_remain;
00198 int_t num_splits;
00199 queue_t taskq;
00200 mutex_t *lu_locks;
00201 volatile int_t *spin_locks;
00202 pan_status_t *pan_status;
00203 int_t *fb_cols;
00204
00205 int_t *inv_perm_c;
00206 int_t *inv_perm_r;
00207 int_t *xprune;
00208 int_t *ispruned;
00209 SuperMatrix *A;
00210 GlobalLU_t *Glu;
00211 Gstat_t *Gstat;
00212 int_t *info;
00213 } pxgstrf_shared_t;
00214
00215
00216 typedef struct {
00217 int_t pnum;
00218 int_t info;
00219 superlumt_options_t *superlumt_options;
00220 pxgstrf_shared_t *pxgstrf_shared;
00221 } pdgstrf_threadarg_t;
00222
00223
00224
00225
00226
00227
00228 #ifdef __cplusplus
00229 extern "C" {
00230 #endif
00231
00232
00233
00234
00235
00236 extern void
00237 pdgssv(int_t, SuperMatrix *, int_t *, int_t *, SuperMatrix *, SuperMatrix *,
00238 SuperMatrix *, int_t *);
00239 extern void
00240 pdgssvx(int_t, superlumt_options_t *, SuperMatrix *, int_t *, int_t *,
00241 equed_t *, double *, double *, SuperMatrix *, SuperMatrix *,
00242 SuperMatrix *, SuperMatrix *,
00243 double *, double *, double *, double *, superlu_memusage_t *,
00244 int_t *);
00245
00246
00247
00248
00249 extern void dgsequ (SuperMatrix *, double *, double *, double *,
00250 double *, double *, int_t *);
00251 extern void dlaqgs (SuperMatrix *, double *, double *, double,
00252 double, double, equed_t *);
00253 extern void dgscon (char *, SuperMatrix *, SuperMatrix *,
00254 double, double *, int_t *);
00255 extern double dPivotGrowth(int_t, SuperMatrix *, int_t *,
00256 SuperMatrix *, SuperMatrix *);
00257 extern void dgsrfs (trans_t, SuperMatrix *, SuperMatrix *, SuperMatrix *,
00258 int_t *, int_t *, equed_t, double *, double *, SuperMatrix *,
00259 SuperMatrix *, double *, double *, Gstat_t *, int_t *);
00260 extern int_t sp_dtrsv (char *, char *, char *, SuperMatrix *, SuperMatrix *,
00261 double *, int_t *);
00262 extern int_t sp_dgemv (char *, double, SuperMatrix *, double *,
00263 int_t, double, double *, int_t);
00264 extern int_t sp_dgemm (char *, int_t, int_t, int_t, double, SuperMatrix *,
00265 double *, int_t, double, double *, int_t);
00266
00267
00268
00269
00270 extern void pxgstrf_scheduler (const int_t, const int_t, const int_t *,
00271 int_t *, int_t *, pxgstrf_shared_t *);
00272 extern int_t dParallelInit (int_t, pxgstrf_relax_t *, superlumt_options_t *,
00273 pxgstrf_shared_t *);
00274 extern int_t ParallelFinalize ();
00275 extern void pdgstrf_StackFree ();
00276 extern int_t queue_init (queue_t *, int_t);
00277 extern int_t queue_destroy (queue_t *);
00278 extern int_t EnqueueRelaxSnode (queue_t *, int_t, pxgstrf_relax_t *,
00279 pxgstrf_shared_t *);
00280 extern int_t EnqueueDomains(queue_t *, struct Branch *, pxgstrf_shared_t *);
00281 extern int_t Enqueue (queue_t *, qitem_t);
00282 extern int_t Dequeue (queue_t *, qitem_t *);
00283 extern int_t NewNsuper (const int_t, pxgstrf_shared_t *, int_t *);
00284 extern int_t lockon(int_t *);
00285 extern void PartDomains(const int_t, const float, SuperMatrix *, int_t *, int_t *);
00286
00287 extern void
00288 dCreate_CompCol_Matrix(SuperMatrix *, int_t, int_t, int_t, double *,
00289 int_t *, int_t *, Stype_t, Dtype_t, Mtype_t);
00290 void
00291 dCreate_CompCol_Permuted(SuperMatrix *, int_t, int_t, int_t, double *, int_t *,
00292 int_t *, int_t *, Stype_t, Dtype_t, Mtype_t);
00293 extern void
00294 dCopy_CompCol_Matrix(SuperMatrix *, SuperMatrix *);
00295 extern void
00296 dCreate_Dense_Matrix(SuperMatrix *, int_t, int_t, double *, int_t,
00297 Stype_t, Dtype_t, Mtype_t);
00298 extern void
00299 dCreate_SuperNode_Matrix(SuperMatrix *, int_t, int_t, int_t, double *, int_t *, int_t *,
00300 int_t *, int_t *, int_t *, Stype_t, Dtype_t, Mtype_t);
00301 extern void
00302 dCreate_SuperNode_Permuted(SuperMatrix *, int_t, int_t, int_t, double *,
00303 int_t *, int_t *, int_t *, int_t *, int_t *, int_t *,
00304 int_t *, int_t *, Stype_t, Dtype_t, Mtype_t);
00305 extern void
00306 dCopy_Dense_Matrix(int_t, int_t, double *, int_t, double *, int_t);
00307
00308 extern void Destroy_SuperMatrix_Store(SuperMatrix *);
00309 extern void Destroy_CompCol_Matrix(SuperMatrix *);
00310 extern void Destroy_CompCol_Permuted(SuperMatrix *);
00311 extern void Destroy_CompCol_NCP(SuperMatrix *);
00312 extern void Destroy_SuperNode_Matrix(SuperMatrix *);
00313 extern void Destroy_SuperNode_SCP(SuperMatrix *);
00314
00315 extern void dallocateA (int_t, int_t, double **, int_t **, int_t **);
00316 extern void StatAlloc (const int_t, const int_t, const int_t, const int_t, Gstat_t*);
00317 extern void StatInit (const int_t, const int_t, Gstat_t*);
00318 extern void StatFree (Gstat_t*);
00319 extern void get_perm_c(int_t, SuperMatrix *, int_t *);
00320 extern void dsp_colorder (SuperMatrix *, int_t *, superlumt_options_t *,
00321 SuperMatrix *);
00322 extern int_t sp_coletree (int_t *, int_t *, int_t *, int_t, int_t, int_t *);
00323 extern int_t dPresetMap (const int_t, SuperMatrix *, pxgstrf_relax_t *,
00324 superlumt_options_t *, GlobalLU_t *);
00325 extern int_t qrnzcnt (int_t, int_t, int_t *, int_t *, int_t *, int_t *, int_t *, int_t *,
00326 int_t *, int_t *, int_t *, int_t *);
00327 extern int_t DynamicSetMap(const int_t, const int_t, const int_t, pxgstrf_shared_t*);
00328 extern void pdgstrf (superlumt_options_t *, SuperMatrix *, int_t *,
00329 SuperMatrix *, SuperMatrix *, Gstat_t *, int_t *);
00330 extern void pdgstrf_init (int_t, fact_t, trans_t, yes_no_t, int_t, int_t, double, yes_no_t, double,
00331 int_t *, int_t *, void *, int_t, SuperMatrix *,
00332 SuperMatrix *, superlumt_options_t *, Gstat_t *);
00333 extern pdgstrf_threadarg_t*
00334 pdgstrf_thread_init (SuperMatrix *, SuperMatrix *, SuperMatrix *,
00335 superlumt_options_t*, pxgstrf_shared_t*, Gstat_t*, int_t*);
00336 extern void
00337 pdgstrf_thread_finalize (pdgstrf_threadarg_t *, pxgstrf_shared_t *,
00338 SuperMatrix *, int_t *, SuperMatrix *, SuperMatrix *);
00339 extern void pdgstrf_finalize(superlumt_options_t *, SuperMatrix *);
00340 extern void pxgstrf_finalize(superlumt_options_t *, SuperMatrix *);
00341 extern void pdgstrf_relax_snode (const int_t, superlumt_options_t *,
00342 pxgstrf_relax_t *);
00343 extern int_t
00344 pdgstrf_factor_snode (const int_t, const int_t, SuperMatrix *, const double,
00345 yes_no_t *, int_t *, int_t *, int_t*, int_t*, int_t*, int_t*,
00346 double *, double *, pxgstrf_shared_t *, int_t *);
00347 extern void
00348 pxgstrf_mark_busy_descends (int_t, int_t, int_t *, pxgstrf_shared_t *, int_t *, int_t *);
00349 extern int_t pdgstrf_snode_dfs (const int_t, const int_t, const int_t, const int_t *,
00350 const int_t *, const int_t *, int_t*, int_t *, int_t *,
00351 pxgstrf_shared_t *);
00352 extern int_t pdgstrf_snode_bmod (const int_t, const int_t, const int_t, const int_t,
00353 double *, double *, GlobalLU_t*, Gstat_t*);
00354 extern void pdgstrf_panel_dfs (const int_t, const int_t, const int_t, const int_t,
00355 SuperMatrix *, int_t*, int_t*, int_t*, int_t*, int_t*,
00356 int_t*, int_t*, int_t*, int_t*, int_t*, int_t*, int_t*, int_t*,
00357 double*, GlobalLU_t *);
00358 extern void pdgstrf_panel_bmod (const int_t, const int_t, const int_t, const int_t,
00359 const int_t, int_t*, int_t*, int_t*, int_t*, int_t*, int_t*,
00360 int_t*, int_t*, double*, double*,
00361 pxgstrf_shared_t *);
00362 extern void pdgstrf_bmod1D (const int_t, const int_t, const int_t, const int_t,
00363 const int_t, const int_t, const int_t, int_t, int_t,
00364 int_t *, int_t *, int_t *, int_t *, double *, double *,
00365 GlobalLU_t *, Gstat_t *);
00366 extern void pdgstrf_bmod2D (const int_t, const int_t, const int_t, const int_t,
00367 const int_t, const int_t, const int_t, int_t, int_t,
00368 int_t *, int_t *, int_t *, int_t *, double *, double *,
00369 GlobalLU_t *, Gstat_t *);
00370 extern void pdgstrf_bmod1D_mv2 (const int_t, const int_t, const int_t, const int_t,
00371 const int_t, const int_t, const int_t, int_t, int_t,
00372 int_t *, int_t *, int_t *, int_t *, double *,
00373 double *, GlobalLU_t *, Gstat_t *);
00374 extern void pdgstrf_bmod2D_mv2 (const int_t, const int_t, const int_t, const int_t,
00375 const int_t, const int_t, const int_t, int_t, int_t,
00376 int_t *, int_t *, int_t *, int_t *, double *, double *,
00377 GlobalLU_t *, Gstat_t *);
00378 extern void pxgstrf_super_bnd_dfs (const int_t, const int_t, const int_t,
00379 const int_t, const int_t, SuperMatrix*,
00380 int_t*, int_t*, int_t*, int_t *, int_t *, int_t *,
00381 int_t *, pxgstrf_shared_t *);
00382 extern int_t pdgstrf_column_dfs(const int_t, const int_t, const int_t, const int_t,
00383 int_t*, int_t*, int_t*, int_t, int_t*, int_t*, int_t*, int_t*,
00384 int_t *, int_t *, int_t *, int_t *, pxgstrf_shared_t *);
00385 extern int_t pdgstrf_column_bmod(const int_t, const int_t, const int_t, const int_t,
00386 int_t*, int_t*, double*, double*,
00387 pxgstrf_shared_t *, Gstat_t *);
00388 extern int_t pdgstrf_pivotL (const int_t, const int_t, const double, yes_no_t*,
00389 int_t*, int_t*, int_t*, int_t*, GlobalLU_t*, Gstat_t*);
00390 extern int_t pdgstrf_copy_to_ucol (const int_t, const int_t, const int_t, const int_t *,
00391 const int_t *, const int_t *, double*,
00392 pxgstrf_shared_t*);
00393 extern void pxgstrf_pruneL (const int_t, const int_t *, const int_t, const int_t,
00394 const int_t *, const int_t *, int_t*, int_t *,
00395 GlobalLU_t *);
00396 extern void pxgstrf_resetrep_col (const int_t, const int_t *, int_t *);
00397 extern void countnz (const int_t, int_t*, int_t *, int_t *, GlobalLU_t *);
00398 extern void fixupL (const int_t, const int_t *, GlobalLU_t *);
00399 extern void compressSUP (const int_t, GlobalLU_t *);
00400 extern int_t spcoletree (int_t *, int_t *, int_t *, int_t, int_t, int_t *);
00401 extern int_t *TreePostorder (int_t, int_t *);
00402 extern void dreadmt (int_t *, int_t *, int_t *, double **, int_t **, int_t **);
00403 extern void dreadhb (int_t *, int_t *, int_t *, double **, int_t **, int_t **);
00404 extern void dGenXtrue (int_t, int_t, double *, int_t);
00405 extern void dFillRHS (trans_t, int_t, double *, int_t,
00406 SuperMatrix *, SuperMatrix *);
00407 extern void dgstrs (trans_t, SuperMatrix *, SuperMatrix*,
00408 int_t*, int_t*, SuperMatrix*, Gstat_t *, int_t *);
00409 extern void dlsolve (int_t, int_t, double *, double *);
00410 extern void dusolve (int_t, int_t, double *, double *);
00411 extern void dmatvec (int_t, int_t, int_t, double *, double *, double *);
00412
00413
00414
00415
00416
00417 extern int dgemm_(char*, char*, int*, int*, int*, double*,
00418 double*, int*, double*, int*, double*,
00419 double*, int*);
00420 extern int dtrsm_(char*, char*, char*, char*, int*, int*, double*,
00421 double*, int*, double*, int*);
00422 extern int dtrsv_(char*, char*, char*, int*, double*, int*,
00423 double*, int*);
00424 extern int dgemv_(char*, int*, int*, double*, double*,
00425 int*, double*, int*, double*, double*, int*);
00426
00427
00428
00429
00430 extern float pdgstrf_MemInit (int_t, int_t, superlumt_options_t *,
00431 SuperMatrix *, SuperMatrix *, GlobalLU_t *);
00432 extern float pdgstrf_memory_use(const int_t, const int_t, const int_t);
00433 extern int_t pdgstrf_WorkInit (int_t, int_t, int_t **, double **);
00434 extern void pxgstrf_SetIWork (int_t, int_t, int_t *, int_t **, int_t **, int_t **,
00435 int_t **, int_t **, int_t **, int_t **);
00436 extern void pdgstrf_SetRWork (int_t, int_t, double *, double **, double **);
00437 extern void pdgstrf_WorkFree (int_t *, double *, GlobalLU_t *);
00438 extern int_t pdgstrf_MemXpand (int_t, int_t, MemType, int_t *, GlobalLU_t *);
00439
00440 extern int_t *intMalloc (int_t);
00441 extern int_t *intCalloc (int_t);
00442 extern double *doubleMalloc(int_t);
00443 extern double *doubleCalloc(int_t);
00444 extern int_t memory_usage ();
00445 extern int_t superlu_dQuerySpace (int_t, SuperMatrix *, SuperMatrix *, int_t,
00446 superlu_memusage_t *);
00447 extern int_t Glu_alloc (const int_t, const int_t, const int_t, const MemType,
00448 int_t *, pxgstrf_shared_t *);
00449
00450
00451
00452
00453 extern double SuperLU_timer_();
00454 extern int_t sp_ienv(int_t);
00455 extern double dlamch_();
00456 extern int lsame_(char *, char *);
00457 extern int xerbla_(char *, int *);
00458 extern void superlu_abort_and_exit(char *);
00459 extern void ifill(int_t *, int_t, int_t);
00460 extern void dfill(double *, int_t, double);
00461 extern void dinf_norm_error(int_t, SuperMatrix *, double *);
00462 extern void dstat_allocate(int_t);
00463 extern void snode_profile(int_t, int_t *);
00464 extern void super_stats(int_t, int_t *, int_t *);
00465 extern void panel_stats(int_t, int_t, int_t *, Gstat_t *);
00466 extern void PrintSumm(char *, int_t, int_t, int_t);
00467 extern void dPrintPerf(SuperMatrix *, SuperMatrix *, superlu_memusage_t *,
00468 double, double, double *, double *, char *,
00469 Gstat_t *);
00470 extern void dCompRow_to_CompCol(int_t m, int_t n, int_t nnz,
00471 double *a, int_t *colind, int_t *rowptr,
00472 double **at, int_t **rowind, int_t **colptr);
00473
00474
00475
00476
00477
00478 extern void print_lu_col(int_t, char *, int_t, int_t, int_t, int_t *, GlobalLU_t *);
00479 extern void print_panel_seg(int_t, int_t, int_t, int_t, int_t *, int_t *);
00480 extern void dcheck_zero_vec(int_t, char *, int_t, double *);
00481 extern void check_repfnz(int_t, int_t, int_t, int_t *);
00482
00483 #ifdef __cplusplus
00484 }
00485 #endif
00486
00487
00488 #endif
00489