1 /* $Id: plog.h,v 1.50 1996/02/26 02:57:21 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 (HAVE_MPE) 154 extern int PLogUpshotBegin(); 155 extern int PLogAllUpshotBegin(); 156 #endif 157 158 #if defined(PETSC_LOG) 159 160 extern int (*_PLB)(int,int,PetscObject,PetscObject,PetscObject,PetscObject); 161 extern int (*_PLE)(int,int,PetscObject,PetscObject,PetscObject,PetscObject); 162 extern int (*_PHC)(PetscObject); 163 extern int (*_PHD)(PetscObject); 164 extern int PLogEventRegister(int*,char*); 165 166 /*M 167 PLogEventBegin - Logs the beginning of a user event. 168 169 Input Parameters: 170 . e - integer associated with the event obtained from PLogEventRegister() 171 . o1,o2,o3,o4 - objects associated with the event, or 0 172 173 Synopsis: 174 PLogEventBegin(int e,PetscObject o1,PetscObject o2,PetscObject o3, 175 PetscObject o4) 176 177 Notes: 178 You should also register each integer event with the command 179 PLogRegisterEvent(). The source code must be compiled with 180 -DPETSC_LOG, which is the default. 181 182 PETSc automatically logs library events if the code has been 183 compiled with -DPETSC_LOG, and -log, -log_summary, or -log_all are 184 specified. PLogEventBegin() is intended for logging user events 185 to supplement this PETSc information. 186 187 Example of Usage: 188 $ int USER_EVENT; 189 $ int user_event_flops; 190 $ PLogEventRegister(&USER_EVENT,"User event"); 191 $ PLogEventBegin(&USER_EVENT,0,0,0,0); 192 $ [code segment to monitor] 193 $ PLogFlops(user_event_flops); 194 $ PLogEventEnd(&USER_EVENT,0,0,0,0); 195 196 .seealso: PLogEventRegister(), PLogEventEnd(), PLogFlops() 197 198 .keywords: log, event, begin 199 M*/ 200 #define PLogEventBegin(e,o1,o2,o3,o4) {static int _tacky = 0;\ 201 { _tacky++;if (_PLB) (*_PLB)(e,_tacky,(PetscObject)o1,\ 202 (PetscObject)o2,(PetscObject)o3,(PetscObject)o4);}; 203 204 /*M 205 PLogEventEnd - Log the end of a user event. 206 207 Input Parameters: 208 . e - integer associated with the event obtained with PLogEventRegister() 209 . o1,o2,o3,o4 - objects associated with the event, or 0 210 211 Synopsis: 212 PLogEventEnd(int e,PetscObject o1,PetscObject o2,PetscObject o3, 213 PetscObject o4) 214 215 Notes: 216 You should also register each integer event with the command 217 PLogRegisterEvent(). Source code must be compiled with 218 -DPETSC_LOG, which is the default. 219 220 PETSc automatically logs library events if the code has been 221 compiled with -DPETSC_LOG, and -log, -log_summary, or -log_all are 222 specified. PLogEventEnd() is intended for logging user events 223 to supplement this PETSc information. 224 225 Example of Usage: 226 $ int USER_EVENT; 227 $ int user_event_flops; 228 $ PLogEventRegister(&USER_EVENT,"User event"); 229 $ PLogEventBegin(USER_EVENT,0,0,0,0); 230 $ [code segment to monitor] 231 $ PLogFlops(user_event_flops); 232 $ PLogEventEnd(USER_EVENT,0,0,0,0); 233 234 .seealso: PLogEventRegister(), PLogEventBegin(), PLogFlops() 235 236 .keywords: log, event, end 237 M*/ 238 #define PLogEventEnd(e,o1,o2,o3,o4) {if (_PLE) (*_PLE)(e,_tacky,(PetscObject)o1,\ 239 (PetscObject)o2,(PetscObject)o3,(PetscObject)o4);}\ 240 _tacky--;} 241 #define PLogObjectParent(p,c) {PETSCVALIDHEADER((PetscObject)c); \ 242 PETSCVALIDHEADER((PetscObject)p);\ 243 ((PetscObject)(c))->parent = (PetscObject) p;} 244 #define PLogObjectParents(p,n,d) {int _i; for ( _i=0; _i<n; _i++ ) \ 245 PLogObjectParent(p,(d)[_i]);} 246 #define PLogObjectCreate(h) {if (_PHC) (*_PHC)((PetscObject)h);} 247 #define PLogObjectDestroy(h) {if (_PHD) (*_PHD)((PetscObject)h);} 248 #define PLogObjectMemory(p,m) {PETSCVALIDHEADER((PetscObject)p);\ 249 ((PetscObject)(p))->mem += (m);} 250 extern int PLogObjectState(PetscObject,char *,...); 251 extern int PLogInfo(PetscObject,char*,...); 252 extern int PLogDestroy(); 253 extern int PLogStagePush(int); 254 extern int PLogStagePop(); 255 extern int PLogStageRegister(int,char*); 256 257 #else 258 259 #define PLogObjectCreate(h) 260 #define PLogObjectDestroy(h) 261 #define PLogObjectMemory(p,m) 262 #define PLogEventBegin(e,o1,o2,o3,o4) 263 #define PLogEventEnd(e,o1,o2,o3,o4) 264 #define PLogObjectParent(p,c) 265 #define PLogObjectParents(p,n,c) 266 extern int PLogInfo(PetscObject,char*,...); 267 extern int PLogDestroy(); 268 extern int PLogStagePush(int); 269 extern int PLogStagePop(); 270 extern int PLogStageRegister(int,char*); 271 #endif 272 273 #endif 274 275