SuperLU_MT_util.h

Go to the documentation of this file.
00001 /* ****************************************************************** **
00002 **    OpenSees - Open System for Earthquake Engineering Simulation    **
00003 **          Pacific Earthquake Engineering Research Center            **
00004 **                                                                    **
00005 **                                                                    **
00006 ** (C) Copyright 1999, The Regents of the University of California    **
00007 ** All Rights Reserved.                                               **
00008 **                                                                    **
00009 ** Commercial use of this program without express permission of the   **
00010 ** University of California, Berkeley, is strictly prohibited.  See   **
00011 ** file 'COPYRIGHT'  in main directory for information on usage and   **
00012 ** redistribution,  and for a DISCLAIMER OF ALL WARRANTIES.           **
00013 **                                                                    **
00014 ** Developed by:                                                      **
00015 **   Frank McKenna (fmckenna@ce.berkeley.edu)                         **
00016 **   Gregory L. Fenves (fenves@ce.berkeley.edu)                       **
00017 **   Filip C. Filippou (filippou@ce.berkeley.edu)                     **
00018 **                                                                    **
00019 ** ****************************************************************** */
00020                                                                         
00021 // $Revision: 1.1.1.1 $
00022 // $Date: 2000/09/15 08:23:30 $
00023 // $Source: /usr/local/cvs/OpenSees/SRC/system_of_eqn/linearSOE/sparseGEN/SuperLU_MT_util.h,v $
00024                                                                         
00025                                                                         
00026 /*
00027  * -- SuperLU MT routine (alpha version) --
00028  * Univ. of California Berkeley, Xerox Palo Alto Research Center,
00029  * and Lawrence Berkeley National Lab.
00030  * August 15, 1997
00031  *
00032  */
00033 
00034 #ifndef __SUPERLU_UTIL /* allow multiple inclusions */
00035 #define __SUPERLU_UTIL
00036 
00037 #include <stdio.h>
00038 #include <stdlib.h>
00039 #include <string.h>
00040 #include <malloc.h>
00041 
00042 /* Macros */
00043 #ifndef USER_ABORT
00044 #define USER_ABORT(msg) superlu_abort_and_exit(msg)
00045 #endif
00046 
00047 #define ABORT(err_msg) \
00048  { char msg[256];\
00049    sprintf(msg,"%s at line %d in file %s\n",err_msg,__LINE__, __FILE__);\
00050    USER_ABORT(msg); }
00051 
00052 
00053 #ifndef USER_MALLOC
00054 #define USER_MALLOC(size) superlu_malloc(size)
00055 #endif
00056 
00057 #define SUPERLU_MALLOC(size) USER_MALLOC(size)
00058 
00059 #ifndef USER_FREE
00060 #define USER_FREE(addr) superlu_free(addr)
00061 #endif
00062 
00063 #define SUPERLU_FREE(addr) USER_FREE(addr)
00064 
00065 
00066 #define MAX(x, y)       ( (x) > (y) ? (x) : (y) )
00067 #define MIN(x, y)       ( (x) < (y) ? (x) : (y) )
00068 
00069 /* 
00070  * Constants 
00071  */
00072 #define EMPTY   (-1)
00073 #define FALSE   0
00074 #define TRUE    1
00075 
00076 /*
00077  * Type definitions
00078  */
00079 typedef float    flops_t;
00080 typedef unsigned char Logical;
00081 typedef enum {
00082     RELAX,
00083     ETREE,
00084     EQUIL,
00085     FINDDOMAIN,
00086     FACT,
00087     DFS,
00088     FLOAT,
00089     TRSV,
00090     GEMV,
00091     RCOND,
00092     TRISOLVE,
00093     SOLVE,
00094     REFINE,
00095     FERR,
00096     NPHASES
00097 } PhaseType;
00098 
00099 /* ----------------------------------------------
00100     The definitions below are used for profiling.
00101    ---------------------------------------------- */
00102 
00103 /* The statistics to be kept by each processor. */
00104 typedef struct {
00105     int     panels;    /* number of panels taken */
00106     float   fcops;     /* factor floating-point operations */
00107     double  fctime;    /* factor time */
00108     int     skedwaits; /* how many times the processor fails to get a task */
00109     double  skedtime;  /* time spent in the scheduler */
00110     double  cs_time;   /* time spent in the critical sections */
00111     double  spintime;  /* spin-wait time */
00112     int     pruned;
00113     int     unpruned;
00114 } procstat_t;
00115 
00116 
00117 /* Statistics about each panel. */
00118 
00119 typedef struct {
00120     int    size;      /* size of the panel */
00121     int    pnum;      /* which processor grabs this panel */
00122     double starttime; /* at waht time this panel is assigned to a proc */
00123     double fctime;    /* factorization time */
00124     float  flopcnt;   /* floating-point operations */
00125     int    pipewaits; /* how many times the panel waited during pipelining */
00126     double spintime;  /* spin waiting time during pipelining */
00127 } panstat_t;
00128 
00129 /* How was a panel selected by the scheduler */
00130 typedef enum {NOPIPE, DADPAN, PIPE} how_selected_t;
00131 
00132 
00133 typedef struct {
00134      flops_t flops;
00135      int     nzs;
00136      double  fctime;
00137 } stat_relax_t;
00138 
00139 typedef struct {
00140      flops_t flops;
00141      int nzs;
00142      double fctime;
00143 } stat_col_t;
00144 
00145 typedef struct {
00146      int ncols;
00147      flops_t flops;
00148      int nzs;
00149      double fctime;
00150 } stat_snode_t;
00151 
00152 /* -------------------------------------------------------------------
00153    The definitions below are used to simulate parallel execution time.
00154    ------------------------------------------------------------------- */
00155 typedef struct {
00156     float est;  /* earliest (possible) start time of the panel */
00157     float pdiv; /* time in flops spent in the (inner) panel factorization */
00158 } cp_panel_t;
00159 
00160 typedef struct {
00161     float eft;  /* earliest finishing time */
00162     float pmod; /* pmod update to the ancestor panel */
00163 } desc_eft_t;
00164                    
00165 /* All statistics. */
00166 typedef struct {
00167     int         *panel_histo;   /* Panel size distribution */
00168     double      *utime;
00169     flops_t     *ops;
00170     procstat_t  *procstat;
00171     panstat_t   *panstat;
00172     int         num_panels;
00173     float       dom_flopcnt;
00174     float       flops_last_P_panels;
00175     
00176     stat_relax_t *stat_relax;
00177     stat_col_t *stat_col; 
00178     stat_snode_t *stat_snode; 
00179     int *panhows;
00180     cp_panel_t *cp_panel; /* panels on the critical path */
00181     desc_eft_t *desc_eft; /* all we need to know from descendants */
00182     int        *cp_firstkid, *cp_nextkid; /* linked list of children */
00183     int        *height;
00184     float      *flops_by_height;
00185 } Gstat_t;
00186 
00187 struct Branch {
00188     int root, first_desc, which_bin;
00189     struct Branch *next;
00190 };
00191 
00192 
00193 #if 0
00194 
00195 /* Statistics for supernode and panel size */
00196 int     no_panels;
00197 float   sum_w;          /* Sum (Wi) */
00198 float   sum_np_w;       /* Sum (Npi*Wi) */
00199 int     max_np;          
00200 int     no_sups;
00201 float   sum_sup;        /* Sum (Supi) */
00202 int     max_sup;     
00203 flops_t reuse_flops;    /* Triangular solve and matrix vector multiply */
00204 float   reuse_data;     /* Doubles in updating supernode */
00205 
00206 /* Statistics for blas operations */
00207 int     num_blas;       /* no of BLAS2 operations, including trsv/gemv */
00208 int     max_blas_n;     /* max dimension n in tri-solve and mat-vec */
00209 int     min_blas_n;     /* min dimension n in tri-solve and mat-vec */
00210 float   sum_blas_n;     /* sum of "        "        " */
00211 int     max_gemv_m;     /* max dimension m in mat-vec */
00212 int     min_gemv_m;     /* max dimension m in mat-vec */
00213 float   sum_gemv_m;     /* sum of "        "        " */
00214 int     lda_blas_m;
00215 int     lda_blas_n;
00216 flops_t *gemv_ops;      /* flops distribution on (m,n) */
00217 flops_t *trsv_ops;      /* flops distribution on n */
00218 
00219 #define i_trsv_ops(i)      trsv_ops[i]
00220 #define ij_gemv_ops(i,j)   gemv_ops[j*lda_blas_m + i]
00221 
00222 #endif
00223 
00224 #endif /* __SUPERLU_UTIL */
00225 

Generated on Mon Oct 23 15:05:29 2006 for OpenSees by doxygen 1.5.0