Actual source code: petsclog.h

  1: /*
  2:     Defines profile/logging in PETSc.
  3: */

 7:  #include petsc.h

 10: #define PETSC_EVENT  1311311

 13: /* Global flop counter */

 17: /* General logging of information; different from event logging */
 18: EXTERN PetscErrorCode  PetscInfo_Private(const char[],void*,const char[],...) PETSC_PRINTF_FORMAT_CHECK(3,4);
 19: #if defined(PETSC_USE_INFO)
 20: #define PetscInfo(A,S)                       PetscInfo_Private(__FUNCT__,A,S)
 21: #define PetscInfo1(A,S,a1)                   PetscInfo_Private(__FUNCT__,A,S,a1)
 22: #define PetscInfo2(A,S,a1,a2)                PetscInfo_Private(__FUNCT__,A,S,a1,a2)
 23: #define PetscInfo3(A,S,a1,a2,a3)             PetscInfo_Private(__FUNCT__,A,S,a1,a2,a3)
 24: #define PetscInfo4(A,S,a1,a2,a3,a4)          PetscInfo_Private(__FUNCT__,A,S,a1,a2,a3,a4)
 25: #define PetscInfo5(A,S,a1,a2,a3,a4,a5)       PetscInfo_Private(__FUNCT__,A,S,a1,a2,a3,a4,a5)
 26: #define PetscInfo6(A,S,a1,a2,a3,a4,a5,a6)    PetscInfo_Private(__FUNCT__,A,S,a1,a2,a3,a4,a5,a6)
 27: #define PetscInfo7(A,S,a1,a2,a3,a4,a5,a6,a7) PetscInfo_Private(__FUNCT__,A,S,a1,a2,a3,a4,a5,a6,a7)
 28: #else 
 29: #define PetscInfo(A,S)                       0
 30: #define PetscInfo1(A,S,a1)                   0
 31: #define PetscInfo2(A,S,a1,a2)                0
 32: #define PetscInfo3(A,S,a1,a2,a3)             0
 33: #define PetscInfo4(A,S,a1,a2,a3,a4)          0
 34: #define PetscInfo5(A,S,a1,a2,a3,a4,a5)       0
 35: #define PetscInfo6(A,S,a1,a2,a3,a4,a5,a6)    0
 36: #define PetscInfo7(A,S,a1,a2,a3,a4,a5,a6,a7) 0
 37: #endif
 38: EXTERN PetscErrorCode  PetscInfoDeactivateClass(PetscCookie);
 39: EXTERN PetscErrorCode  PetscInfoActivateClass(PetscCookie);

 42: /* We must make these structures available if we are to access the event
 43:    activation flags in the PetscLogEventBegin/End() macros. If we forced a
 44:    function call each time, we could make these private.
 45: */
 46: /* Default log */
 47: typedef struct _n_StageLog *StageLog;

 50: /* A simple stack (should replace) */
 51: typedef struct _n_IntStack *IntStack;

 53: /* The structures for logging performance */
 54: typedef struct {
 55:   int            id;            /* The integer identifying this section */
 56:   PetscTruth     active;        /* The flag to activate logging */
 57:   PetscTruth     visible;       /* The flag to print info in summary */
 58:   int            depth;         /* The nesting depth of the event call */
 59:   int            count;         /* The number of times this section was executed */
 60:   PetscLogDouble flops;         /* The flops used in this section */
 61:   PetscLogDouble time;          /* The time taken for this section */
 62:   PetscLogDouble numMessages;   /* The number of messages in this section */
 63:   PetscLogDouble messageLength; /* The total message lengths in this section */
 64:   PetscLogDouble numReductions; /* The number of reductions in this section */
 65: } EventPerfInfo;

 67: typedef struct {
 68:   int            id;           /* The integer identifying this class */
 69:   int            creations;    /* The number of objects of this class created */
 70:   int            destructions; /* The number of objects of this class destroyed */
 71:   PetscLogDouble mem;          /* The total memory allocated by objects of this class */
 72:   PetscLogDouble descMem;      /* The total memory allocated by descendents of these objects */
 73: } ClassPerfInfo;

 75: /* The structures for logging registration */
 76: typedef struct  {
 77:   char        *name;   /* The class name */
 78:   PetscCookie cookie; /* The integer identifying this class */
 79: } ClassRegInfo;

 81: typedef struct {
 82:   char        *name;   /* The name of this event */
 83:   PetscCookie cookie; /* The class id for this event (should maybe give class ID instead) */
 84: #if defined (PETSC_HAVE_MPE)
 85:   int         mpe_id_begin; /* MPE IDs that define the event */
 86:   int         mpe_id_end;
 87: #endif
 88: } EventRegInfo;

 90: typedef struct _n_EventRegLog *EventRegLog;
 91: struct _n_EventRegLog {
 92:   int           numEvents; /* The number of registered events */
 93:   int           maxEvents; /* The maximum number of events */
 94:   EventRegInfo *eventInfo; /* The registration information for each event */
 95: };

 97: typedef struct _n_EventPerfLog *EventPerfLog;
 98: struct _n_EventPerfLog {
 99:   int            numEvents; /* The number of logging events */
100:   int            maxEvents; /* The maximum number of events */
101:   EventPerfInfo *eventInfo; /* The performance information for each event */
102: };

