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