1 /* $Id: plog.h,v 1.18 1995/09/30 19:31:53 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 85 /* event numbers 80 to 99 are reserved for applications */ 86 87 /* Global flop counter */ 88 extern double _TotalFlops; 89 #if defined(PETSC_LOG) 90 #define PLogFlops(n) {_TotalFlops += n;} 91 #else 92 #define PLogFlops(n) 93 #endif 94 95 /*M 96 PLogFlops - Adds floating point operations to the global counter. 97 98 Input Parameter: 99 . f - flop counter 100 101 Synopsis: 102 PLogFlops(int f) 103 104 Notes: 105 A global counter logs all PETSc flop counts. The user can use 106 PLogFlops() to increment this counter to include flops for the 107 application code. 108 109 PETSc automatically logs library events if the code has been 110 compiled with -DPETSC_LOG (which is the default), and -log, 111 -log_summary, or -log_all are specified. PLogFlops() is 112 intended for logging user flops to supplement this PETSc 113 information. 114 115 Example of Usage: 116 $ #define USER_EVENT 75 117 $ PLogEventRegister(USER_EVENT,"User event"); 118 $ PLogEventBegin(USER_EVENT,0,0,0,0); 119 $ [code segment to monitor] 120 $ PLogFlops(user_flops) 121 $ PLogEventEnd(USER_EVENT,0,0,0,0); 122 123 .seealso: PLogEventRegister(), PLogEventBegin(), PLogEventEnd() 124 125 .keywords: Petsc, log, flops, floating point operations 126 M*/ 127 128 extern int PLogPrint(MPI_Comm,FILE *); 129 extern int PLogBegin(); 130 extern int PLogAllBegin(); 131 extern int PLogDump(char*); 132 133 #if defined(PETSC_LOG) 134 135 extern int (*_PLB)(int,int,PetscObject,PetscObject,PetscObject,PetscObject); 136 extern int (*_PLE)(int,int,PetscObject,PetscObject,PetscObject,PetscObject); 137 extern int (*_PHC)(PetscObject); 138 extern int (*_PHD)(PetscObject); 139 extern int PLogEventRegister(int,char*); 140 141 /*M 142 PLogEventBegin - Logs the beginning of a user event. 143 144 Input Parameters: 145 . e - integer associated with the event (69 < e < 89) 146 . o1,o2,o3,o4 - objects associated with the event, or 0 147 148 Synopsis: 149 PLogEventBegin(int e,PetscObject o1,PetscObject o2,PetscObject o3, 150 PetscObject o4) 151 152 Notes: 153 You should also register each integer event with the command 154 PLogRegisterEvent(). The source code must be compiled with 155 -DPETSC_LOG, which is the default. 156 157 PETSc automatically logs library events if the code has been 158 compiled with -DPETSC_LOG, and -log, -log_summary, or -log_all are 159 specified. PLogEventBegin() is intended for logging user events 160 to supplement this PETSc information. 161 162 Example of Usage: 163 $ #define USER_EVENT 75 164 $ int user_event_flops; 165 $ PLogEventRegister(USER_EVENT,"User event"); 166 $ PLogEventBegin(USER_EVENT,0,0,0,0); 167 $ [code segment to monitor] 168 $ PLogFlops(user_event_flops); 169 $ PLogEventEnd(USER_EVENT,0,0,0,0); 170 171 .seealso: PLogEventRegister(), PLogEventEnd(), PLogFlops() 172 173 .keywords: log, event, begin 174 M*/ 175 #define PLogEventBegin(e,o1,o2,o3,o4) {static int _tacky = 0;\ 176 { _tacky++;if (_PLB) (*_PLB)(e,_tacky,(PetscObject)o1,\ 177 (PetscObject)o2,(PetscObject)o3,(PetscObject)o4);}; 178 179 /*M 180 PLogEventEnd - Log the end of a user event. 181 182 Input Parameters: 183 . e - integer associated with the event (69 < e < 89) 184 . o1,o2,o3,o4 - objects associated with the event, or 0 185 186 Synopsis: 187 PLogEventEnd(int e,PetscObject o1,PetscObject o2,PetscObject o3, 188 PetscObject o4) 189 190 Notes: 191 You should also register each integer event with the command 192 PLogRegisterEvent(). Source code must be compiled with 193 -DPETSC_LOG, which is the default. 194 195 PETSc automatically logs library events if the code has been 196 compiled with -DPETSC_LOG, and -log, -log_summary, or -log_all are 197 specified. PLogEventEnd() is intended for logging user events 198 to supplement this PETSc information. 199 200 Example of Usage: 201 $ #define USER_EVENT 75 202 $ int user_event_flops; 203 $ PLogEventRegister(USER_EVENT,"User event"); 204 $ PLogEventBegin(USER_EVENT,0,0,0,0); 205 $ [code segment to monitor] 206 $ PLogFlops(user_event_flops); 207 $ PLogEventEnd(USER_EVENT,0,0,0,0); 208 209 .seealso: PLogEventRegister(), PLogEventBegin(), PLogFlops() 210 211 .keywords: log, event, end 212 M*/ 213 #define PLogEventEnd(e,o1,o2,o3,o4) {if (_PLE) (*_PLE)(e,_tacky,(PetscObject)o1,\ 214 (PetscObject)o2,(PetscObject)o3,(PetscObject)o4);}\ 215 _tacky--;} 216 #define PLogObjectParent(p,c) {PETSCVALIDHEADER((PetscObject)c); \ 217 PETSCVALIDHEADER((PetscObject)p);\ 218 ((PetscObject)(c))->parent = (PetscObject) p;} 219 #define PLogObjectParents(p,n,d) {int _i; for ( _i=0; _i<n; _i++ ) \ 220 PLogObjectParent(p,(d)[_i]);} 221 #define PLogObjectCreate(h) {if (_PHC) (*_PHC)((PetscObject)h);} 222 #define PLogObjectDestroy(h) {if (_PHD) (*_PHD)((PetscObject)h);} 223 #define PLogObjectMemory(p,m) {PETSCVALIDHEADER((PetscObject)p);\ 224 ((PetscObject)(p))->mem += (m);} 225 extern int PLogObjectState(PetscObject,char *,...); 226 extern int PLogInfo(PetscObject,char*,...); 227 extern int PLogDestroy(); 228 229 #else 230 231 #define PLogObjectCreate(h) 232 #define PLogObjectDestroy(h) 233 #define PLogObjectMemory(p,m) 234 #define PLogEventBegin(e,o1,o2,o3,o4) 235 #define PLogEventEnd(e,o1,o2,o3,o4) 236 #define PLogObjectParent(p,c) 237 #define PLogObjectParents(p,n,c) 238 extern int PLogInfo(PetscObject,char*,...); 239 #endif 240 241 #endif 242