SRC/superlu_zdefs.h

Go to the documentation of this file.
00001 
00002 /* @file Distributed SuperLU data types and function prototypes
00003  * \brief 
00004  *
00005  * <pre>
00006  * -- Distributed SuperLU routine (version 2.1) --
00007  * Lawrence Berkeley National Lab, Univ. of California Berkeley.
00008  * November 1, 2007
00009  * </pre>
00010  */
00011 
00012 #ifndef __SUPERLU_zDEFS /* allow multiple inclusions */
00013 #define __SUPERLU_zDEFS
00014 
00015 /*
00016  * File name:   superlu_zdefs.h
00017  * Purpose:     Distributed SuperLU data types and function prototypes
00018  * History:
00019  */
00020 
00021 #include "superlu_defs.h"
00022 #include "dcomplex.h"
00023 
00024 /* 
00025  * On each processor, the blocks in L are stored in compressed block
00026  * column format, the blocks in U are stored in compressed block row format.
00027  */
00028 typedef struct {
00029     int_t   **Lrowind_bc_ptr; /* size ceil(NSUPERS/Pc)                 */
00030     doublecomplex  **Lnzval_bc_ptr;  /* size ceil(NSUPERS/Pc)                 */
00031     int_t   **Ufstnz_br_ptr;  /* size ceil(NSUPERS/Pr)                 */
00032     doublecomplex  **Unzval_br_ptr;  /* size ceil(NSUPERS/Pr)                 */
00033 #if 0
00034     int_t   *Lsub_buf;        /* Buffer for the remote subscripts of L */
00035     double  *Lval_buf;        /* Buffer for the remote nonzeros of L   */
00036 #endif
00037     int_t   *Lsub_buf_2[2];   /* Buffers for the remote subscripts of L*/
00038     doublecomplex  *Lval_buf_2[2];   /* Buffers for the remote nonzeros of L  */
00039     int_t   *Usub_buf;        /* Buffer for the remote subscripts of U */
00040     doublecomplex  *Uval_buf;        /* Buffer for the remote nonzeros of U   */
00041     doublecomplex  *ujrow;           /* used in panel factorization.          */
00042     int_t   bufmax[NBUFFERS]; /* Buffer size; 5 entries
00043                                *     0 : size of Lsub_buf[]
00044                                *     1 : size of Lval_buf[]
00045                                *     2 : size of Usub_buf[] 
00046                                *     3 : size of Uval_buf[]
00047                                *     4 : size of tempv[LDA]
00048                                */
00049 
00050     /*-- Record communication schedule for factorization. --*/
00051     int_t   *ToRecv;          /* Recv from no one (0), left (1), and up (2).*/
00052     int_t   *ToSendD;         /* Whether need to send down block row.       */
00053     int_t   **ToSendR;        /* List of processes to send right block col. */
00054 
00055     /*-- Record communication schedule for solves. --*/
00056     int_t   *fmod;            /* Modification count for L-solve            */
00057     int_t   **fsendx_plist;   /* Column process list to send down Xk       */
00058     int_t   *frecv;           /* Modifications to be recv'd in proc row    */
00059     int_t   nfrecvx;          /* Number of Xk I will receive in L-solve    */
00060     int_t   nfsendx;          /* Number of Xk I will send in L-solve       */
00061     int_t   *bmod;            /* Modification count for U-solve            */
00062     int_t   **bsendx_plist;   /* Column process list to send down Xk       */
00063     int_t   *brecv;           /* Modifications to be recv'd in proc row    */
00064     int_t   nbrecvx;          /* Number of Xk I will receive in U-solve    */
00065     int_t   nbsendx;          /* Number of Xk I will send in U-solve       */
00066 
00067     /*-- Auxiliary arrays used for solves. --*/
00068     int_t   *ilsum;           /* Starting position of each supernode in lsum
00069                                  (local)  */
00070     int_t   ldalsum;          /* LDA of lsum (local) */
00071     int_t   SolveMsgSent;     /* Number of actual messages sent in LU-solve */
00072     int_t   SolveMsgVol;      /* Volume of messages sent in the solve phase */
00073 } LocalLU_t;
00074 
00075 typedef struct {
00076     int_t *etree;
00077     Glu_persist_t *Glu_persist;
00078     LocalLU_t *Llu;
00079 } LUstruct_t;
00080 
00081 /*-- Auxiliary data type used in PxGSTRS/PxGSTRS1. */
00082 typedef struct {
00083     int_t lbnum;  /* Row block number (local).      */
00084     int_t indpos; /* Starting position in Uindex[]. */
00085 } Ucb_indptr_t;
00086 
00087 /*-- Data structure for communication during matrix-vector multiplication. */
00088 typedef struct {
00089     int_t *extern_start;
00090     int_t *ind_tosend;    /* X indeices to be sent to other processes */
00091     int_t *ind_torecv;    /* X indeices to be received from other processes */
00092     int_t *ptr_ind_tosend;/* Printers to ind_tosend[] (Size procs)
00093                              (also point to val_torecv) */
00094     int_t *ptr_ind_torecv;/* Printers to ind_torecv[] (Size procs)
00095                              (also point to val_tosend) */
00096     int   *SendCounts;    /* Numbers of X indices to be sent
00097                              (also numbers of X values to be received) */
00098     int   *RecvCounts;    /* Numbers of X indices to be received
00099                              (also numbers of X values to be sent) */
00100     doublecomplex *val_tosend;   /* X values to be sent to other processes */
00101     doublecomplex *val_torecv;   /* X values to be received from other processes */
00102     int_t TotalIndSend;   /* Total number of indices to be sent
00103                              (also total number of values to be received) */
00104     int_t TotalValSend;   /* Total number of values to be sent.
00105                              (also total number of indices to be received) */
00106 } pzgsmv_comm_t;
00107 
00108 /*-- Data structure for redistribution of B and X --*/
00109 typedef struct {
00110     int  *B_to_X_SendCnt;
00111     int  *X_to_B_SendCnt;
00112     int  *ptr_to_ibuf, *ptr_to_dbuf;
00113 } pxgstrs_comm_t;
00114 
00115 /*-- Data structure holding the information for the solution phase --*/
00116 typedef struct {
00117     int_t *row_to_proc;
00118     int_t *inv_perm_c;
00119     int_t num_diag_procs, *diag_procs, *diag_len;
00120     pzgsmv_comm_t *gsmv_comm;
00121     pxgstrs_comm_t *gstrs_comm;
00122     int_t *A_colind_gsmv; /* After pzgsmv_init(), the global column
00123                              indices of A are translated into the relative
00124                              positions in the gathered x-vector.
00125                              This is re-used in repeated calls to pzgsmv() */
00126 } SOLVEstruct_t;
00127 
00128 
00129 /***********************************************************************
00130  * Function prototypes
00131  ***********************************************************************/
00132 
00133 #ifdef __cplusplus
00134 extern "C" {
00135 #endif
00136 
00137 
00138 /* Supernodal LU factor related */
00139 extern void
00140 zCreate_CompCol_Matrix_dist(SuperMatrix *, int_t, int_t, int_t, doublecomplex *,
00141                             int_t *, int_t *, Stype_t, Dtype_t, Mtype_t);
00142 extern void
00143 zCreate_CompRowLoc_Matrix_dist(SuperMatrix *, int_t, int_t, int_t, int_t,
00144                                int_t, doublecomplex *, int_t *, int_t *,
00145                                Stype_t, Dtype_t, Mtype_t);
00146 extern void
00147 zCompRow_to_CompCol_dist(int_t, int_t, int_t, doublecomplex *, int_t *, int_t *,
00148                          doublecomplex **, int_t **, int_t **);
00149 extern int
00150 pzCompRow_loc_to_CompCol_global(int_t, SuperMatrix *, gridinfo_t *,
00151                                 SuperMatrix *);
00152 extern void
00153 zCopy_CompCol_Matrix_dist(SuperMatrix *, SuperMatrix *);
00154 extern void
00155 zCreate_Dense_Matrix_dist(SuperMatrix *, int_t, int_t, doublecomplex *, int_t,
00156                           Stype_t, Dtype_t, Mtype_t);
00157 extern void
00158 zCreate_SuperNode_Matrix_dist(SuperMatrix *, int_t, int_t, int_t, doublecomplex *, 
00159                               int_t *, int_t *, int_t *, int_t *, int_t *,
00160                               Stype_t, Dtype_t, Mtype_t);
00161 extern void
00162 zCopy_Dense_Matrix_dist(int_t, int_t, doublecomplex *, int_t,
00163                         doublecomplex *, int_t);
00164 
00165 extern void    zallocateA_dist (int_t, int_t, doublecomplex **, int_t **, int_t **);
00166 extern void    zGenXtrue_dist (int_t, int_t, doublecomplex *, int_t);
00167 extern void    zFillRHS_dist (char *, int_t, doublecomplex *, int_t,
00168                               SuperMatrix *, doublecomplex *, int_t);
00169 extern int     zcreate_matrix(SuperMatrix *, int, doublecomplex **, int *, 
00170                               doublecomplex **, int *, FILE *, gridinfo_t *);
00171 
00172 /* Driver related */
00173 extern void    zgsequ_dist (SuperMatrix *, double *, double *, double *,
00174                             double *, double *, int_t *);
00175 extern double  zlangs_dist (char *, SuperMatrix *);
00176 extern void    zlaqgs_dist (SuperMatrix *, double *, double *, double,
00177                             double, double, char *);
00178 extern void    pzgsequ (SuperMatrix *, double *, double *, double *,
00179                         double *, double *, int_t *, gridinfo_t *);
00180 extern double  pzlangs (char *, SuperMatrix *, gridinfo_t *);
00181 extern void    pzlaqgs (SuperMatrix *, double *, double *, double,
00182                         double, double, char *);
00183 extern int     pzPermute_Dense_Matrix(int_t, int_t, int_t [], int_t[],
00184                                       doublecomplex [], int, doublecomplex [], int, int,
00185                                       gridinfo_t *);
00186 
00187 extern int     sp_ztrsv_dist (char *, char *, char *, SuperMatrix *,
00188                               SuperMatrix *, doublecomplex *, int *);
00189 extern int     sp_zgemv_dist (char *, doublecomplex, SuperMatrix *, doublecomplex *,
00190                               int, doublecomplex, doublecomplex *, int);
00191 extern int     sp_zgemm_dist (char *, char *, int, int, int, doublecomplex,
00192                         SuperMatrix *, doublecomplex *, int, doublecomplex, 
00193                         doublecomplex *, int);
00194 
00195 extern int_t zdistribute(fact_t, int_t, SuperMatrix *, Glu_freeable_t *, 
00196                          LUstruct_t *, gridinfo_t *);
00197 extern void  pzgssvx_ABglobal(superlu_options_t *, SuperMatrix *, 
00198                               ScalePermstruct_t *, doublecomplex *,
00199                               int, int, gridinfo_t *, LUstruct_t *, double *,
00200                               SuperLUStat_t *, int *);
00201 extern int_t pzdistribute(fact_t, int_t, SuperMatrix *, 
00202                          ScalePermstruct_t *, Glu_freeable_t *, 
00203                          LUstruct_t *, gridinfo_t *);
00204 extern void  pzgssvx(superlu_options_t *, SuperMatrix *, 
00205                      ScalePermstruct_t *, doublecomplex *,
00206                      int, int, gridinfo_t *, LUstruct_t *,
00207                      SOLVEstruct_t *, double *, SuperLUStat_t *, int *);
00208 extern int  zSolveInit(superlu_options_t *, SuperMatrix *, int_t [], int_t [],
00209                        int_t, LUstruct_t *, gridinfo_t *, SOLVEstruct_t *);
00210 extern int_t pxgstrs_init(int_t, int_t, int_t, int_t,
00211                           int_t [], int_t [], gridinfo_t *grid,
00212                           Glu_persist_t *, SOLVEstruct_t *);
00213 extern void pxgstrs_finalize(pxgstrs_comm_t *);
00214 extern void zSolveFinalize(superlu_options_t *, SOLVEstruct_t *);
00215 extern void zldperm(int_t, int_t, int_t, int_t [], int_t [],
00216                     doublecomplex [], int_t *, double [], double []);
00217 extern int_t pzgstrf(superlu_options_t *, int, int, double,
00218                     LUstruct_t*, gridinfo_t*, SuperLUStat_t*, int*);
00219 extern void pzgstrs_Bglobal(int_t, LUstruct_t *, gridinfo_t *,
00220                              doublecomplex *, int_t, int, SuperLUStat_t *, int *);
00221 extern void pzgstrs(int_t, LUstruct_t *, ScalePermstruct_t *, gridinfo_t *,
00222                     doublecomplex *, int_t, int_t, int_t, int, SOLVEstruct_t *,
00223                     SuperLUStat_t *, int *);
00224 extern void zlsum_fmod(doublecomplex *, doublecomplex *, doublecomplex *, doublecomplex *,
00225                        int, int, int_t , int_t *, int_t, int_t, int_t,
00226                        int_t *, gridinfo_t *, LocalLU_t *, 
00227                        MPI_Request [], SuperLUStat_t *);
00228 extern void zlsum_bmod(doublecomplex *, doublecomplex *, doublecomplex *,
00229                        int, int_t, int_t *, int_t *, Ucb_indptr_t **,
00230                        int_t **, int_t *, gridinfo_t *, LocalLU_t *,
00231                        MPI_Request [], SuperLUStat_t *);
00232 extern void pzgsrfs(int_t, SuperMatrix *, double, LUstruct_t *,
00233                     ScalePermstruct_t *, gridinfo_t *,
00234                     doublecomplex [], int_t, doublecomplex [], int_t, int,
00235                     SOLVEstruct_t *, double *, SuperLUStat_t *, int *);
00236 extern void pzgsrfs_ABXglobal(int_t, SuperMatrix *, double, LUstruct_t *,
00237                   gridinfo_t *, doublecomplex *, int_t, doublecomplex *, int_t,
00238                   int, double *, SuperLUStat_t *, int *);
00239 extern int   pzgsmv_AXglobal_setup(SuperMatrix *, Glu_persist_t *,
00240                                    gridinfo_t *, int_t *, int_t *[],
00241                                    doublecomplex *[], int_t *[], int_t []);
00242 extern int  pzgsmv_AXglobal(int_t, int_t [], doublecomplex [], int_t [],
00243                                doublecomplex [], doublecomplex []);
00244 extern int  pzgsmv_AXglobal_abs(int_t, int_t [], doublecomplex [], int_t [],
00245                                  doublecomplex [], double []);
00246 extern void pzgsmv_init(SuperMatrix *, int_t *, gridinfo_t *,
00247                         pzgsmv_comm_t *);
00248 extern void pzgsmv(int_t, SuperMatrix *, gridinfo_t *, pzgsmv_comm_t *,
00249                    doublecomplex x[], doublecomplex ax[]);
00250 extern void pzgsmv_finalize(pzgsmv_comm_t *);
00251 
00252 /* Memory-related */
00253 extern doublecomplex  *doublecomplexMalloc_dist(int_t);
00254 extern doublecomplex  *doublecomplexCalloc_dist(int_t);
00255 extern double  *doubleMalloc_dist(int_t);
00256 extern double  *doubleCalloc_dist(int_t);
00257 extern void  *duser_malloc_dist (int_t, int_t);
00258 extern void  duser_free_dist (int_t, int_t);
00259 extern int_t zQuerySpace_dist(int_t, LUstruct_t *, gridinfo_t *, mem_usage_t *);
00260 extern void    Destroy_LU(int_t, gridinfo_t *, LUstruct_t *);
00261 extern void    LUstructInit(const int_t, const int_t, LUstruct_t *);
00262 extern void    LUstructFree(LUstruct_t *);
00263 
00264 /* Auxiliary routines */
00265 extern void    zfill_dist (doublecomplex *, int_t, doublecomplex);
00266 extern void    zinf_norm_error_dist (int_t, int_t, doublecomplex*, int_t,
00267                                      doublecomplex*, int_t, gridinfo_t*);
00268 extern void    pzinf_norm_error(int, int_t, int_t, doublecomplex [], int_t,
00269                                 doublecomplex [], int_t , gridinfo_t *);
00270 extern void  zreadhb_dist (int, FILE *, int_t *, int_t *, int_t *, 
00271                            doublecomplex **, int_t **, int_t **);
00272 
00273 /* Distribute the data for numerical factorization */
00274 extern int_t zdist_psymbtonum
00275 (fact_t, int_t, SuperMatrix *,
00276  ScalePermstruct_t *, Pslu_freeable_t *, 
00277  LUstruct_t *, gridinfo_t *);
00278 
00279 /* Routines for debugging */
00280 extern void  zPrintLblocks(int_t, int_t, gridinfo_t *, Glu_persist_t *,
00281                            LocalLU_t *);
00282 extern void  zPrintUblocks(int_t, int_t, gridinfo_t *, Glu_persist_t *,
00283                            LocalLU_t *);
00284 extern void  zPrint_CompCol_Matrix_dist(SuperMatrix *);
00285 extern void  zPrint_Dense_Matrix_dist(SuperMatrix *);
00286 extern int   zPrint_CompRowLoc_Matrix_dist(SuperMatrix *);
00287 extern void  PrintDoublecomplex(char *, int_t, doublecomplex *);
00288 extern int   file_PrintDoublecomplex(FILE *fp, char *, int_t, doublecomplex *);
00289 
00290 /* BLAS */
00291 
00292 #ifdef USE_VENDOR_BLAS
00293 extern int zgemm_(char*, char*, int*, int*, int*, doublecomplex*,
00294                   doublecomplex*, int*, doublecomplex*, int*, doublecomplex*,
00295                   doublecomplex*, int*, int, int);
00296 extern int ztrsv_(char*, char*, char*, int*, doublecomplex*, int*,
00297                   doublecomplex*, int*, int, int, int);
00298 #else
00299 extern int zgemm_(char*, char*, int*, int*, int*, doublecomplex*,
00300                   doublecomplex*, int*, doublecomplex*, int*, doublecomplex*,
00301                   doublecomplex*, int*);
00302 extern int ztrsv_(char*, char*, char*, int*, doublecomplex*, int*,
00303                   doublecomplex*, int*);
00304 #endif
00305 
00306 extern int zger_(int*, int*, doublecomplex*, doublecomplex*, int*,
00307                  doublecomplex*, int*, doublecomplex*, int*);
00308 
00309 
00310 #ifdef __cplusplus
00311   }
00312 #endif
00313 
00314 #endif /* __SUPERLU_dDEFS */
00315 

Generated on Sat Aug 9 23:23:51 2008 for SuperLUDistributed by  doxygen 1.4.6