104: /* The structure for logging class information */
105: typedef struct _n_ClassRegLog *ClassRegLog;
106: struct _n_ClassRegLog {
107:   int           numClasses; /* The number of classes registered */
108:   int           maxClasses; /* The maximum number of classes */
109:   ClassRegInfo *classInfo;  /* The structure for class information (cookies are monotonicly increasing) */
110: };

112: typedef struct _n_ClassPerfLog *ClassPerfLog;
113: struct _n_ClassPerfLog {
114:   int            numClasses; /* The number of logging classes */
115:   int            maxClasses; /* The maximum number of classes */
116:   ClassPerfInfo *classInfo;  /* The structure for class information (cookies are monotonicly increasing) */
117: };

119: /* The structures for logging in stages */
120: typedef struct _StageInfo {
121:   char         *name;     /* The stage name */
122:   PetscTruth    used;     /* The stage was pushed on this processor */
123:   EventPerfInfo perfInfo; /* The stage performance information */
124:   EventPerfLog  eventLog; /* The event information for this stage */
125:   ClassPerfLog  classLog; /* The class information for this stage */
126: } StageInfo;

128: struct _n_StageLog {
129:   /* Size information */
130:   int         numStages; /* The number of registered stages */
131:   int         maxStages; /* The maximum number of stages */
132:   /* Runtime information */
133:   IntStack    stack;     /* The stack for active stages */
134:   int         curStage;  /* The current stage (only used in macros so we don't call StackTop) */
135:   /* Stage specific information */
136:   StageInfo  *stageInfo; /* The information for each stage */
137:   EventRegLog eventLog;  /* The registered events */
138:   ClassRegLog classLog;  /* The registered classes */
139: };

141: #if defined(PETSC_USE_LOG)  /* --- Logging is turned on --------------------------------*/

143: /* 
144:    Flop counting:  We count each arithmetic operation (e.g., addition, multiplication) separately.

146:    For the complex numbers version, note that
147:        1 complex addition = 2 flops
148:        1 complex multiplication = 6 flops,
149:    where we define 1 flop as that for a double precision scalar.  We roughly approximate
150:    flop counting for complex numbers by multiplying the total flops by 4; this corresponds
151:    to the assumption that we're counting mostly additions and multiplications -- and
152:    roughly the same number of each.  More accurate counting could be done by distinguishing
153:    among the various arithmetic operations.
154:  */

156: #if defined(PETSC_USE_COMPLEX)
157: #define PETSC_FLOPS_PER_OP 4
158: #else
159: #define PETSC_FLOPS_PER_OP 1
160: #endif

162: #if defined(PETSC_USE_DEBUG)
163: #define PetscLogFlops(n) (petsc_tmp_flops = (PETSC_FLOPS_PER_OP*(n)), ((petsc_tmp_flops < 0) ? PETSC_ERR_FLOP_COUNT : (_TotalFlops += petsc_tmp_flops,0)))
164: #define PetscLogFlopsNoError(n) (_TotalFlops += PETSC_FLOPS_PER_OP*(n))
165: #else
166: #define PetscLogFlops(n) (_TotalFlops += PETSC_FLOPS_PER_OP*(n),0)
167: #define PetscLogFlopsNoError(n) (_TotalFlops += PETSC_FLOPS_PER_OP*(n))
168: #endif

