SuperLU_DIST  4.0
superlu_dist on CPU and GPU clusters
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
util_dist.h
Go to the documentation of this file.
1 
5 #ifndef __SUPERLU_UTIL /* allow multiple inclusions */
6 #define __SUPERLU_UTIL
7 
8 #include <stdio.h>
9 #include <stdlib.h>
10 #include <string.h>
11 #include <assert.h>
12 #include "superlu_enum_consts.h"
13 
14 /*
15  * Macros
16  */
17 #ifndef USER_ABORT
18 #define USER_ABORT(msg) superlu_abort_and_exit_dist(msg)
19 #endif
20 
21 #define ABORT(err_msg) \
22  { char msg[256];\
23  sprintf(msg,"%s at line %d in file %s\n",err_msg,__LINE__, __FILE__);\
24  USER_ABORT(msg); }
25 
26 
27 #ifndef USER_MALLOC
28 #define USER_MALLOC(size) superlu_malloc_dist(size)
29 #endif
30 
31 #define SUPERLU_MALLOC(size) USER_MALLOC(size)
32 
33 #ifndef USER_FREE
34 #define USER_FREE(addr) superlu_free_dist(addr)
35 #endif
36 
37 #define SUPERLU_FREE(addr) USER_FREE(addr)
38 
39 #define CHECK_MALLOC(pnum, where) { \
40  extern long int superlu_malloc_total; \
41  printf("(%d) %s: superlu_malloc_total (MB) %.6f\n", \
42  pnum, where, superlu_malloc_total*1e-6); \
43 }
44 
45 #define SUPERLU_MAX(x, y) ( (x) > (y) ? (x) : (y) )
46 #define SUPERLU_MIN(x, y) ( (x) < (y) ? (x) : (y) )
47 
48 
49 /*
50  * Constants
51  */
52 #define EMPTY (-1)
53 #ifndef FALSE
54 #define FALSE (0)
55 #endif
56 #ifndef TRUE
57 #define TRUE (1)
58 #endif
59 
60 /*
61  * Type definitions
62  */
63 typedef float flops_t;
64 typedef unsigned char Logical;
65 
66 /*
67 #ifdef _CRAY
68 #define int short
69 #endif
70 */
71 
72 typedef struct {
73  int *panel_histo; /* histogram of panel size distribution */
74  double *utime; /* running time at various phases */
75  flops_t *ops; /* operation count at various phases */
76  int TinyPivots; /* number of tiny pivots */
77  int RefineSteps; /* number of iterative refinement steps */
78  int num_look_aheads; /* number of look ahead */
79  /*-- new --*/
80  float current_buffer; /* bytes allocated for buffer in numerical factorization */
81  float peak_buffer; /* monitor the peak buffer size */
82  float gpu_buffer; /* monitor the buffer allocated on GPU */
84 
85 /* Headers for 2 types of dynamatically managed memory */
86 typedef struct e_node {
87  int size; /* length of the memory that has been used */
88  void *mem; /* pointer to the new malloc'd store */
89 } ExpHeader;
90 
91 typedef struct {
92  int size;
93  int used;
94  int top1; /* grow upward, relative to &array[0] */
95  int top2; /* grow downward */
96  void *array;
97 } LU_stack_t;
98 
99 /* Constants */
100 #define GluIntArray(n) (5 * (n) + 5)
101 #define NO_MEMTYPE 6 /* 0: lusup;
102  1: ucol;
103  2: lsub;
104  3: usub
105  4: llvl; level number in L for ILU(k)
106  5: ulvl; level number in U for ILU(k)
107  */
108 
109 /* Macros to manipulate stack */
110 #define StackFull(x) ( x + stack.used >= stack.size )
111 #define NotDoubleAlign(addr) ( (long)addr & 7 )
112 #define DoubleAlign(addr) ( ((long)addr + 7) & ~7L )
113 #define TempSpace(n, w) ( (2*w + 4 + NO_MARKER)*m*sizeof(int) + \
114  (w + 1)*n*sizeof(double) )
115 #define Reduce(alpha) ((alpha + 1) / 2) /* i.e. (alpha-1)/2 + 1 */
116 
117 #define FIRSTCOL_OF_SNODE(i) (xsup[i])
118 
119 #if ( PROFlevel>=1 )
120 #define TIC(t) t = SuperLU_timer_()
121 #define TOC(t2, t1) t2 = SuperLU_timer_() - t1
122 #else
123 #define TIC(t)
124 #define TOC(t2, t1)
125 #endif
126 
127 /*********************************************************
128  * Macros used for easy access of sparse matrix entries. *
129  *********************************************************/
130 #define L_SUB_START(col) ( Lstore->rowind_colptr[col] )
131 #define L_SUB(ptr) ( Lstore->rowind[ptr] )
132 #define L_NZ_START(col) ( Lstore->nzval_colptr[col] )
133 #define L_FST_SUPC(superno) ( Lstore->sup_to_col[superno] )
134 #define U_NZ_START(col) ( Ustore->colptr[col] )
135 #define U_SUB(ptr) ( Ustore->rowind[ptr] )
136 
137 #endif /* __SUPERLU_UTIL */
void * array
Definition: util_dist.h:96
struct e_node ExpHeader
int top2
Definition: util_dist.h:95
int * panel_histo
Definition: util_dist.h:73
int top1
Definition: util_dist.h:94
enum constants header file
Definition: util_dist.h:72
float peak_buffer
Definition: util_dist.h:81
void * mem
Definition: util_dist.h:88
Definition: util_dist.h:86
int size
Definition: util_dist.h:92
unsigned char Logical
Definition: util_dist.h:64
float current_buffer
Definition: util_dist.h:80
int num_look_aheads
Definition: util_dist.h:78
int TinyPivots
Definition: util_dist.h:76
Definition: util_dist.h:91
int size
Definition: util_dist.h:87
flops_t * ops
Definition: util_dist.h:75
float gpu_buffer
Definition: util_dist.h:82
int RefineSteps
Definition: util_dist.h:77
int used
Definition: util_dist.h:93
double * utime
Definition: util_dist.h:74
float flops_t
Definition: util_dist.h:63