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