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