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