170: #if defined (PETSC_HAVE_MPE)
171: #include "mpe.h"
172: EXTERN PetscErrorCode         PetscLogMPEBegin(void);
173: EXTERN PetscErrorCode         PetscLogMPEDump(const char[]);
175: #define PETSC_LOG_EVENT_MPE_BEGIN(e) \
176:   ((UseMPE && _stageLog->stageInfo[_stageLog->curStage].eventLog->eventInfo[e].active) ? \
177:    MPE_Log_event(_stageLog->eventLog->eventInfo[e].mpe_id_begin,0,NULL) : 0)

179: #define PETSC_LOG_EVENT_MPE_END(e) \
180:   ((UseMPE && _stageLog->stageInfo[_stageLog->curStage].eventLog->eventInfo[e].active) ? \
181:    MPE_Log_event(_stageLog->eventLog->eventInfo[e].mpe_id_end,0,NULL) : 0)

183: #else 
184: #define PETSC_LOG_EVENT_MPE_BEGIN(e) 0 
185: #define PETSC_LOG_EVENT_MPE_END(e)   0
186: #endif

188: EXTERN  PetscErrorCode (*_PetscLogPLB)(PetscLogEvent,int,PetscObject,PetscObject,PetscObject,PetscObject);
189: EXTERN  PetscErrorCode (*_PetscLogPLE)(PetscLogEvent,int,PetscObject,PetscObject,PetscObject,PetscObject);
190: EXTERN  PetscErrorCode (*_PetscLogPHC)(PetscObject);
191: EXTERN  PetscErrorCode (*_PetscLogPHD)(PetscObject);

193: #define PetscLogObjectParent(p,c) \
194:   ((c && p) ? ((PetscObject)(c))->parent = (PetscObject)(p),((PetscObject)(c))->parentid = ((PetscObject)p)->id : 0, 0)

196: #define PetscLogObjectParents(p,n,d)  0;{int _i; for (_i=0; _i<n; _i++) {PetscLogObjectParent(p,(d)[_i]);}}
197: #define PetscLogObjectCreate(h)      ((_PetscLogPHC) ? (*_PetscLogPHC)((PetscObject)h) : 0)
198: #define PetscLogObjectDestroy(h)     ((_PetscLogPHD) ? (*_PetscLogPHD)((PetscObject)h) : 0)
199: #define PetscLogObjectMemory(p,m)    (((PetscObject)(p))->mem += (m),0)
200: /* Initialization functions */
201: EXTERN PetscErrorCode  PetscLogBegin(void);
202: EXTERN PetscErrorCode  PetscLogAllBegin(void);
203: EXTERN PetscErrorCode  PetscLogTraceBegin(FILE *);
204: EXTERN PetscErrorCode  PetscLogActions(PetscTruth);
205: EXTERN PetscErrorCode  PetscLogObjects(PetscTruth);
206: /* General functions */
207: EXTERN PetscErrorCode  PetscLogGetRGBColor(const char*[]);
208: EXTERN PetscErrorCode  PetscLogDestroy(void);
209: EXTERN PetscErrorCode  PetscLogSet(PetscErrorCode (*)(int, int, PetscObject, PetscObject, PetscObject, PetscObject),
210:                    PetscErrorCode (*)(int, int, PetscObject, PetscObject, PetscObject, PetscObject));
211: EXTERN PetscErrorCode  PetscLogObjectState(PetscObject, const char[], ...)  PETSC_PRINTF_FORMAT_CHECK(2,3);
212: /* Output functions */
213: EXTERN PetscErrorCode  PetscLogPrintSummary(MPI_Comm, const char[]);
214: EXTERN PetscErrorCode  PetscLogPrintDetailed(MPI_Comm, const char[]);
215: EXTERN PetscErrorCode  PetscLogDump(const char[]);
216: /* Counter functions */
217: EXTERN PetscErrorCode  PetscGetFlops(PetscLogDouble *);
218: /* Stage functions */
219: EXTERN PetscErrorCode  PetscLogStageRegister(const char[],PetscLogStage*);
220: EXTERN PetscErrorCode  PetscLogStagePush(PetscLogStage);
221: EXTERN PetscErrorCode  PetscLogStagePop(void);
222: EXTERN PetscErrorCode  PetscLogStageSetActive(PetscLogStage, PetscTruth);
223: EXTERN PetscErrorCode  PetscLogStageGetActive(PetscLogStage, PetscTruth *);
224: EXTERN PetscErrorCode  PetscLogStageSetVisible(PetscLogStage, PetscTruth);
225: EXTERN PetscErrorCode  PetscLogStageGetVisible(PetscLogStage, PetscTruth *);
226: EXTERN PetscErrorCode  PetscLogStageGetId(const char [], PetscLogStage *);
227: /* Event functions */
228: EXTERN PetscErrorCode  PetscLogEventRegister(const char[], PetscCookie,PetscLogEvent*);
229: EXTERN PetscErrorCode  PetscLogEventActivate(PetscLogEvent);
230: EXTERN PetscErrorCode  PetscLogEventDeactivate(PetscLogEvent);
231: EXTERN PetscErrorCode  PetscLogEventSetActiveAll(PetscLogEvent, PetscTruth);
232: EXTERN PetscErrorCode  PetscLogEventActivateClass(PetscCookie);
233: EXTERN PetscErrorCode  PetscLogEventDeactivateClass(PetscCookie);


