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) %.2f\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  * Constants
50  */
51 #define EMPTY (-1)
52 #ifndef FALSE
53 #define FALSE (0)
54 #endif
55 #ifndef TRUE
56 #define TRUE (1)
57 #endif
58 
59 /*
60  * Type definitions
61  */
62 typedef float flops_t;
63 typedef unsigned char Logical;
64 
65 /*
66 #ifdef _CRAY
67 #define int short
68 #endif
69 */
70 
71 typedef struct {
72  int *panel_histo; /* histogram of panel size distribution */
73  double *utime; /* running time at various phases */
74  flops_t *ops; /* operation count at various phases */
75  int TinyPivots; /* number of tiny pivots */
76  int RefineSteps; /* number of iterative refinement steps */
77  int num_look_aheads; /* number of look ahead */
79 
80 /* Headers for 2 types of dynamatically managed memory */
81 typedef struct e_node {
82  int size; /* length of the memory that has been used */
83  void *mem; /* pointer to the new malloc'd store */
85 
86 typedef struct {
87  int size;
88  int used;
89  int top1; /* grow upward, relative to &array[0] */
90  int top2; /* grow downward */
91  void *array;
92 } LU_stack_t;
93 
94 /* Constants */
95 #define GluIntArray(n) (5 * (n) + 5)
96 #define NO_MEMTYPE 6 /* 0: lusup;
97  1: ucol;
98  2: lsub;
99  3: usub
100  4: llvl; level number in L for ILU(k)
101  5: ulvl; level number in U for ILU(k)
102  */
103 
104 /* Macros to manipulate stack */
105 #define StackFull(x) ( x + stack.used >= stack.size )
106 #define NotDoubleAlign(addr) ( (long)addr & 7 )
107 #define DoubleAlign(addr) ( ((long)addr + 7) & ~7L )
108 #define TempSpace(n, w) ( (2*w + 4 + NO_MARKER)*m*sizeof(int) + \
109  (w + 1)*n*sizeof(double) )
110 #define Reduce(alpha) ((alpha + 1) / 2) /* i.e. (alpha-1)/2 + 1 */
111 
112 #define FIRSTCOL_OF_SNODE(i) (xsup[i])
113 
114 #if ( PROFlevel>=1 )
115 #define TIC(t) t = SuperLU_timer_()
116 #define TOC(t2, t1) t2 = SuperLU_timer_() - t1
117 #else
118 #define TIC(t)
119 #define TOC(t2, t1)
120 #endif
121 
122 /*********************************************************
123  * Macros used for easy access of sparse matrix entries. *
124  *********************************************************/
125 #define L_SUB_START(col) ( Lstore->rowind_colptr[col] )
126 #define L_SUB(ptr) ( Lstore->rowind[ptr] )
127 #define L_NZ_START(col) ( Lstore->nzval_colptr[col] )
128 #define L_FST_SUPC(superno) ( Lstore->sup_to_col[superno] )
129 #define U_NZ_START(col) ( Ustore->colptr[col] )
130 #define U_SUB(ptr) ( Ustore->rowind[ptr] )
131 
132 #endif /* __SUPERLU_UTIL */
Scalar Scalar int size
Definition: benchVecAdd.cpp:17
std::array< T, N > array
Definition: EmulateArray.h:231
enum constants header file
float flops_t
Definition: slu_util.h:114
Definition: slu_util.h:282
Definition: slu_util.h:290
int num_look_aheads
Definition: util_dist.h:77
Headers for 4 types of dynamatically managed memory.
Definition: slu_util.h:277
int size
Definition: slu_util.h:278
void * mem
Definition: slu_util.h:279
unsigned char Logical
Definition: util_dist.h:63
float flops_t
Definition: util_dist.h:62
struct e_node ExpHeader