xref: /petsc/include/petsclog.h (revision a4e54b7346c817ae59e2f21eb1dd3b05b45e4301)
1 /* $Id: plog.h,v 1.71 1996/06/12 20:22:32 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/plog/src/plog.c, and
14   petsc/src/plog/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_ApplySymmetricLeft                   78
87 #define PC_ApplySymmetricRight                  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 #define DFVec_RefineVector                      110
102 #define DFVec_AssembleFullVector                111
103 #define DFVec_GetComponentVectors               112
104 #define DFVec_DrawContours                      113
105 
106 /*
107    Event numbers PLOG_USER_EVENT_LOW to PLOG_USER_EVENT_HIGH are reserved
108    for applications.  Make sure that src/plog/src/plog.c defines enough
109    entries in (*name)[] to go up to PLOG_USER_EVENT_HIGH.
110 */
111 #define PLOG_USER_EVENT_LOW_STATIC              120
112 #define PLOG_USER_EVENT_HIGH                    200
113 
114 /* Global flop counter */
115 extern double _TotalFlops;
116 
117 /* General logging of information; different from event logging */
118 extern int PLogInfo(void*,char*,...);
119 extern int PLogInfoDeactivateClass(int);
120 extern int PLogInfoActivateClass(int);
121 
122 #if defined(PETSC_LOG)  /* --------------------------------------------*/
123 
124 #define PLogFlops(n) {_TotalFlops += n;}
125 
126 #if defined (HAVE_MPE)
127 #include "mpe.h"
128 #define MPEBEGIN    1000
129 extern int PLogMPEBegin();
130 extern int PLogMPEDump(char *);
131 extern int UseMPE,PLogEventMPEFlags[];
132 extern int PLogEventMPEActivate(int);
133 extern int PLogEventMPEDeActivate(int);
134 #else
135 #define PLogEventMPEActivate(a)
136 #define PLogEventMPEDeActivate(a)
137 #endif
138 
139 extern int PLogEventActivate(int);
140 extern int PLogEventDeActivate(int);
141 
142 extern int PLogEventActivateClass();
143 extern int PLogEventDeActivateClass();
144 
145 extern int PLogEventFlags[];
146 extern int (*_PLB)(int,int,PetscObject,PetscObject,PetscObject,PetscObject);
147 extern int (*_PLE)(int,int,PetscObject,PetscObject,PetscObject,PetscObject);
148 extern int (*_PHC)(PetscObject);
149 extern int (*_PHD)(PetscObject);
150 
151 #if defined(HAVE_MPE)
152 #define PLogEventBegin(e,o1,o2,o3,o4) {static int _tacky = 0; \
153   { _tacky++; \
154    if (_PLB && PLogEventFlags[e]) \
155      (*_PLB)(e,_tacky,(PetscObject)(o1),(PetscObject)(o2),(PetscObject)(o3),(PetscObject)(o4));\
156    if (_tacky == 1 && UseMPE && PLogEventMPEFlags[e])\
157      MPE_Log_event(MPEBEGIN+2*e,0,"");\
158   }
159 #else
160 #define PLogEventBegin(e,o1,o2,o3,o4) {static int _tacky = 0; \
161   { _tacky++; \
162    if (_PLB && PLogEventFlags[e]) \
163      (*_PLB)(e,_tacky,(PetscObject)(o1),(PetscObject)(o2),(PetscObject)(o3),(PetscObject)(o4));\
164   }
165 #endif
166 
167 #if defined(HAVE_MPE)
168 #define PLogEventEnd(e,o1,o2,o3,o4) {\
169   if (_PLE && PLogEventFlags[e]) \
170     (*_PLE)(e,_tacky,(PetscObject)(o1),(PetscObject)(o2),(PetscObject)(o3),(PetscObject)(o4));\
171   if (_tacky == 1 && UseMPE && PLogEventMPEFlags[e])\
172      MPE_Log_event(MPEBEGIN+2*e+1,0,"");\
173   }  _tacky--;}
174 #else
175 #define PLogEventEnd(e,o1,o2,o3,o4) {\
176   if (_PLE && PLogEventFlags[e]) \
177     (*_PLE)(e,_tacky,(PetscObject)(o1),(PetscObject)(o2),(PetscObject)(o3),(PetscObject)(o4));\
178   } _tacky--;}
179 #endif
180 
181 
182 #define PLogObjectParent(p,c)       {PetscValidHeader((PetscObject)c); \
183                                      PetscValidHeader((PetscObject)p);\
184                                      ((PetscObject)(c))->parent = (PetscObject) p;}
185 #define PLogObjectParents(p,n,d)    {int _i; for ( _i=0; _i<n; _i++ ) \
186                                     PLogObjectParent(p,(d)[_i]);}
187 #define PLogObjectCreate(h)         {if (_PHC) (*_PHC)((PetscObject)h);}
188 #define PLogObjectDestroy(h)        {if (_PHD) (*_PHD)((PetscObject)h);}
189 #define PLogObjectMemory(p,m)       {PetscValidHeader((PetscObject)p);\
190                                     ((PetscObject)(p))->mem += (m);}
191 extern int PLogObjectState(PetscObject,char *,...);
192 extern int PLogDestroy();
193 extern int PLogStagePush(int);
194 extern int PLogStagePop();
195 extern int PLogStageRegister(int,char*);
196 extern int PLogPrintSummary(MPI_Comm,FILE *);
197 extern int PLogBegin();
198 extern int PLogAllBegin();
199 extern int PLogDump(char*);
200 extern int PLogEventRegister(int*,char*,char*);
201 
202 
203 #else  /* ------------------------------------------------------------*/
204 
205 #define PLogFlops(n)
206 
207 #if defined (HAVE_MPE)
208 #define MPEBEGIN    1000
209 extern int PLogMPEBegin();
210 extern int PLogMPEDump(char *);
211 #else
212 #define PLogEventMPEActivate(a)
213 #define PLogEventMPEDeActivate(a)
214 #endif
215 
216 #define PLogEventActivate(a)
217 #define PLogEventDeActivate(a)
218 
219 #define PLogEventActivateClass()
220 #define PLogEventDeActivateClass()
221 
222 #define _PLB                          0
223 #define _PLE                          0
224 #define _PHC                          0
225 #define _PHD                          0
226 #define PLogEventBegin(e,o1,o2,o3,o4)
227 #define PLogEventEnd(e,o1,o2,o3,o4)
228 #define PLogObjectParent(p,c)
229 #define PLogObjectParents(p,n,c)
230 #define PLogObjectCreate(h)
231 #define PLogObjectDestroy(h)
232 #define PLogObjectMemory(p,m)
233 #define PLogDestroy()
234 #define PLogStagePush(int)
235 #define PLogStagePop()
236 #define PLogStageRegister(a,b)
237 #define PLogPrintSummary(comm,file)
238 #define PLogBegin()
239 #define PLogAllBegin()
240 #define PLogDump(char)
241 #define PLogEventRegister(a,b,c)
242 #define PLogMPEBegin()
243 #define PLogMPEDump(a)
244 extern int PLogObjectState(PetscObject,char *,...);
245 
246 #endif
247 
248 /*MC
249    PLogFlops - Adds floating point operations to the global counter.
250 
251    Input Parameter:
252 .  f - flop counter
253 
254    Synopsis:
255    void PLogFlops(int f)
256 
257    Notes:
258    A global counter logs all PETSc flop counts.  The user can use
259    PLogFlops() to increment this counter to include flops for the
260    application code.
261 
262    PETSc automatically logs library events if the code has been
263    compiled with -DPETSC_LOG (which is the default), and -log,
264    -log_summary, or -log_all are specified.  PLogFlops() is
265    intended for logging user flops to supplement this PETSc
266    information.
267 
268     Example of Usage:
269 $     int USER_EVENT;
270 $     PLogEventRegister(&USER_EVENT,"User event","Color:");
271 $     PLogEventBegin(USER_EVENT,0,0,0,0);
272 $        [code segment to monitor]
273 $        PLogFlops(user_flops)
274 $     PLogEventEnd(USER_EVENT,0,0,0,0);
275 
276 .seealso: PLogEventRegister(), PLogEventBegin(), PLogEventEnd(), PetscGetFlops()
277 
278 .keywords: log, flops, floating point operations
279 M*/
280 
281 
282 /*MC
283    PLogEventBegin - Logs the beginning of a user event.
284 
285    Input Parameters:
286 .  e - integer associated with the event obtained from PLogEventRegister()
287 .  o1,o2,o3,o4 - objects associated with the event, or 0
288 
289    Synopsis:
290    void PLogEventBegin(int e,PetscObject o1,PetscObject o2,PetscObject o3,
291                   PetscObject o4)
292 
293    Notes:
294    You should also register each integer event with the command
295    PLogRegisterEvent().  The source code must be compiled with
296    -DPETSC_LOG, which is the default.
297 
298    PETSc automatically logs library events if the code has been
299    compiled with -DPETSC_LOG, and -log, -log_summary, or -log_all are
300    specified.  PLogEventBegin() is intended for logging user events
301    to supplement this PETSc information.
302 
303     Example of Usage:
304 $     int USER_EVENT;
305 $     int user_event_flops;
306 $     PLogEventRegister(&USER_EVENT,"User event","Color:");
307 $     PLogEventBegin(&USER_EVENT,0,0,0,0);
308 $        [code segment to monitor]
309 $        PLogFlops(user_event_flops);
310 $     PLogEventEnd(&USER_EVENT,0,0,0,0);
311 
312 .seealso: PLogEventRegister(), PLogEventEnd(), PLogFlops()
313 
314 .keywords: log, event, begin
315 M*/
316 
317 /*MC
318    PLogEventEnd - Log the end of a user event.
319 
320    Input Parameters:
321 .  e - integer associated with the event obtained with PLogEventRegister()
322 .  o1,o2,o3,o4 - objects associated with the event, or 0
323 
324    Synopsis:
325    void PLogEventEnd(int e,PetscObject o1,PetscObject o2,PetscObject o3,
326                 PetscObject o4)
327 
328    Notes:
329    You should also register each integer event with the command
330    PLogRegisterEvent(). Source code must be compiled with
331    -DPETSC_LOG, which is the default.
332 
333    PETSc automatically logs library events if the code has been
334    compiled with -DPETSC_LOG, and -log, -log_summary, or -log_all are
335    specified.  PLogEventEnd() is intended for logging user events
336    to supplement this PETSc information.
337 
338     Example of Usage:
339 $     int USER_EVENT;
340 $     int user_event_flops;
341 $     PLogEventRegister(&USER_EVENT,"User event","Color:");
342 $     PLogEventBegin(USER_EVENT,0,0,0,0);
343 $        [code segment to monitor]
344 $        PLogFlops(user_event_flops);
345 $     PLogEventEnd(USER_EVENT,0,0,0,0);
346 
347 .seealso: PLogEventRegister(), PLogEventBegin(), PLogFlops()
348 
349 .keywords: log, event, end
350 M*/
351 
352 #endif
353 
354 
355 
356