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