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