-
Notifications
You must be signed in to change notification settings - Fork 0
/
mpiPi.h.in
444 lines (356 loc) · 11.3 KB
/
mpiPi.h.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
/* -*- C -*-
mpiP MPI Profiler ( http://llnl.github.io/mpiP )
Please see COPYRIGHT AND LICENSE information at the end of this file.
-----
mpiPi.h -- internal mpiP header
$Id$
*/
#ifndef _MPIPI_H
#define _MPIPI_H
#include <assert.h>
#include <malloc.h>
#include <math.h>
#include <setjmp.h>
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <sys/time.h>
#include <time.h>
#include <unistd.h>
#include "mpiPconfig.h"
#ifdef ENABLE_BFD
#include "bfd.h"
#endif
#if !defined(CEXTRACT) && !defined(ENABLE_API_ONLY)
#include <mpi.h>
#include "mpiPi_def.h"
#endif
#include "mpiP-hash.h"
#include "mpip_timers.h"
#define MPIPI_HOSTNAME_LEN_MAX 128
#define MPIP_CALLSITE_STACK_DEPTH_MAX @STACKDEPTH@
#define MPIP_HELP_LIST "@PACKAGE_BUGREPORT@"
#define MPIP_CALLSITE_STACK_DEPTH (mpiPi.stackDepth)
#define MPIP_CALLSITE_STATS_COOKIE 518641
#define MPIP_CALLSITE_STATS_COOKIE_ASSERT(f) {assert(MPIP_CALLSITE_STATS_COOKIE==((f)->cookie));}
#ifdef USE_MPI3_CONSTS
typedef const void mpip_const_void_t;
typedef const int mpip_const_int_t;
typedef const char mpip_const_char_t;
typedef const MPI_Datatype mpip_const_datatype_t;
#else
typedef void mpip_const_void_t;
typedef int mpip_const_int_t;
typedef char mpip_const_char_t;
#endif
typedef char mpiPi_hostname_t[MPIPI_HOSTNAME_LEN_MAX];
typedef struct _callsite_stats
{
unsigned op;
unsigned rank;
int csid;
long long count;
double cumulativeTime;
double cumulativeTimeSquared;
double maxDur;
double minDur;
double maxDataSent;
double minDataSent;
double maxIO;
double minIO;
double maxRMA;
double minRMA;
double cumulativeDataSent;
double cumulativeIO;
double cumulativeRMA;
long long arbitraryMessageCount;
double *siteData;
int siteDataIdx;
void *pc[MPIP_CALLSITE_STACK_DEPTH_MAX];
char *filename[MPIP_CALLSITE_STACK_DEPTH_MAX];
char *functname[MPIP_CALLSITE_STACK_DEPTH_MAX];
int lineno[MPIP_CALLSITE_STACK_DEPTH_MAX];
long cookie;
}
callsite_stats_t;
typedef struct callsite_src_id_cache_entry_t
{
int id; /* unique id for this src code/stack location */
int op; /* at the lowest level, this is a MPI op */
char *filename[MPIP_CALLSITE_STACK_DEPTH_MAX];
char *functname[MPIP_CALLSITE_STACK_DEPTH_MAX];
int line[MPIP_CALLSITE_STACK_DEPTH_MAX];
void *pc[MPIP_CALLSITE_STACK_DEPTH_MAX];
}
callsite_src_id_cache_entry_t;
extern h_t *callsite_src_id_cache;
typedef struct _mpiPi_lookup_t
{
int op;
char *name;
}
mpiPi_lookup_t;
typedef struct _histogram_entry_t
{
int op;
double time;
long count;
int comm_size_bin;
int data_size_bin;
}
mpiPi_histogram_entry_t;
extern mpiPi_lookup_t mpiPi_lookup[];
enum
{ MPIP_MPI_TIME_FMT, MPIP_MPI_TIME_SUMMARY_FMT,
MPIP_AGGREGATE_TIME_FMT, MPIP_AGGREGATE_COV_TIME_FMT,
MPIP_AGGREGATE_MESS_FMT, MPIP_AGGREGATE_IO_FMT,
MPIP_CALLSITE_TIME_SUMMARY_FMT, MPIP_CALLSITE_TIME_RANK_FMT,
MPIP_CALLSITE_MESS_SUMMARY_FMT, MPIP_CALLSITE_MESS_RANK_FMT,
MPIP_CALLSITE_IO_SUMMARY_FMT, MPIP_CALLSITE_IO_RANK_FMT,
MPIP_CALLSITE_TIME_CONCISE_FMT, MPIP_CALLSITE_MESS_CONCISE_FMT,
MPIP_HISTOGRAM_FMT
};
typedef enum
{ MPIP_REPORT_SCI_FORMAT, MPIP_REPORT_FLT_FORMAT }
MPIP_REPORT_FORMAT_TYPE;
#ifdef ENABLE_BFD
typedef struct SO_INFO
{
void *lvma;
void *uvma;
char *fpath;
bfd *bfd;
} so_info_t;
#endif
typedef struct _mpiPi_histogram
{
int first_bin_max;
int hist_size;
int *bin_intervals;
} mpiPi_histogram_t;
typedef struct _mpiPi_t
{
int ac;
char *av[32];
char *toolname;
char *appName;
char *appFullName;
char oFilename[256];
int tag;
int procID;
int rank;
int size;
int collectorRank;
#ifndef ENABLE_API_ONLY
MPI_Comm comm;
mpiPi_hostname_t hostname;
#endif
int hostnamelen;
char *outputDir;
char *envStr;
FILE *stdout_;
FILE *stderr_;
mpiPi_TIME startTime;
mpiPi_TIME endTime;
double cumulativeTime; /* necessary for pcontrol */
time_t start_timeofday;
time_t stop_timeofday;
/* pcontrol */
int enabled;
int enabledCount;
mpiPi_TIMER timer;
mpiPi_hostname_t *global_task_hostnames;
double *global_task_app_time;
double *global_task_mpi_time;
double global_app_time;
double global_mpi_time;
double global_mpi_size;
double global_mpi_io;
double global_mpi_rma;
long long global_mpi_msize_threshold_count;
long long global_mpi_sent_count;
long long global_time_callsite_count;
int tableSize;
h_t *task_callsite_stats;
callsite_stats_t *rawCallsiteData;
h_t *global_callsite_stats;
h_t *global_callsite_stats_agg;
h_t *global_MPI_stats_agg;
mpiPi_lookup_t *lookup;
int stackDepth;
double reportPrintThreshold;
int baseNames;
MPIP_REPORT_FORMAT_TYPE reportFormat;
int calcCOV;
int do_lookup;
int inAPIrtb;
int messageCountThreshold;
long text_start;
int obj_mode;
int printRankInfo;
enum mpiPi_report_style
{ mpiPi_style_verbose, mpiPi_style_concise, mpiPi_style_both } report_style;
int print_callsite_detail;
int collective_report;
#ifdef SO_LOOKUP
so_info_t **so_info;
int so_count;
#endif
int disable_finalize_report;
int do_collective_stats_report;
mpiPi_histogram_t coll_comm_histogram;
mpiPi_histogram_t coll_size_histogram;
double coll_time_stats[(mpiPi_DEF_END - mpiPi_BASE)][32][32];
int do_pt2pt_stats_report;
mpiPi_histogram_t pt2pt_comm_histogram;
mpiPi_histogram_t pt2pt_size_histogram;
double pt2pt_send_stats[(mpiPi_DEF_END - mpiPi_BASE)][32][32];
}
mpiPi_t;
extern mpiPi_t mpiPi;
extern int mpiPi_vmajor;
extern int mpiPi_vminor;
extern int mpiPi_vpatch;
extern char *mpiPi_vdate;
extern char *mpiPi_vtime;
extern int mpiPi_debug;
extern int mpiPi_do_demangle;
#ifdef HAVE_MPIR_TOPOINTER
extern void *MPIR_ToPointer (int idx);
#endif
#if !defined(UNICOS_mp)
/* AIX */
#if defined(AIX)
#if defined(__64BIT__) /* 64-bit AIX */
#define ParentFP(jb) ((void *) *(long *) jb[5])
#else /* 32-bit AIX */
#define ParentFP(jb) ((void *) *(long *) jb[3])
#endif
/* For both 32-bit and 64-bit AIX */
#define FramePC(fp) ((void *) *(long *) (((long) fp) + (2 * sizeof (void *))))
#define NextFP(fp) ((void *) *(long *) fp)
/* IA32 Linux */
#elif defined(Linux) && defined(IA32)
#define ParentFP(jb) ((void*) jb[0].__jmpbuf[3])
#define FramePC(fp) ((void*)(((void**)fp)[1]))
#define NextFP(fp) ((void*)((void**)fp)[0])
/* X86_64 Linux */
#elif defined(Linux) && defined(X86_64)
#define ParentFP(jb) ((void*) jb[0].__jmpbuf[1])
#define FramePC(fp) ((void*)(((void**)fp)[1]))
#define NextFP(fp) ((void*)((void**)fp)[0])
/* BG/L */
#elif defined(ppc64)
#define ParentFP(jb) NextFP(((void*)jb[0].__jmpbuf[0]))
#define FramePC(fp) ((void*)(((char**)fp)[1]))
#define NextFP(fp) ((void*)((char**)fp)[0])
/* Catamount */
#elif defined(Catamount) && defined(X86_64)
#define ParentFP(jb) ((void*) jb[0].__jmpbuf[1])
#define FramePC(fp) ((void*)(((void**)fp)[1]))
#define NextFP(fp) ((void*)((void**)fp)[0])
/* MIPS+GCC */
/* We don't use the macros on the mips and instead
* use gcc's __builtin_return_address(0) intrinsic
* to get a single level of stack backtrace. The
* value is saved in saved_ret_addr variable each time
* setjmp is called.
*/
#elif defined(mips) && defined(__GNUC__)
#define ParentFP(jb) (0)
#define FramePC(fp) (0)
#define NextFP(fp) (0)
extern void *saved_ret_addr;
/* undefined */
#else
#if ! (defined(HAVE_LIBUNWIND) || defined(USE_BACKTRACE))
#warning "No stack trace mechanism defined for this platform."
#endif
#define ParentFP(jb) (0)
#define FramePC(fp) (0)
#define NextFP(fp) (0)
#endif
#else /* defined(UNICOS_mp) */
#include <intrinsics.h>
#include <stdint.h>
/*
* Cray X1
* Stacks grow downward in the address space.
*/
/*
* Unlike some of the other platforms, we do not use setjmp to obtain
* the frame pointer of the current function. Instead, we use the
* Cray intrinsic function _read_fp() to get the frame pointer of the
* current function.
*/
#define GetFP() ((void*)(_read_fp()))
/*
* Given a frame pointer for a callee, the caller's frame pointer is at the
* callee's frame pointer address.
*/
#define NextFP(fp) ((void*)((void**)fp)[0])
/*
* Given a frame pointer for a callee, the return address to the caller
* is two elements in the callee's frame.
* TODO try masking off the high 32-bits
*/
#define FramePC(fp) ((void*)(((uint64_t)(((void**)fp)[-2])) & 0xFFFFFFFF))
#endif /* defined(UNICOS_mp) */
#define min(x,y) ((x<y)?(x):(y))
#define max(x,y) ((x>y)?(x):(y))
#include "mpiPi_proto.h"
#endif
/*
<license>
Copyright (c) 2006, The Regents of the University of California.
Produced at the Lawrence Livermore National Laboratory
Written by Jeffery Vetter and Christopher Chambreau.
UCRL-CODE-223450.
All rights reserved.
This file is part of mpiP. For details, see http://llnl.github.io/mpiP.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the disclaimer below.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the disclaimer (as noted below) in
the documentation and/or other materials provided with the
distribution.
* Neither the name of the UC/LLNL nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OF
THE UNIVERSITY OF CALIFORNIA, THE U.S. DEPARTMENT OF ENERGY OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Additional BSD Notice
1. This notice is required to be provided under our contract with the
U.S. Department of Energy (DOE). This work was produced at the
University of California, Lawrence Livermore National Laboratory under
Contract No. W-7405-ENG-48 with the DOE.
2. Neither the United States Government nor the University of
California nor any of their employees, makes any warranty, express or
implied, or assumes any liability or responsibility for the accuracy,
completeness, or usefulness of any information, apparatus, product, or
process disclosed, or represents that its use would not infringe
privately-owned rights.
3. Also, reference herein to any specific commercial products,
process, or services by trade name, trademark, manufacturer or
otherwise does not necessarily constitute or imply its endorsement,
recommendation, or favoring by the United States Government or the
University of California. The views and opinions of authors expressed
herein do not necessarily state or reflect those of the United States
Government or the University of California, and shall not be used for
advertising or product endorsement purposes.
</license>
*/
/* EOF */