1 /* 2 Defines profile/logging in PETSc. 3 */ 4 5 #if !defined(__PetscLog_H) 6 #define __PetscLog_H 7 #include "petsc.h" 8 PETSC_EXTERN_CXX_BEGIN 9 10 #define PETSC_EVENT 1311311 11 extern PetscEvent PETSC_LARGEST_EVENT; 12 13 /* Global flop counter */ 14 extern PetscLogDouble PETSC_DLLEXPORT _TotalFlops; 15 16 /* General logging of information; different from event logging */ 17 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscInfo_Private(const char[],void*,const char[],...) PETSC_PRINTF_FORMAT_CHECK(3,4); 18 #if defined(PETSC_USE_INFO) 19 #define PetscInfo(A,S) PetscInfo_Private(__FUNCT__,A,S) 20 #define PetscInfo1(A,S,a1) PetscInfo_Private(__FUNCT__,A,S,a1) 21 #define PetscInfo2(A,S,a1,a2) PetscInfo_Private(__FUNCT__,A,S,a1,a2) 22 #define PetscInfo3(A,S,a1,a2,a3) PetscInfo_Private(__FUNCT__,A,S,a1,a2,a3) 23 #define PetscInfo4(A,S,a1,a2,a3,a4) PetscInfo_Private(__FUNCT__,A,S,a1,a2,a3,a4) 24 #define PetscInfo5(A,S,a1,a2,a3,a4,a5) PetscInfo_Private(__FUNCT__,A,S,a1,a2,a3,a4,a5) 25 #define PetscInfo6(A,S,a1,a2,a3,a4,a5,a6) PetscInfo_Private(__FUNCT__,A,S,a1,a2,a3,a4,a5,a6) 26 #define PetscInfo7(A,S,a1,a2,a3,a4,a5,a6,a7) PetscInfo_Private(__FUNCT__,A,S,a1,a2,a3,a4,a5,a6,a7) 27 #else 28 #define PetscInfo(A,S) 0 29 #define PetscInfo1(A,S,a1) 0 30 #define PetscInfo2(A,S,a1,a2) 0 31 #define PetscInfo3(A,S,a1,a2,a3) 0 32 #define PetscInfo4(A,S,a1,a2,a3,a4) 0 33 #define PetscInfo5(A,S,a1,a2,a3,a4,a5) 0 34 #define PetscInfo6(A,S,a1,a2,a3,a4,a5,a6) 0 35 #define PetscInfo7(A,S,a1,a2,a3,a4,a5,a6,a7) 0 36 #endif 37 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscInfoDeactivateClass(PetscCookie); 38 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscInfoActivateClass(PetscCookie); 39 extern PetscTruth PETSC_DLLEXPORT PetscLogPrintInfo; /* if true, indicates PetscInfo() is turned on */ 40 41 #if defined(PETSC_USE_LOG) /* --- Logging is turned on --------------------------------*/ 42 43 /* 44 Flop counting: We count each arithmetic operation (e.g., addition, multiplication) separately. 45 46 For the complex numbers version, note that 47 1 complex addition = 2 flops 48 1 complex multiplication = 6 flops, 49 where we define 1 flop as that for a double precision scalar. We roughly approximate 50 flop counting for complex numbers by multiplying the total flops by 4; this corresponds 51 to the assumption that we're counting mostly additions and multiplications -- and 52 roughly the same number of each. More accurate counting could be done by distinguishing 53 among the various arithmetic operations. 54 */ 55 56 #if defined(PETSC_USE_COMPLEX) 57 #define PetscLogFlops(n) (_TotalFlops += (4*n),0) 58 #else 59 #define PetscLogFlops(n) (_TotalFlops += (n),0) 60 #endif 61 62 #if defined (PETSC_HAVE_MPE) 63 #include "mpe.h" 64 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscLogMPEBegin(void); 65 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscLogMPEDump(const char[]); 66 extern PetscTruth UseMPE; 67 #define PETSC_LOG_EVENT_MPE_BEGIN(e) \ 68 ((UseMPE && _stageLog->stageInfo[_stageLog->curStage].eventLog->eventInfo[e].active) ? \ 69 MPE_Log_event(_stageLog->eventLog->eventInfo[e].mpe_id_begin,0,NULL) : 0) 70 71 #define PETSC_LOG_EVENT_MPE_END(e) \ 72 ((UseMPE && _stageLog->stageInfo[_stageLog->curStage].eventLog->eventInfo[e].active) ? \ 73 MPE_Log_event(_stageLog->eventLog->eventInfo[e].mpe_id_end,0,NULL) : 0) 74 75 #else 76 #define PETSC_LOG_EVENT_MPE_BEGIN(e) 0 77 #define PETSC_LOG_EVENT_MPE_END(e) 0 78 #endif 79 80 EXTERN PETSC_DLLEXPORT PetscErrorCode (*_PetscLogPLB)(PetscEvent,int,PetscObject,PetscObject,PetscObject,PetscObject); 81 EXTERN PETSC_DLLEXPORT PetscErrorCode (*_PetscLogPLE)(PetscEvent,int,PetscObject,PetscObject,PetscObject,PetscObject); 82 EXTERN PETSC_DLLEXPORT PetscErrorCode (*_PetscLogPHC)(PetscObject); 83 EXTERN PETSC_DLLEXPORT PetscErrorCode (*_PetscLogPHD)(PetscObject); 84 85 #define PetscLogObjectParent(p,c) \ 86 ((c && p) ? ((PetscObject)(c))->parent = (PetscObject)(p),((PetscObject)(c))->parentid = ((PetscObject)p)->id : 0, 0) 87 88 #define PetscLogObjectParents(p,n,d) 0;{int _i; for (_i=0; _i<n; _i++) {ierr = PetscLogObjectParent(p,(d)[_i]);CHKERRQ(ierr);}} 89 #define PetscLogObjectCreate(h) ((_PetscLogPHC) ? (*_PetscLogPHC)((PetscObject)h) : 0) 90 #define PetscLogObjectDestroy(h) ((_PetscLogPHD) ? (*_PetscLogPHD)((PetscObject)h) : 0) 91 #define PetscLogObjectMemory(p,m) (((PetscObject)(p))->mem += (m),0) 92 /* Initialization functions */ 93 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscLogBegin(void); 94 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscLogAllBegin(void); 95 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscLogTraceBegin(FILE *); 96 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscLogActions(PetscTruth); 97 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscLogObjects(PetscTruth); 98 /* General functions */ 99 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscLogGetRGBColor(const char*[]); 100 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscLogDestroy(void); 101 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscLogSet(PetscErrorCode (*)(int, int, PetscObject, PetscObject, PetscObject, PetscObject), 102 PetscErrorCode (*)(int, int, PetscObject, PetscObject, PetscObject, PetscObject)); 103 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscLogObjectState(PetscObject, const char[], ...) PETSC_PRINTF_FORMAT_CHECK(2,3); 104 /* Output functions */ 105 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscLogPrintSummary(MPI_Comm, const char[]); 106 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscLogPrintDetailed(MPI_Comm, const char[]); 107 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscLogDump(const char[]); 108 /* Counter functions */ 109 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscGetFlops(PetscLogDouble *); 110 /* Stage functions */ 111 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscLogStageRegister(int*, const char[]); 112 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscLogStagePush(int); 113 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscLogStagePop(void); 114 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscLogStageSetActive(int, PetscTruth); 115 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscLogStageGetActive(int, PetscTruth *); 116 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscLogStageSetVisible(int, PetscTruth); 117 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscLogStageGetVisible(int, PetscTruth *); 118 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscLogStageGetId(const char [], int *); 119 /* Event functions */ 120 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscLogEventRegister(PetscEvent*, const char[], PetscCookie); 121 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscLogEventActivate(PetscEvent); 122 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscLogEventDeactivate(PetscEvent); 123 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscLogEventSetActiveAll(PetscEvent, PetscTruth); 124 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscLogEventActivateClass(PetscCookie); 125 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscLogEventDeactivateClass(PetscCookie); 126 /* Class functions */ 127 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscLogClassRegister(PetscCookie*, const char []); 128 129 /* Global counters */ 130 extern PETSC_DLLEXPORT PetscLogDouble irecv_ct; 131 extern PETSC_DLLEXPORT PetscLogDouble isend_ct; 132 extern PETSC_DLLEXPORT PetscLogDouble recv_ct; 133 extern PETSC_DLLEXPORT PetscLogDouble send_ct; 134 extern PETSC_DLLEXPORT PetscLogDouble irecv_len; 135 extern PETSC_DLLEXPORT PetscLogDouble isend_len; 136 extern PETSC_DLLEXPORT PetscLogDouble recv_len; 137 extern PETSC_DLLEXPORT PetscLogDouble send_len; 138 extern PETSC_DLLEXPORT PetscLogDouble allreduce_ct; 139 extern PETSC_DLLEXPORT PetscLogDouble wait_ct; 140 extern PETSC_DLLEXPORT PetscLogDouble wait_any_ct; 141 extern PETSC_DLLEXPORT PetscLogDouble wait_all_ct; 142 extern PETSC_DLLEXPORT PetscLogDouble sum_of_waits_ct; 143 extern PETSC_DLLEXPORT int PETSC_DUMMY_SIZE; 144 extern PETSC_DLLEXPORT int PETSC_DUMMY_COUNT; 145 146 /* We must make these structures available if we are to access the event 147 activation flags in the PetscLogEventBegin/End() macros. If we forced a 148 function call each time, we could make these private. 149 */ 150 /* Default log */ 151 typedef struct _n_StageLog *StageLog; 152 extern PETSC_DLLEXPORT StageLog _stageLog; 153 154 /* A simple stack (should replace) */ 155 typedef struct _n_IntStack *IntStack; 156 157 /* The structures for logging performance */ 158 typedef struct { 159 int id; /* The integer identifying this section */ 160 PetscTruth active; /* The flag to activate logging */ 161 PetscTruth visible; /* The flag to print info in summary */ 162 int depth; /* The nesting depth of the event call */ 163 int count; /* The number of times this section was executed */ 164 PetscLogDouble flops; /* The flops used in this section */ 165 PetscLogDouble time; /* The time taken for this section */ 166 PetscLogDouble numMessages; /* The number of messages in this section */ 167 PetscLogDouble messageLength; /* The total message lengths in this section */ 168 PetscLogDouble numReductions; /* The number of reductions in this section */ 169 } EventPerfInfo; 170 171 typedef struct { 172 int id; /* The integer identifying this class */ 173 int creations; /* The number of objects of this class created */ 174 int destructions; /* The number of objects of this class destroyed */ 175 PetscLogDouble mem; /* The total memory allocated by objects of this class */ 176 PetscLogDouble descMem; /* The total memory allocated by descendents of these objects */ 177 } ClassPerfInfo; 178 179 /* The structures for logging registration */ 180 typedef struct { 181 char *name; /* The class name */ 182 PetscCookie cookie; /* The integer identifying this class */ 183 } ClassRegInfo; 184 185 typedef struct { 186 char *name; /* The name of this event */ 187 PetscCookie cookie; /* The class id for this event (should maybe give class ID instead) */ 188 #if defined (PETSC_HAVE_MPE) 189 int mpe_id_begin; /* MPE IDs that define the event */ 190 int mpe_id_end; 191 #endif 192 } EventRegInfo; 193 194 typedef struct _n_EventRegLog *EventRegLog; 195 struct _n_EventRegLog { 196 int numEvents; /* The number of registered events */ 197 int maxEvents; /* The maximum number of events */ 198 EventRegInfo *eventInfo; /* The registration information for each event */ 199 }; 200 201 typedef struct _n_EventPerfLog *EventPerfLog; 202 struct _n_EventPerfLog { 203 int numEvents; /* The number of logging events */ 204 int maxEvents; /* The maximum number of events */ 205 EventPerfInfo *eventInfo; /* The performance information for each event */ 206 }; 207 208 /* The structure for logging class information */ 209 typedef struct _n_ClassRegLog *ClassRegLog; 210 struct _n_ClassRegLog { 211 int numClasses; /* The number of classes registered */ 212 int maxClasses; /* The maximum number of classes */ 213 ClassRegInfo *classInfo; /* The structure for class information (cookies are monotonicly increasing) */ 214 }; 215 216 typedef struct _n_ClassPerfLog *ClassPerfLog; 217 struct _n_ClassPerfLog { 218 int numClasses; /* The number of logging classes */ 219 int maxClasses; /* The maximum number of classes */ 220 ClassPerfInfo *classInfo; /* The structure for class information (cookies are monotonicly increasing) */ 221 }; 222 223 /* The structures for logging in stages */ 224 typedef struct _StageInfo { 225 char *name; /* The stage name */ 226 PetscTruth used; /* The stage was pushed on this processor */ 227 EventPerfInfo perfInfo; /* The stage performance information */ 228 EventPerfLog eventLog; /* The event information for this stage */ 229 ClassPerfLog classLog; /* The class information for this stage */ 230 } StageInfo; 231 232 struct _n_StageLog { 233 /* Size information */ 234 int numStages; /* The number of registered stages */ 235 int maxStages; /* The maximum number of stages */ 236 /* Runtime information */ 237 IntStack stack; /* The stack for active stages */ 238 int curStage; /* The current stage (only used in macros so we don't call StackTop) */ 239 /* Stage specific information */ 240 StageInfo *stageInfo; /* The information for each stage */ 241 EventRegLog eventLog; /* The registered events */ 242 ClassRegLog classLog; /* The registered classes */ 243 }; 244 245 #define PetscLogEventBarrierBegin(e,o1,o2,o3,o4,cm) \ 246 (((_PetscLogPLB && _stageLog->stageInfo[_stageLog->curStage].perfInfo.active && _stageLog->stageInfo[_stageLog->curStage].eventLog->eventInfo[e].active) ? \ 247 (PetscLogEventBegin((e),o1,o2,o3,o4) || MPI_Barrier(cm) || PetscLogEventEnd((e),o1,o2,o3,o4)) : 0 ) || \ 248 PetscLogEventBegin((e)+1,o1,o2,o3,o4)) 249 250 #define PetscLogEventBegin(e,o1,o2,o3,o4) \ 251 (((_PetscLogPLB && _stageLog->stageInfo[_stageLog->curStage].perfInfo.active && _stageLog->stageInfo[_stageLog->curStage].eventLog->eventInfo[e].active) ? \ 252 (*_PetscLogPLB)((e),0,(PetscObject)(o1),(PetscObject)(o2),(PetscObject)(o3),(PetscObject)(o4)) : 0 ) || \ 253 PETSC_LOG_EVENT_MPE_BEGIN(e)) 254 255 #define PetscLogEventBarrierEnd(e,o1,o2,o3,o4,cm) PetscLogEventEnd(e+1,o1,o2,o3,o4) 256 257 #define PetscLogEventEnd(e,o1,o2,o3,o4) \ 258 (((_PetscLogPLE && _stageLog->stageInfo[_stageLog->curStage].perfInfo.active && _stageLog->stageInfo[_stageLog->curStage].eventLog->eventInfo[e].active) ? \ 259 (*_PetscLogPLE)((e),0,(PetscObject)(o1),(PetscObject)(o2),(PetscObject)(o3),(PetscObject)(o4)) : 0 ) || \ 260 PETSC_LOG_EVENT_MPE_END(e)) 261 262 /* Creation and destruction functions */ 263 EXTERN PetscErrorCode PETSC_DLLEXPORT StageLogCreate(StageLog *); 264 EXTERN PetscErrorCode PETSC_DLLEXPORT StageLogDestroy(StageLog); 265 /* Registration functions */ 266 EXTERN PetscErrorCode PETSC_DLLEXPORT StageLogRegister(StageLog, const char [], int *); 267 /* Runtime functions */ 268 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscLogGetStageLog(StageLog *); 269 EXTERN PetscErrorCode PETSC_DLLEXPORT StageLogPush(StageLog, int); 270 EXTERN PetscErrorCode PETSC_DLLEXPORT StageLogPop(StageLog); 271 EXTERN PetscErrorCode PETSC_DLLEXPORT StageLogGetCurrent(StageLog, int *); 272 EXTERN PetscErrorCode PETSC_DLLEXPORT StageLogSetActive(StageLog, int, PetscTruth); 273 EXTERN PetscErrorCode PETSC_DLLEXPORT StageLogGetActive(StageLog, int, PetscTruth *); 274 EXTERN PetscErrorCode PETSC_DLLEXPORT StageLogSetVisible(StageLog, int, PetscTruth); 275 EXTERN PetscErrorCode PETSC_DLLEXPORT StageLogGetVisible(StageLog, int, PetscTruth *); 276 EXTERN PetscErrorCode PETSC_DLLEXPORT StageLogGetStage(StageLog, const char [], int *); 277 EXTERN PetscErrorCode PETSC_DLLEXPORT StageLogGetClassRegLog(StageLog, ClassRegLog *); 278 EXTERN PetscErrorCode PETSC_DLLEXPORT StageLogGetEventRegLog(StageLog, EventRegLog *); 279 EXTERN PetscErrorCode PETSC_DLLEXPORT StageLogGetClassPerfLog(StageLog, int, ClassPerfLog *); 280 EXTERN PetscErrorCode PETSC_DLLEXPORT StageLogGetEventPerfLog(StageLog, int, EventPerfLog *); 281 282 /* 283 These are used internally in the PETSc routines to keep a count of MPI messages and 284 their sizes. 285 286 This does not work for MPI-Uni because our include/mpiuni/mpi.h file 287 uses macros to defined the MPI operations. 288 289 It does not work correctly from HP-UX because it processes the 290 macros in a way that sometimes it double counts, hence 291 PETSC_HAVE_BROKEN_RECURSIVE_MACRO 292 293 It does not work with Windows because winmpich lacks MPI_Type_size() 294 */ 295 #if !defined(_petsc_mpi_uni) && !defined(PETSC_HAVE_BROKEN_RECURSIVE_MACRO) && !defined (PETSC_HAVE_MPI_MISSING_TYPESIZE) 296 /* 297 Logging of MPI activities 298 */ 299 #define TypeSize(buff,count,type) \ 300 (MPI_Type_size(type,&PETSC_DUMMY_SIZE) || (buff += (PetscLogDouble) ((count)*PETSC_DUMMY_SIZE),0)) 301 302 #define MPI_Irecv(buf,count,datatype,source,tag,comm,request) \ 303 ((PETSC_DUMMY_COUNT = count,irecv_ct++,0) || TypeSize(irecv_len,PETSC_DUMMY_COUNT,datatype) || MPI_Irecv(buf,PETSC_DUMMY_COUNT,datatype,source,tag,comm,request)) 304 305 #define MPI_Isend(buf,count,datatype,dest,tag,comm,request) \ 306 ((PETSC_DUMMY_COUNT = count,isend_ct++,0) || TypeSize(isend_len,PETSC_DUMMY_COUNT,datatype) || MPI_Isend(buf,PETSC_DUMMY_COUNT,datatype,dest,tag,comm,request)) 307 308 #define MPI_Startall_irecv(count,number,requests) \ 309 ((irecv_ct += (PetscLogDouble)(number),0) || TypeSize(irecv_len,count,MPIU_SCALAR) || MPI_Startall(number,requests)) 310 311 #define MPI_Startall_isend(count,number,requests) \ 312 ((isend_ct += (PetscLogDouble)(number),0) || TypeSize(isend_len,count,MPIU_SCALAR) || MPI_Startall(number,requests)) 313 314 #define MPI_Start_isend(count,requests) \ 315 ((isend_ct++,0) || TypeSize(isend_len,count,MPIU_SCALAR) || MPI_Start(requests)) 316 317 #define MPI_Recv(buf,count,datatype,source,tag,comm,status) \ 318 ((PETSC_DUMMY_COUNT = count,recv_ct++,0) || TypeSize(recv_len,PETSC_DUMMY_COUNT,datatype) || MPI_Recv(buf,PETSC_DUMMY_COUNT,datatype,source,tag,comm,status)) 319 320 #define MPI_Send(buf,count,datatype,dest,tag,comm) \ 321 ((PETSC_DUMMY_COUNT = count,send_ct++,0) || TypeSize(send_len,PETSC_DUMMY_COUNT,datatype) || MPI_Send(buf,PETSC_DUMMY_COUNT,datatype,dest,tag,comm)) 322 323 #define MPI_Wait(request,status) \ 324 ((wait_ct++,sum_of_waits_ct++,0) || MPI_Wait(request,status)) 325 326 #define MPI_Waitany(a,b,c,d) \ 327 ((wait_any_ct++,sum_of_waits_ct++,0) || MPI_Waitany(a,b,c,d)) 328 329 #define MPI_Waitall(count,array_of_requests,array_of_statuses) \ 330 ((PETSC_DUMMY_COUNT = count,wait_all_ct++,sum_of_waits_ct += (PetscLogDouble) (PETSC_DUMMY_COUNT),0) || MPI_Waitall(PETSC_DUMMY_COUNT,array_of_requests,array_of_statuses)) 331 332 #define MPI_Allreduce(sendbuf,recvbuf,count,datatype,op,comm) \ 333 ((allreduce_ct++,0) || MPI_Allreduce(sendbuf,recvbuf,count,datatype,op,comm)) 334 335 #else 336 337 #define MPI_Startall_irecv(count,number,requests) \ 338 (MPI_Startall(number,requests)) 339 340 #define MPI_Startall_isend(count,number,requests) \ 341 (MPI_Startall(number,requests)) 342 343 #define MPI_Start_isend(count,requests) \ 344 (MPI_Start(requests)) 345 346 #endif /* !_petsc_mpi_uni && ! PETSC_HAVE_BROKEN_RECURSIVE_MACRO */ 347 348 #else /* ---Logging is turned off --------------------------------------------*/ 349 350 #define PetscLogFlops(n) 0 351 352 /* 353 With logging turned off, then MPE has to be turned off 354 */ 355 #define PetscLogMPEBegin() 0 356 #define PetscLogMPEDump(a) 0 357 358 #define PetscLogEventActivate(a) 0 359 #define PetscLogEventDeactivate(a) 0 360 361 #define PetscLogEventActivateClass(a) 0 362 #define PetscLogEventDeactivateClass(a) 0 363 #define PetscLogClassRegister(a,b) PetscCookieRegister(a) 364 #define PetscLogEventSetActiveAll(a,b) 0 365 366 #define _PetscLogPLB 0 367 #define _PetscLogPLE 0 368 #define _PetscLogPHC 0 369 #define _PetscLogPHD 0 370 #define PetscGetFlops(a) (*(a) = 0.0,0) 371 #define PetscLogEventBegin(e,o1,o2,o3,o4) 0 372 #define PetscLogEventEnd(e,o1,o2,o3,o4) 0 373 #define PetscLogEventBarrierBegin(e,o1,o2,o3,o4,cm) 0 374 #define PetscLogEventBarrierEnd(e,o1,o2,o3,o4,cm) 0 375 #define PetscLogObjectParent(p,c) 0 376 #define PetscLogObjectParents(p,n,c) 0 377 #define PetscLogObjectCreate(h) 0 378 #define PetscLogObjectDestroy(h) 0 379 #define PetscLogObjectMemory(p,m) 0 380 #define PetscLogDestroy() 0 381 #define PetscLogStagePush(a) 0 382 #define PetscLogStagePop() 0 383 #define PetscLogStageRegister(a,b) 0 384 #define PetscLogStagePrint(a,flg) 0 385 #define PetscLogPrintSummary(comm,file) 0 386 #define PetscLogPrintDetailed(comm,file) 0 387 #define PetscLogBegin() 0 388 #define PetscLogTraceBegin(file) 0 389 #define PetscLogSet(lb,le) 0 390 #define PetscLogAllBegin() 0 391 #define PetscLogDump(c) 0 392 #define PetscLogEventRegister(a,b,c) 0 393 #define PetscLogObjects(a) 0 394 #define PetscLogActions(a) 0 395 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscLogObjectState(PetscObject,const char[],...) PETSC_PRINTF_FORMAT_CHECK(2,3); 396 397 /* If PETSC_USE_LOG is NOT defined, these still need to be! */ 398 #define MPI_Startall_irecv(count,number,requests) MPI_Startall(number,requests) 399 #define MPI_Startall_isend(count,number,requests) MPI_Startall(number,requests) 400 #define MPI_Start_isend(count,requests) MPI_Start(requests) 401 402 /* Creation and destruction functions */ 403 #define StageLogCreate(stageLog) 0 404 #define StageLogDestroy(stageLog) 0 405 /* Registration functions */ 406 #define StageLogRegister(stageLog, name, stage) 0 407 /* Runtime functions */ 408 #define PetscLogGetStageLog(stageLog) 0 409 #define StageLogPush(stageLog, stage) 0 410 #define StageLogPop(stageLog) 0 411 #define StageLogGetCurrent(stageLog, stage) 0 412 #define StageLogSetActive(stageLog, stage, active) 0 413 #define StageLogGetActive(stageLog, stage, active) 0 414 #define StageLogSetVisible(stageLog, stage, visible) 0 415 #define StageLogGetVisible(stageLog, stage, visible) 0 416 #define StageLogGetStage(stageLog, name, stage) 0 417 #define PetscLogStageGetId(a,b) (*(b)=0,0) 418 #define PetscLogStageSetActive(a,b) 0 419 420 #endif /* PETSC_USE_LOG */ 421 422 #define PreLoadBegin(flag,name) \ 423 {\ 424 PetscTruth PreLoading = flag;\ 425 int PreLoadMax,PreLoadIt,_stageNum,_3_ierr;\ 426 _3_ierr = PetscOptionsGetTruth(PETSC_NULL,"-preload",&PreLoading,PETSC_NULL);CHKERRQ(_3_ierr);\ 427 PreLoadMax = (int)(PreLoading);\ 428 PetscPreLoadingUsed = PreLoading ? PETSC_TRUE : PetscPreLoadingUsed;\ 429 for (PreLoadIt=0; PreLoadIt<=PreLoadMax; PreLoadIt++) {\ 430 PetscPreLoadingOn = PreLoading;\ 431 _3_ierr = PetscBarrier(PETSC_NULL);CHKERRQ(_3_ierr);\ 432 if (PreLoadIt>0) {\ 433 _3_ierr = PetscLogStageGetId(name,&_stageNum);CHKERRQ(_3_ierr);\ 434 } else {\ 435 _3_ierr = PetscLogStageRegister(&_stageNum,name);CHKERRQ(_3_ierr);\ 436 }\ 437 _3_ierr = PetscLogStageSetActive(_stageNum,(PetscTruth)(!PreLoadMax || PreLoadIt));\ 438 _3_ierr = PetscLogStagePush(_stageNum);CHKERRQ(_3_ierr); 439 440 #define PreLoadEnd() \ 441 _3_ierr = PetscLogStagePop();CHKERRQ(_3_ierr);\ 442 PreLoading = PETSC_FALSE;\ 443 }\ 444 } 445 446 #define PreLoadStage(name) \ 447 _3_ierr = PetscLogStagePop();CHKERRQ(_3_ierr);\ 448 if (PreLoadIt>0) {\ 449 _3_ierr = PetscLogStageGetId(name,&_stageNum);CHKERRQ(_3_ierr);\ 450 } else {\ 451 _3_ierr = PetscLogStageRegister(&_stageNum,name);CHKERRQ(_3_ierr);\ 452 }\ 453 _3_ierr = PetscLogStageSetActive(_stageNum,(PetscTruth)(!PreLoadMax || PreLoadIt));\ 454 _3_ierr = PetscLogStagePush(_stageNum);CHKERRQ(_3_ierr); 455 456 PETSC_EXTERN_CXX_END 457 #endif 458