236: /* Global counters */

255: #define PetscLogEventBarrierBegin(e,o1,o2,o3,o4,cm) \
256:   (((_PetscLogPLB && _stageLog->stageInfo[_stageLog->curStage].perfInfo.active &&  _stageLog->stageInfo[_stageLog->curStage].eventLog->eventInfo[e].active) ? \
257:     (PetscLogEventBegin((e),o1,o2,o3,o4) || MPI_Barrier(cm) || PetscLogEventEnd((e),o1,o2,o3,o4)) : 0 ) || \
258:    PetscLogEventBegin((e)+1,o1,o2,o3,o4))

260: #define PetscLogEventBegin(e,o1,o2,o3,o4) \
261:   (((_PetscLogPLB && _stageLog->stageInfo[_stageLog->curStage].perfInfo.active && _stageLog->stageInfo[_stageLog->curStage].eventLog->eventInfo[e].active) ? \
262:     (*_PetscLogPLB)((e),0,(PetscObject)(o1),(PetscObject)(o2),(PetscObject)(o3),(PetscObject)(o4)) : 0 ) || \
263:   PETSC_LOG_EVENT_MPE_BEGIN(e))

265: #define PetscLogEventBarrierEnd(e,o1,o2,o3,o4,cm) PetscLogEventEnd(e+1,o1,o2,o3,o4)

267: #define PetscLogEventEnd(e,o1,o2,o3,o4) \
268:   (((_PetscLogPLE && _stageLog->stageInfo[_stageLog->curStage].perfInfo.active && _stageLog->stageInfo[_stageLog->curStage].eventLog->eventInfo[e].active) ? \
269:     (*_PetscLogPLE)((e),0,(PetscObject)(o1),(PetscObject)(o2),(PetscObject)(o3),(PetscObject)(o4)) : 0 ) || \
270:   PETSC_LOG_EVENT_MPE_END(e))

272: /* Creation and destruction functions */
273: EXTERN PetscErrorCode  StageLogCreate(StageLog *);
274: EXTERN PetscErrorCode  StageLogDestroy(StageLog);
275: /* Registration functions */
276: EXTERN PetscErrorCode  StageLogRegister(StageLog, const char [], int *);
277: /* Runtime functions */
278: EXTERN PetscErrorCode  PetscLogGetStageLog(StageLog *);
279: EXTERN PetscErrorCode  StageLogPush(StageLog, int);
280: EXTERN PetscErrorCode  StageLogPop(StageLog);
281: EXTERN PetscErrorCode  StageLogGetCurrent(StageLog, int *);
282: EXTERN PetscErrorCode  StageLogSetActive(StageLog, int, PetscTruth);
283: EXTERN PetscErrorCode  StageLogGetActive(StageLog, int, PetscTruth *);
284: EXTERN PetscErrorCode  StageLogSetVisible(StageLog, int, PetscTruth);
285: EXTERN PetscErrorCode  StageLogGetVisible(StageLog, int, PetscTruth *);
286: EXTERN PetscErrorCode  StageLogGetStage(StageLog, const char [], int *);
287: EXTERN PetscErrorCode  StageLogGetClassRegLog(StageLog, ClassRegLog *);
288: EXTERN PetscErrorCode  StageLogGetEventRegLog(StageLog, EventRegLog *);
289: EXTERN PetscErrorCode  StageLogGetClassPerfLog(StageLog, int, ClassPerfLog *);
290: EXTERN PetscErrorCode  StageLogGetEventPerfLog(StageLog, int, EventPerfLog *);

