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