1 /* $Id: plog.h,v 1.43 1996/01/22 01:16:48 curfman Exp balay $ */ 2 3 /* 4 Defines high level logging in PETSc. 5 */ 6 7 #if !defined(__PLOG_PACKAGE) 8 #define __PLOG_PACKAGE 9 #include "petsc.h" 10 11 /* 12 If you add an event here, make sure you add to petsc/bin/petscview.cfg 13 and petsc/src/sys/src/plog.c!! 14 */ 15 #define MAT_Mult 0 16 #define MAT_AssemblyBegin 1 17 #define MAT_AssemblyEnd 2 18 #define MAT_GetReordering 3 19 #define MAT_MultTrans 4 20 #define MAT_MultAdd 5 21 #define MAT_MultTransAdd 6 22 #define MAT_LUFactor 7 23 #define MAT_CholeskyFactor 8 24 #define MAT_LUFactorSymbolic 9 25 #define MAT_ILUFactorSymbolic 10 26 #define MAT_CholeskyFactorSymbolic 11 27 #define MAT_IncompleteCholeskyFactorSymbolic 12 28 #define MAT_LUFactorNumeric 13 29 #define MAT_CholeskyFactorNumeric 14 30 #define MAT_Relax 15 31 #define MAT_Copy 16 32 #define MAT_Convert 17 33 #define MAT_Scale 18 34 #define MAT_ZeroEntries 19 35 #define MAT_Solve 20 36 #define MAT_SolveAdd 21 37 #define MAT_SolveTrans 22 38 #define MAT_SolveTransAdd 23 39 #define MAT_SetValues 24 40 #define MAT_ForwardSolve 25 41 #define MAT_BackwardSolve 26 42 #define MAT_Load 27 43 #define MAT_View 28 44 #define MAT_ILUFactor 29 45 #define MAT_GetSubMatrix 30 46 #define MAT_GetSubMatrices 31 47 #define MAT_GetValues 32 48 #define MAT_IncreaseOverlap 33 49 50 #define VEC_Dot 40 51 #define VEC_Norm 41 52 #define VEC_Max 42 53 #define VEC_Min 43 54 #define VEC_TDot 44 55 #define VEC_Scale 45 56 #define VEC_Copy 46 57 #define VEC_Set 47 58 #define VEC_AXPY 48 59 #define VEC_AYPX 49 60 #define VEC_Swap 50 61 #define VEC_WAXPY 51 62 #define VEC_AssemblyBegin 52 63 #define VEC_AssemblyEnd 53 64 #define VEC_MTDot 54 65 #define VEC_MDot 55 66 #define VEC_MAXPY 56 67 #define VEC_PMult 57 68 #define VEC_SetValues 58 69 #define VEC_Load 59 70 #define VEC_View 60 71 #define VEC_ScatterBegin 61 72 #define VEC_ScatterEnd 62 73 #define VEC_SetRandom 63 74 75 #define SLES_Solve 70 76 #define SLES_SetUp 71 77 78 #define KSP_GMRESOrthogonalization 72 79 #define KSP_Solve 73 80 81 #define PC_SetUp 75 82 #define PC_Apply 76 83 #define PC_ApplySymmLeft 77 84 #define PC_ApplySymmRight 78 85 86 #define SNES_Solve 80 87 #define SNES_LineSearch 81 88 #define SNES_FunctionEval 82 89 #define SNES_JacobianEval 83 90 #define SNES_MinimizationFunctionEval 84 91 #define SNES_GradientEval 85 92 #define SNES_HessianEval 86 93 94 #define TS_Step 90 95 /* 96 Event numbers PLOG_USER_EVENT_LOW to PLOG_USER_EVENT_HIGH are reserved 97 for applications. Make sure that src/sys/src/plog.c defines enough 98 entries in (*name)[] to go up to PLOG_USER_EVENT_HIGH. 99 */ 100 #define PLOG_USER_EVENT_LOW 120 101 #define PLOG_USER_EVENT_HIGH 200 102 103 /* Global flop counter */ 104 extern double _TotalFlops; 105 #if defined(PETSC_LOG) 106 #define PLogFlops(n) {_TotalFlops += n;} 107 #else 108 #define PLogFlops(n) 109 #endif 110 111 112 /*M 113 PLogFlops - Adds floating point operations to the global counter. 114 You must include "plog.h" to use this function. 115 116 Input Parameter: 117 . f - flop counter 118 119 Synopsis: 120 PLogFlops(int f) 121 122 Notes: 123 A global counter logs all PETSc flop counts. The user can use 124 PLogFlops() to increment this counter to include flops for the 125 application code. 126 127 PETSc automatically logs library events if the code has been 128 compiled with -DPETSC_LOG (which is the default), and -log, 129 -log_summary, or -log_all are specified. PLogFlops() is 130 intended for logging user flops to supplement this PETSc 131 information. 132 133 Example of Usage: 134 $ #define USER_EVENT PLOG_USER_EVENT_LOW 135 $ PLogEventRegister(USER_EVENT,"User event"); 136 $ PLogEventBegin(USER_EVENT,0,0,0,0); 137 $ [code segment to monitor] 138 $ PLogFlops(user_flops) 139 $ PLogEventEnd(USER_EVENT,0,0,0,0); 140 141 .seealso: PLogEventRegister(), PLogEventBegin(), PLogEventEnd() 142 143 .keywords: Petsc, log, flops, floating point operations 144 M*/ 145 146 extern int PLogPrint(MPI_Comm,FILE *); 147 extern int PLogBegin(); 148 extern int PLogAllBegin(); 149 extern int PLogDump(char*); 150 151 #if defined(PETSC_LOG) 152 153 extern int (*_PLB)(int,int,PetscObject,PetscObject,PetscObject,PetscObject); 154 extern int (*_PLE)(int,int,PetscObject,PetscObject,PetscObject,PetscObject); 155 extern int (*_PHC)(PetscObject); 156 extern int (*_PHD)(PetscObject); 157 extern int PLogEventRegister(int,char*); 158 159 /*M 160 PLogEventBegin - Logs the beginning of a user event. 161 162 Input Parameters: 163 . e - integer associated with the event (PLOG_USER_EVENT_LOW <= e < PLOG_USER_EVENT_HIGH) 164 . o1,o2,o3,o4 - objects associated with the event, or 0 165 166 Synopsis: 167 PLogEventBegin(int e,PetscObject o1,PetscObject o2,PetscObject o3, 168 PetscObject o4) 169 170 Notes: 171 You should also register each integer event with the command 172 PLogRegisterEvent(). The source code must be compiled with 173 -DPETSC_LOG, which is the default. 174 175 PETSc automatically logs library events if the code has been 176 compiled with -DPETSC_LOG, and -log, -log_summary, or -log_all are 177 specified. PLogEventBegin() is intended for logging user events 178 to supplement this PETSc information. 179 180 Example of Usage: 181 $ #define USER_EVENT PLOG_USER_EVENT_LOW 182 $ int user_event_flops; 183 $ PLogEventRegister(USER_EVENT,"User event"); 184 $ PLogEventBegin(USER_EVENT,0,0,0,0); 185 $ [code segment to monitor] 186 $ PLogFlops(user_event_flops); 187 $ PLogEventEnd(USER_EVENT,0,0,0,0); 188 189 .seealso: PLogEventRegister(), PLogEventEnd(), PLogFlops() 190 191 .keywords: log, event, begin 192 M*/ 193 #define PLogEventBegin(e,o1,o2,o3,o4) {static int _tacky = 0;\ 194 { _tacky++;if (_PLB) (*_PLB)(e,_tacky,(PetscObject)o1,\ 195 (PetscObject)o2,(PetscObject)o3,(PetscObject)o4);}; 196 197 /*M 198 PLogEventEnd - Log the end of a user event. 199 200 Input Parameters: 201 . e - integer associated with the event (PLOG_USER_EVENT_LOW <= e < PLOG_USER_EVENT_HIGH) 202 . o1,o2,o3,o4 - objects associated with the event, or 0 203 204 Synopsis: 205 PLogEventEnd(int e,PetscObject o1,PetscObject o2,PetscObject o3, 206 PetscObject o4) 207 208 Notes: 209 You should also register each integer event with the command 210 PLogRegisterEvent(). Source code must be compiled with 211 -DPETSC_LOG, which is the default. 212 213 PETSc automatically logs library events if the code has been 214 compiled with -DPETSC_LOG, and -log, -log_summary, or -log_all are 215 specified. PLogEventEnd() is intended for logging user events 216 to supplement this PETSc information. 217 218 Example of Usage: 219 $ #define USER_EVENT PLOG_EVENT_USER_LOW 220 $ int user_event_flops; 221 $ PLogEventRegister(USER_EVENT,"User event"); 222 $ PLogEventBegin(USER_EVENT,0,0,0,0); 223 $ [code segment to monitor] 224 $ PLogFlops(user_event_flops); 225 $ PLogEventEnd(USER_EVENT,0,0,0,0); 226 227 .seealso: PLogEventRegister(), PLogEventBegin(), PLogFlops() 228 229 .keywords: log, event, end 230 M*/ 231 #define PLogEventEnd(e,o1,o2,o3,o4) {if (_PLE) (*_PLE)(e,_tacky,(PetscObject)o1,\ 232 (PetscObject)o2,(PetscObject)o3,(PetscObject)o4);}\ 233 _tacky--;} 234 #define PLogObjectParent(p,c) {PETSCVALIDHEADER((PetscObject)c); \ 235 PETSCVALIDHEADER((PetscObject)p);\ 236 ((PetscObject)(c))->parent = (PetscObject) p;} 237 #define PLogObjectParents(p,n,d) {int _i; for ( _i=0; _i<n; _i++ ) \ 238 PLogObjectParent(p,(d)[_i]);} 239 #define PLogObjectCreate(h) {if (_PHC) (*_PHC)((PetscObject)h);} 240 #define PLogObjectDestroy(h) {if (_PHD) (*_PHD)((PetscObject)h);} 241 #define PLogObjectMemory(p,m) {PETSCVALIDHEADER((PetscObject)p);\ 242 ((PetscObject)(p))->mem += (m);} 243 extern int PLogObjectState(PetscObject,char *,...); 244 extern int PLogInfo(PetscObject,char*,...); 245 extern int PLogDestroy(); 246 extern int PLogStagePush(int); 247 extern int PLogStagePop(); 248 extern int PLogStageRegister(int,char*); 249 250 #else 251 252 #define PLogObjectCreate(h) 253 #define PLogObjectDestroy(h) 254 #define PLogObjectMemory(p,m) 255 #define PLogEventBegin(e,o1,o2,o3,o4) 256 #define PLogEventEnd(e,o1,o2,o3,o4) 257 #define PLogObjectParent(p,c) 258 #define PLogObjectParents(p,n,c) 259 extern int PLogInfo(PetscObject,char*,...); 260 extern int PLogDestroy(); 261 extern int PLogStagePush(int); 262 extern int PLogStagePop(); 263 extern int PLogStageRegister(int,char*); 264 #endif 265 266 #endif 267 268