292: /*
293:      These are used internally in the PETSc routines to keep a count of MPI messages and 
294:    their sizes.

296:      This does not work for MPI-Uni because our include/mpiuni/mpi.h file
297:    uses macros to defined the MPI operations. 

299:      It does not work correctly from HP-UX because it processes the 
300:    macros in a way that sometimes it double counts, hence 
301:    PETSC_HAVE_BROKEN_RECURSIVE_MACRO

303:      It does not work with Windows because winmpich lacks MPI_Type_size()
304: */
306: /*
307:    Logging of MPI activities
308: */
309: #define TypeSize(buff,count,type) \
310:  (MPI_Type_size(type,&PETSC_DUMMY_SIZE) || (buff += (PetscLogDouble) ((count)*PETSC_DUMMY_SIZE),0))

312: #define MPI_Irecv(buf,count,datatype,source,tag,comm,request) \
313:  ((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))

315: #define MPI_Isend(buf,count,datatype,dest,tag,comm,request) \
316:  ((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))

318: #define MPI_Startall_irecv(count,number,requests) \
319:  ((irecv_ct += (PetscLogDouble)(number),0) || TypeSize(irecv_len,count,MPIU_SCALAR) || MPI_Startall(number,requests))

321: #define MPI_Startall_isend(count,number,requests) \
322:  ((isend_ct += (PetscLogDouble)(number),0) || TypeSize(isend_len,count,MPIU_SCALAR) || MPI_Startall(number,requests))

324: #define MPI_Start_isend(count,requests) \
325:  ((isend_ct++,0) || TypeSize(isend_len,count,MPIU_SCALAR) || MPI_Start(requests))

327: #define MPI_Recv(buf,count,datatype,source,tag,comm,status) \
328:  ((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))

330: #define MPI_Send(buf,count,datatype,dest,tag,comm) \
331:  ((PETSC_DUMMY_COUNT = count,send_ct++,0) || TypeSize(send_len,PETSC_DUMMY_COUNT,datatype) || MPI_Send(buf,PETSC_DUMMY_COUNT,datatype,dest,tag,comm))

333: #define MPI_Wait(request,status) \
334:  ((wait_ct++,sum_of_waits_ct++,0) || MPI_Wait(request,status))
335: 
336: #define MPI_Waitany(a,b,c,d) \
337:  ((wait_any_ct++,sum_of_waits_ct++,0) || MPI_Waitany(a,b,c,d))

339: #define MPI_Waitall(count,array_of_requests,array_of_statuses) \
340:  ((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))

342: #define MPI_Allreduce(sendbuf,recvbuf,count,datatype,op,comm) \
343:  ((allreduce_ct++,0) || MPI_Allreduce(sendbuf,recvbuf,count,datatype,op,comm))

345: #define MPI_Allgather(sendbuf,sendcount,sendtype,recvbuf,recvcount,recvtype,comm) \
346:  ((gather_ct++,0) || MPI_Allgather(sendbuf,sendcount,sendtype,recvbuf,recvcount,recvtype,comm))

348: #define MPI_Allgatherv(sendbuf,sendcount,sendtype,recvbuf,recvcount,displs,recvtype,comm) \
349:  ((gather_ct++,0) || MPI_Allgatherv(sendbuf,sendcount,sendtype,recvbuf,recvcount,displs,recvtype,comm))

