1 /* $Id: plog.h,v 1.67 1996/03/23 20:44:39 bsmith Exp curfman $ */ 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, petsc/src/sys/src/plog.c, and 14 petsc/src/sys/src/plogmpe.c!!! 15 */ 16 #define MAT_Mult 0 17 #define MAT_MatrixFreeMult 1 18 #define MAT_AssemblyBegin 2 19 #define MAT_AssemblyEnd 3 20 #define MAT_GetReordering 4 21 #define MAT_MultTrans 5 22 #define MAT_MultAdd 6 23 #define MAT_MultTransAdd 7 24 #define MAT_LUFactor 8 25 #define MAT_CholeskyFactor 9 26 #define MAT_LUFactorSymbolic 10 27 #define MAT_ILUFactorSymbolic 11 28 #define MAT_CholeskyFactorSymbolic 12 29 #define MAT_IncompleteCholeskyFactorSymbolic 13 30 #define MAT_LUFactorNumeric 14 31 #define MAT_CholeskyFactorNumeric 15 32 #define MAT_Relax 16 33 #define MAT_Copy 17 34 #define MAT_Convert 18 35 #define MAT_Scale 19 36 #define MAT_ZeroEntries 20 37 #define MAT_Solve 21 38 #define MAT_SolveAdd 22 39 #define MAT_SolveTrans 23 40 #define MAT_SolveTransAdd 24 41 #define MAT_SetValues 25 42 #define MAT_ForwardSolve 26 43 #define MAT_BackwardSolve 27 44 #define MAT_Load 28 45 #define MAT_View 29 46 #define MAT_ILUFactor 30 47 #define MAT_GetSubMatrix 31 48 #define MAT_GetSubMatrices 32 49 #define MAT_GetValues 33 50 #define MAT_IncreaseOverlap 34 51 #define MAT_GetRow 35 52 53 #define VEC_Dot 40 54 #define VEC_Norm 41 55 #define VEC_Max 42 56 #define VEC_Min 43 57 #define VEC_TDot 44 58 #define VEC_Scale 45 59 #define VEC_Copy 46 60 #define VEC_Set 47 61 #define VEC_AXPY 48 62 #define VEC_AYPX 49 63 #define VEC_Swap 50 64 #define VEC_WAXPY 51 65 #define VEC_AssemblyBegin 52 66 #define VEC_AssemblyEnd 53 67 #define VEC_MTDot 54 68 #define VEC_MDot 55 69 #define VEC_MAXPY 56 70 #define VEC_PMult 57 71 #define VEC_SetValues 58 72 #define VEC_Load 59 73 #define VEC_View 60 74 #define VEC_ScatterBegin 61 75 #define VEC_ScatterEnd 62 76 #define VEC_SetRandom 63 77 78 #define SLES_Solve 70 79 #define SLES_SetUp 71 80 81 #define KSP_GMRESOrthogonalization 72 82 83 #define PC_SetUp 75 84 #define PC_SetUpOnBlocks 76 85 #define PC_Apply 77 86 #define PC_ApplySymmLeft 78 87 #define PC_ApplySymmRight 79 88 89 #define SNES_Solve 80 90 #define SNES_LineSearch 81 91 #define SNES_FunctionEval 82 92 #define SNES_JacobianEval 83 93 #define SNES_MinimizationFunctionEval 84 94 #define SNES_GradientEval 85 95 #define SNES_HessianEval 86 96 97 #define TS_Step 90 98 99 #define Petsc_Barrier 100 100 /* 101 Event numbers PLOG_USER_EVENT_LOW to PLOG_USER_EVENT_HIGH are reserved 102 for applications. Make sure that src/plog/src/plog.c defines enough 103 entries in (*name)[] to go up to PLOG_USER_EVENT_HIGH. 104 */ 105 #define PLOG_USER_EVENT_LOW_STATIC 120 106 #define PLOG_USER_EVENT_HIGH 200 107 108 /* Global flop counter */ 109 extern double _TotalFlops; 110 #if defined(PETSC_LOG) 111 #define PLogFlops(n) {_TotalFlops += n;} 112 #else 113 #define PLogFlops(n) 114 #endif 115 116 /* General logging of information; different from event logging */ 117 extern int PLogInfo(void*,char*,...); 118 119 #if defined (HAVE_MPE) 120 #include "mpe.h" 121 extern int PLogMPEBegin(); 122 extern int PLogMPEDump(char *); 123 extern int UseMPE,MPEFlags[]; 124 #define MPEBEGIN 1000 125 #endif 126 127 #if defined(PETSC_LOG) 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 133 #if defined(HAVE_MPE) 134 #define PLogEventBegin(e,o1,o2,o3,o4) {static int _tacky = 0; \ 135 { _tacky++; \ 136 if (_PLB) \ 137 (*_PLB)(e,_tacky,(PetscObject)(o1),(PetscObject)(o2),(PetscObject)(o3),(PetscObject)(o4));\ 138 if (_tacky == 1 && UseMPE && MPEFlags[e])\ 139 MPE_Log_event(MPEBEGIN+2*e,0,"");\ 140 } 141 #else 142 #define PLogEventBegin(e,o1,o2,o3,o4) {static int _tacky = 0; \ 143 { _tacky++; \ 144 if (_PLB) \ 145 (*_PLB)(e,_tacky,(PetscObject)(o1),(PetscObject)(o2),(PetscObject)(o3),(PetscObject)(o4));\ 146 } 147 #endif 148 149 #if defined(HAVE_MPE) 150 #define PLogEventEnd(e,o1,o2,o3,o4) {\ 151 if (_PLE) \ 152 (*_PLE)(e,_tacky,(PetscObject)(o1),(PetscObject)(o2),(PetscObject)(o3),(PetscObject)(o4));\ 153 if (_tacky == 1 && UseMPE && MPEFlags[e])\ 154 MPE_Log_event(MPEBEGIN+2*e+1,0,"");\ 155 } _tacky--;} 156 #else 157 #define PLogEventEnd(e,o1,o2,o3,o4) {\ 158 if (_PLE) \ 159 (*_PLE)(e,_tacky,(PetscObject)(o1),(PetscObject)(o2),(PetscObject)(o3),(PetscObject)(o4));\ 160 } _tacky--;} 161 #endif 162 163 164 #define PLogObjectParent(p,c) {PetscValidHeader((PetscObject)c); \ 165 PetscValidHeader((PetscObject)p);\ 166 ((PetscObject)(c))->parent = (PetscObject) p;} 167 #define PLogObjectParents(p,n,d) {int _i; for ( _i=0; _i<n; _i++ ) \ 168 PLogObjectParent(p,(d)[_i]);} 169 #define PLogObjectCreate(h) {if (_PHC) (*_PHC)((PetscObject)h);} 170 #define PLogObjectDestroy(h) {if (_PHD) (*_PHD)((PetscObject)h);} 171 #define PLogObjectMemory(p,m) {PetscValidHeader((PetscObject)p);\ 172 ((PetscObject)(p))->mem += (m);} 173 extern int PLogObjectState(PetscObject,char *,...); 174 extern int PLogDestroy(); 175 extern int PLogStagePush(int); 176 extern int PLogStagePop(); 177 extern int PLogStageRegister(int,char*); 178 extern int PLogPrintSummary(MPI_Comm,FILE *); 179 extern int PLogBegin(); 180 extern int PLogAllBegin(); 181 extern int PLogDump(char*); 182 extern int PLogEventRegister(int*,char*,char*); 183 184 #else 185 186 #define _PLB 0 187 #define _PLE 0 188 #define _PHC 0 189 #define _PHD 0 190 #define PLogEventBegin(e,o1,o2,o3,o4) 191 #define PLogEventEnd(e,o1,o2,o3,o4) 192 #define PLogObjectParent(p,c) 193 #define PLogObjectParents(p,n,c) 194 #define PLogObjectCreate(h) 195 #define PLogObjectDestroy(h) 196 #define PLogObjectMemory(p,m) 197 #define PLogDestroy() 198 #define PLogStagePush(int) 199 #define PLogStagePop() 200 #define PLogStageRegister(a,b) 201 #define PLogPrintSummary(comm,file) 202 #define PLogBegin() 203 #define PLogAllBegin() 204 #define PLogDump(char) 205 #define PLogEventRegister(a,b,c) 206 #define PLogMPEBegin() 207 #define PLogMPEDump(a) 208 extern int PLogObjectState(PetscObject,char *,...); 209 210 #endif 211 212 /*MC 213 PLogFlops - Adds floating point operations to the global counter. 214 215 Input Parameter: 216 . f - flop counter 217 218 Synopsis: 219 void PLogFlops(int f) 220 221 Notes: 222 A global counter logs all PETSc flop counts. The user can use 223 PLogFlops() to increment this counter to include flops for the 224 application code. 225 226 PETSc automatically logs library events if the code has been 227 compiled with -DPETSC_LOG (which is the default), and -log, 228 -log_summary, or -log_all are specified. PLogFlops() is 229 intended for logging user flops to supplement this PETSc 230 information. 231 232 Example of Usage: 233 $ int USER_EVENT; 234 $ PLogEventRegister(&USER_EVENT,"User event","Color:"); 235 $ PLogEventBegin(USER_EVENT,0,0,0,0); 236 $ [code segment to monitor] 237 $ PLogFlops(user_flops) 238 $ PLogEventEnd(USER_EVENT,0,0,0,0); 239 240 .seealso: PLogEventRegister(), PLogEventBegin(), PLogEventEnd() 241 242 .keywords: log, flops, floating point operations 243 M*/ 244 245 246 /*MC 247 PLogEventBegin - Logs the beginning of a user event. 248 249 Input Parameters: 250 . e - integer associated with the event obtained from PLogEventRegister() 251 . o1,o2,o3,o4 - objects associated with the event, or 0 252 253 Synopsis: 254 void PLogEventBegin(int e,PetscObject o1,PetscObject o2,PetscObject o3, 255 PetscObject o4) 256 257 Notes: 258 You should also register each integer event with the command 259 PLogRegisterEvent(). The source code must be compiled with 260 -DPETSC_LOG, which is the default. 261 262 PETSc automatically logs library events if the code has been 263 compiled with -DPETSC_LOG, and -log, -log_summary, or -log_all are 264 specified. PLogEventBegin() is intended for logging user events 265 to supplement this PETSc information. 266 267 Example of Usage: 268 $ int USER_EVENT; 269 $ int user_event_flops; 270 $ PLogEventRegister(&USER_EVENT,"User event","Color:"); 271 $ PLogEventBegin(&USER_EVENT,0,0,0,0); 272 $ [code segment to monitor] 273 $ PLogFlops(user_event_flops); 274 $ PLogEventEnd(&USER_EVENT,0,0,0,0); 275 276 .seealso: PLogEventRegister(), PLogEventEnd(), PLogFlops() 277 278 .keywords: log, event, begin 279 M*/ 280 281 /*MC 282 PLogEventEnd - Log the end of a user event. 283 284 Input Parameters: 285 . e - integer associated with the event obtained with PLogEventRegister() 286 . o1,o2,o3,o4 - objects associated with the event, or 0 287 288 Synopsis: 289 void PLogEventEnd(int e,PetscObject o1,PetscObject o2,PetscObject o3, 290 PetscObject o4) 291 292 Notes: 293 You should also register each integer event with the command 294 PLogRegisterEvent(). Source code must be compiled with 295 -DPETSC_LOG, which is the default. 296 297 PETSc automatically logs library events if the code has been 298 compiled with -DPETSC_LOG, and -log, -log_summary, or -log_all are 299 specified. PLogEventEnd() is intended for logging user events 300 to supplement this PETSc information. 301 302 Example of Usage: 303 $ int USER_EVENT; 304 $ int user_event_flops; 305 $ PLogEventRegister(&USER_EVENT,"User event","Color:"); 306 $ PLogEventBegin(USER_EVENT,0,0,0,0); 307 $ [code segment to monitor] 308 $ PLogFlops(user_event_flops); 309 $ PLogEventEnd(USER_EVENT,0,0,0,0); 310 311 .seealso: PLogEventRegister(), PLogEventBegin(), PLogFlops() 312 313 .keywords: log, event, end 314 M*/ 315 316 #endif 317 318 319 320