351: #define MPI_Gather(sendbuf,sendcount,sendtype,recvbuf,recvcount,recvtype,root,comm) \
352:  ((PETSC_DUMMY_COUNT = sendcount,gather_ct++,0) || TypeSize(send_len,PETSC_DUMMY_COUNT,sendtype) || MPI_Gather(sendbuf,sendcount,sendtype,recvbuf,recvcount,recvtype,root,comm))

354: #define MPI_Gatherv(sendbuf,sendcount,sendtype,recvbuf,recvcount,displs,recvtype,root,comm) \
355:  ((PETSC_DUMMY_COUNT = sendcount,gather_ct++,0) || TypeSize(send_len,PETSC_DUMMY_COUNT,sendtype) || MPI_Gatherv(sendbuf,sendcount,sendtype,recvbuf,recvcount,displs,recvtype,root,comm))

357: #define MPI_Scatter(sendbuf,sendcount,sendtype,recvbuf,recvcount,recvtype,root,comm) \
358:   ((PETSC_DUMMY_COUNT = recvcount,scatter_ct++,0) || TypeSize(recv_len,PETSC_DUMMY_COUNT,recvtype) || MPI_Scatter(sendbuf,sendcount,sendtype,recvbuf,recvcount,recvtype,root,comm))

360: #define MPI_Scatterv(sendbuf,sendcount,displs,sendtype,recvbuf,recvcount,recvtype,root,comm) \
361:   ((PETSC_DUMMY_COUNT = recvcount,scatter_ct++,0) || TypeSize(recv_len,PETSC_DUMMY_COUNT,recvtype) || MPI_Scatterv(sendbuf,sendcount,displs,sendtype,recvbuf,recvcount,recvtype,root,comm))

363: #else

365: #define MPI_Startall_irecv(count,number,requests) \
366:  (MPI_Startall(number,requests))

368: #define MPI_Startall_isend(count,number,requests) \
369:  (MPI_Startall(number,requests))

371: #define MPI_Start_isend(count,requests) \
372:  (MPI_Start(requests))

374: #endif /* !__MPIUNI_H && ! PETSC_HAVE_BROKEN_RECURSIVE_MACRO */

376: #else  /* ---Logging is turned off --------------------------------------------*/

378: #define PetscLogFlops(n) 0
379: #define PetscLogFlopsNoError(n)

381: /*
382:      With logging turned off, then MPE has to be turned off
383: */
384: #define PetscLogMPEBegin()         0
385: #define PetscLogMPEDump(a)         0

387: #define PetscLogEventActivate(a)   0
388: #define PetscLogEventDeactivate(a) 0

390: #define PetscLogEventActivateClass(a)   0
391: #define PetscLogEventDeactivateClass(a) 0
392: #define PetscLogEventSetActiveAll(a,b)  0

394: #define _PetscLogPLB                        0
395: #define _PetscLogPLE                        0
396: #define _PetscLogPHC                        0
397: #define _PetscLogPHD                        0
398: #define PetscGetFlops(a)                (*(a) = 0.0,0)
399: #define PetscLogEventBegin(e,o1,o2,o3,o4)   0
400: #define PetscLogEventEnd(e,o1,o2,o3,o4)     0
401: #define PetscLogEventBarrierBegin(e,o1,o2,o3,o4,cm) 0
402: #define PetscLogEventBarrierEnd(e,o1,o2,o3,o4,cm)   0
403: #define PetscLogObjectParent(p,c)           0
404: #define PetscLogObjectParents(p,n,c)        0
405: #define PetscLogObjectCreate(h)             0
406: #define PetscLogObjectDestroy(h)            0
407: #define PetscLogObjectMemory(p,m)           0
408: #define PetscLogDestroy()                   0
409: #define PetscLogStagePush(a)                0
410: #define PetscLogStagePop()                  0
411: #define PetscLogStageRegister(a,b)          0
412: #define PetscLogStagePrint(a,flg)           0
413: #define PetscLogPrintSummary(comm,file)     0
414: #define PetscLogPrintDetailed(comm,file)    0
415: #define PetscLogBegin()                     0
416: #define PetscLogTraceBegin(file)            0
417: #define PetscLogSet(lb,le)                  0
418: #define PetscLogAllBegin()                  0
419: #define PetscLogDump(c)                     0
420: #define PetscLogEventRegister(a,b,c)        0
421: #define PetscLogObjects(a)                  0
422: #define PetscLogActions(a)                  0
423: EXTERN PetscErrorCode  PetscLogObjectState(PetscObject,const char[],...) PETSC_PRINTF_FORMAT_CHECK(2,3);

425: /* If PETSC_USE_LOG is NOT defined, these still need to be! */
426: #define MPI_Startall_irecv(count,number,requests) MPI_Startall(number,requests)
427: #define MPI_Startall_isend(count,number,requests) MPI_Startall(number,requests)
428: #define MPI_Start_isend(count,requests) MPI_Start(requests)

430: /* Creation and destruction functions */
431: #define StageLogCreate(stageLog)                     0
432: #define StageLogDestroy(stageLog)                    0
433: /* Registration functions */
434: #define StageLogRegister(stageLog, name, stage)      0
435: /* Runtime functions */
436: #define PetscLogGetStageLog(stageLog)                0
437: #define StageLogPush(stageLog, stage)                0
438: #define StageLogPop(stageLog)                        0
439: #define StageLogGetCurrent(stageLog, stage)          0
440: #define StageLogSetActive(stageLog, stage, active)   0
441: #define StageLogGetActive(stageLog, stage, active)   0
442: #define StageLogSetVisible(stageLog, stage, visible) 0
443: #define StageLogGetVisible(stageLog, stage, visible) 0
444: #define StageLogGetStage(stageLog, name, stage)      0
445: #define PetscLogStageGetId(a,b)                      (*(b)=0,0)
446: #define PetscLogStageSetActive(a,b)                  0
447: #define PetscLogStageGetActive(a,b)                  0
448: #define PetscLogStageGetVisible(a,b)                 0
449: #define PetscLogStageSetVisible(a,b)                 0

451: #endif   /* PETSC_USE_LOG */

453: #define PreLoadBegin(flag,name) \
454: {\
455:   PetscTruth     PreLoading = flag;\
456:   int            PreLoadMax,PreLoadIt;\
457:   PetscLogStage  _stageNum;\
458:   PetscErrorCode _3_ierr;        \
459:   _3_PetscOptionsGetTruth(PETSC_NULL,"-preload",&PreLoading,PETSC_NULL);CHKERRQ(_3_ierr);\
460:   PreLoadMax = (int)(PreLoading);\
461:   PetscPreLoadingUsed = PreLoading ? PETSC_TRUE : PetscPreLoadingUsed;\
462:   for (PreLoadIt=0; PreLoadIt<=PreLoadMax; PreLoadIt++) {\
463:     PetscPreLoadingOn = PreLoading;\
464:     _3_PetscBarrier(PETSC_NULL);CHKERRQ(_3_ierr);\
465:     if (PreLoadIt>0) {\
466:       _3_PetscLogStageGetId(name,&_stageNum);CHKERRQ(_3_ierr);\
467:     } else {\
468:       _3_PetscLogStageRegister(name,&_stageNum);CHKERRQ(_3_ierr); \
469:     }\
470:     _3_PetscLogStageSetActive(_stageNum,(PetscTruth)(!PreLoadMax || PreLoadIt));\
471:     _3_PetscLogStagePush(_stageNum);CHKERRQ(_3_ierr);

473: #define PreLoadEnd() \
474:     _3_PetscLogStagePop();CHKERRQ(_3_ierr);\
475:     PreLoading = PETSC_FALSE;\
476:   }\
477: }

479: #define PreLoadStage(name) \
480:   _3_PetscLogStagePop();CHKERRQ(_3_ierr);\
481:   if (PreLoadIt>0) {\
482:     _3_PetscLogStageGetId(name,&_stageNum);CHKERRQ(_3_ierr);\
483:   } else {\
484:     _3_PetscLogStageRegister(name,&_stageNum);CHKERRQ(_3_ierr);        \
485:   }\
486:   _3_PetscLogStageSetActive(_stageNum,(PetscTruth)(!PreLoadMax || PreLoadIt));\
487:   _3_PetscLogStagePush(_stageNum);CHKERRQ(_3_ierr);

490: #endif