From 49abeb6887f2e3590ef0fbc79f3b5ec94a7d72de Mon Sep 17 00:00:00 2001 From: Artem Polyakov Date: Fri, 7 Jun 2019 15:21:24 -0700 Subject: [PATCH] Indentation fixes only. No actual changes. Signed-off-by: Artem Polyakov --- mpiP-hash.c | 119 +- mpiP-hash.h | 6 +- mpiPi.c | 658 +++++----- mpiPi_proto.h | 18 +- pc_lookup.c | 252 ++-- pc_lookup_dwarf.c | 644 +++++----- pcontrol.c | 10 +- record_stack.c | 120 +- report.c | 3010 ++++++++++++++++++++++----------------------- util.c | 484 ++++---- 10 files changed, 2659 insertions(+), 2662 deletions(-) diff --git a/mpiP-hash.c b/mpiP-hash.c index e712e68..014b584 100644 --- a/mpiP-hash.c +++ b/mpiP-hash.c @@ -4,7 +4,7 @@ Please see COPYRIGHT AND LICENSE information at the end of this file. - ----- + ----- mpiP-hash.c -- generic hash table @@ -90,15 +90,14 @@ h_insert (h_t * ht, void *ptr) /* search list for similar key, if not, append it to list */ /* OPTIMIZATION: remove this and let users deal with it :) */ for (het_index = ht->table[tableIndex]; - het_index != NULL; het_index = het_index->next) - { - if (ht->hc (het_index->ptr, ptr) == 0) - { - printf - ("hash: warning: tried to insert identical entry again\n"); - return 1; - } - } + het_index != NULL; het_index = het_index->next) + { + if (ht->hc (het_index->ptr, ptr) == 0) + { + printf("hash: warning: tried to insert identical entry again\n"); + return 1; + } + } het->next = ht->table[tableIndex]; ht->table[tableIndex] = het; } @@ -128,14 +127,14 @@ h_search (h_t * ht, void *key, void **ptr) { /* search list for similar key */ for (het_index = ht->table[tableIndex]; - het_index != NULL; het_index = het_index->next) - { - if (ht->hc (het_index->ptr, key) == 0) - { - *ptr = het_index->ptr; - return *ptr; - } - } + het_index != NULL; het_index = het_index->next) + { + if (ht->hc (het_index->ptr, key) == 0) + { + *ptr = het_index->ptr; + return *ptr; + } + } } return NULL; } @@ -159,21 +158,21 @@ h_delete (h_t * ht, void *key, void **ptr) { /* search list for similar key */ for (het_index = ht->table[tableIndex], - next_addr = &(ht->table[tableIndex]); - het_index != NULL; het_index = het_index->next) - { - if (ht->hc (het_index->ptr, key) == 0) - { - /* match */ - *ptr = het_index->ptr; - *next_addr = het_index->next; - free (het_index); - ht->count--; - return *ptr; - } - - next_addr = &(het_index->next); - } + next_addr = &(ht->table[tableIndex]); + het_index != NULL; het_index = het_index->next) + { + if (ht->hc (het_index->ptr, key) == 0) + { + /* match */ + *ptr = het_index->ptr; + *next_addr = het_index->next; + free (het_index); + ht->count--; + return *ptr; + } + + next_addr = &(het_index->next); + } } return NULL; } @@ -193,14 +192,14 @@ h_gather_data (h_t * ht, int *ac, void ***ptr) for (i = 0; i < ht->size; i++) { if (ht->table[i] != NULL) - { - for (het_index = ht->table[i]; - het_index != NULL; het_index = het_index->next) - { - (*ptr)[*ac] = het_index->ptr; - (*ac)++; - } - } + { + for (het_index = ht->table[i]; + het_index != NULL; het_index = het_index->next) + { + (*ptr)[*ac] = het_index->ptr; + (*ac)++; + } + } } return *ac; } @@ -255,9 +254,9 @@ main () for (i = 0; i < 20; i++) /* insert some elements */ { if (NULL != h_insert (ht, &sr[i])) - { - printf ("%5d: inserted %d\n", i, sr[i].id); - } + { + printf ("%5d: inserted %d\n", i, sr[i].id); + } } printf ("-----\n"); { @@ -266,7 +265,7 @@ main () h_gather_data (ht, &dc, (void ***) &dv); /* gather elements and print */ for (i = 0; i < dc; i++) { - printf ("%5d: %d %d %d\n", i, dv[i]->id, dv[i]->size, dv[i]->order); + printf ("%5d: %d %d %d\n", i, dv[i]->id, dv[i]->size, dv[i]->order); } free (dv); /* remember to release return vector */ } @@ -275,9 +274,9 @@ main () { SampleRecord_t *d; if (NULL != h_delete (ht, &sr[i], (void **) &d)) - { - printf ("%5d: deleted %d\n", i, sr[i].id); - } + { + printf ("%5d: deleted %d\n", i, sr[i].id); + } } printf ("-----\n"); @@ -287,7 +286,7 @@ main () h_gather_data (ht, &dc, (void ***) &dv); /* gather elements and print */ for (i = 0; i < dc; i++) { - printf ("%5d: %d %d %d\n", i, dv[i]->id, dv[i]->size, dv[i]->order); + printf ("%5d: %d %d %d\n", i, dv[i]->id, dv[i]->size, dv[i]->order); } free (dv); /* remember to release return vector */ } @@ -297,9 +296,9 @@ main () { SampleRecord_t *d; if (NULL != h_delete (ht, &sr[i], (void **) &d)) - { - printf ("%5d: deleted %d\n", i, sr[i].id); - } + { + printf ("%5d: deleted %d\n", i, sr[i].id); + } } h_close (ht); @@ -318,13 +317,13 @@ 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. @@ -349,22 +348,22 @@ 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, diff --git a/mpiP-hash.h b/mpiP-hash.h index 5bd0c28..0b53a71 100644 --- a/mpiP-hash.h +++ b/mpiP-hash.h @@ -29,9 +29,9 @@ typedef struct _h_t { int size; int count; - h_HashFunct hf; /* given an element compute the hash number */ - h_Comparator hc; /* given two elements, do they match? 0 for yes */ - h_entry_t **table; /* table[size] of pointers to lists of entries */ + h_HashFunct hf; /* given an element compute the hash number */ + h_Comparator hc; /* given two elements, do they match? 0 for yes */ + h_entry_t **table; /* table[size] of pointers to lists of entries */ } h_t; diff --git a/mpiPi.c b/mpiPi.c index c54b583..95509e9 100644 --- a/mpiPi.c +++ b/mpiPi.c @@ -1,10 +1,10 @@ -/* -*- C -*- +/* -*- C -*- mpiP MPI Profiler ( http://llnl.github.io/mpiP ) Please see COPYRIGHT AND LICENSE information at the end of this file. - ----- + ----- mpiPi.c -- main mpiP internal functions @@ -115,13 +115,13 @@ mpiPi_callsite_stats_src_id_comparator (const void *p1, const void *p2) } #ifndef ENABLE_API_ONLY /* { */ -/* task level init +/* task level init - executed by each MPI task only once immediately after MPI_Init */ void init_histogram (mpiPi_histogram_t * h, int first_bin_max, int size, - int *intervals) + int *intervals) { h->first_bin_max = first_bin_max; h->hist_size = size; @@ -181,7 +181,7 @@ mpiPi_init (char *appName) mpiPi.stackDepth = 0; mpiPi.print_callsite_detail = 0; } - else // verbose default + else // verbose default { mpiPi.report_style = mpiPi_style_verbose; mpiPi.stackDepth = 1; @@ -202,8 +202,8 @@ mpiPi_init (char *appName) mpiPi_getenv (); mpiPi.task_callsite_stats = - h_open (mpiPi.tableSize, mpiPi_callsite_stats_pc_hashkey, - mpiPi_callsite_stats_pc_comparator); + h_open (mpiPi.tableSize, mpiPi_callsite_stats_pc_hashkey, + mpiPi_callsite_stats_pc_comparator); if (mpiPi.do_collective_stats_report == 1) { @@ -222,14 +222,14 @@ mpiPi_init (char *appName) { mpiPi_msg (""); mpiPi_msg ("%s V%d.%d.%d (Build %s/%s)\n", mpiPi.toolname, mpiPi_vmajor, - mpiPi_vminor, mpiPi_vpatch, mpiPi_vdate, mpiPi_vtime); + mpiPi_vminor, mpiPi_vpatch, mpiPi_vdate, mpiPi_vtime); mpiPi_msg ("Direct questions and errors to %s\n", MPIP_HELP_LIST); mpiPi_msg ("\n"); } mpiPi_msg_debug ("appName is %s\n", appName); mpiPi_msg_debug ("sizeof(callsite_stats_t) is %d\n", - sizeof (callsite_stats_t)); + sizeof (callsite_stats_t)); mpiPi_msg_debug ("successful init on %d, %s\n", mpiPi.rank, mpiPi.hostname); if (mpiPi.enabled) @@ -291,35 +291,35 @@ mpiPi_query_pc (void *pc, char **filename, char **functname, int *lineno) { /* no cache entry: create, lookup, and insert */ csp = - (callsite_pc_cache_entry_t *) - malloc (sizeof (callsite_pc_cache_entry_t)); + (callsite_pc_cache_entry_t *) + malloc (sizeof (callsite_pc_cache_entry_t)); csp->pc = pc; #if defined(ENABLE_BFD) || defined(USE_LIBDWARF) if (mpiP_find_src_loc (pc, filename, lineno, functname) == 0) - { - if (*filename == NULL || strcmp (*filename, "??") == 0) - *filename = "[unknown]"; - - if (*functname == NULL) - *functname = "[unknown]"; - - mpiPi_msg_debug - ("Successful Source lookup for [%s]: %s, %d, %s\n", - mpiP_format_address (pc, addr_buf), *filename, *lineno, - *functname); - - csp->filename = strdup (*filename); - csp->functname = strdup (*functname); - csp->line = *lineno; - } + { + if (*filename == NULL || strcmp (*filename, "??") == 0) + *filename = "[unknown]"; + + if (*functname == NULL) + *functname = "[unknown]"; + + mpiPi_msg_debug + ("Successful Source lookup for [%s]: %s, %d, %s\n", + mpiP_format_address (pc, addr_buf), *filename, *lineno, + *functname); + + csp->filename = strdup (*filename); + csp->functname = strdup (*functname); + csp->line = *lineno; + } else - { - mpiPi_msg_debug ("Unsuccessful Source lookup for [%s]\n", - mpiP_format_address (pc, addr_buf)); - csp->filename = strdup ("[unknown]"); - csp->functname = strdup ("[unknown]"); - csp->line = 0; - } + { + mpiPi_msg_debug ("Unsuccessful Source lookup for [%s]\n", + mpiP_format_address (pc, addr_buf)); + csp->filename = strdup ("[unknown]"); + csp->functname = strdup ("[unknown]"); + csp->line = 0; + } #else /* ! ENABLE_BFD || USE_LIBDWARF */ csp->filename = strdup ("[unknown]"); csp->functname = strdup ("[unknown]"); @@ -358,30 +358,30 @@ callsite_src_id_cache_comparator (const void *p1, const void *p2) else { for (i = 0; i < MPIP_CALLSITE_STACK_DEPTH; i++) - { - if (csp_1->filename[i] != NULL && csp_2->filename[i] != NULL) - { - if (strcmp (csp_1->filename[i], csp_2->filename[i]) > 0) - { - return 1; - } - if (strcmp (csp_1->filename[i], csp_2->filename[i]) < 0) - { - return -1; - } - express (line[i]); - if (strcmp (csp_1->functname[i], csp_2->functname[i]) > 0) - { - return 1; - } - if (strcmp (csp_1->functname[i], csp_2->functname[i]) < 0) - { - return -1; - } - } - - express (pc[i]); - } + { + if (csp_1->filename[i] != NULL && csp_2->filename[i] != NULL) + { + if (strcmp (csp_1->filename[i], csp_2->filename[i]) > 0) + { + return 1; + } + if (strcmp (csp_1->filename[i], csp_2->filename[i]) < 0) + { + return -1; + } + express (line[i]); + if (strcmp (csp_1->functname[i], csp_2->functname[i]) > 0) + { + return 1; + } + if (strcmp (csp_1->functname[i], csp_2->functname[i]) < 0) + { + return -1; + } + } + + express (pc[i]); + } } #undef express return 0; @@ -396,16 +396,16 @@ callsite_src_id_cache_hashkey (const void *p1) for (i = 0; i < MPIP_CALLSITE_STACK_DEPTH; i++) { if (cs1->filename[i] != NULL) - { - for (j = 0; cs1->filename[i][j] != '\0'; j++) - { - res ^= (unsigned) cs1->filename[i][j]; - } - for (j = 0; cs1->functname[i][j] != '\0'; j++) - { - res ^= (unsigned) cs1->functname[i][j]; - } - } + { + for (j = 0; cs1->filename[i][j] != '\0'; j++) + { + res ^= (unsigned) cs1->filename[i][j]; + } + for (j = 0; cs1->functname[i][j] != '\0'; j++) + { + res ^= (unsigned) cs1->functname[i][j]; + } + } res ^= cs1->line[i]; } return 662917 ^ res; @@ -430,14 +430,14 @@ mpiPi_query_src (callsite_stats_t * p) for (i = 0; (i < MPIP_CALLSITE_STACK_DEPTH) && (p->pc[i] != NULL); i++) { if (mpiPi.do_lookup == 1) - mpiPi_query_pc (p->pc[i], &(p->filename[i]), &(p->functname[i]), - &(p->lineno[i])); + mpiPi_query_pc (p->pc[i], &(p->filename[i]), &(p->functname[i]), + &(p->lineno[i])); else - { - p->filename[i] = strdup ("[unknown]"); - p->functname[i] = strdup ("[unknown]"); - p->lineno[i] = 0; - } + { + p->filename[i] = strdup ("[unknown]"); + p->functname[i] = strdup ("[unknown]"); + p->lineno[i] = 0; + } key.filename[i] = p->filename[i]; key.functname[i] = p->functname[i]; @@ -453,22 +453,22 @@ mpiPi_query_src (callsite_stats_t * p) { /* create a new entry, and assign an id based on callstack */ csp = - (callsite_src_id_cache_entry_t *) - malloc (sizeof (callsite_src_id_cache_entry_t)); + (callsite_src_id_cache_entry_t *) + malloc (sizeof (callsite_src_id_cache_entry_t)); bzero (csp, sizeof (callsite_src_id_cache_entry_t)); for (i = 0; (i < MPIP_CALLSITE_STACK_DEPTH) && (p->pc[i] != NULL); i++) - { - csp->filename[i] = strdup (key.filename[i]); - csp->functname[i] = strdup (key.functname[i]); - csp->line[i] = key.line[i]; - csp->pc[i] = p->pc[i]; - } + { + csp->filename[i] = strdup (key.filename[i]); + csp->functname[i] = strdup (key.functname[i]); + csp->line[i] = key.line[i]; + csp->pc[i] = p->pc[i]; + } csp->op = p->op; if (mpiPi.stackDepth == 0) - csp->id = csp->op - mpiPi_BASE; + csp->id = csp->op - mpiPi_BASE; else - csp->id = callsite_src_id_counter++; + csp->id = callsite_src_id_counter++; h_insert (callsite_src_id_cache, csp); } @@ -481,7 +481,7 @@ mpiPi_query_src (callsite_stats_t * p) static void mpiPi_merge_individual_callsite_records (callsite_stats_t * a, - callsite_stats_t * b) + callsite_stats_t * b) { a->count += b->count; a->cumulativeTime += b->cumulativeTime; @@ -510,24 +510,24 @@ mpiPi_insert_callsite_records (callsite_stats_t * p) /* If exists, accumulate, otherwise insert. This is specifically for optimizations that have multiple PCs for - one src line. We aggregate across rank after this. + one src line. We aggregate across rank after this. - The collective_report reporting approach does not aggregate individual + The collective_report reporting approach does not aggregate individual process callsite information at the collector process. */ if (mpiPi.collective_report == 0) { if (NULL == h_search (mpiPi.global_callsite_stats, p, (void **) &csp)) - { - callsite_stats_t *newp = NULL; - newp = (callsite_stats_t *) malloc (sizeof (callsite_stats_t)); - - memcpy (newp, p, sizeof (callsite_stats_t)); - /* insert new record into global */ - h_insert (mpiPi.global_callsite_stats, newp); - } + { + callsite_stats_t *newp = NULL; + newp = (callsite_stats_t *) malloc (sizeof (callsite_stats_t)); + + memcpy (newp, p, sizeof (callsite_stats_t)); + /* insert new record into global */ + h_insert (mpiPi.global_callsite_stats, newp); + } else - mpiPi_merge_individual_callsite_records (csp, p); + mpiPi_merge_individual_callsite_records (csp, p); } /* Collect aggregate callsite summary information indpendent of rank. */ @@ -540,11 +540,11 @@ mpiPi_insert_callsite_records (callsite_stats_t * p) newp->rank = -1; if (mpiPi.calcCOV) - { - newp->siteData = (double *) malloc (mpiPi.size * sizeof (double)); - newp->siteData[0] = p->cumulativeTime; - newp->siteDataIdx = 1; - } + { + newp->siteData = (double *) malloc (mpiPi.size * sizeof (double)); + newp->siteData[0] = p->cumulativeTime; + newp->siteDataIdx = 1; + } /* insert new record into global */ h_insert (mpiPi.global_callsite_stats_agg, newp); @@ -554,10 +554,10 @@ mpiPi_insert_callsite_records (callsite_stats_t * p) mpiPi_merge_individual_callsite_records (csp, p); if (mpiPi.calcCOV) - { - csp->siteData[csp->siteDataIdx] = p->cumulativeTime; - csp->siteDataIdx += 1; - } + { + csp->siteData[csp->siteDataIdx] = p->cumulativeTime; + csp->siteDataIdx += 1; + } } /* Do global accumulation while we are iterating through individual callsites */ @@ -627,8 +627,8 @@ mpiPi_insert_MPI_records () { /* Open hash table for MPI call data. */ mpiPi.global_MPI_stats_agg = h_open (mpiPi.tableSize, - mpiPi_callsite_stats_MPI_id_hashkey, - mpiPi_callsite_stats_op_comparator); + mpiPi_callsite_stats_MPI_id_hashkey, + mpiPi_callsite_stats_op_comparator); /* Get individual call data. */ h_gather_data (mpiPi.global_callsite_stats_agg, &ac, (void ***) &av); @@ -638,27 +638,27 @@ mpiPi_insert_MPI_records () /* For each call site, add call site info to hash table entry for MPI op, independent of rank. */ for (i = 0; i < ac; i++) - { - p = av[i]; - - /* Check if there is already an entry for the MPI op. */ - if (NULL == - h_search (mpiPi.global_MPI_stats_agg, p, (void **) &csp)) - { - callsite_stats_t *newp = NULL; - newp = (callsite_stats_t *) malloc (sizeof (callsite_stats_t)); - memcpy (newp, p, sizeof (callsite_stats_t)); - newp->rank = -1; - newp->csid = p->op - mpiPi_BASE; - - /* insert new record into global */ - h_insert (mpiPi.global_MPI_stats_agg, newp); - } - else - { - mpiPi_merge_individual_callsite_records (csp, p); - } - } + { + p = av[i]; + + /* Check if there is already an entry for the MPI op. */ + if (NULL == + h_search (mpiPi.global_MPI_stats_agg, p, (void **) &csp)) + { + callsite_stats_t *newp = NULL; + newp = (callsite_stats_t *) malloc (sizeof (callsite_stats_t)); + memcpy (newp, p, sizeof (callsite_stats_t)); + newp->rank = -1; + newp->csid = p->op - mpiPi_BASE; + + /* insert new record into global */ + h_insert (mpiPi.global_MPI_stats_agg, newp); + } + else + { + mpiPi_merge_individual_callsite_records (csp, p); + } + } } return 1; @@ -681,13 +681,13 @@ mpiPi_mergeResults () /* determine size of space necessary on collector */ PMPI_Allreduce (&ac, &totalCount, 1, MPI_INT, MPI_SUM, mpiPi.comm); PMPI_Reduce (&ac, &maxCount, 1, MPI_INT, MPI_MAX, mpiPi.collectorRank, - mpiPi.comm); + mpiPi.comm); if (totalCount < 1) { if (mpiPi.rank == mpiPi.collectorRank) - mpiPi_msg_warn - ("Collector found no records to merge. Omitting report.\n"); + mpiPi_msg_warn + ("Collector found no records to merge. Omitting report.\n"); return 0; } @@ -700,113 +700,113 @@ mpiPi_mergeResults () #ifdef ENABLE_BFD if (mpiPi.appFullName != NULL) - { - if (open_bfd_executable (mpiPi.appFullName) == 0) - mpiPi.do_lookup = 0; - } + { + if (open_bfd_executable (mpiPi.appFullName) == 0) + mpiPi.do_lookup = 0; + } #elif defined(USE_LIBDWARF) if (mpiPi.appFullName != NULL) - { - if (open_dwarf_executable (mpiPi.appFullName) == 0) - mpiPi.do_lookup = 0; - } + { + if (open_dwarf_executable (mpiPi.appFullName) == 0) + mpiPi.do_lookup = 0; + } #endif #if defined(ENABLE_BFD) || defined(USE_LIBDWARF) else - { - mpiPi_msg_warn - ("Failed to open executable. The mpiP -x runtime flag may address this issue.\n"); - mpiPi.do_lookup = 0; - } + { + mpiPi_msg_warn + ("Failed to open executable. The mpiP -x runtime flag may address this issue.\n"); + mpiPi.do_lookup = 0; + } #endif /* Open call site hash tables. */ mpiPi.global_callsite_stats = h_open (mpiPi.tableSize, - mpiPi_callsite_stats_src_hashkey, - mpiPi_callsite_stats_src_comparator); + mpiPi_callsite_stats_src_hashkey, + mpiPi_callsite_stats_src_comparator); mpiPi.global_callsite_stats_agg = h_open (mpiPi.tableSize, - mpiPi_callsite_stats_src_id_hashkey, - mpiPi_callsite_stats_src_id_comparator); + mpiPi_callsite_stats_src_id_hashkey, + mpiPi_callsite_stats_src_id_comparator); if (callsite_pc_cache == NULL) - { - callsite_pc_cache = h_open (mpiPi.tableSize, - callsite_pc_cache_hashkey, - callsite_pc_cache_comparator); - } + { + callsite_pc_cache = h_open (mpiPi.tableSize, + callsite_pc_cache_hashkey, + callsite_pc_cache_comparator); + } if (callsite_src_id_cache == NULL) - { - callsite_src_id_cache = h_open (mpiPi.tableSize, - callsite_src_id_cache_hashkey, - callsite_src_id_cache_comparator); - } + { + callsite_src_id_cache = h_open (mpiPi.tableSize, + callsite_src_id_cache_hashkey, + callsite_src_id_cache_comparator); + } /* Try to allocate space for max count of callsite info from all tasks */ mpiPi.rawCallsiteData = - (callsite_stats_t *) calloc (maxCount, sizeof (callsite_stats_t)); + (callsite_stats_t *) calloc (maxCount, sizeof (callsite_stats_t)); if (mpiPi.rawCallsiteData == NULL) - { - mpiPi_msg_warn - ("Failed to allocate memory to collect callsite info"); - retval = 0; - } + { + mpiPi_msg_warn + ("Failed to allocate memory to collect callsite info"); + retval = 0; + } /* Clear global_mpi_time and global_mpi_size before accumulation in mpiPi_insert_callsite_records */ mpiPi.global_mpi_time = 0.0; mpiPi.global_mpi_size = 0.0; if (retval == 1) - { - /* Insert collector callsite data into global and task-specific hash tables */ - for (ndx = 0; ndx < ac; ndx++) - { - mpiPi_insert_callsite_records (av[ndx]); - } - ndx = 0; - for (i = 1; i < mpiPi.size; i++) /* n-1 */ - { - MPI_Status status; - int count; - int j; - - /* okay in any order */ - PMPI_Probe (MPI_ANY_SOURCE, mpiPi.tag, mpiPi.comm, &status); - PMPI_Get_count (&status, MPI_CHAR, &count); - PMPI_Recv (&(mpiPi.rawCallsiteData[ndx]), count, MPI_CHAR, - status.MPI_SOURCE, mpiPi.tag, mpiPi.comm, &status); - count /= sizeof (callsite_stats_t); - - - for (j = 0; j < count; j++) - { - mpiPi_insert_callsite_records (&(mpiPi.rawCallsiteData[j])); - } - } - free (mpiPi.rawCallsiteData); - } + { + /* Insert collector callsite data into global and task-specific hash tables */ + for (ndx = 0; ndx < ac; ndx++) + { + mpiPi_insert_callsite_records (av[ndx]); + } + ndx = 0; + for (i = 1; i < mpiPi.size; i++) /* n-1 */ + { + MPI_Status status; + int count; + int j; + + /* okay in any order */ + PMPI_Probe (MPI_ANY_SOURCE, mpiPi.tag, mpiPi.comm, &status); + PMPI_Get_count (&status, MPI_CHAR, &count); + PMPI_Recv (&(mpiPi.rawCallsiteData[ndx]), count, MPI_CHAR, + status.MPI_SOURCE, mpiPi.tag, mpiPi.comm, &status); + count /= sizeof (callsite_stats_t); + + + for (j = 0; j < count; j++) + { + mpiPi_insert_callsite_records (&(mpiPi.rawCallsiteData[j])); + } + } + free (mpiPi.rawCallsiteData); + } } else { int ndx; char *sbuf = (char *) malloc (ac * sizeof (callsite_stats_t)); for (ndx = 0; ndx < ac; ndx++) - { - bcopy (av[ndx], - &(sbuf[ndx * sizeof (callsite_stats_t)]), - sizeof (callsite_stats_t)); - } + { + bcopy (av[ndx], + &(sbuf[ndx * sizeof (callsite_stats_t)]), + sizeof (callsite_stats_t)); + } PMPI_Send (sbuf, ac * sizeof (callsite_stats_t), - MPI_CHAR, mpiPi.collectorRank, mpiPi.tag, mpiPi.comm); + MPI_CHAR, mpiPi.collectorRank, mpiPi.tag, mpiPi.comm); free (sbuf); } if (mpiPi.rank == mpiPi.collectorRank && retval == 1) { if (mpiPi.collective_report == 0) - mpiPi_msg_debug - ("MEMORY : Allocated for global_callsite_stats : %13ld\n", - h_count (mpiPi.global_callsite_stats) * sizeof (callsite_stats_t)); + mpiPi_msg_debug + ("MEMORY : Allocated for global_callsite_stats : %13ld\n", + h_count (mpiPi.global_callsite_stats) * sizeof (callsite_stats_t)); mpiPi_msg_debug - ("MEMORY : Allocated for global_callsite_stats_agg : %13ld\n", - h_count (mpiPi.global_callsite_stats_agg) * - sizeof (callsite_stats_t)); + ("MEMORY : Allocated for global_callsite_stats_agg : %13ld\n", + h_count (mpiPi.global_callsite_stats_agg) * + sizeof (callsite_stats_t)); } /* TODO: need to free all these pointers as well. */ @@ -815,14 +815,14 @@ mpiPi_mergeResults () if (mpiPi.rank == mpiPi.collectorRank) { if (mpiPi.do_lookup == 1) - { + { #ifdef ENABLE_BFD - /* clean up */ - close_bfd_executable (); + /* clean up */ + close_bfd_executable (); #elif defined(USE_LIBDWARF) - close_dwarf_executable (); + close_dwarf_executable (); #endif - } + } } /* Quadrics MPI does not appear to support MPI_IN_PLACE */ @@ -844,28 +844,28 @@ mpiPi_mergeCollectiveStats () { all_call_count = mpiPi_DEF_END - mpiPi_BASE + 1; matrix_size = - all_call_count * mpiPi.coll_comm_histogram.hist_size * - mpiPi.coll_size_histogram.hist_size; + all_call_count * mpiPi.coll_comm_histogram.hist_size * + mpiPi.coll_size_histogram.hist_size; mpiPi_msg_debug ("matrix_size is %d, histogram data is %d\n", - matrix_size, sizeof (mpiPi.coll_time_stats)); + matrix_size, sizeof (mpiPi.coll_time_stats)); coll_time_local = (double *) malloc (matrix_size * sizeof (double)); coll_time_results = (double *) malloc (matrix_size * sizeof (double)); i = 0; for (x = 0; x < mpiPi_DEF_END - mpiPi_BASE; x++) - for (y = 0; y < 32; y++) - for (z = 0; z < 32; z++) - coll_time_local[i++] = mpiPi.coll_time_stats[x][y][z]; + for (y = 0; y < 32; y++) + for (z = 0; z < 32; z++) + coll_time_local[i++] = mpiPi.coll_time_stats[x][y][z]; /* Collect Collective statistic data were used */ PMPI_Reduce (coll_time_local, coll_time_results, matrix_size, - MPI_DOUBLE, MPI_SUM, mpiPi.collectorRank, mpiPi.comm); + MPI_DOUBLE, MPI_SUM, mpiPi.collectorRank, mpiPi.comm); i = 0; for (x = 0; x < mpiPi_DEF_END - mpiPi_BASE; x++) - for (y = 0; y < 32; y++) - for (z = 0; z < 32; z++) - mpiPi.coll_time_stats[x][y][z] = coll_time_results[i++]; + for (y = 0; y < 32; y++) + for (z = 0; z < 32; z++) + mpiPi.coll_time_stats[x][y][z] = coll_time_results[i++]; free (coll_time_local); free (coll_time_results); @@ -887,28 +887,28 @@ mpiPi_mergept2ptStats () { all_call_count = mpiPi_DEF_END - mpiPi_BASE + 1; matrix_size = - all_call_count * mpiPi.pt2pt_comm_histogram.hist_size * - mpiPi.pt2pt_size_histogram.hist_size; + all_call_count * mpiPi.pt2pt_comm_histogram.hist_size * + mpiPi.pt2pt_size_histogram.hist_size; mpiPi_msg_debug ("matrix_size is %d, histogram data is %d\n", - matrix_size, sizeof (mpiPi.pt2pt_send_stats)); + matrix_size, sizeof (mpiPi.pt2pt_send_stats)); pt2pt_send_local = (double *) malloc (matrix_size * sizeof (double)); pt2pt_send_results = (double *) malloc (matrix_size * sizeof (double)); i = 0; for (x = 0; x < mpiPi_DEF_END - mpiPi_BASE; x++) - for (y = 0; y < 32; y++) - for (z = 0; z < 32; z++) - pt2pt_send_local[i++] = mpiPi.pt2pt_send_stats[x][y][z]; + for (y = 0; y < 32; y++) + for (z = 0; z < 32; z++) + pt2pt_send_local[i++] = mpiPi.pt2pt_send_stats[x][y][z]; /* Collect Collective statistic data were used */ PMPI_Reduce (pt2pt_send_local, pt2pt_send_results, matrix_size, - MPI_DOUBLE, MPI_SUM, mpiPi.collectorRank, mpiPi.comm); + MPI_DOUBLE, MPI_SUM, mpiPi.collectorRank, mpiPi.comm); i = 0; for (x = 0; x < mpiPi_DEF_END - mpiPi_BASE; x++) - for (y = 0; y < 32; y++) - for (z = 0; z < 32; z++) - mpiPi.pt2pt_send_stats[x][y][z] = pt2pt_send_results[i++]; + for (y = 0; y < 32; y++) + for (z = 0; z < 32; z++) + mpiPi.pt2pt_send_stats[x][y][z] = pt2pt_send_results[i++]; free (pt2pt_send_local); free (pt2pt_send_results); @@ -929,28 +929,28 @@ mpiPi_publishResults (int report_style) /* Generate output filename, and open */ do - { - printCount++; - snprintf (mpiPi.oFilename, 256, "%s/%s.%d.%d.%d.mpiP", - mpiPi.outputDir, mpiPi.appName, mpiPi.size, mpiPi.procID, - printCount); - } + { + printCount++; + snprintf (mpiPi.oFilename, 256, "%s/%s.%d.%d.%d.mpiP", + mpiPi.outputDir, mpiPi.appName, mpiPi.size, mpiPi.procID, + printCount); + } while (access (mpiPi.oFilename, F_OK) == 0); fp = fopen (mpiPi.oFilename, "w"); if (fp == NULL) - { - mpiPi_msg_warn ("Could not open [%s], writing to stdout\n", - mpiPi.oFilename); - fp = stdout; - } + { + mpiPi_msg_warn ("Could not open [%s], writing to stdout\n", + mpiPi.oFilename); + fp = stdout; + } else - { - mpiPi_msg ("\n"); - mpiPi_msg ("Storing mpiP output in [%s].\n", mpiPi.oFilename); - mpiPi_msg ("\n"); - } + { + mpiPi_msg ("\n"); + mpiPi_msg ("Storing mpiP output in [%s].\n", mpiPi.oFilename); + mpiPi_msg ("\n"); + } } mpiPi_profile_print (fp, report_style); PMPI_Barrier (mpiPi.comm); @@ -975,70 +975,70 @@ mpiPi_collect_basics (int report_style) /* In the case where multiple reports are generated per run, only allocate memory for global_task_info once */ if (mpiPi.global_task_app_time == NULL) - { - mpiPi.global_task_app_time = - (double *) calloc (mpiPi.size, sizeof (double)); + { + mpiPi.global_task_app_time = + (double *) calloc (mpiPi.size, sizeof (double)); - if (mpiPi.global_task_app_time == NULL) - mpiPi_abort - ("Failed to allocate memory for global_task_app_time"); + if (mpiPi.global_task_app_time == NULL) + mpiPi_abort + ("Failed to allocate memory for global_task_app_time"); - mpiPi_msg_debug - ("MEMORY : Allocated for global_task_app_time : %13ld\n", - mpiPi.size * sizeof (double)); - } + mpiPi_msg_debug + ("MEMORY : Allocated for global_task_app_time : %13ld\n", + mpiPi.size * sizeof (double)); + } bzero (mpiPi.global_task_app_time, mpiPi.size * sizeof (double)); if (mpiPi.global_task_mpi_time == NULL) - { - mpiPi.global_task_mpi_time = - (double *) calloc (mpiPi.size, sizeof (double)); + { + mpiPi.global_task_mpi_time = + (double *) calloc (mpiPi.size, sizeof (double)); - if (mpiPi.global_task_mpi_time == NULL) - mpiPi_abort - ("Failed to allocate memory for global_task_mpi_time"); + if (mpiPi.global_task_mpi_time == NULL) + mpiPi_abort + ("Failed to allocate memory for global_task_mpi_time"); - mpiPi_msg_debug - ("MEMORY : Allocated for global_task_mpi_time : %13ld\n", - mpiPi.size * sizeof (double)); - } + mpiPi_msg_debug + ("MEMORY : Allocated for global_task_mpi_time : %13ld\n", + mpiPi.size * sizeof (double)); + } bzero (mpiPi.global_task_mpi_time, mpiPi.size * sizeof (double)); // Only allocate hostname storage if we are doing a verbose report if (mpiPi.global_task_hostnames == NULL - && (report_style == mpiPi_style_verbose - || report_style == mpiPi_style_both)) - { - mpiPi.global_task_hostnames = - (mpiPi_hostname_t *) calloc (mpiPi.size, - sizeof (char) * - MPIPI_HOSTNAME_LEN_MAX); - - if (mpiPi.global_task_hostnames == NULL) - mpiPi_abort - ("Failed to allocate memory for global_task_hostnames"); - - mpiPi_msg_debug - ("MEMORY : Allocated for global_task_hostnames : %13ld\n", - mpiPi.size * sizeof (char) * MPIPI_HOSTNAME_LEN_MAX); - } + && (report_style == mpiPi_style_verbose + || report_style == mpiPi_style_both)) + { + mpiPi.global_task_hostnames = + (mpiPi_hostname_t *) calloc (mpiPi.size, + sizeof (char) * + MPIPI_HOSTNAME_LEN_MAX); + + if (mpiPi.global_task_hostnames == NULL) + mpiPi_abort + ("Failed to allocate memory for global_task_hostnames"); + + mpiPi_msg_debug + ("MEMORY : Allocated for global_task_hostnames : %13ld\n", + mpiPi.size * sizeof (char) * MPIPI_HOSTNAME_LEN_MAX); + } if (mpiPi.global_task_hostnames != NULL) - bzero (mpiPi.global_task_hostnames, - mpiPi.size * sizeof (char) * MPIPI_HOSTNAME_LEN_MAX); + bzero (mpiPi.global_task_hostnames, + mpiPi.size * sizeof (char) * MPIPI_HOSTNAME_LEN_MAX); } PMPI_Gather (&mpiPi.cumulativeTime, 1, MPI_DOUBLE, - mpiPi.global_task_app_time, 1, MPI_DOUBLE, - mpiPi.collectorRank, mpiPi.comm); + mpiPi.global_task_app_time, 1, MPI_DOUBLE, + mpiPi.collectorRank, mpiPi.comm); if (report_style == mpiPi_style_verbose || report_style == mpiPi_style_both) { PMPI_Gather (mpiPi.hostname, MPIPI_HOSTNAME_LEN_MAX, MPI_CHAR, - mpiPi.global_task_hostnames, MPIPI_HOSTNAME_LEN_MAX, - MPI_CHAR, mpiPi.collectorRank, mpiPi.comm); + mpiPi.global_task_hostnames, MPIPI_HOSTNAME_LEN_MAX, + MPI_CHAR, mpiPi.collectorRank, mpiPi.comm); } return; @@ -1057,7 +1057,7 @@ mpiPi_generateReport (int report_style) if (mpiPi.enabled) { dur = - (mpiPi_GETTIMEDIFF (&mpiPi.endTime, &mpiPi.startTime) / 1000000.0); + (mpiPi_GETTIMEDIFF (&mpiPi.endTime, &mpiPi.startTime) / 1000000.0); mpiPi.cumulativeTime += dur; assert (mpiPi.cumulativeTime >= 0); mpiPi_GETTIME (&mpiPi.startTime); @@ -1098,12 +1098,12 @@ mpiPi_generateReport (int report_style) { mpiPi_GETTIME (&timer_start); if (mpiPi.report_style == mpiPi_style_both) - { - mpiPi_publishResults (mpiPi_style_concise); - mpiPi_publishResults (mpiPi_style_verbose); - } + { + mpiPi_publishResults (mpiPi_style_concise); + mpiPi_publishResults (mpiPi_style_verbose); + } else - mpiPi_publishResults (report_style); + mpiPi_publishResults (report_style); mpiPi_GETTIME (&timer_end); dur = (mpiPi_GETTIMEDIFF (&timer_end, &timer_start) / 1000000.0); mpiPi_msg_debug0 ("TIMING : publish time is %12.6f\n", dur); @@ -1146,8 +1146,8 @@ mpiPi_finalize () void mpiPi_update_callsite_stats (unsigned op, unsigned rank, void **pc, - double dur, double sendSize, double ioSize, - double rmaSize) + double dur, double sendSize, double ioSize, + double rmaSize) { int i; callsite_stats_t *csp = NULL; @@ -1176,9 +1176,9 @@ mpiPi_update_callsite_stats (unsigned op, unsigned rank, void **pc, csp->op = op; csp->rank = rank; for (i = 0; i < MPIP_CALLSITE_STACK_DEPTH; i++) - { - csp->pc[i] = pc[i]; - } + { + csp->pc[i] = pc[i]; + } csp->cookie = MPIP_CALLSITE_STATS_COOKIE; csp->cumulativeTime = 0; csp->minDur = DBL_MAX; @@ -1214,10 +1214,10 @@ mpiPi_update_callsite_stats (unsigned op, unsigned rank, void **pc, #if 0 mpiPi_msg_debug ("mpiPi.messageCountThreshold is %d\n", - mpiPi.messageCountThreshold); + mpiPi.messageCountThreshold); mpiPi_msg_debug ("sendSize is %f\n", sendSize); mpiPi_msg_debug ("csp->arbitraryMessageCount is %lld\n", - csp->arbitraryMessageCount); + csp->arbitraryMessageCount); #endif return; @@ -1235,12 +1235,12 @@ get_histogram_bin (mpiPi_histogram_t * h, int val) if (h->bin_intervals == NULL) { while (wv > h->first_bin_max && bin < h->hist_size) - { - wv >>= 1; - bin++; - } + { + wv >>= 1; + bin++; + } } - else /* Add code for custom intervals later */ + else /* Add code for custom intervals later */ { } @@ -1250,7 +1250,7 @@ get_histogram_bin (mpiPi_histogram_t * h, int val) void mpiPi_update_collective_stats (int op, double dur, double size, - MPI_Comm * comm) + MPI_Comm * comm) { int op_idx, comm_size, comm_bin, size_bin; @@ -1262,9 +1262,9 @@ mpiPi_update_collective_stats (int op, double dur, double size, size_bin = get_histogram_bin (&mpiPi.coll_size_histogram, size); mpiPi_msg_debug - ("Adding %.0f time to entry mpiPi.collective_stats[%d][%d][%d] value of %.0f\n", - dur, op_idx, comm_bin, size_bin, - mpiPi.coll_time_stats[op_idx][comm_bin][size_bin]); + ("Adding %.0f time to entry mpiPi.collective_stats[%d][%d][%d] value of %.0f\n", + dur, op_idx, comm_bin, size_bin, + mpiPi.coll_time_stats[op_idx][comm_bin][size_bin]); mpiPi.coll_time_stats[op_idx][comm_bin][size_bin] += dur; } @@ -1283,9 +1283,9 @@ mpiPi_update_pt2pt_stats (int op, double dur, double size, MPI_Comm * comm) size_bin = get_histogram_bin (&mpiPi.pt2pt_size_histogram, size); mpiPi_msg_debug - ("Adding %.0f send size to entry mpiPi.pt2pt_stats[%d][%d][%d] value of %.0f\n", - size, op_idx, comm_bin, size_bin, - mpiPi.pt2pt_send_stats[op_idx][comm_bin][size_bin]); + ("Adding %.0f send size to entry mpiPi.pt2pt_stats[%d][%d][%d] value of %.0f\n", + size, op_idx, comm_bin, size_bin, + mpiPi.pt2pt_send_stats[op_idx][comm_bin][size_bin]); mpiPi.pt2pt_send_stats[op_idx][comm_bin][size_bin] += size; } @@ -1295,22 +1295,22 @@ mpiPi_update_pt2pt_stats (int op, double dur, double size, MPI_Comm * comm) -/* +/* -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. - +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. @@ -1335,22 +1335,22 @@ 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 - + + +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, diff --git a/mpiPi_proto.h b/mpiPi_proto.h index d91fa56..83286b4 100644 --- a/mpiPi_proto.h +++ b/mpiPi_proto.h @@ -36,17 +36,17 @@ extern void *h_delete (h_t * ht, void *key, void **ptr); extern int h_gather_data (h_t * ht, int *ac, void ***ptr); extern void mpiPi_init (char *appName); extern int mpiPi_query_pc (void *pc, char **filename, char **functname, - int *lineno); + int *lineno); extern int mpiPi_query_src (callsite_stats_t * p); extern void mpiPi_generateReport (int report_style); extern void mpiPi_finalize (void); extern void mpiPi_update_callsite_stats (unsigned op, unsigned rank, - void **pc, double dur, - double sendSize, double ioSize, - double rmaSize); + void **pc, double dur, + double sendSize, double ioSize, + double rmaSize); extern char *mpiPdemangle (const char *mangledSym); extern int mpiP_find_src_loc (void *i_addr_hex, char **o_file_str, - int *o_lineno, char **o_funct_str); + int *o_lineno, char **o_funct_str); extern int open_bfd_executable (char *filename); extern void close_bfd_executable (void); extern int MPI_Pcontrol (const int flag, ...); @@ -63,18 +63,18 @@ extern char *getProcExeLink (void); extern void getProcCmdLine (int *ac, char **av); extern void mpiPi_copy_args (int *ac, char **av, int av_len); extern void mpiPi_copy_given_args (int *ac, char **av, int av_len, int argc, - char **argv); + char **argv); extern unsigned long long mpiPi_get_text_start (char *filename); extern void mpiPi_update_collective_stats (int op, double dur, double size, - MPI_Comm * comm); + MPI_Comm * comm); extern void mpiPi_update_pt2pt_stats (int op, double dur, double size, - MPI_Comm * comm); + MPI_Comm * comm); #ifdef NEED_MREAD_REAL_TIME_DECL #include #include extern int mread_real_time (timebasestruct_t * t, - size_t size_of_timebasestruct_t); + size_t size_of_timebasestruct_t); #endif /* diff --git a/pc_lookup.c b/pc_lookup.c index 8e4e620..5e0dcd0 100644 --- a/pc_lookup.c +++ b/pc_lookup.c @@ -139,36 +139,36 @@ find_address_in_section (abfd, section, data) local_pc &= 0x00000000FFFFFFFF; local_pc += mpiPi.text_start; mpiPi_msg_debug ("pc is %s, text_start is %s, local_pc is %s\n", - mpiP_format_address ((void *) pc, addr_buf1), - mpiP_format_address ((void *) mpiPi.text_start, addr_buf2), - mpiP_format_address ((void *) local_pc, addr_buf3)); + mpiP_format_address ((void *) pc, addr_buf1), + mpiP_format_address ((void *) mpiPi.text_start, addr_buf2), + mpiP_format_address ((void *) local_pc, addr_buf3)); #else local_pc = pc /*& (~0x10000000) */ ; #endif if ((bfd_get_section_flags (abfd, section) & SEC_ALLOC) == 0) - { - mpiPi_msg_debug ("failed bfd_get_section_flags\n"); - return; - } + { + mpiPi_msg_debug ("failed bfd_get_section_flags\n"); + return; + } vma = bfd_get_section_vma (abfd, section); if (local_pc < vma) - { - if (mpiPi_debug == 1) - { - sprintf_vma (addr_buf1, local_pc); - sprintf_vma (addr_buf2, vma); - mpiPi_msg_debug - ("failed bfd_get_section_vma: local_pc=%s vma=%s\n", - addr_buf1, addr_buf2); - } - return; - } + { + if (mpiPi_debug == 1) + { + sprintf_vma (addr_buf1, local_pc); + sprintf_vma (addr_buf2, vma); + mpiPi_msg_debug + ("failed bfd_get_section_vma: local_pc=%s vma=%s\n", + addr_buf1, addr_buf2); + } + return; + } /* The following define addresses binutils modifications between * version 2.15 and 2.15.96 - */ +*/ #ifdef HAVE_BFD_GET_SECTION_SIZE size = bfd_get_section_size (section); #else @@ -179,42 +179,42 @@ find_address_in_section (abfd, section, data) #endif if (local_pc >= vma + size) - { - if (mpiPi_debug == 1) - { - sprintf_vma (addr_buf1, local_pc); - sprintf_vma (addr_buf2, vma); - sprintf_vma (addr_buf3, (vma + size)); - mpiPi_msg_debug ("PC not in section: pc=%s vma=%s-%s\n", - addr_buf1, addr_buf2, addr_buf3); - } - return; - } + { + if (mpiPi_debug == 1) + { + sprintf_vma (addr_buf1, local_pc); + sprintf_vma (addr_buf2, vma); + sprintf_vma (addr_buf3, (vma + size)); + mpiPi_msg_debug ("PC not in section: pc=%s vma=%s-%s\n", + addr_buf1, addr_buf2, addr_buf3); + } + return; + } found = bfd_find_nearest_line (abfd, section, syms, local_pc - vma, - &filename, &functionname, &line); + &filename, &functionname, &line); if (!found && mpiPi_debug == 1) - { - sprintf_vma (addr_buf1, local_pc); - sprintf_vma (addr_buf2, vma); - sprintf_vma (addr_buf3, (vma + size)); - mpiPi_msg_debug ("bfd_find_nearest_line failed for : pc=%s vma=%s-%s\n", - addr_buf1, addr_buf2, addr_buf3); - } + { + sprintf_vma (addr_buf1, local_pc); + sprintf_vma (addr_buf2, vma); + sprintf_vma (addr_buf3, (vma + size)); + mpiPi_msg_debug ("bfd_find_nearest_line failed for : pc=%s vma=%s-%s\n", + addr_buf1, addr_buf2, addr_buf3); + } if (mpiPi_debug == 1) - { - sprintf_vma (addr_buf1, local_pc); - sprintf_vma (addr_buf2, vma); - sprintf_vma (addr_buf3, (vma + size)); - mpiPi_msg_debug ("bfd_find_nearest_line for : pc=%s vma=%s-%s\n", - addr_buf1, addr_buf2, addr_buf3); - - mpiPi_msg_debug (" returned : %s:%s:%u\n", - filename, functionname, line); - } + { + sprintf_vma (addr_buf1, local_pc); + sprintf_vma (addr_buf2, vma); + sprintf_vma (addr_buf3, (vma + size)); + mpiPi_msg_debug ("bfd_find_nearest_line for : pc=%s vma=%s-%s\n", + addr_buf1, addr_buf2, addr_buf3); + + mpiPi_msg_debug (" returned : %s:%s:%u\n", + filename, functionname, line); + } } @@ -323,13 +323,13 @@ mpiPi_parse_maps () { /* sanity check input buffer */ if (inbuf == NULL) - return 0; + return 0; mpiPi_msg_debug ("maps getline is %s\n", inbuf); /* scan address range */ if (sscanf (inbuf, scan_str, &lvma, &uvma) < 2) - return 0; + return 0; mpiPi_msg_debug ("Parsed range as %lx - %lx\n", lvma, uvma); @@ -341,7 +341,7 @@ mpiPi_parse_maps () /* Check for text segment */ if (tokptr == NULL || tokptr[0] != 'r' || tokptr[2] != 'x') - continue; + continue; /* get pointer to offset */ tokptr = strtok_r (NULL, delim, &sp); @@ -357,20 +357,20 @@ mpiPi_parse_maps () /* Process file info */ if (fpath == NULL || fpath[0] != '/') - continue; + continue; mpiPi_msg_debug ("maps fpath is %s\n", fpath); /* copy info into structure */ cso = (so_info_t *) malloc (sizeof (so_info_t)); if (cso == NULL) - return 0; + return 0; cso->lvma = lvma; cso->uvma = uvma; cso->fpath = strdup (fpath); cso->bfd = NULL; if (tsearch (cso, (void **) &(mpiPi.so_info), mpiPi_so_info_compare) != - NULL) - mpiPi.so_count++; + NULL) + mpiPi.so_count++; } fclose (fh); @@ -387,7 +387,7 @@ mpiPi_parse_maps () int mpiP_find_src_loc (void *i_addr_hex, char **o_file_str, int *o_lineno, - char **o_funct_str) + char **o_funct_str) { char buf[128]; char addr_buf[24]; @@ -395,7 +395,7 @@ mpiP_find_src_loc (void *i_addr_hex, char **o_file_str, int *o_lineno, if (i_addr_hex == NULL) { mpiPi_msg_debug - ("mpiP_find_src_loc returning failure as i_addr_hex == NULL\n"); + ("mpiP_find_src_loc returning failure as i_addr_hex == NULL\n"); return 1; } @@ -405,7 +405,7 @@ mpiP_find_src_loc (void *i_addr_hex, char **o_file_str, int *o_lineno, if (abfd == NULL) { mpiPi_msg_debug - ("mpiP_find_src_loc returning failure as abfd == NULL\n"); + ("mpiP_find_src_loc returning failure as abfd == NULL\n"); return 1; } @@ -422,42 +422,42 @@ mpiP_find_src_loc (void *i_addr_hex, char **o_file_str, int *o_lineno, so_info_t cso, *fso, **pfso; if (mpiPi.so_info == NULL) - if (mpiPi_parse_maps () == 0) - { - mpiPi_msg_debug ("Failed to parse SO maps.\n"); - return 1; - } + if (mpiPi_parse_maps () == 0) + { + mpiPi_msg_debug ("Failed to parse SO maps.\n"); + return 1; + } cso.lvma = (void *) i_addr_hex; mpiPi_msg_debug - ("At SO tfind, &cso is %p, &so_info is %p, &mpiPi_so_info_compare is %p\n", - &cso, &(mpiPi.so_info), mpiPi_so_info_compare); + ("At SO tfind, &cso is %p, &so_info is %p, &mpiPi_so_info_compare is %p\n", + &cso, &(mpiPi.so_info), mpiPi_so_info_compare); pfso = - (so_info_t **) tfind ((void *) &cso, (void **) &(mpiPi.so_info), - mpiPi_so_info_compare); + (so_info_t **) tfind ((void *) &cso, (void **) &(mpiPi.so_info), + mpiPi_so_info_compare); mpiPi_msg_debug ("After SO tfind\n"); if (pfso != NULL) - { - fso = *pfso; - if (fso->bfd == NULL) - { - mpiPi_msg_debug ("opening SO filename %s\n", fso->fpath); - fso->bfd = (bfd *) open_bfd_object (fso->fpath); - } - - pc = (char *) i_addr_hex - (char *) fso->lvma; - mpiPi_msg_debug - ("Calling bfd_map_over_sections with new bfd for %p\n", pc); - - found = FALSE; - - mpiPi_msg_debug ("fso->bfd->sections is %p\n", - ((bfd *) (fso->bfd))->sections); - bfd_map_over_sections (fso->bfd, find_address_in_section, - (PTR) NULL); - } + { + fso = *pfso; + if (fso->bfd == NULL) + { + mpiPi_msg_debug ("opening SO filename %s\n", fso->fpath); + fso->bfd = (bfd *) open_bfd_object (fso->fpath); + } + + pc = (char *) i_addr_hex - (char *) fso->lvma; + mpiPi_msg_debug + ("Calling bfd_map_over_sections with new bfd for %p\n", pc); + + found = FALSE; + + mpiPi_msg_debug ("fso->bfd->sections is %p\n", + ((bfd *) (fso->bfd))->sections); + bfd_map_over_sections (fso->bfd, find_address_in_section, + (PTR) NULL); + } } #endif /* #ifdef SO_LOOKUP */ @@ -475,22 +475,22 @@ mpiP_find_src_loc (void *i_addr_hex, char **o_file_str, int *o_lineno, char *res = NULL; #if defined(DEMANGLE_IBM) || defined(DEMANGLE_Compaq) || defined(DEMANGLE_GNU) - res = mpiPdemangle (functionname); + res = mpiPdemangle (functionname); #endif - if (res == NULL) - { - *o_funct_str = strdup (functionname); - } - else - { - *o_funct_str = res; - } + if (res == NULL) + { + *o_funct_str = strdup (functionname); + } + else + { + *o_funct_str = res; + } #if defined(DEMANGLE_IBM) || defined(DEMANGLE_Compaq) || defined(DEMANGLE_GNU) - mpiPi_msg_debug ("attempted demangle %s->%s\n", functionname, - *o_funct_str); + mpiPi_msg_debug ("attempted demangle %s->%s\n", functionname, + *o_funct_str); #endif - } + } /* set the filename and line no */ if (mpiPi.baseNames == 0 && filename != NULL) @@ -498,14 +498,14 @@ mpiP_find_src_loc (void *i_addr_hex, char **o_file_str, int *o_lineno, char *h; h = strrchr (filename, '/'); if (h != NULL) - filename = h + 1; + filename = h + 1; } *o_lineno = line; *o_file_str = strdup (filename ? filename : "[unknown]"); mpiPi_msg_debug ("BFD: %s -> %s:%u:%s\n", buf, *o_file_str, *o_lineno, - *o_funct_str); + *o_funct_str); return 0; } @@ -526,7 +526,7 @@ open_bfd_object (char *filename) { mpiPi_msg_warn ("BFD Object filename is NULL!\n"); mpiPi_msg_warn - ("If this is a Fortran application, you may be using the incorrect mpiP library.\n"); + ("If this is a Fortran application, you may be using the incorrect mpiP library.\n"); return NULL; } @@ -563,11 +563,11 @@ open_bfd_object (char *filename) { char *curr_match; if (matching != NULL) - { - for (curr_match = matching[0]; curr_match != NULL; curr_match++) - mpiPi_msg_debug ("found matching type %s\n", curr_match); - free (matching); - } + { + for (curr_match = matching[0]; curr_match != NULL; curr_match++) + mpiPi_msg_debug ("found matching type %s\n", curr_match); + free (matching); + } mpiPi_msg_warn ("BFD format matching failed"); bfd_close (new_bfd); return NULL; @@ -593,8 +593,8 @@ open_bfd_object (char *filename) symcount = bfd_read_minisymbols (new_bfd, FALSE, (void *) &syms, &size); if (symcount == 0) symcount = - bfd_read_minisymbols (new_bfd, TRUE /* dynamic */ , (void *) &syms, - &size); + bfd_read_minisymbols (new_bfd, TRUE /* dynamic */ , (void *) &syms, + &size); if (symcount < 0) { @@ -689,15 +689,15 @@ mpiPi_get_text_start (char *filename) mpiPi_msg_debug ("text start is 0x%0x\n", AoutHeader32.o_text_start); while (count++ < FileHeader32.f_nscns) - { - read (fh, &SectHeader32, sizeof (SCNHDR)); - mpiPi_msg_debug ("found header name %s\n", SectHeader32.s_name); - mpiPi_msg_debug ("found header raw ptr 0x%0x\n", - SectHeader32.s_scnptr); - - if (SectHeader32.s_flags & STYP_TEXT) - text_start = AoutHeader32.o_text_start - SectHeader32.s_scnptr; - } + { + read (fh, &SectHeader32, sizeof (SCNHDR)); + mpiPi_msg_debug ("found header name %s\n", SectHeader32.s_name); + mpiPi_msg_debug ("found header raw ptr 0x%0x\n", + SectHeader32.s_scnptr); + + if (SectHeader32.s_flags & STYP_TEXT) + text_start = AoutHeader32.o_text_start - SectHeader32.s_scnptr; + } } else if (magic == 0x01EF || magic == 0x01F7) /* 64-bit */ { @@ -708,15 +708,15 @@ mpiPi_get_text_start (char *filename) mpiPi_msg_debug ("text start is 0x%0llx\n", AoutHeader64.o_text_start); while (count++ < FileHeader64.f_nscns) - { - read (fh, &SectHeader64, sizeof (SCNHDR_64)); - mpiPi_msg_debug ("found header name %s\n", SectHeader64.s_name); - mpiPi_msg_debug ("found header raw ptr 0x%0llx\n", - SectHeader64.s_scnptr); - - if (SectHeader64.s_flags & STYP_TEXT) - text_start = AoutHeader64.o_text_start - SectHeader64.s_scnptr; - } + { + read (fh, &SectHeader64, sizeof (SCNHDR_64)); + mpiPi_msg_debug ("found header name %s\n", SectHeader64.s_name); + mpiPi_msg_debug ("found header raw ptr 0x%0llx\n", + SectHeader64.s_scnptr); + + if (SectHeader64.s_flags & STYP_TEXT) + text_start = AoutHeader64.o_text_start - SectHeader64.s_scnptr; + } } else { diff --git a/pc_lookup_dwarf.c b/pc_lookup_dwarf.c index d6fa687..d70d043 100644 --- a/pc_lookup_dwarf.c +++ b/pc_lookup_dwarf.c @@ -79,10 +79,10 @@ UniqueFileName_Get (const char *testFileName) while (currInfo != NULL) { if (strcmp (testFileName, currInfo->ufi.fileName) == 0) - { - /* we found a match */ - break; - } + { + /* we found a match */ + break; + } /* advance to the next file name */ currInfo = currInfo->next; @@ -103,17 +103,17 @@ UniqueFileName_Get (const char *testFileName) * Allocate a new string. */ currInfo = (struct UniqueFileNameListNode *) - malloc (sizeof (struct UniqueFileNameListNode)); + malloc (sizeof (struct UniqueFileNameListNode)); if (currInfo == NULL) - { - mpiPi_abort ("malloc failed\n"); - } + { + mpiPi_abort ("malloc failed\n"); + } currInfo->ufi.fileName = strdup (testFileName); if (currInfo->ufi.fileName == NULL) - { - mpiPi_abort ("malloc failed\n"); - } + { + mpiPi_abort ("malloc failed\n"); + } /* * link the new entry into our list @@ -192,7 +192,7 @@ AddrRangeMap_Init (struct AddrRangeMap *map) static void AddrRangeMap_DestroyAux (struct AddrRangeMapNode *node, - void (*nodeInfoFreeFunc) (void *)) + void (*nodeInfoFreeFunc) (void *)) { assert (node != NULL); @@ -219,14 +219,14 @@ AddrRangeMap_DestroyAux (struct AddrRangeMapNode *node, static void AddrRangeMap_Destroy (struct AddrRangeMap *map, - void (*nodeInfoFreeFunc) (void *)) + void (*nodeInfoFreeFunc) (void *)) { if (map != NULL) { if (map->root != NULL) - { - AddrRangeMap_DestroyAux (map->root, nodeInfoFreeFunc); - } + { + AddrRangeMap_DestroyAux (map->root, nodeInfoFreeFunc); + } free (map); } } @@ -234,7 +234,7 @@ AddrRangeMap_Destroy (struct AddrRangeMap *map, static void AddrRangeMap_LeftRotate (struct AddrRangeMap *map, - struct AddrRangeMapNode *node) + struct AddrRangeMapNode *node) { struct AddrRangeMapNode *oldRightChild = NULL; @@ -275,7 +275,7 @@ AddrRangeMap_LeftRotate (struct AddrRangeMap *map, static void AddrRangeMap_RightRotate (struct AddrRangeMap *map, - struct AddrRangeMapNode *node) + struct AddrRangeMapNode *node) { struct AddrRangeMapNode *oldLeftChild = NULL; @@ -319,14 +319,14 @@ AddrRangeMap_RightRotate (struct AddrRangeMap *map, static void AddrRangeMap_Add (struct AddrRangeMap *map, - Dwarf_Addr lowAddr, Dwarf_Addr highAddr, void *info) + Dwarf_Addr lowAddr, Dwarf_Addr highAddr, void *info) { struct AddrRangeMapNode *currNode = NULL; struct AddrRangeMapNode *newEntry = NULL; mpiPi_msg_debug ("AddrRangeMap::Add: [0x%016llx,0x%016llx]\n", - lowAddr, highAddr); + lowAddr, highAddr); /* build a new entry for this mapping */ newEntry = @@ -356,47 +356,47 @@ AddrRangeMap_Add (struct AddrRangeMap *map, /* new node is not the first node to be added */ currNode = map->root; while (currNode != NULL) - { - if (highAddr <= currNode->lowAddr) - { - /* target address is below range covered by current node */ - if (currNode->leftChild != NULL) - { - /* compare with ranges smaller than ours */ - currNode = currNode->leftChild; - } - else - { - /* adopt new node as our left child */ - currNode->leftChild = newEntry; - newEntry->parent = currNode; - break; - } - } - else if (lowAddr >= currNode->highAddr) - { - /* target address is above range covered by current node */ - if (currNode->rightChild != NULL) - { - /* compare with ranges larger than ours */ - currNode = currNode->rightChild; - } - else - { - /* adopt new node as our right child */ - currNode->rightChild = newEntry; - newEntry->parent = currNode; - break; - } - } - else - { - /* new range overlaps with our range! */ - mpiPi_abort - ("new address node range [0x%016llx,0x%016llx] overlaps our range [0x%016llx,0x%016llx]\n", - lowAddr, highAddr, currNode->lowAddr, currNode->highAddr); - } - } + { + if (highAddr <= currNode->lowAddr) + { + /* target address is below range covered by current node */ + if (currNode->leftChild != NULL) + { + /* compare with ranges smaller than ours */ + currNode = currNode->leftChild; + } + else + { + /* adopt new node as our left child */ + currNode->leftChild = newEntry; + newEntry->parent = currNode; + break; + } + } + else if (lowAddr >= currNode->highAddr) + { + /* target address is above range covered by current node */ + if (currNode->rightChild != NULL) + { + /* compare with ranges larger than ours */ + currNode = currNode->rightChild; + } + else + { + /* adopt new node as our right child */ + currNode->rightChild = newEntry; + newEntry->parent = currNode; + break; + } + } + else + { + /* new range overlaps with our range! */ + mpiPi_abort + ("new address node range [0x%016llx,0x%016llx] overlaps our range [0x%016llx,0x%016llx]\n", + lowAddr, highAddr, currNode->lowAddr, currNode->highAddr); + } + } } @@ -409,60 +409,60 @@ AddrRangeMap_Add (struct AddrRangeMap *map, */ currNode = newEntry; while ((currNode != map->root) && - (currNode->parent->color == AddrRangeMapNodeColor_Red)) + (currNode->parent->color == AddrRangeMapNodeColor_Red)) { struct AddrRangeMapNode *uncleNode = NULL; if (currNode->parent == currNode->parent->parent->leftChild) - { - /* currNode's parent is its parent's left child */ - uncleNode = currNode->parent->parent->rightChild; - if ((uncleNode != NULL) && - (uncleNode->color == AddrRangeMapNodeColor_Red)) - { - currNode->parent->color = AddrRangeMapNodeColor_Black; - uncleNode->color = AddrRangeMapNodeColor_Black; - currNode->parent->parent->color = AddrRangeMapNodeColor_Red; - currNode = currNode->parent->parent; - } - else - { - /* uncleNode is NULL (NULL is assumed black) or is black */ - if (currNode == currNode->parent->rightChild) - { - currNode = currNode->parent; - AddrRangeMap_LeftRotate (map, currNode); - } - currNode->parent->color = AddrRangeMapNodeColor_Black; - currNode->parent->parent->color = AddrRangeMapNodeColor_Red; - AddrRangeMap_RightRotate (map, currNode->parent->parent); - } - } + { + /* currNode's parent is its parent's left child */ + uncleNode = currNode->parent->parent->rightChild; + if ((uncleNode != NULL) && + (uncleNode->color == AddrRangeMapNodeColor_Red)) + { + currNode->parent->color = AddrRangeMapNodeColor_Black; + uncleNode->color = AddrRangeMapNodeColor_Black; + currNode->parent->parent->color = AddrRangeMapNodeColor_Red; + currNode = currNode->parent->parent; + } + else + { + /* uncleNode is NULL (NULL is assumed black) or is black */ + if (currNode == currNode->parent->rightChild) + { + currNode = currNode->parent; + AddrRangeMap_LeftRotate (map, currNode); + } + currNode->parent->color = AddrRangeMapNodeColor_Black; + currNode->parent->parent->color = AddrRangeMapNodeColor_Red; + AddrRangeMap_RightRotate (map, currNode->parent->parent); + } + } else - { - /* currNode's parent is its parent's right child */ - uncleNode = currNode->parent->parent->leftChild; - if ((uncleNode != NULL) && - (uncleNode->color == AddrRangeMapNodeColor_Red)) - { - currNode->parent->color = AddrRangeMapNodeColor_Black; - uncleNode->color = AddrRangeMapNodeColor_Black; - currNode->parent->parent->color = AddrRangeMapNodeColor_Red; - currNode = currNode->parent->parent; - } - else - { - /* uncleNode is NULL (NULL is assumed black) or is black */ - if (currNode == currNode->parent->leftChild) - { - currNode = currNode->parent; - AddrRangeMap_RightRotate (map, currNode); - } - currNode->parent->color = AddrRangeMapNodeColor_Black; - currNode->parent->parent->color = AddrRangeMapNodeColor_Red; - AddrRangeMap_LeftRotate (map, currNode->parent->parent); - } - } + { + /* currNode's parent is its parent's right child */ + uncleNode = currNode->parent->parent->leftChild; + if ((uncleNode != NULL) && + (uncleNode->color == AddrRangeMapNodeColor_Red)) + { + currNode->parent->color = AddrRangeMapNodeColor_Black; + uncleNode->color = AddrRangeMapNodeColor_Black; + currNode->parent->parent->color = AddrRangeMapNodeColor_Red; + currNode = currNode->parent->parent; + } + else + { + /* uncleNode is NULL (NULL is assumed black) or is black */ + if (currNode == currNode->parent->leftChild) + { + currNode = currNode->parent; + AddrRangeMap_RightRotate (map, currNode); + } + currNode->parent->color = AddrRangeMapNodeColor_Black; + currNode->parent->parent->color = AddrRangeMapNodeColor_Red; + AddrRangeMap_LeftRotate (map, currNode->parent->parent); + } + } } assert (map->root != NULL); map->root->color = AddrRangeMapNodeColor_Black; @@ -482,30 +482,30 @@ AddrRangeMap_Find (struct AddrRangeMap *map, void *addr) while (currNode != NULL) { mpiPi_msg_debug - ("AddrRangeMap::Find: comparing with [0x%016llx,0x%016llx]\n", - currNode->lowAddr, currNode->highAddr); + ("AddrRangeMap::Find: comparing with [0x%016llx,0x%016llx]\n", + currNode->lowAddr, currNode->highAddr); if (((Dwarf_Addr) addr) < currNode->lowAddr) - { - /* target address is below range covered by current node */ - /* NOTE: we might not have a left child */ - mpiPi_msg_debug ("AddrRangeMap::Find: going left\n"); - currNode = currNode->leftChild; - } + { + /* target address is below range covered by current node */ + /* NOTE: we might not have a left child */ + mpiPi_msg_debug ("AddrRangeMap::Find: going left\n"); + currNode = currNode->leftChild; + } else if (((Dwarf_Addr) addr) > currNode->highAddr) - { - /* target address is above range covered by current node */ - /* NOTE: we might not have a right child */ - mpiPi_msg_debug ("AddrRangeMap::Find: going right\n"); - currNode = currNode->rightChild; - } + { + /* target address is above range covered by current node */ + /* NOTE: we might not have a right child */ + mpiPi_msg_debug ("AddrRangeMap::Find: going right\n"); + currNode = currNode->rightChild; + } else - { - /* target address falls within range of current node's statement */ - mpiPi_msg_debug ("AddrRangeMap::Find: found\n"); - ret = currNode->info; - break; - } + { + /* target address falls within range of current node's statement */ + mpiPi_msg_debug ("AddrRangeMap::Find: found\n"); + ret = currNode->info; + break; + } } return ret; @@ -569,27 +569,27 @@ AddrToSourceMap_Destroy (void) static void AddrToSourceMap_Add (Dwarf_Addr addr, - const char *fileName, unsigned int lineNumber) + const char *fileName, unsigned int lineNumber) { /* build a new entry for this mapping */ struct AddrToSourceInfo *newEntry = - (struct AddrToSourceInfo *) malloc (sizeof (struct AddrToSourceInfo)); - if (newEntry == NULL) - { - mpiPi_abort ("malloc failed\n"); - } - newEntry->fileName = UniqueFileName_Get (fileName); - assert (newEntry->fileName != NULL); - newEntry->lineNumber = lineNumber; + (struct AddrToSourceInfo *) malloc (sizeof (struct AddrToSourceInfo)); + if (newEntry == NULL) + { + mpiPi_abort ("malloc failed\n"); + } + newEntry->fileName = UniqueFileName_Get (fileName); + assert (newEntry->fileName != NULL); + newEntry->lineNumber = lineNumber; - mpiPi_msg_debug ("AddrToSourceMap::Add: 0x%016llx => %s: %d\n", - addr, newEntry->fileName, newEntry->lineNumber); + mpiPi_msg_debug ("AddrToSourceMap::Add: 0x%016llx => %s: %d\n", + addr, newEntry->fileName, newEntry->lineNumber); - assert (addrToSourceMap != NULL); - AddrRangeMap_Add (addrToSourceMap, addr, addr, /* we will patch range ends later */ - newEntry); + assert (addrToSourceMap != NULL); + AddrRangeMap_Add (addrToSourceMap, addr, addr, /* we will patch range ends later */ + newEntry); } @@ -598,7 +598,7 @@ AddrToSourceMap_Add (Dwarf_Addr addr, static Dwarf_Addr AddrToSourceMap_PatchRangesAux (struct AddrRangeMapNode *node, - Dwarf_Addr maxAddress) + Dwarf_Addr maxAddress) { Dwarf_Addr ret; @@ -630,7 +630,7 @@ AddrToSourceMap_PatchRangesAux (struct AddrRangeMapNode *node, * so there are ranges that are larger than ours */ maxAddress = AddrToSourceMap_PatchRangesAux (node->rightChild, - maxAddress); + maxAddress); } /* @@ -671,11 +671,11 @@ AddrToSourceMap_PatchRanges (void) static const struct AddrToSourceInfo * -AddrToSourceMap_Find (void *addr) + AddrToSourceMap_Find (void *addr) { assert (addrToSourceMap != NULL); return (const struct AddrToSourceInfo *) AddrRangeMap_Find (addrToSourceMap, - addr); + addr); } @@ -728,7 +728,7 @@ FunctionMap_Destroy (void) void FunctionMap_Add (const char *funcName, - Dwarf_Addr lowAddress, Dwarf_Addr highAddress) + Dwarf_Addr lowAddress, Dwarf_Addr highAddress) { /* build a new entry for this function */ struct FunctionInfo *newEntry = @@ -739,7 +739,7 @@ FunctionMap_Add (const char *funcName, } mpiPi_msg_debug ("FunctionMap::Add: %s [0x%016llx,0x%016llx]\n", - funcName, lowAddress, highAddress); + funcName, lowAddress, highAddress); newEntry->name = strdup (funcName); if (newEntry->name == NULL) @@ -784,20 +784,20 @@ HandleFunctionDIE (Dwarf_Debug dwHandle, Dwarf_Die currChildDIE) int dwDieNameRet, dwDieLowAddrRet, dwDieHighAddrRet; dwDieNameRet = dwarf_diename (currChildDIE, - &funcName, - &dw_err); + &funcName, + &dw_err); if (dwDieNameRet != DW_DLV_OK) mpiPi_msg_debug("Failed to get DIE name : %s\n", dwarf_errmsg(dw_err)); dwDieLowAddrRet = dwarf_lowpc (currChildDIE, - &lowAddress, - &dw_err); + &lowAddress, + &dw_err); if (dwDieLowAddrRet != DW_DLV_OK) mpiPi_msg_debug("Failed to get low PC : %s\n", dwarf_errmsg(dw_err)); dwDieHighAddrRet = dwarf_highpc (currChildDIE, - &highAddress, - &dw_err); + &highAddress, + &dw_err); if (dwDieHighAddrRet != DW_DLV_OK) mpiPi_msg_debug("Failed to get high PC : %s\n", dwarf_errmsg(dw_err)); @@ -827,7 +827,7 @@ open_dwarf_executable (char *fileName) { mpiPi_msg_warn ("Executable file name is NULL!\n"); mpiPi_msg_warn - ("If this is a Fortran application, you may be using the incorrect mpiP library.\n"); + ("If this is a Fortran application, you may be using the incorrect mpiP library.\n"); } /* open the executable */ @@ -843,11 +843,11 @@ open_dwarf_executable (char *fileName) /* initialize the DWARF library */ assert (dwHandle == NULL); dwStatus = dwarf_init (dwFd, /* exe file descriptor */ - DW_DLC_READ, /* desired access */ - NULL, /* error handler */ - NULL, /* error argument */ - &dwHandle, /* session handle */ - &dw_err); /* error object */ + DW_DLC_READ, /* desired access */ + NULL, /* error handler */ + NULL, /* error argument */ + &dwHandle, /* session handle */ + &dw_err); /* error object */ if (dwStatus == DW_DLV_ERROR) { close (dwFd); @@ -880,142 +880,142 @@ open_dwarf_executable (char *fileName) /* access next compilation unit header */ dwStatus = dwarf_next_cu_header (dwHandle, NULL, /* cu_header_length */ - NULL, /* version_stamp */ - NULL, /* abbrev_offset */ - NULL, /* address_size */ - &nextCompilationUnitHeaderOffset, &dw_err); /* error object */ + NULL, /* version_stamp */ + NULL, /* abbrev_offset */ + NULL, /* address_size */ + &nextCompilationUnitHeaderOffset, &dw_err); /* error object */ if (dwStatus != DW_DLV_OK) - { - if (dwStatus != DW_DLV_NO_ENTRY) - { - mpiPi_abort ("failed to access next DWARF cu header : %s\n", dwarf_errmsg(dw_err)); - } - break; - } + { + if (dwStatus != DW_DLV_NO_ENTRY) + { + mpiPi_abort ("failed to access next DWARF cu header : %s\n", dwarf_errmsg(dw_err)); + } + break; + } /* access the first debug info entry (DIE) for this computation unit */ dwStatus = dwarf_siblingof (dwHandle, NULL, /* current DIE */ - &currCompileUnitDIE, /* sibling DIE */ - &dw_err); /* error object */ + &currCompileUnitDIE, /* sibling DIE */ + &dw_err); /* error object */ if (dwStatus != DW_DLV_OK) - { - mpiPi_abort ("failed to access first DWARF DIE : %s\n", dwarf_errmsg(dw_err)); - } + { + mpiPi_abort ("failed to access first DWARF DIE : %s\n", dwarf_errmsg(dw_err)); + } /* get line number information for this compilation * unit, if available */ dwStatus = dwarf_srclines (currCompileUnitDIE, - &lineEntries, &nLineEntries, &dw_err); + &lineEntries, &nLineEntries, &dw_err); if (dwStatus == DW_DLV_OK) - { - unsigned int i; + { + unsigned int i; - /* - * Extract and save address-to-source line mapping. - * - * NOTE: At least on the Cray X1, we see line number - * information with the same address mapping to different lines. - * It seems like when there are multiple entries for a given - * address, the last one is the correct one. (Needs verification.) - * If we see multiple entries for a given address, we only - * save the last one. - */ - for (i = 0; i < nLineEntries; i++) - { - Dwarf_Unsigned lineNumber = 0; - Dwarf_Addr lineAddress = 0; - char *lineSourceFile = NULL; + /* + * Extract and save address-to-source line mapping. + * + * NOTE: At least on the Cray X1, we see line number + * information with the same address mapping to different lines. + * It seems like when there are multiple entries for a given + * address, the last one is the correct one. (Needs verification.) + * If we see multiple entries for a given address, we only + * save the last one. + */ + for (i = 0; i < nLineEntries; i++) + { + Dwarf_Unsigned lineNumber = 0; + Dwarf_Addr lineAddress = 0; + char *lineSourceFile = NULL; - int lineNoStatus, lineAddrStatus, lineSrcFileStatus; + int lineNoStatus, lineAddrStatus, lineSrcFileStatus; - lineNoStatus = dwarf_lineno (lineEntries[i], - &lineNumber, - &dw_err); + lineNoStatus = dwarf_lineno (lineEntries[i], + &lineNumber, + &dw_err); if (lineNoStatus != DW_DLV_OK) - mpiPi_msg_debug("Failed to get line number : %s\n", dwarf_errmsg(dw_err)); + mpiPi_msg_debug("Failed to get line number : %s\n", dwarf_errmsg(dw_err)); - lineAddrStatus = dwarf_lineaddr (lineEntries[i], - &lineAddress, - &dw_err); + lineAddrStatus = dwarf_lineaddr (lineEntries[i], + &lineAddress, + &dw_err); if (lineAddrStatus != DW_DLV_OK) - mpiPi_msg_debug("Failed to get line address : %s\n", dwarf_errmsg(dw_err)); + mpiPi_msg_debug("Failed to get line address : %s\n", dwarf_errmsg(dw_err)); - lineSrcFileStatus = dwarf_linesrc (lineEntries[i], - &lineSourceFile, - &dw_err); + lineSrcFileStatus = dwarf_linesrc (lineEntries[i], + &lineSourceFile, + &dw_err); if (lineSrcFileStatus != DW_DLV_OK) - mpiPi_msg_debug("Failed to get source file status : %s\n", dwarf_errmsg(dw_err)); - - if ((lineNoStatus == DW_DLV_OK) && - (lineAddrStatus == DW_DLV_OK) - && (lineSrcFileStatus == DW_DLV_OK)) - { - int saveCurrentEntry = 0; /* bool */ - - if (i < (nLineEntries - 1)) - { - /* - * We're not on the last line number entry - - * check the address associated with the next - * entry to see if it differs from this one. - * Only save the entry if it the next address - * differs. - */ - Dwarf_Addr nextLineAddress = 0; - int nextLineAddrStatus = - dwarf_lineaddr (lineEntries[i + 1], - &nextLineAddress, - &dw_err); - assert (nextLineAddrStatus == DW_DLV_OK); - if (nextLineAddress != lineAddress) - { - saveCurrentEntry = 1; - } - } - else - { - /* we're on the last line number entry */ - saveCurrentEntry = 1; - } - - if (saveCurrentEntry) - { - /* save the mapping entry */ - AddrToSourceMap_Add (lineAddress, lineSourceFile, - lineNumber); - } - } - - if (lineSourceFile != NULL) - { - dwarf_dealloc (dwHandle, lineSourceFile, DW_DLA_STRING); - } - } - - /* release the line number info */ - for (i = 0; i < nLineEntries; i++) - { - dwarf_dealloc (dwHandle, lineEntries[i], DW_DLA_LINE); - } - dwarf_dealloc (dwHandle, lineEntries, DW_DLA_LIST); - } + mpiPi_msg_debug("Failed to get source file status : %s\n", dwarf_errmsg(dw_err)); + + if ((lineNoStatus == DW_DLV_OK) && + (lineAddrStatus == DW_DLV_OK) + && (lineSrcFileStatus == DW_DLV_OK)) + { + int saveCurrentEntry = 0; /* bool */ + + if (i < (nLineEntries - 1)) + { + /* + * We're not on the last line number entry - + * check the address associated with the next + * entry to see if it differs from this one. + * Only save the entry if it the next address + * differs. + */ + Dwarf_Addr nextLineAddress = 0; + int nextLineAddrStatus = + dwarf_lineaddr (lineEntries[i + 1], + &nextLineAddress, + &dw_err); + assert (nextLineAddrStatus == DW_DLV_OK); + if (nextLineAddress != lineAddress) + { + saveCurrentEntry = 1; + } + } + else + { + /* we're on the last line number entry */ + saveCurrentEntry = 1; + } + + if (saveCurrentEntry) + { + /* save the mapping entry */ + AddrToSourceMap_Add (lineAddress, lineSourceFile, + lineNumber); + } + } + + if (lineSourceFile != NULL) + { + dwarf_dealloc (dwHandle, lineSourceFile, DW_DLA_STRING); + } + } + + /* release the line number info */ + for (i = 0; i < nLineEntries; i++) + { + dwarf_dealloc (dwHandle, lineEntries[i], DW_DLA_LINE); + } + dwarf_dealloc (dwHandle, lineEntries, DW_DLA_LIST); + } else if (dwStatus != DW_DLV_ERROR) - { - /* - * no line information for the current DIE - - * not an error, just unfortunate - */ - } + { + /* + * no line information for the current DIE - + * not an error, just unfortunate + */ + } else - { - mpiPi_abort ("failed to obtain line info for the current DIE : %s\n", dwarf_errmsg(dw_err)); - } + { + mpiPi_abort ("failed to obtain line info for the current DIE : %s\n", dwarf_errmsg(dw_err)); + } /* discover function information for the current compilation unit */ /* @@ -1029,54 +1029,54 @@ open_dwarf_executable (char *fileName) /* access the first child DIE of the compile unit DIE */ dwStatus = dwarf_child (currCompileUnitDIE, &currChildDIE, &dw_err); if (dwStatus == DW_DLV_NO_ENTRY) - { + { // On some Cray systems, executables are linked with assembly compile units // with no functions. // mpiPi_abort ("no child DIEs of compile unit DIE\n"); - } + } else if (dwStatus != DW_DLV_OK) - { - mpiPi_abort - ("failed to access first child DIE of compile unit DIE\n"); - } + { + mpiPi_abort + ("failed to access first child DIE of compile unit DIE\n"); + } while (dwStatus == DW_DLV_OK) - { - /* determine the type of the child DIE */ - dwStatus = dwarf_tag (currChildDIE, &currDIETag, &dw_err); - if (dwStatus == DW_DLV_OK) - { - if ((currDIETag == DW_TAG_subprogram) || - (currDIETag == DW_TAG_entry_point)) - { - HandleFunctionDIE (dwHandle, currChildDIE); - } - } - else - { - mpiPi_abort ("unable to determine tag of current child DIE : %s \n", dwarf_errmsg(dw_err)); - } - - /* advance to the next child DIE */ - oldChildDIE = currChildDIE; - dwStatus = dwarf_siblingof (dwHandle, - currChildDIE, &nextChildDIE, &dw_err); - if (dwStatus == DW_DLV_OK) - { - currChildDIE = nextChildDIE; - nextChildDIE = NULL; - } - else if (dwStatus != DW_DLV_NO_ENTRY) - { - mpiPi_abort - ("unable to access next child DIE of current compilation unit : %s\n", dwarf_errmsg(dw_err)); - } - - if (oldChildDIE != NULL) - { - dwarf_dealloc (dwHandle, oldChildDIE, DW_DLA_DIE); - } - } + { + /* determine the type of the child DIE */ + dwStatus = dwarf_tag (currChildDIE, &currDIETag, &dw_err); + if (dwStatus == DW_DLV_OK) + { + if ((currDIETag == DW_TAG_subprogram) || + (currDIETag == DW_TAG_entry_point)) + { + HandleFunctionDIE (dwHandle, currChildDIE); + } + } + else + { + mpiPi_abort ("unable to determine tag of current child DIE : %s \n", dwarf_errmsg(dw_err)); + } + + /* advance to the next child DIE */ + oldChildDIE = currChildDIE; + dwStatus = dwarf_siblingof (dwHandle, + currChildDIE, &nextChildDIE, &dw_err); + if (dwStatus == DW_DLV_OK) + { + currChildDIE = nextChildDIE; + nextChildDIE = NULL; + } + else if (dwStatus != DW_DLV_NO_ENTRY) + { + mpiPi_abort + ("unable to access next child DIE of current compilation unit : %s\n", dwarf_errmsg(dw_err)); + } + + if (oldChildDIE != NULL) + { + dwarf_dealloc (dwHandle, oldChildDIE, DW_DLA_DIE); + } + } /* release the current compilation unit DIE */ dwarf_dealloc (dwHandle, currCompileUnitDIE, DW_DLA_DIE); @@ -1151,17 +1151,17 @@ mpiP_find_src_loc (void *i_addr_hex, *o_lineno = addrToSrcMapping->lineNumber; if (mpiPi.baseNames == 0 && *o_file_str != NULL) - { - char *h; - h = strrchr (*o_file_str, '/'); - if (h != NULL) - *o_file_str = h + 1; - } + { + char *h; + h = strrchr (*o_file_str, '/'); + if (h != NULL) + *o_file_str = h + 1; + } } else { mpiPi_msg_warn ("unable to find source line info for address 0x%p\n", - i_addr_hex); + i_addr_hex); /* * the rest of the mpiP code seems to expect that the filename * will be set to "??" if we are unable to associate it with a file @@ -1178,7 +1178,7 @@ mpiP_find_src_loc (void *i_addr_hex, else { mpiPi_msg_warn ("unable to find function info for address %s\n", - mpiP_format_address (i_addr_hex, addr_buf)); + mpiP_format_address (i_addr_hex, addr_buf)); } return (((addrToSrcMapping != NULL) || (functionInfo != NULL)) ? 0 : 1); diff --git a/pcontrol.c b/pcontrol.c index 95e4bc6..17c41e9 100644 --- a/pcontrol.c +++ b/pcontrol.c @@ -81,12 +81,12 @@ mpiPi_MPI_Pcontrol (const int flag) if (flag == 0) { if (!mpiPi.enabled) - mpiPi_msg_warn - ("MPI_Pcontrol trying to disable MPIP while it is already disabled.\n"); + mpiPi_msg_warn + ("MPI_Pcontrol trying to disable MPIP while it is already disabled.\n"); mpiPi_GETTIME (&mpiPi.endTime); dur = - (mpiPi_GETTIMEDIFF (&mpiPi.endTime, &mpiPi.startTime) / 1000000.0); + (mpiPi_GETTIMEDIFF (&mpiPi.endTime, &mpiPi.startTime) / 1000000.0); mpiPi.cumulativeTime += dur; assert (mpiPi.cumulativeTime >= 0); mpiPi.enabled = 0; @@ -108,8 +108,8 @@ mpiPi_MPI_Pcontrol (const int flag) else { if (mpiPi.enabled) - mpiPi_msg_warn - ("MPI_Pcontrol trying to enable MPIP while it is already enabled.\n"); + mpiPi_msg_warn + ("MPI_Pcontrol trying to enable MPIP while it is already enabled.\n"); mpiPi.enabled = 1; mpiPi.enabledCount++; diff --git a/record_stack.c b/record_stack.c index d16a32a..070e90b 100644 --- a/record_stack.c +++ b/record_stack.c @@ -61,39 +61,39 @@ mpiPi_RecordTraceBack (jmp_buf jb, void *pc_array[], int max_back) if (unw_init_local (&cursor, &uc) != UNW_ESUCCESS) { mpiPi_msg_debug - ("Failed to initialize libunwind cursor with unw_init_local\n"); + ("Failed to initialize libunwind cursor with unw_init_local\n"); } else { for (i = 0; i < parent_frame_start; i++) - { - if (unw_step (&cursor) < 1) - mpiPi_msg_debug - ("unw_step failed to step into mpiPi caller frame.\n"); - } + { + if (unw_step (&cursor) < 1) + mpiPi_msg_debug + ("unw_step failed to step into mpiPi caller frame.\n"); + } for (i = 0, valid_cursor = 1; i < max_back; i++) - { - if (valid_cursor && unw_step (&cursor) >= 0) - { - frame_count++; - if (unw_get_reg (&cursor, UNW_REG_IP, &pc) != UNW_ESUCCESS) - { - pc_array[i] = NULL; - mpiPi_msg_debug ("unw_get_reg failed.\n"); - } - else - { - pc_array[i] = (void *) ((char *) pc - 1); - } - } - else - { - pc_array[i] = NULL; - mpiPi_msg_debug ("unw_step failed.\n"); - valid_cursor = 0; - } - } + { + if (valid_cursor && unw_step (&cursor) >= 0) + { + frame_count++; + if (unw_get_reg (&cursor, UNW_REG_IP, &pc) != UNW_ESUCCESS) + { + pc_array[i] = NULL; + mpiPi_msg_debug ("unw_get_reg failed.\n"); + } + else + { + pc_array[i] = (void *) ((char *) pc - 1); + } + } + else + { + pc_array[i] = NULL; + mpiPi_msg_debug ("unw_step failed.\n"); + valid_cursor = 0; + } + } } return frame_count; @@ -119,24 +119,24 @@ mpiPi_RecordTraceBack (jmp_buf jb, void *pc_array[], int max_back) { pc = (void *) context->sc_pc; if (pc != NULL) - unwind (context, 0); + unwind (context, 0); } for (i = 0; i < max_back; i++) { if (pc != NULL) - { - unwind (context, 0); - - /* record this frame's pc and calculate the previous instruction */ - pc_array[i] = (void *) context->sc_pc - (void *) 0x4; - pc = (void *) context->sc_pc; - frame_count++; - } + { + unwind (context, 0); + + /* record this frame's pc and calculate the previous instruction */ + pc_array[i] = (void *) context->sc_pc - (void *) 0x4; + pc = (void *) context->sc_pc; + frame_count++; + } else - { - pc_array[i] = NULL; - } + { + pc_array[i] = NULL; + } } return frame_count; @@ -193,7 +193,7 @@ mpiPi_RecordTraceBack (jmp_buf jb, void *pc_array[], int report_back) user_frame_count = report_back; memmove (pc_array, &(temp_stack_trace[MPIP_INTERNAL_FRAMES]), - (user_frame_count * sizeof (void *))); + (user_frame_count * sizeof (void *))); pc_array[user_frame_count] = NULL; #if defined(DO_PC_SUBTRACTION) @@ -256,27 +256,27 @@ mpiPi_RecordTraceBack (jmp_buf jb, void *pc_array[], int max_back) for (i = 0; i < max_back; i++) { if (fp != NULL && pc != NULL) - { - /* record this frame's pc */ - pc = FramePC (fp); - if (pc != NULL) - { - frame_count++; - /* Get previous instruction */ - pc_array[i] = (void *) ((char *) pc - 1); - } - else - pc_array[i] = NULL; - - /* update frame ptr */ - lastfp = fp; - fp = NextFP (fp); - } + { + /* record this frame's pc */ + pc = FramePC (fp); + if (pc != NULL) + { + frame_count++; + /* Get previous instruction */ + pc_array[i] = (void *) ((char *) pc - 1); + } + else + pc_array[i] = NULL; + + /* update frame ptr */ + lastfp = fp; + fp = NextFP (fp); + } else - { - /* pad the array w/ nulls, if necessary */ - pc_array[i] = NULL; - } + { + /* pad the array w/ nulls, if necessary */ + pc_array[i] = NULL; + } } return frame_count; diff --git a/report.c b/report.c index 41695cf..045f100 100644 --- a/report.c +++ b/report.c @@ -64,7 +64,7 @@ static void mpiPi_print_top_io_sites (FILE * fp); static void mpiPi_print_top_rma_sites (FILE * fp); static void mpiPi_print_all_callsite_time_info (FILE * fp); static int callsite_stats_sort_by_cumulative (mpiPi_callsite_summary_t * cs1, - mpiPi_callsite_summary_t * cs2); + mpiPi_callsite_summary_t * cs2); static void mpiPi_print_concise_callsite_time_info (FILE * fp); static void mpiPi_print_callsite_sent_info (FILE * fp); static void mpiPi_print_all_callsite_sent_info (FILE * fp); @@ -375,9 +375,9 @@ mpiPi_print_report_header (FILE * fp) } fprintf (fp, "\n"); print_intro_line (fp, "Version", "%d.%d.%d", mpiPi_vmajor, mpiPi_vminor, - mpiPi_vpatch); + mpiPi_vpatch); print_intro_line (fp, "MPIP Build date", "%s, %s", mpiPi_vdate, - mpiPi_vtime); + mpiPi_vtime); { char nowstr[128]; const struct tm *nowstruct; @@ -396,14 +396,14 @@ mpiPi_print_report_header (FILE * fp) print_intro_line (fp, "Timer Used", "%s", mpiPi_TIMER_NAME); print_intro_line (fp, "MPIP env var", "%s", - mpiPi.envStr == NULL ? "[null]" : mpiPi.envStr); + mpiPi.envStr == NULL ? "[null]" : mpiPi.envStr); print_intro_line (fp, "Collector Rank", "%d", mpiPi.collectorRank); print_intro_line (fp, "Collector PID", "%d", mpiPi.procID); print_intro_line (fp, "Final Output Dir", "%s", mpiPi.outputDir); print_intro_line (fp, "Report generation", "%s", - mpiPi.collective_report == - 0 ? "Single collector task" : "Collective"); + mpiPi.collective_report == + 0 ? "Single collector task" : "Collective"); } static void @@ -413,7 +413,7 @@ mpiPi_print_task_assignment (FILE * fp) for (i = 0; i < mpiPi.size; i++) { print_intro_line (fp, "MPI Task Assignment", "%d %s", - i, mpiPi.global_task_hostnames[i]); + i, mpiPi.global_task_hostnames[i]); } } @@ -427,7 +427,7 @@ mpiPi_print_verbose_task_info (FILE * fp) for (i = 0; i < mpiPi.size; i++) { mpiPi_msg_debug ("app runtime for task %d is %g\n", i, - mpiPi.global_task_app_time[i]); + mpiPi.global_task_app_time[i]); mpiPi.global_app_time += mpiPi.global_task_app_time[i]; /*mpiPi.global_task_mpi_time[i] = 0; */ } @@ -436,30 +436,30 @@ mpiPi_print_verbose_task_info (FILE * fp) /* -- print the mpi/app times */ print_section_heading (fp, "MPI Time (seconds)"); fprintf (fp, "%-4s %10s %10s %5s\n", "Task", "AppTime", "MPITime", - "MPI%"); + "MPI%"); for (i = 0; i < mpiPi.size; i++) { double ratio; if (mpiPi.global_task_app_time[i] > 0) - { - ratio = (100.0 * mpiPi.global_task_mpi_time[i] / 1e6) / - mpiPi.global_task_app_time[i]; - } + { + ratio = (100.0 * mpiPi.global_task_mpi_time[i] / 1e6) / + mpiPi.global_task_app_time[i]; + } else - ratio = 0; + ratio = 0; fprintf (fp, - mpiP_Report_Formats[MPIP_MPI_TIME_FMT][mpiPi.reportFormat], - i, mpiPi.global_task_app_time[i], - mpiPi.global_task_mpi_time[i] / 1e6, ratio); + mpiP_Report_Formats[MPIP_MPI_TIME_FMT][mpiPi.reportFormat], + i, mpiPi.global_task_app_time[i], + mpiPi.global_task_mpi_time[i] / 1e6, ratio); } fprintf (fp, - mpiP_Report_Formats[MPIP_MPI_TIME_SUMMARY_FMT][mpiPi.reportFormat], - mpiPi.global_app_time, mpiPi.global_mpi_time / 1e6, - mpiPi.global_app_time > - 0 ? (100.0 * mpiPi.global_mpi_time / 1e6) / - mpiPi.global_app_time : 0); + mpiP_Report_Formats[MPIP_MPI_TIME_SUMMARY_FMT][mpiPi.reportFormat], + mpiPi.global_app_time, mpiPi.global_mpi_time / 1e6, + mpiPi.global_app_time > + 0 ? (100.0 * mpiPi.global_mpi_time / 1e6) / + mpiPi.global_app_time : 0); } static void @@ -480,30 +480,30 @@ mpiPi_print_concise_task_info (FILE * fp) for (i = 0; i < mpiPi.size; i++) { if (mpiPi.global_task_app_time[i] < min_app_time) - { - min_app_time = mpiPi.global_task_app_time[i]; - min_app_rank = i; - } + { + min_app_time = mpiPi.global_task_app_time[i]; + min_app_rank = i; + } if (mpiPi.global_task_app_time[i] > max_app_time) - { - max_app_time = mpiPi.global_task_app_time[i]; - max_app_rank = i; - } + { + max_app_time = mpiPi.global_task_app_time[i]; + max_app_rank = i; + } tot_app_time += mpiPi.global_task_app_time[i]; if (mpiPi.global_task_mpi_time[i] < min_mpi_time) - { - min_mpi_time = mpiPi.global_task_mpi_time[i]; - min_mpi_rank = i; - } + { + min_mpi_time = mpiPi.global_task_mpi_time[i]; + min_mpi_rank = i; + } if (mpiPi.global_task_mpi_time[i] > max_mpi_time) - { - max_mpi_time = mpiPi.global_task_mpi_time[i]; - max_mpi_rank = i; - } + { + max_mpi_time = mpiPi.global_task_mpi_time[i]; + max_mpi_rank = i; + } tot_mpi_time += mpiPi.global_task_mpi_time[i]; mpiPi.global_app_time += mpiPi.global_task_app_time[i]; @@ -522,23 +522,23 @@ mpiPi_print_concise_task_info (FILE * fp) print_section_heading (fp, "Task Time Statistics (seconds)"); fprintf (fp, "%*s %*s %*s %*s %*s %*s\n", - colw, " ", - tcolw, "AppTime", - tcolw, "MPITime", pcolw, "MPI%", colw, "App Task", colw, - "MPI Task"); + colw, " ", + tcolw, "AppTime", + tcolw, "MPITime", pcolw, "MPI%", colw, "App Task", colw, + "MPI Task"); fprintf (fp, "%-*s %*f %*f %*s %*d %*d\n", colw, "Max", tcolw, max_app_time, - tcolw, max_mpi_time / USECS, pcolw, "", colw, max_app_rank, colw, - max_mpi_rank); + tcolw, max_mpi_time / USECS, pcolw, "", colw, max_app_rank, colw, + max_mpi_rank); fprintf (fp, "%-*s %*f %*f\n", colw, "Mean", tcolw, mean_app_time, tcolw, - mean_mpi_time / USECS); + mean_mpi_time / USECS); fprintf (fp, "%-*s %*f %*f %*s %*d %*d\n", colw, "Min", tcolw, min_app_time, - tcolw, min_mpi_time / USECS, pcolw, "", colw, min_app_rank, colw, - min_mpi_rank); + tcolw, min_mpi_time / USECS, pcolw, "", colw, min_app_rank, colw, + min_mpi_rank); fprintf (fp, "%-*s %*f %*f\n", colw, "Stddev", tcolw, sqrt (var_app_time), - tcolw, sqrt (var_mpi_time) / USECS); + tcolw, sqrt (var_mpi_time) / USECS); fprintf (fp, "%-*s %*f %*f %*.2f\n", colw, "Aggregate", tcolw, tot_app_time, - tcolw, tot_mpi_time / USECS, pcolw, - tot_mpi_time / USECS / tot_app_time * 100); + tcolw, tot_mpi_time / USECS, pcolw, + tot_mpi_time / USECS / tot_app_time * 100); } @@ -567,61 +567,61 @@ mpiPi_print_callsites (FILE * fp) { int j, currlen; for (j = 0; - (j < MPIP_CALLSITE_STACK_DEPTH) && (av[i]->filename[j] != NULL); - j++) - { - currlen = strlen (av[i]->filename[j]); - fileLenMax = currlen > fileLenMax ? currlen : fileLenMax; - currlen = strlen (av[i]->functname[j]); - funcLenMax = currlen > funcLenMax ? currlen : funcLenMax; - } + (j < MPIP_CALLSITE_STACK_DEPTH) && (av[i]->filename[j] != NULL); + j++) + { + currlen = strlen (av[i]->filename[j]); + fileLenMax = currlen > fileLenMax ? currlen : fileLenMax; + currlen = strlen (av[i]->functname[j]); + funcLenMax = currlen > funcLenMax ? currlen : funcLenMax; + } } fprintf (fp, "%3s %3s %-*s %5s %-*s %s\n", - "ID", "Lev", fileLenMax, "File/Address", "Line", funcLenMax, - "Parent_Funct", "MPI_Call"); + "ID", "Lev", fileLenMax, "File/Address", "Line", funcLenMax, + "Parent_Funct", "MPI_Call"); for (i = 0; i < ac; i++) { int j; for (j = 0, stack_continue_flag = 1; - (j < MPIP_CALLSITE_STACK_DEPTH) && (av[i]->filename[j] != NULL) && - stack_continue_flag == 1; j++) - { - if (av[i]->line[j] == 0 && - (strcmp (av[i]->filename[j], "[unknown]") == 0 || - strcmp (av[i]->functname[j], "[unknown]") == 0)) - { - fprintf (fp, "%3d %3d %-*s %-*s %s\n", - av[i]->id, - j, - fileLenMax + 6, - mpiP_format_address (av[i]->pc[j], addr_buf), - funcLenMax, - av[i]->functname[j], - (j == - 0) ? &(mpiPi.lookup[av[i]->op - - mpiPi_BASE].name[4]) : ""); - } - else - { - fprintf (fp, "%3d %3d %-*s %5d %-*s %s\n", - av[i]->id, - j, - fileLenMax, - av[i]->filename[j], av[i]->line[j], - funcLenMax, - av[i]->functname[j], - (j == - 0) ? &(mpiPi.lookup[av[i]->op - - mpiPi_BASE].name[4]) : ""); - } - /* Do not bother printing stack frames above main */ - if (strcmp (av[i]->functname[j], "main") == 0 - || strcmp (av[i]->functname[j], ".main") == 0 - || strcmp (av[i]->functname[j], "MAIN__") == 0) - stack_continue_flag = 0; - } + (j < MPIP_CALLSITE_STACK_DEPTH) && (av[i]->filename[j] != NULL) && + stack_continue_flag == 1; j++) + { + if (av[i]->line[j] == 0 && + (strcmp (av[i]->filename[j], "[unknown]") == 0 || + strcmp (av[i]->functname[j], "[unknown]") == 0)) + { + fprintf (fp, "%3d %3d %-*s %-*s %s\n", + av[i]->id, + j, + fileLenMax + 6, + mpiP_format_address (av[i]->pc[j], addr_buf), + funcLenMax, + av[i]->functname[j], + (j == + 0) ? &(mpiPi.lookup[av[i]->op - + mpiPi_BASE].name[4]) : ""); + } + else + { + fprintf (fp, "%3d %3d %-*s %5d %-*s %s\n", + av[i]->id, + j, + fileLenMax, + av[i]->filename[j], av[i]->line[j], + funcLenMax, + av[i]->functname[j], + (j == + 0) ? &(mpiPi.lookup[av[i]->op - + mpiPi_BASE].name[4]) : ""); + } + /* Do not bother printing stack frames above main */ + if (strcmp (av[i]->functname[j], "main") == 0 + || strcmp (av[i]->functname[j], ".main") == 0 + || strcmp (av[i]->functname[j], "MAIN__") == 0) + stack_continue_flag = 0; + } } free (av); } @@ -644,56 +644,56 @@ mpiPi_print_top_time_sites (FILE * fp) qsort (av, ac, sizeof (void *), callsite_sort_by_cumulative_time); print_section_heading (fp, - "Aggregate Time (top twenty, descending, milliseconds)"); + "Aggregate Time (top twenty, descending, milliseconds)"); if (mpiPi.calcCOV) { fprintf (fp, "%-20s %4s %12s%6s %6s %6s %6s\n", "Call", "Site", - "Time ", "App%", "MPI%", "Count", "COV"); + "Time ", "App%", "MPI%", "Count", "COV"); } else { fprintf (fp, "%-20s %4s %12s%6s %6s %6s\n", "Call", "Site", "Time ", - "App%", "MPI%", "Count"); + "App%", "MPI%", "Count"); } for (i = 0; (i < 20) && (i < ac); i++) { if (av[i]->cumulativeTime > 0) - { - if (mpiPi.calcCOV) - { - timeCOV = calc_COV (av[i]->siteData, av[i]->siteDataIdx); - - fprintf (fp, - mpiP_Report_Formats[MPIP_AGGREGATE_COV_TIME_FMT] - [mpiPi.reportFormat], - &(mpiPi.lookup[av[i]->op - mpiPi_BASE].name[4]), - av[i]->csid, av[i]->cumulativeTime / 1000.0, - 100.0 * av[i]->cumulativeTime / - (mpiPi.global_app_time * 1e6), - mpiPi.global_mpi_time > - 0 ? (100.0 * av[i]->cumulativeTime / - mpiPi.global_mpi_time) : 0, - av[i]->count, - timeCOV); - } - else - { - fprintf (fp, - mpiP_Report_Formats[MPIP_AGGREGATE_TIME_FMT] - [mpiPi.reportFormat], - &(mpiPi.lookup[av[i]->op - mpiPi_BASE].name[4]), - av[i]->csid, av[i]->cumulativeTime / 1000.0, - mpiPi.global_app_time > - 0 ? 100.0 * av[i]->cumulativeTime / - (mpiPi.global_app_time * 1e6) : 0, - mpiPi.global_mpi_time > - 0 ? 100.0 * av[i]->cumulativeTime / - mpiPi.global_mpi_time : 0, - av[i]->count); - } - } + { + if (mpiPi.calcCOV) + { + timeCOV = calc_COV (av[i]->siteData, av[i]->siteDataIdx); + + fprintf (fp, + mpiP_Report_Formats[MPIP_AGGREGATE_COV_TIME_FMT] + [mpiPi.reportFormat], + &(mpiPi.lookup[av[i]->op - mpiPi_BASE].name[4]), + av[i]->csid, av[i]->cumulativeTime / 1000.0, + 100.0 * av[i]->cumulativeTime / + (mpiPi.global_app_time * 1e6), + mpiPi.global_mpi_time > + 0 ? (100.0 * av[i]->cumulativeTime / + mpiPi.global_mpi_time) : 0, + av[i]->count, + timeCOV); + } + else + { + fprintf (fp, + mpiP_Report_Formats[MPIP_AGGREGATE_TIME_FMT] + [mpiPi.reportFormat], + &(mpiPi.lookup[av[i]->op - mpiPi_BASE].name[4]), + av[i]->csid, av[i]->cumulativeTime / 1000.0, + mpiPi.global_app_time > + 0 ? 100.0 * av[i]->cumulativeTime / + (mpiPi.global_app_time * 1e6) : 0, + mpiPi.global_mpi_time > + 0 ? 100.0 * av[i]->cumulativeTime / + mpiPi.global_mpi_time : 0, + av[i]->count); + } + } } free (av); @@ -708,9 +708,9 @@ mpiPi_print_top_sent_sites (FILE * fp) if (mpiPi.global_mpi_size > 0) { if (mpiPi.stackDepth > 0) - h_gather_data (mpiPi.global_callsite_stats_agg, &ac, (void ***) &av); + h_gather_data (mpiPi.global_callsite_stats_agg, &ac, (void ***) &av); else - h_gather_data (mpiPi.global_MPI_stats_agg, &ac, (void ***) &av); + h_gather_data (mpiPi.global_MPI_stats_agg, &ac, (void ***) &av); /* -- now that we have all the statistics in a queue, which is * pointers to the data, we can sort it however we need to. @@ -718,32 +718,32 @@ mpiPi_print_top_sent_sites (FILE * fp) qsort (av, ac, sizeof (void *), callsite_sort_by_cumulative_size); print_section_heading (fp, - "Aggregate Sent Message Size (top twenty, descending, bytes)"); + "Aggregate Sent Message Size (top twenty, descending, bytes)"); fprintf (fp, "%-20s %4s %10s %10s %10s %6s\n", "Call", "Site", - "Count", "Total", "Avrg", "Sent%"); + "Count", "Total", "Avrg", "Sent%"); for (i = 0; (i < 20) && (i < ac); i++) - { - if (av[i]->cumulativeDataSent > 0) - { - fprintf (fp, - mpiP_Report_Formats[MPIP_AGGREGATE_MESS_FMT] - [mpiPi.reportFormat], - &(mpiPi.lookup[av[i]->op - mpiPi_BASE].name[4]), - av[i]->csid, av[i]->count, av[i]->cumulativeDataSent, - av[i]->cumulativeDataSent / av[i]->count, - av[i]->cumulativeDataSent * 100 / - mpiPi.global_mpi_size); - } - } + { + if (av[i]->cumulativeDataSent > 0) + { + fprintf (fp, + mpiP_Report_Formats[MPIP_AGGREGATE_MESS_FMT] + [mpiPi.reportFormat], + &(mpiPi.lookup[av[i]->op - mpiPi_BASE].name[4]), + av[i]->csid, av[i]->count, av[i]->cumulativeDataSent, + av[i]->cumulativeDataSent / av[i]->count, + av[i]->cumulativeDataSent * 100 / + mpiPi.global_mpi_size); + } + } if (mpiPi.messageCountThreshold >= 0) - { - fprintf (fp, - "\nTotal send/collective operation calls >= %d bytes : %lld of %lld operations\n", - mpiPi.messageCountThreshold, - mpiPi.global_mpi_msize_threshold_count, - mpiPi.global_mpi_sent_count); - } + { + fprintf (fp, + "\nTotal send/collective operation calls >= %d bytes : %lld of %lld operations\n", + mpiPi.messageCountThreshold, + mpiPi.global_mpi_msize_threshold_count, + mpiPi.global_mpi_sent_count); + } free (av); } @@ -784,8 +784,8 @@ mpiPi_print_top_collective_sent_sites (FILE * fp) all_call_count = mpiPi_DEF_END - mpiPi_BASE; matrix_size = - all_call_count * mpiPi.coll_comm_histogram.hist_size * - mpiPi.coll_size_histogram.hist_size; + all_call_count * mpiPi.coll_comm_histogram.hist_size * + mpiPi.coll_size_histogram.hist_size; result_ptrs = (double **) malloc (sizeof (double *) * matrix_size); @@ -793,63 +793,63 @@ mpiPi_print_top_collective_sent_sites (FILE * fp) for (x = 0; x < all_call_count; x++) for (y = 0; y < mpiPi.coll_comm_histogram.hist_size; y++) for (z = 0; z < mpiPi.coll_size_histogram.hist_size; z++) - { - if (mpiPi.coll_time_stats[x][y][z] > 0) - { - result_ptrs[result_count] = &mpiPi.coll_time_stats[x][y][z]; - result_count++; - } - } + { + if (mpiPi.coll_time_stats[x][y][z] > 0) + { + result_ptrs[result_count] = &mpiPi.coll_time_stats[x][y][z]; + result_count++; + } + } qsort (result_ptrs, result_count, sizeof (double *), - histogram_sort_by_value); + histogram_sort_by_value); if (mpiPi.global_mpi_size > 0) { print_section_heading (fp, - "Aggregate Collective Time (top twenty, descending)"); + "Aggregate Collective Time (top twenty, descending)"); if (result_count == 0) - { - /* there were no collective operations within this phase */ - fprintf (fp, "No collective operations to report\n"); - goto done; - } + { + /* there were no collective operations within this phase */ + fprintf (fp, "No collective operations to report\n"); + goto done; + } fprintf (fp, "%-20s %10s %21s %21s\n", "Call", "MPI Time %", - "Comm Size", "Data Size"); + "Comm Size", "Data Size"); mpiPi_msg_debug ("Found max time of %6.3f at %p\n", *result_ptrs[0], - result_ptrs[0]); + result_ptrs[0]); j = 0; for (i = 0; (i < 20) && (i < result_count); i++) - { - /* Find location in matrix */ - for (x = 0; x < all_call_count; x++) - for (y = 0; y < mpiPi.coll_comm_histogram.hist_size; y++) - for (z = 0; z < mpiPi.coll_size_histogram.hist_size; z++) - { - if (&mpiPi.coll_time_stats[x][y][z] == result_ptrs[j]) - { - j++; - goto print; - } - } - - print: - if (mpiPi.coll_time_stats[x][y][z] == 0) - goto done; - - get_histogram_bin_str (&mpiPi.coll_comm_histogram, y, commbinbuf); - get_histogram_bin_str (&mpiPi.coll_size_histogram, z, databinbuf); - - fprintf (fp, - mpiP_Report_Formats[MPIP_HISTOGRAM_FMT] - [mpiPi.reportFormat], - &(mpiPi.lookup[x].name[4]), - mpiPi.coll_time_stats[x][y][z] / mpiPi.global_mpi_time * - 100, commbinbuf, databinbuf); - } + { + /* Find location in matrix */ + for (x = 0; x < all_call_count; x++) + for (y = 0; y < mpiPi.coll_comm_histogram.hist_size; y++) + for (z = 0; z < mpiPi.coll_size_histogram.hist_size; z++) + { + if (&mpiPi.coll_time_stats[x][y][z] == result_ptrs[j]) + { + j++; + goto print; + } + } + +print: + if (mpiPi.coll_time_stats[x][y][z] == 0) + goto done; + + get_histogram_bin_str (&mpiPi.coll_comm_histogram, y, commbinbuf); + get_histogram_bin_str (&mpiPi.coll_size_histogram, z, databinbuf); + + fprintf (fp, + mpiP_Report_Formats[MPIP_HISTOGRAM_FMT] + [mpiPi.reportFormat], + &(mpiPi.lookup[x].name[4]), + mpiPi.coll_time_stats[x][y][z] / mpiPi.global_mpi_time * + 100, commbinbuf, databinbuf); + } } @@ -872,8 +872,8 @@ mpiPi_print_top_pt2pt_sent_sites (FILE * fp) all_call_count = mpiPi_DEF_END - mpiPi_BASE; matrix_size = - all_call_count * mpiPi.pt2pt_comm_histogram.hist_size * - mpiPi.pt2pt_size_histogram.hist_size; + all_call_count * mpiPi.pt2pt_comm_histogram.hist_size * + mpiPi.pt2pt_size_histogram.hist_size; result_ptrs = (double **) malloc (sizeof (double *) * matrix_size); @@ -881,63 +881,63 @@ mpiPi_print_top_pt2pt_sent_sites (FILE * fp) for (x = 0; x < all_call_count; x++) for (y = 0; y < mpiPi.pt2pt_comm_histogram.hist_size; y++) for (z = 0; z < mpiPi.pt2pt_size_histogram.hist_size; z++) - { - if (mpiPi.pt2pt_send_stats[x][y][z] > 0) - { - result_ptrs[result_count] = &mpiPi.pt2pt_send_stats[x][y][z]; - result_count++; - } - } + { + if (mpiPi.pt2pt_send_stats[x][y][z] > 0) + { + result_ptrs[result_count] = &mpiPi.pt2pt_send_stats[x][y][z]; + result_count++; + } + } qsort (result_ptrs, result_count, sizeof (double *), - histogram_sort_by_value); + histogram_sort_by_value); if (mpiPi.global_mpi_size > 0) { print_section_heading (fp, - "Aggregate Point-To-Point Sent (top twenty, descending)"); + "Aggregate Point-To-Point Sent (top twenty, descending)"); if (result_count == 0) - { - /* there were no point to point messages send in the current phase */ - fprintf (fp, "No point to point operations to report\n"); - goto done; - } + { + /* there were no point to point messages send in the current phase */ + fprintf (fp, "No point to point operations to report\n"); + goto done; + } fprintf (fp, "%-20s %10s %21s %21s\n", "Call", "MPI Sent %", - "Comm Size", "Data Size"); + "Comm Size", "Data Size"); mpiPi_msg_debug ("Found max sent of %6.3f at %p\n", *result_ptrs[0], - result_ptrs[0]); + result_ptrs[0]); j = 0; for (i = 0; (i < 20) && (i < result_count); i++) - { - /* Find location in matrix */ - for (x = 0; x < all_call_count; x++) - for (y = 0; y < mpiPi.pt2pt_comm_histogram.hist_size; y++) - for (z = 0; z < mpiPi.pt2pt_size_histogram.hist_size; z++) - { - if (&mpiPi.pt2pt_send_stats[x][y][z] == result_ptrs[j]) - { - j++; - goto print; - } - } - - print: - if (mpiPi.pt2pt_send_stats[x][y][z] == 0) - goto done; - - get_histogram_bin_str (&mpiPi.pt2pt_comm_histogram, y, commbinbuf); - get_histogram_bin_str (&mpiPi.pt2pt_size_histogram, z, databinbuf); - - fprintf (fp, - mpiP_Report_Formats[MPIP_HISTOGRAM_FMT] - [mpiPi.reportFormat], - &(mpiPi.lookup[x].name[4]), - (mpiPi.pt2pt_send_stats[x][y][z] * 100) / - mpiPi.global_mpi_size, commbinbuf, databinbuf); - } + { + /* Find location in matrix */ + for (x = 0; x < all_call_count; x++) + for (y = 0; y < mpiPi.pt2pt_comm_histogram.hist_size; y++) + for (z = 0; z < mpiPi.pt2pt_size_histogram.hist_size; z++) + { + if (&mpiPi.pt2pt_send_stats[x][y][z] == result_ptrs[j]) + { + j++; + goto print; + } + } + +print: + if (mpiPi.pt2pt_send_stats[x][y][z] == 0) + goto done; + + get_histogram_bin_str (&mpiPi.pt2pt_comm_histogram, y, commbinbuf); + get_histogram_bin_str (&mpiPi.pt2pt_size_histogram, z, databinbuf); + + fprintf (fp, + mpiP_Report_Formats[MPIP_HISTOGRAM_FMT] + [mpiPi.reportFormat], + &(mpiPi.lookup[x].name[4]), + (mpiPi.pt2pt_send_stats[x][y][z] * 100) / + mpiPi.global_mpi_size, commbinbuf, databinbuf); + } } @@ -957,9 +957,9 @@ mpiPi_print_top_io_sites (FILE * fp) if (mpiPi.global_mpi_io > 0) { if (mpiPi.stackDepth > 0) - h_gather_data (mpiPi.global_callsite_stats_agg, &ac, (void ***) &av); + h_gather_data (mpiPi.global_callsite_stats_agg, &ac, (void ***) &av); else - h_gather_data (mpiPi.global_MPI_stats_agg, &ac, (void ***) &av); + h_gather_data (mpiPi.global_MPI_stats_agg, &ac, (void ***) &av); /* -- now that we have all the statistics in a queue, which is * pointers to the data, we can sort it however we need to. @@ -967,23 +967,23 @@ mpiPi_print_top_io_sites (FILE * fp) qsort (av, ac, sizeof (void *), callsite_sort_by_cumulative_io); print_section_heading (fp, - "Aggregate I/O Size (top twenty, descending, bytes)"); + "Aggregate I/O Size (top twenty, descending, bytes)"); fprintf (fp, "%-20s %4s %10s %10s %10s %6s\n", "Call", "Site", - "Count", "Total", "Avrg", "I/O%"); + "Count", "Total", "Avrg", "I/O%"); for (i = 0; (i < 20) && (i < ac); i++) - { - if (av[i]->cumulativeIO > 0) - { - fprintf (fp, - mpiP_Report_Formats[MPIP_AGGREGATE_IO_FMT] - [mpiPi.reportFormat], - &(mpiPi.lookup[av[i]->op - mpiPi_BASE].name[4]), - av[i]->csid, av[i]->count, av[i]->cumulativeIO, - av[i]->cumulativeIO / av[i]->count, - av[i]->cumulativeIO * 100 / mpiPi.global_mpi_io); - } - } + { + if (av[i]->cumulativeIO > 0) + { + fprintf (fp, + mpiP_Report_Formats[MPIP_AGGREGATE_IO_FMT] + [mpiPi.reportFormat], + &(mpiPi.lookup[av[i]->op - mpiPi_BASE].name[4]), + av[i]->csid, av[i]->count, av[i]->cumulativeIO, + av[i]->cumulativeIO / av[i]->count, + av[i]->cumulativeIO * 100 / mpiPi.global_mpi_io); + } + } free (av); } @@ -1001,9 +1001,9 @@ mpiPi_print_top_rma_sites (FILE * fp) if (mpiPi.global_mpi_rma > 0) { if (mpiPi.stackDepth > 0) - h_gather_data (mpiPi.global_callsite_stats_agg, &ac, (void ***) &av); + h_gather_data (mpiPi.global_callsite_stats_agg, &ac, (void ***) &av); else - h_gather_data (mpiPi.global_MPI_stats_agg, &ac, (void ***) &av); + h_gather_data (mpiPi.global_MPI_stats_agg, &ac, (void ***) &av); /* -- now that we have all the statistics in a queue, which is @@ -1012,23 +1012,23 @@ mpiPi_print_top_rma_sites (FILE * fp) qsort (av, ac, sizeof (void *), callsite_sort_by_cumulative_rma); print_section_heading (fp, - "Aggregate RMA Origin Size (top twenty, descending, bytes)"); + "Aggregate RMA Origin Size (top twenty, descending, bytes)"); fprintf (fp, "%-20s %4s %10s %10s %10s %6s\n", "Call", "Site", - "Count", "Total", "Avrg", "I/O%"); + "Count", "Total", "Avrg", "I/O%"); for (i = 0; (i < 20) && (i < ac); i++) - { - if (av[i]->cumulativeRMA > 0) - { - fprintf (fp, - mpiP_Report_Formats[MPIP_AGGREGATE_IO_FMT] - [mpiPi.reportFormat], - &(mpiPi.lookup[av[i]->op - mpiPi_BASE].name[4]), - av[i]->csid, av[i]->count, av[i]->cumulativeRMA, - av[i]->cumulativeRMA / av[i]->count, - av[i]->cumulativeRMA * 100 / mpiPi.global_mpi_rma); - } - } + { + if (av[i]->cumulativeRMA > 0) + { + fprintf (fp, + mpiP_Report_Formats[MPIP_AGGREGATE_IO_FMT] + [mpiPi.reportFormat], + &(mpiPi.lookup[av[i]->op - mpiPi_BASE].name[4]), + av[i]->csid, av[i]->count, av[i]->cumulativeRMA, + av[i]->cumulativeRMA / av[i]->count, + av[i]->cumulativeRMA * 100 / mpiPi.global_mpi_rma); + } + } free (av); } @@ -1051,7 +1051,7 @@ mpiPi_print_all_callsite_time_info (FILE * fp) sprintf (buf, "Callsite Time statistics (all, milliseconds): %d", ac); print_section_heading (fp, buf); fprintf (fp, "%-17s %4s %4s %6s %8s %8s %8s %6s %6s\n", "Name", "Site", - "Rank", "Count", "Max", "Mean", "Min", "App%", "MPI%"); + "Rank", "Count", "Max", "Mean", "Min", "App%", "MPI%"); { long long sCount = 0; @@ -1061,60 +1061,60 @@ mpiPi_print_all_callsite_time_info (FILE * fp) for (i = 0; i < ac; i++) { - if (i != 0 && (av[i]->csid != av[i - 1]->csid)) - { - fprintf (fp, - mpiP_Report_Formats[MPIP_CALLSITE_TIME_SUMMARY_FMT] - [mpiPi.reportFormat], - &(mpiPi.lookup[av[i - 1]->op - mpiPi_BASE].name[4]), - av[i - 1]->csid, "*", sCount, sMax / 1000.0, - sCumulative / (sCount * 1000.0), sMin / 1000.0, - mpiPi.global_app_time > - 0 ? 100.0 * sCumulative / (mpiPi.global_app_time * - 1e6) : 0, - mpiPi.global_mpi_time > - 0 ? 100.0 * sCumulative / mpiPi.global_mpi_time : 0); - fprintf (fp, "\n"); - sCount = 0; - sMax = 0; - sMin = DBL_MAX; - sCumulative = 0; - } - - sCount += av[i]->count; - sCumulative += av[i]->cumulativeTime; - sMax = max (av[i]->maxDur, sMax); - sMin = min (av[i]->minDur, sMin); - - if (mpiPi.global_task_mpi_time[av[i]->rank] != 0 && - (100.0 * av[i]->cumulativeTime / - mpiPi.global_task_mpi_time[av[i]->rank]) - >= mpiPi.reportPrintThreshold) - { - fprintf (fp, - mpiP_Report_Formats[MPIP_CALLSITE_TIME_RANK_FMT] - [mpiPi.reportFormat], - &(mpiPi.lookup[av[i]->op - mpiPi_BASE].name[4]), - av[i]->csid, av[i]->rank, av[i]->count, - av[i]->maxDur / 1000.0, - av[i]->cumulativeTime / (av[i]->count * 1000.0), - av[i]->minDur / 1000.0, - 100.0 * av[i]->cumulativeTime / - (mpiPi.global_task_app_time[av[i]->rank] * 1e6), - 100.0 * av[i]->cumulativeTime / - mpiPi.global_task_mpi_time[av[i]->rank]); - } + if (i != 0 && (av[i]->csid != av[i - 1]->csid)) + { + fprintf (fp, + mpiP_Report_Formats[MPIP_CALLSITE_TIME_SUMMARY_FMT] + [mpiPi.reportFormat], + &(mpiPi.lookup[av[i - 1]->op - mpiPi_BASE].name[4]), + av[i - 1]->csid, "*", sCount, sMax / 1000.0, + sCumulative / (sCount * 1000.0), sMin / 1000.0, + mpiPi.global_app_time > + 0 ? 100.0 * sCumulative / (mpiPi.global_app_time * + 1e6) : 0, + mpiPi.global_mpi_time > + 0 ? 100.0 * sCumulative / mpiPi.global_mpi_time : 0); + fprintf (fp, "\n"); + sCount = 0; + sMax = 0; + sMin = DBL_MAX; + sCumulative = 0; + } + + sCount += av[i]->count; + sCumulative += av[i]->cumulativeTime; + sMax = max (av[i]->maxDur, sMax); + sMin = min (av[i]->minDur, sMin); + + if (mpiPi.global_task_mpi_time[av[i]->rank] != 0 && + (100.0 * av[i]->cumulativeTime / + mpiPi.global_task_mpi_time[av[i]->rank]) + >= mpiPi.reportPrintThreshold) + { + fprintf (fp, + mpiP_Report_Formats[MPIP_CALLSITE_TIME_RANK_FMT] + [mpiPi.reportFormat], + &(mpiPi.lookup[av[i]->op - mpiPi_BASE].name[4]), + av[i]->csid, av[i]->rank, av[i]->count, + av[i]->maxDur / 1000.0, + av[i]->cumulativeTime / (av[i]->count * 1000.0), + av[i]->minDur / 1000.0, + 100.0 * av[i]->cumulativeTime / + (mpiPi.global_task_app_time[av[i]->rank] * 1e6), + 100.0 * av[i]->cumulativeTime / + mpiPi.global_task_mpi_time[av[i]->rank]); + } } fprintf (fp, - mpiP_Report_Formats[MPIP_CALLSITE_TIME_SUMMARY_FMT] - [mpiPi.reportFormat], - &(mpiPi.lookup[av[i - 1]->op - mpiPi_BASE].name[4]), - av[i - 1]->csid, "*", sCount, sMax / 1000.0, - sCumulative / (sCount * 1000.0), sMin / 1000.0, - mpiPi.global_app_time > - 0 ? 100.0 * sCumulative / (mpiPi.global_app_time * 1e6) : 0, - mpiPi.global_mpi_time > - 0 ? 100.0 * sCumulative / mpiPi.global_mpi_time : 0); + mpiP_Report_Formats[MPIP_CALLSITE_TIME_SUMMARY_FMT] + [mpiPi.reportFormat], + &(mpiPi.lookup[av[i - 1]->op - mpiPi_BASE].name[4]), + av[i - 1]->csid, "*", sCount, sMax / 1000.0, + sCumulative / (sCount * 1000.0), sMin / 1000.0, + mpiPi.global_app_time > + 0 ? 100.0 * sCumulative / (mpiPi.global_app_time * 1e6) : 0, + mpiPi.global_mpi_time > + 0 ? 100.0 * sCumulative / mpiPi.global_mpi_time : 0); } free (av); @@ -1122,7 +1122,7 @@ mpiPi_print_all_callsite_time_info (FILE * fp) static int callsite_stats_sort_by_cumulative (mpiPi_callsite_summary_t * cs1, - mpiPi_callsite_summary_t * cs2) + mpiPi_callsite_summary_t * cs2) { if (cs1->cumulative > cs2->cumulative) { @@ -1150,13 +1150,13 @@ mpiPi_print_concise_callsite_time_info (FILE * fp) */ qsort (av, ac, sizeof (void *), callsite_sort_by_name_id_rank); callsite_stats = - (mpiPi_callsite_summary_t *) malloc (sizeof (mpiPi_callsite_summary_t) * - callsite_src_id_cache->count); + (mpiPi_callsite_summary_t *) malloc (sizeof (mpiPi_callsite_summary_t) * + callsite_src_id_cache->count); if (callsite_stats == NULL) { mpiPi_msg_warn - ("Failed to allocate space for callsite time summary reporting\n"); + ("Failed to allocate space for callsite time summary reporting\n"); free (av); return; } @@ -1170,46 +1170,46 @@ mpiPi_print_concise_callsite_time_info (FILE * fp) for (i = 0; i < ac; i++) { - if (i != 0 && (av[i]->csid != av[i - 1]->csid)) - { - if (csidx >= callsite_src_id_cache->count) - { - mpiPi_msg_warn - ("Concise callsite time report encountered index out of bounds.\n"); - return; - } - callsite_stats[csidx].name = - &(mpiPi.lookup[av[i - 1]->op - mpiPi_BASE].name[4]); - callsite_stats[csidx].site = av[i - 1]->csid; - callsite_stats[csidx].count = sCount; - callsite_stats[csidx].max = sMax; - callsite_stats[csidx].min = sMin; - callsite_stats[csidx].cumulative = sCumulative; - callsite_stats[csidx].max_rnk = max_rnk; - callsite_stats[csidx].min_rnk = min_rnk; - - sCount = 0; - sMax = 0; - sMin = DBL_MAX; - sCumulative = 0; - csidx++; - } - - sCount++; - sCumulative += av[i]->cumulativeTime; - if (av[i]->cumulativeTime > sMax) - { - sMax = av[i]->cumulativeTime; - max_rnk = av[i]->rank; - } - if (av[i]->cumulativeTime < sMin) - { - sMin = av[i]->cumulativeTime; - min_rnk = av[i]->rank; - } + if (i != 0 && (av[i]->csid != av[i - 1]->csid)) + { + if (csidx >= callsite_src_id_cache->count) + { + mpiPi_msg_warn + ("Concise callsite time report encountered index out of bounds.\n"); + return; + } + callsite_stats[csidx].name = + &(mpiPi.lookup[av[i - 1]->op - mpiPi_BASE].name[4]); + callsite_stats[csidx].site = av[i - 1]->csid; + callsite_stats[csidx].count = sCount; + callsite_stats[csidx].max = sMax; + callsite_stats[csidx].min = sMin; + callsite_stats[csidx].cumulative = sCumulative; + callsite_stats[csidx].max_rnk = max_rnk; + callsite_stats[csidx].min_rnk = min_rnk; + + sCount = 0; + sMax = 0; + sMin = DBL_MAX; + sCumulative = 0; + csidx++; + } + + sCount++; + sCumulative += av[i]->cumulativeTime; + if (av[i]->cumulativeTime > sMax) + { + sMax = av[i]->cumulativeTime; + max_rnk = av[i]->rank; + } + if (av[i]->cumulativeTime < sMin) + { + sMin = av[i]->cumulativeTime; + min_rnk = av[i]->rank; + } } callsite_stats[csidx].name = - &(mpiPi.lookup[av[i - 1]->op - mpiPi_BASE].name[4]); + &(mpiPi.lookup[av[i - 1]->op - mpiPi_BASE].name[4]); callsite_stats[csidx].site = av[i - 1]->csid; callsite_stats[csidx].count = sCount; callsite_stats[csidx].max = sMax; @@ -1222,25 +1222,25 @@ mpiPi_print_concise_callsite_time_info (FILE * fp) free (av); sprintf (buf, "Callsite Time statistics (all callsites, milliseconds): %d", - csidx + 1); + csidx + 1); print_section_heading (fp, buf); fprintf (fp, "%-17s %4s %7s %9s %9s %9s %6s %6s\n", "Name", "Site", - "Tasks", "Max", "Mean", "Min", "MaxRnk", "MinRnk"); + "Tasks", "Max", "Mean", "Min", "MaxRnk", "MinRnk"); qsort (callsite_stats, csidx + 1, sizeof (mpiPi_callsite_summary_t), - (int (*)(const void *, const void *)) - callsite_stats_sort_by_cumulative); + (int (*)(const void *, const void *)) + callsite_stats_sort_by_cumulative); for (i = 0; i <= csidx; i++) { fprintf (fp, - mpiP_Report_Formats[MPIP_CALLSITE_TIME_CONCISE_FMT] - [mpiPi.reportFormat], callsite_stats[i].name, - callsite_stats[i].site, callsite_stats[i].count, - callsite_stats[i].max / 1000.0, - callsite_stats[i].cumulative / (callsite_stats[i].count * - 1000), - callsite_stats[i].min / 1000.0, callsite_stats[i].max_rnk, - callsite_stats[i].min_rnk); + mpiP_Report_Formats[MPIP_CALLSITE_TIME_CONCISE_FMT] + [mpiPi.reportFormat], callsite_stats[i].name, + callsite_stats[i].site, callsite_stats[i].count, + callsite_stats[i].max / 1000.0, + callsite_stats[i].cumulative / (callsite_stats[i].count * + 1000), + callsite_stats[i].min / 1000.0, callsite_stats[i].max_rnk, + callsite_stats[i].min_rnk); } free (callsite_stats); } @@ -1257,7 +1257,7 @@ mpiPi_print_callsite_sent_info (FILE * fp) static void mpiPi_print_all_callsite_sent_info (FILE * fp) - /* Print Sent Data Section */ +/* Print Sent Data Section */ { int i, ac; char buf[256]; @@ -1275,64 +1275,64 @@ mpiPi_print_all_callsite_sent_info (FILE * fp) sprintf (buf, "Callsite Message Sent statistics (all, sent bytes)"); print_section_heading (fp, buf); fprintf (fp, "%-17s %4s %4s %7s %9s %9s %9s %9s\n", "Name", "Site", - "Rank", "Count", "Max", "Mean", "Min", "Sum"); + "Rank", "Count", "Max", "Mean", "Min", "Sum"); { - long long sCount = 0; - double sMin = DBL_MAX; - double sMax = 0; - double sCumulative = 0; - int lastcsid = 0; - - for (i = 0; i < ac; i++) - { - if (i != 0 && sCumulative > 0 && (av[i]->csid != av[i - 1]->csid)) - { - fprintf (fp, - mpiP_Report_Formats[MPIP_CALLSITE_MESS_SUMMARY_FMT] - [mpiPi.reportFormat], - &(mpiPi.lookup[av[i - 1]->op - mpiPi_BASE].name[4]), - av[i - 1]->csid, "*", sCount, sMax, - sCumulative / sCount, sMin, sCumulative); - - sCount = 0; - sMax = 0; - sMin = DBL_MAX; - sCumulative = 0; - } - - if (av[i]->cumulativeDataSent > 0) - { - sCount += av[i]->count; - sCumulative += av[i]->cumulativeDataSent; - sMax = max (av[i]->maxDataSent, sMax); - sMin = min (av[i]->minDataSent, sMin); - - if (lastcsid != 0 && lastcsid != av[i]->csid) - fprintf (fp, "\n"); - - fprintf (fp, - mpiP_Report_Formats[MPIP_CALLSITE_MESS_RANK_FMT] - [mpiPi.reportFormat], - &(mpiPi.lookup[av[i]->op - mpiPi_BASE].name[4]), - av[i]->csid, av[i]->rank, av[i]->count, - av[i]->maxDataSent, - av[i]->cumulativeDataSent / av[i]->count, - av[i]->minDataSent, av[i]->cumulativeDataSent); - - lastcsid = av[i]->csid; - } - } - - if (sCumulative > 0) - { - fprintf (fp, - mpiP_Report_Formats[MPIP_CALLSITE_MESS_SUMMARY_FMT] - [mpiPi.reportFormat], - &(mpiPi.lookup[av[i - 1]->op - mpiPi_BASE].name[4]), - av[i - 1]->csid, "*", sCount, sMax, - sCumulative / sCount, sMin, sCumulative); - } + long long sCount = 0; + double sMin = DBL_MAX; + double sMax = 0; + double sCumulative = 0; + int lastcsid = 0; + + for (i = 0; i < ac; i++) + { + if (i != 0 && sCumulative > 0 && (av[i]->csid != av[i - 1]->csid)) + { + fprintf (fp, + mpiP_Report_Formats[MPIP_CALLSITE_MESS_SUMMARY_FMT] + [mpiPi.reportFormat], + &(mpiPi.lookup[av[i - 1]->op - mpiPi_BASE].name[4]), + av[i - 1]->csid, "*", sCount, sMax, + sCumulative / sCount, sMin, sCumulative); + + sCount = 0; + sMax = 0; + sMin = DBL_MAX; + sCumulative = 0; + } + + if (av[i]->cumulativeDataSent > 0) + { + sCount += av[i]->count; + sCumulative += av[i]->cumulativeDataSent; + sMax = max (av[i]->maxDataSent, sMax); + sMin = min (av[i]->minDataSent, sMin); + + if (lastcsid != 0 && lastcsid != av[i]->csid) + fprintf (fp, "\n"); + + fprintf (fp, + mpiP_Report_Formats[MPIP_CALLSITE_MESS_RANK_FMT] + [mpiPi.reportFormat], + &(mpiPi.lookup[av[i]->op - mpiPi_BASE].name[4]), + av[i]->csid, av[i]->rank, av[i]->count, + av[i]->maxDataSent, + av[i]->cumulativeDataSent / av[i]->count, + av[i]->minDataSent, av[i]->cumulativeDataSent); + + lastcsid = av[i]->csid; + } + } + + if (sCumulative > 0) + { + fprintf (fp, + mpiP_Report_Formats[MPIP_CALLSITE_MESS_SUMMARY_FMT] + [mpiPi.reportFormat], + &(mpiPi.lookup[av[i - 1]->op - mpiPi_BASE].name[4]), + av[i - 1]->csid, "*", sCount, sMax, + sCumulative / sCount, sMin, sCumulative); + } } free (av); @@ -1355,13 +1355,13 @@ mpiPi_print_concise_callsite_sent_info (FILE * fp) */ qsort (av, ac, sizeof (void *), callsite_sort_by_name_id_rank); callsite_stats = - (mpiPi_callsite_summary_t *) malloc (sizeof (mpiPi_callsite_summary_t) * - callsite_src_id_cache->count); + (mpiPi_callsite_summary_t *) malloc (sizeof (mpiPi_callsite_summary_t) * + callsite_src_id_cache->count); if (callsite_stats == NULL) { mpiPi_msg_warn - ("Failed to allocate space for callsite volume summary reporting\n"); + ("Failed to allocate space for callsite volume summary reporting\n"); free (av); return; } @@ -1375,62 +1375,62 @@ mpiPi_print_concise_callsite_sent_info (FILE * fp) for (i = 0, csidx = 0; i < ac; i++) { - if (i != 0 && (av[i]->csid != av[i - 1]->csid)) - { - if (sCumulative > 0) - { - if (csidx >= callsite_src_id_cache->count) - { - mpiPi_msg_warn - ("Concise callsite sent report encountered index out of bounds.\n"); - return; - } - callsite_stats[csidx].name = - &(mpiPi.lookup[av[i - 1]->op - mpiPi_BASE].name[4]); - callsite_stats[csidx].site = av[i - 1]->csid; - callsite_stats[csidx].count = sCount; - callsite_stats[csidx].max = sMax; - callsite_stats[csidx].min = sMin; - callsite_stats[csidx].cumulative = sCumulative; - callsite_stats[csidx].max_rnk = max_rnk; - callsite_stats[csidx].min_rnk = min_rnk; - csidx++; - } - - sCount = 0; - sMax = 0; - sMin = DBL_MAX; - sCumulative = 0; - max_rnk = -1; - min_rnk = -1; - } - - sCount++; - sCumulative += av[i]->cumulativeDataSent; - - if (av[i]->cumulativeDataSent > sMax) - { - sMax = av[i]->cumulativeDataSent; - max_rnk = av[i]->rank; - } - if (av[i]->cumulativeDataSent < sMin) - { - sMin = av[i]->cumulativeDataSent; - min_rnk = av[i]->rank; - } + if (i != 0 && (av[i]->csid != av[i - 1]->csid)) + { + if (sCumulative > 0) + { + if (csidx >= callsite_src_id_cache->count) + { + mpiPi_msg_warn + ("Concise callsite sent report encountered index out of bounds.\n"); + return; + } + callsite_stats[csidx].name = + &(mpiPi.lookup[av[i - 1]->op - mpiPi_BASE].name[4]); + callsite_stats[csidx].site = av[i - 1]->csid; + callsite_stats[csidx].count = sCount; + callsite_stats[csidx].max = sMax; + callsite_stats[csidx].min = sMin; + callsite_stats[csidx].cumulative = sCumulative; + callsite_stats[csidx].max_rnk = max_rnk; + callsite_stats[csidx].min_rnk = min_rnk; + csidx++; + } + + sCount = 0; + sMax = 0; + sMin = DBL_MAX; + sCumulative = 0; + max_rnk = -1; + min_rnk = -1; + } + + sCount++; + sCumulative += av[i]->cumulativeDataSent; + + if (av[i]->cumulativeDataSent > sMax) + { + sMax = av[i]->cumulativeDataSent; + max_rnk = av[i]->rank; + } + if (av[i]->cumulativeDataSent < sMin) + { + sMin = av[i]->cumulativeDataSent; + min_rnk = av[i]->rank; + } } if (sCumulative > 0) { - callsite_stats[csidx].name = - &(mpiPi.lookup[av[i - 1]->op - mpiPi_BASE].name[4]); - callsite_stats[csidx].site = av[i - 1]->csid; - callsite_stats[csidx].count = sCount; - callsite_stats[csidx].max = sMax; - callsite_stats[csidx].min = sMin; - callsite_stats[csidx].cumulative = sCumulative; - callsite_stats[csidx].max_rnk = max_rnk; - callsite_stats[csidx].min_rnk = min_rnk; + callsite_stats[csidx].name = + &(mpiPi.lookup[av[i - 1]->op - mpiPi_BASE].name[4]); + callsite_stats[csidx].site = av[i - 1]->csid; + callsite_stats[csidx].count = sCount; + callsite_stats[csidx].max = sMax; + callsite_stats[csidx].min = sMin; + callsite_stats[csidx].cumulative = sCumulative; + callsite_stats[csidx].max_rnk = max_rnk; + callsite_stats[csidx].min_rnk = min_rnk; } else csidx--; @@ -1441,26 +1441,26 @@ mpiPi_print_concise_callsite_sent_info (FILE * fp) if (csidx > 0) { sprintf (buf, - "Callsite Message Sent statistics (all callsites, sent bytes): %d", - csidx + 1); + "Callsite Message Sent statistics (all callsites, sent bytes): %d", + csidx + 1); print_section_heading (fp, buf); fprintf (fp, "%-17s %4s %7s %9s %9s %9s %6s %6s\n", "Name", "Site", - "Tasks", "Max", "Mean", "Min", "MaxRnk", "MinRnk"); + "Tasks", "Max", "Mean", "Min", "MaxRnk", "MinRnk"); qsort (callsite_stats, csidx + 1, sizeof (mpiPi_callsite_summary_t), - (int (*)(const void *, const void *)) - callsite_stats_sort_by_cumulative); + (int (*)(const void *, const void *)) + callsite_stats_sort_by_cumulative); for (i = 0; i <= csidx; i++) - { - fprintf (fp, - mpiP_Report_Formats[MPIP_CALLSITE_MESS_CONCISE_FMT] - [mpiPi.reportFormat], callsite_stats[i].name, - callsite_stats[i].site, callsite_stats[i].count, - callsite_stats[i].max, - callsite_stats[i].cumulative / callsite_stats[i].count, - callsite_stats[i].min, callsite_stats[i].max_rnk, - callsite_stats[i].min_rnk); - } + { + fprintf (fp, + mpiP_Report_Formats[MPIP_CALLSITE_MESS_CONCISE_FMT] + [mpiPi.reportFormat], callsite_stats[i].name, + callsite_stats[i].site, callsite_stats[i].count, + callsite_stats[i].max, + callsite_stats[i].cumulative / callsite_stats[i].count, + callsite_stats[i].min, callsite_stats[i].max_rnk, + callsite_stats[i].min_rnk); + } } free (callsite_stats); } @@ -1487,63 +1487,63 @@ mpiPi_print_all_callsite_io_info (FILE * fp) sprintf (buf, "Callsite I/O statistics (all, I/O bytes)"); print_section_heading (fp, buf); fprintf (fp, "%-17s %4s %4s %7s %9s %9s %9s %9s\n", "Name", "Site", - "Rank", "Count", "Max", "Mean", "Min", "Sum"); + "Rank", "Count", "Max", "Mean", "Min", "Sum"); { - long long sCount = 0; - double sMin = DBL_MAX; - double sMax = 0; - double sCumulative = 0; - int lastcsid = 0; - - for (i = 0; i < ac; i++) - { - if (i != 0 && sCumulative > 0 && (av[i]->csid != av[i - 1]->csid)) - { - fprintf (fp, - mpiP_Report_Formats[MPIP_CALLSITE_IO_SUMMARY_FMT] - [mpiPi.reportFormat], - &(mpiPi.lookup[av[i - 1]->op - mpiPi_BASE].name[4]), - av[i - 1]->csid, "*", sCount, sMax, - sCumulative / sCount, sMin, sCumulative); - - sCount = 0; - sMax = 0; - sMin = DBL_MAX; - sCumulative = 0; - } - - if (av[i]->cumulativeIO > 0) - { - sCount += av[i]->count; - sCumulative += av[i]->cumulativeIO; - sMax = max (av[i]->maxIO, sMax); - sMin = min (av[i]->minIO, sMin); - - if (lastcsid != 0 && lastcsid != av[i]->csid) - fprintf (fp, "\n"); - - fprintf (fp, - mpiP_Report_Formats[MPIP_CALLSITE_IO_RANK_FMT] - [mpiPi.reportFormat], - &(mpiPi.lookup[av[i]->op - mpiPi_BASE].name[4]), - av[i]->csid, av[i]->rank, av[i]->count, - av[i]->maxIO, av[i]->cumulativeIO / av[i]->count, - av[i]->minIO, av[i]->cumulativeIO); - - lastcsid = av[i]->csid; - } - } - - if (sCumulative > 0) - { - fprintf (fp, - mpiP_Report_Formats[MPIP_CALLSITE_IO_SUMMARY_FMT] - [mpiPi.reportFormat], - &(mpiPi.lookup[av[i - 1]->op - mpiPi_BASE].name[4]), - av[i - 1]->csid, "*", sCount, sMax, - sCumulative / sCount, sMin, sCumulative); - } + long long sCount = 0; + double sMin = DBL_MAX; + double sMax = 0; + double sCumulative = 0; + int lastcsid = 0; + + for (i = 0; i < ac; i++) + { + if (i != 0 && sCumulative > 0 && (av[i]->csid != av[i - 1]->csid)) + { + fprintf (fp, + mpiP_Report_Formats[MPIP_CALLSITE_IO_SUMMARY_FMT] + [mpiPi.reportFormat], + &(mpiPi.lookup[av[i - 1]->op - mpiPi_BASE].name[4]), + av[i - 1]->csid, "*", sCount, sMax, + sCumulative / sCount, sMin, sCumulative); + + sCount = 0; + sMax = 0; + sMin = DBL_MAX; + sCumulative = 0; + } + + if (av[i]->cumulativeIO > 0) + { + sCount += av[i]->count; + sCumulative += av[i]->cumulativeIO; + sMax = max (av[i]->maxIO, sMax); + sMin = min (av[i]->minIO, sMin); + + if (lastcsid != 0 && lastcsid != av[i]->csid) + fprintf (fp, "\n"); + + fprintf (fp, + mpiP_Report_Formats[MPIP_CALLSITE_IO_RANK_FMT] + [mpiPi.reportFormat], + &(mpiPi.lookup[av[i]->op - mpiPi_BASE].name[4]), + av[i]->csid, av[i]->rank, av[i]->count, + av[i]->maxIO, av[i]->cumulativeIO / av[i]->count, + av[i]->minIO, av[i]->cumulativeIO); + + lastcsid = av[i]->csid; + } + } + + if (sCumulative > 0) + { + fprintf (fp, + mpiP_Report_Formats[MPIP_CALLSITE_IO_SUMMARY_FMT] + [mpiPi.reportFormat], + &(mpiPi.lookup[av[i - 1]->op - mpiPi_BASE].name[4]), + av[i - 1]->csid, "*", sCount, sMax, + sCumulative / sCount, sMin, sCumulative); + } } free (av); @@ -1572,63 +1572,63 @@ mpiPi_print_all_callsite_rma_info (FILE * fp) sprintf (buf, "Callsite RMA statistics (all, origin bytes)"); print_section_heading (fp, buf); fprintf (fp, "%-17s %4s %4s %7s %9s %9s %9s %9s\n", "Name", "Site", - "Rank", "Count", "Max", "Mean", "Min", "Sum"); + "Rank", "Count", "Max", "Mean", "Min", "Sum"); { - long long sCount = 0; - double sMin = DBL_MAX; - double sMax = 0; - double sCumulative = 0; - int lastcsid = 0; - - for (i = 0; i < ac; i++) - { - if (i != 0 && sCumulative > 0 && (av[i]->csid != av[i - 1]->csid)) - { - fprintf (fp, - mpiP_Report_Formats[MPIP_CALLSITE_IO_SUMMARY_FMT] - [mpiPi.reportFormat], - &(mpiPi.lookup[av[i - 1]->op - mpiPi_BASE].name[4]), - av[i - 1]->csid, "*", sCount, sMax, - sCumulative / sCount, sMin, sCumulative); - - sCount = 0; - sMax = 0; - sMin = DBL_MAX; - sCumulative = 0; - } - - if (av[i]->cumulativeRMA > 0) - { - sCount += av[i]->count; - sCumulative += av[i]->cumulativeRMA; - sMax = max (av[i]->maxRMA, sMax); - sMin = min (av[i]->minRMA, sMin); - - if (lastcsid != 0 && lastcsid != av[i]->csid) - fprintf (fp, "\n"); - - fprintf (fp, - mpiP_Report_Formats[MPIP_CALLSITE_IO_RANK_FMT] - [mpiPi.reportFormat], - &(mpiPi.lookup[av[i]->op - mpiPi_BASE].name[4]), - av[i]->csid, av[i]->rank, av[i]->count, - av[i]->maxRMA, av[i]->cumulativeRMA / av[i]->count, - av[i]->minRMA, av[i]->cumulativeRMA); - - lastcsid = av[i]->csid; - } - } - - if (sCumulative > 0) - { - fprintf (fp, - mpiP_Report_Formats[MPIP_CALLSITE_IO_SUMMARY_FMT] - [mpiPi.reportFormat], - &(mpiPi.lookup[av[i - 1]->op - mpiPi_BASE].name[4]), - av[i - 1]->csid, "*", sCount, sMax, - sCumulative / sCount, sMin, sCumulative); - } + long long sCount = 0; + double sMin = DBL_MAX; + double sMax = 0; + double sCumulative = 0; + int lastcsid = 0; + + for (i = 0; i < ac; i++) + { + if (i != 0 && sCumulative > 0 && (av[i]->csid != av[i - 1]->csid)) + { + fprintf (fp, + mpiP_Report_Formats[MPIP_CALLSITE_IO_SUMMARY_FMT] + [mpiPi.reportFormat], + &(mpiPi.lookup[av[i - 1]->op - mpiPi_BASE].name[4]), + av[i - 1]->csid, "*", sCount, sMax, + sCumulative / sCount, sMin, sCumulative); + + sCount = 0; + sMax = 0; + sMin = DBL_MAX; + sCumulative = 0; + } + + if (av[i]->cumulativeRMA > 0) + { + sCount += av[i]->count; + sCumulative += av[i]->cumulativeRMA; + sMax = max (av[i]->maxRMA, sMax); + sMin = min (av[i]->minRMA, sMin); + + if (lastcsid != 0 && lastcsid != av[i]->csid) + fprintf (fp, "\n"); + + fprintf (fp, + mpiP_Report_Formats[MPIP_CALLSITE_IO_RANK_FMT] + [mpiPi.reportFormat], + &(mpiPi.lookup[av[i]->op - mpiPi_BASE].name[4]), + av[i]->csid, av[i]->rank, av[i]->count, + av[i]->maxRMA, av[i]->cumulativeRMA / av[i]->count, + av[i]->minRMA, av[i]->cumulativeRMA); + + lastcsid = av[i]->csid; + } + } + + if (sCumulative > 0) + { + fprintf (fp, + mpiP_Report_Formats[MPIP_CALLSITE_IO_SUMMARY_FMT] + [mpiPi.reportFormat], + &(mpiPi.lookup[av[i - 1]->op - mpiPi_BASE].name[4]), + av[i - 1]->csid, "*", sCount, sMax, + sCumulative / sCount, sMin, sCumulative); + } } free (av); @@ -1656,114 +1656,114 @@ mpiPi_print_concise_callsite_io_info (FILE * fp) */ qsort (av, ac, sizeof (void *), callsite_sort_by_name_id_rank); callsite_stats = - (mpiPi_callsite_summary_t *) malloc (sizeof (mpiPi_callsite_summary_t) - * callsite_src_id_cache->count); + (mpiPi_callsite_summary_t *) malloc (sizeof (mpiPi_callsite_summary_t) + * callsite_src_id_cache->count); if (callsite_stats == NULL) - { - mpiPi_msg_warn - ("Failed to allocate space for callsite volume summary reporting\n"); - free (av); - return; - } + { + mpiPi_msg_warn + ("Failed to allocate space for callsite volume summary reporting\n"); + free (av); + return; + } { - long long sCount = 0; - double sMin = DBL_MAX; - double sMax = 0; - double sCumulative = 0; - int max_rnk = -1, min_rnk = -1; - - for (i = 0, csidx = 0; i < ac; i++) - { - if (i != 0 && (av[i]->csid != av[i - 1]->csid)) - { - if (sCumulative > 0) - { - if (csidx >= callsite_src_id_cache->count) - { - mpiPi_msg_warn - ("Concise callsite i/o report encountered index out of bounds.\n"); - return; - } - callsite_stats[csidx].name = - &(mpiPi.lookup[av[i - 1]->op - mpiPi_BASE].name[4]); - callsite_stats[csidx].site = av[i - 1]->csid; - callsite_stats[csidx].count = sCount; - callsite_stats[csidx].max = sMax; - callsite_stats[csidx].min = sMin; - callsite_stats[csidx].cumulative = sCumulative; - callsite_stats[csidx].max_rnk = max_rnk; - callsite_stats[csidx].min_rnk = min_rnk; - csidx++; - } - - sCount = 0; - sMax = 0; - sMin = DBL_MAX; - sCumulative = 0; - max_rnk = -1; - min_rnk = -1; - } - - sCount++; - sCumulative += av[i]->cumulativeIO; - - if (av[i]->cumulativeIO > sMax) - { - sMax = av[i]->cumulativeIO; - max_rnk = av[i]->rank; - } - if (av[i]->cumulativeIO < sMin) - { - sMin = av[i]->cumulativeIO; - min_rnk = av[i]->rank; - } - } - - if (sCumulative > 0) - { - callsite_stats[csidx].name = - &(mpiPi.lookup[av[i - 1]->op - mpiPi_BASE].name[4]); - callsite_stats[csidx].site = av[i - 1]->csid; - callsite_stats[csidx].count = sCount; - callsite_stats[csidx].max = sMax; - callsite_stats[csidx].min = sMin; - callsite_stats[csidx].cumulative = sCumulative; - callsite_stats[csidx].max_rnk = max_rnk; - callsite_stats[csidx].min_rnk = min_rnk; - } - else - csidx--; + long long sCount = 0; + double sMin = DBL_MAX; + double sMax = 0; + double sCumulative = 0; + int max_rnk = -1, min_rnk = -1; + + for (i = 0, csidx = 0; i < ac; i++) + { + if (i != 0 && (av[i]->csid != av[i - 1]->csid)) + { + if (sCumulative > 0) + { + if (csidx >= callsite_src_id_cache->count) + { + mpiPi_msg_warn + ("Concise callsite i/o report encountered index out of bounds.\n"); + return; + } + callsite_stats[csidx].name = + &(mpiPi.lookup[av[i - 1]->op - mpiPi_BASE].name[4]); + callsite_stats[csidx].site = av[i - 1]->csid; + callsite_stats[csidx].count = sCount; + callsite_stats[csidx].max = sMax; + callsite_stats[csidx].min = sMin; + callsite_stats[csidx].cumulative = sCumulative; + callsite_stats[csidx].max_rnk = max_rnk; + callsite_stats[csidx].min_rnk = min_rnk; + csidx++; + } + + sCount = 0; + sMax = 0; + sMin = DBL_MAX; + sCumulative = 0; + max_rnk = -1; + min_rnk = -1; + } + + sCount++; + sCumulative += av[i]->cumulativeIO; + + if (av[i]->cumulativeIO > sMax) + { + sMax = av[i]->cumulativeIO; + max_rnk = av[i]->rank; + } + if (av[i]->cumulativeIO < sMin) + { + sMin = av[i]->cumulativeIO; + min_rnk = av[i]->rank; + } + } + + if (sCumulative > 0) + { + callsite_stats[csidx].name = + &(mpiPi.lookup[av[i - 1]->op - mpiPi_BASE].name[4]); + callsite_stats[csidx].site = av[i - 1]->csid; + callsite_stats[csidx].count = sCount; + callsite_stats[csidx].max = sMax; + callsite_stats[csidx].min = sMin; + callsite_stats[csidx].cumulative = sCumulative; + callsite_stats[csidx].max_rnk = max_rnk; + callsite_stats[csidx].min_rnk = min_rnk; + } + else + csidx--; } free (av); if (csidx > 0) - { - snprintf (buf, 256, - "Callsite I/O statistics (all callsites, bytes): %d", - csidx + 1); - print_section_heading (fp, buf); - fprintf (fp, "%-17s %4s %7s %9s %9s %9s %6s %6s\n", "Name", "Site", - "Tasks", "Max", "Mean", "Min", "MaxRnk", "MinRnk"); - - qsort (callsite_stats, csidx + 1, sizeof (mpiPi_callsite_summary_t), - (int (*)(const void *, const void *)) - callsite_stats_sort_by_cumulative); - for (i = 0; i <= csidx; i++) - { - fprintf (fp, - mpiP_Report_Formats[MPIP_CALLSITE_MESS_CONCISE_FMT] - [mpiPi.reportFormat], callsite_stats[i].name, - callsite_stats[i].site, callsite_stats[i].count, - callsite_stats[i].max, - callsite_stats[i].cumulative / callsite_stats[i].count, - callsite_stats[i].min, callsite_stats[i].max_rnk, - callsite_stats[i].min_rnk); - } - } + { + snprintf (buf, 256, + "Callsite I/O statistics (all callsites, bytes): %d", + csidx + 1); + print_section_heading (fp, buf); + fprintf (fp, "%-17s %4s %7s %9s %9s %9s %6s %6s\n", "Name", "Site", + "Tasks", "Max", "Mean", "Min", "MaxRnk", "MinRnk"); + + qsort (callsite_stats, csidx + 1, sizeof (mpiPi_callsite_summary_t), + (int (*)(const void *, const void *)) + callsite_stats_sort_by_cumulative); + for (i = 0; i <= csidx; i++) + { + fprintf (fp, + mpiP_Report_Formats[MPIP_CALLSITE_MESS_CONCISE_FMT] + [mpiPi.reportFormat], callsite_stats[i].name, + callsite_stats[i].site, callsite_stats[i].count, + callsite_stats[i].max, + callsite_stats[i].cumulative / callsite_stats[i].count, + callsite_stats[i].min, callsite_stats[i].max_rnk, + callsite_stats[i].min_rnk); + } + } free (callsite_stats); } } @@ -1788,114 +1788,114 @@ mpiPi_print_concise_callsite_rma_info (FILE * fp) */ qsort (av, ac, sizeof (void *), callsite_sort_by_name_id_rank); callsite_stats = - (mpiPi_callsite_summary_t *) malloc (sizeof (mpiPi_callsite_summary_t) - * callsite_src_id_cache->count); + (mpiPi_callsite_summary_t *) malloc (sizeof (mpiPi_callsite_summary_t) + * callsite_src_id_cache->count); if (callsite_stats == NULL) - { - mpiPi_msg_warn - ("Failed to allocate space for callsite RMA volume summary reporting\n"); - free (av); - return; - } + { + mpiPi_msg_warn + ("Failed to allocate space for callsite RMA volume summary reporting\n"); + free (av); + return; + } { - long long sCount = 0; - double sMin = DBL_MAX; - double sMax = 0; - double sCumulative = 0; - int max_rnk = -1, min_rnk = -1; - - for (i = 0, csidx = 0; i < ac; i++) - { - if (i != 0 && (av[i]->csid != av[i - 1]->csid)) - { - if (sCumulative > 0) - { - if (csidx >= callsite_src_id_cache->count) - { - mpiPi_msg_warn - ("Concise callsite i/o report encountered index out of bounds.\n"); - return; - } - callsite_stats[csidx].name = - &(mpiPi.lookup[av[i - 1]->op - mpiPi_BASE].name[4]); - callsite_stats[csidx].site = av[i - 1]->csid; - callsite_stats[csidx].count = sCount; - callsite_stats[csidx].max = sMax; - callsite_stats[csidx].min = sMin; - callsite_stats[csidx].cumulative = sCumulative; - callsite_stats[csidx].max_rnk = max_rnk; - callsite_stats[csidx].min_rnk = min_rnk; - csidx++; - } - - sCount = 0; - sMax = 0; - sMin = DBL_MAX; - sCumulative = 0; - max_rnk = -1; - min_rnk = -1; - } - - sCount++; - sCumulative += av[i]->cumulativeRMA; - - if (av[i]->cumulativeRMA > sMax) - { - sMax = av[i]->cumulativeRMA; - max_rnk = av[i]->rank; - } - if (av[i]->cumulativeRMA < sMin) - { - sMin = av[i]->cumulativeRMA; - min_rnk = av[i]->rank; - } - } - - if (sCumulative > 0) - { - callsite_stats[csidx].name = - &(mpiPi.lookup[av[i - 1]->op - mpiPi_BASE].name[4]); - callsite_stats[csidx].site = av[i - 1]->csid; - callsite_stats[csidx].count = sCount; - callsite_stats[csidx].max = sMax; - callsite_stats[csidx].min = sMin; - callsite_stats[csidx].cumulative = sCumulative; - callsite_stats[csidx].max_rnk = max_rnk; - callsite_stats[csidx].min_rnk = min_rnk; - } - else - csidx--; + long long sCount = 0; + double sMin = DBL_MAX; + double sMax = 0; + double sCumulative = 0; + int max_rnk = -1, min_rnk = -1; + + for (i = 0, csidx = 0; i < ac; i++) + { + if (i != 0 && (av[i]->csid != av[i - 1]->csid)) + { + if (sCumulative > 0) + { + if (csidx >= callsite_src_id_cache->count) + { + mpiPi_msg_warn + ("Concise callsite i/o report encountered index out of bounds.\n"); + return; + } + callsite_stats[csidx].name = + &(mpiPi.lookup[av[i - 1]->op - mpiPi_BASE].name[4]); + callsite_stats[csidx].site = av[i - 1]->csid; + callsite_stats[csidx].count = sCount; + callsite_stats[csidx].max = sMax; + callsite_stats[csidx].min = sMin; + callsite_stats[csidx].cumulative = sCumulative; + callsite_stats[csidx].max_rnk = max_rnk; + callsite_stats[csidx].min_rnk = min_rnk; + csidx++; + } + + sCount = 0; + sMax = 0; + sMin = DBL_MAX; + sCumulative = 0; + max_rnk = -1; + min_rnk = -1; + } + + sCount++; + sCumulative += av[i]->cumulativeRMA; + + if (av[i]->cumulativeRMA > sMax) + { + sMax = av[i]->cumulativeRMA; + max_rnk = av[i]->rank; + } + if (av[i]->cumulativeRMA < sMin) + { + sMin = av[i]->cumulativeRMA; + min_rnk = av[i]->rank; + } + } + + if (sCumulative > 0) + { + callsite_stats[csidx].name = + &(mpiPi.lookup[av[i - 1]->op - mpiPi_BASE].name[4]); + callsite_stats[csidx].site = av[i - 1]->csid; + callsite_stats[csidx].count = sCount; + callsite_stats[csidx].max = sMax; + callsite_stats[csidx].min = sMin; + callsite_stats[csidx].cumulative = sCumulative; + callsite_stats[csidx].max_rnk = max_rnk; + callsite_stats[csidx].min_rnk = min_rnk; + } + else + csidx--; } free (av); if (csidx > 0) - { - snprintf (buf, 256, - "Callsite RMA Target statistics (all callsites, bytes): %d", - csidx + 1); - print_section_heading (fp, buf); - fprintf (fp, "%-17s %4s %7s %9s %9s %9s %6s %6s\n", "Name", "Site", - "Tasks", "Max", "Mean", "Min", "MaxRnk", "MinRnk"); - - qsort (callsite_stats, csidx + 1, sizeof (mpiPi_callsite_summary_t), - (int (*)(const void *, const void *)) - callsite_stats_sort_by_cumulative); - for (i = 0; i <= csidx; i++) - { - fprintf (fp, - mpiP_Report_Formats[MPIP_CALLSITE_MESS_CONCISE_FMT] - [mpiPi.reportFormat], callsite_stats[i].name, - callsite_stats[i].site, callsite_stats[i].count, - callsite_stats[i].max, - callsite_stats[i].cumulative / callsite_stats[i].count, - callsite_stats[i].min, callsite_stats[i].max_rnk, - callsite_stats[i].min_rnk); - } - } + { + snprintf (buf, 256, + "Callsite RMA Target statistics (all callsites, bytes): %d", + csidx + 1); + print_section_heading (fp, buf); + fprintf (fp, "%-17s %4s %7s %9s %9s %9s %6s %6s\n", "Name", "Site", + "Tasks", "Max", "Mean", "Min", "MaxRnk", "MinRnk"); + + qsort (callsite_stats, csidx + 1, sizeof (mpiPi_callsite_summary_t), + (int (*)(const void *, const void *)) + callsite_stats_sort_by_cumulative); + for (i = 0; i <= csidx; i++) + { + fprintf (fp, + mpiP_Report_Formats[MPIP_CALLSITE_MESS_CONCISE_FMT] + [mpiPi.reportFormat], callsite_stats[i].name, + callsite_stats[i].site, callsite_stats[i].count, + callsite_stats[i].max, + callsite_stats[i].cumulative / callsite_stats[i].count, + callsite_stats[i].min, callsite_stats[i].max_rnk, + callsite_stats[i].min_rnk); + } + } free (callsite_stats); } } @@ -1922,20 +1922,20 @@ mpiPi_coll_print_all_callsite_time_info (FILE * fp) task_data = malloc (sizeof (callsite_stats_t) * mpiPi.size); if (task_data == NULL) - { - mpiPi_msg_warn ("Failed to allocate space for task time data\n"); - malloc_check = 0; - free (av); - } + { + mpiPi_msg_warn ("Failed to allocate space for task time data\n"); + malloc_check = 0; + free (av); + } else - { - sprintf (buf, "Callsite Time statistics (all, milliseconds): %lld", - mpiPi.global_time_callsite_count); - print_section_heading (fp, buf); - fprintf (fp, "%-17s %4s %4s %6s %8s %8s %8s %6s %6s\n", "Name", - "Site", "Rank", "Count", "Max", "Mean", "Min", "App%", - "MPI%"); - } + { + sprintf (buf, "Callsite Time statistics (all, milliseconds): %lld", + mpiPi.global_time_callsite_count); + print_section_heading (fp, buf); + fprintf (fp, "%-17s %4s %4s %6s %8s %8s %8s %6s %6s\n", "Name", + "Site", "Rank", "Count", "Max", "Mean", "Min", "App%", + "MPI%"); + } } /* Check whether collector malloc succeeded. */ @@ -1953,91 +1953,91 @@ mpiPi_coll_print_all_callsite_time_info (FILE * fp) for (i = 0; i < ac; i++) { if (mpiPi.rank == mpiPi.collectorRank) - task_stats = av[i]; + task_stats = av[i]; else - task_stats = &cs_buf; + task_stats = &cs_buf; PMPI_Bcast (task_stats, sizeof (callsite_stats_t), - MPI_CHAR, mpiPi.collectorRank, mpiPi.comm); + MPI_CHAR, mpiPi.collectorRank, mpiPi.comm); task_stats->rank = mpiPi.rank; if (h_search - (mpiPi.task_callsite_stats, task_stats, - (void **) &task_lookup) == NULL) - { - task_lookup = &cs_buf; - task_lookup->count = 0; - task_lookup->cumulativeTime = 0; - task_lookup->cumulativeTimeSquared = 0; - task_lookup->maxDur = 0; - task_lookup->minDur = 0; - task_lookup->cumulativeDataSent = 0; - task_lookup->cumulativeIO = 0; - task_lookup->maxDataSent = 0; - task_lookup->minDataSent = 0; - task_lookup->maxIO = 0; - task_lookup->minIO = 0; - task_lookup->arbitraryMessageCount = 0; - task_lookup->rank = mpiPi.rank; - } + (mpiPi.task_callsite_stats, task_stats, + (void **) &task_lookup) == NULL) + { + task_lookup = &cs_buf; + task_lookup->count = 0; + task_lookup->cumulativeTime = 0; + task_lookup->cumulativeTimeSquared = 0; + task_lookup->maxDur = 0; + task_lookup->minDur = 0; + task_lookup->cumulativeDataSent = 0; + task_lookup->cumulativeIO = 0; + task_lookup->maxDataSent = 0; + task_lookup->minDataSent = 0; + task_lookup->maxIO = 0; + task_lookup->minIO = 0; + task_lookup->arbitraryMessageCount = 0; + task_lookup->rank = mpiPi.rank; + } PMPI_Gather (task_lookup, sizeof (callsite_stats_t), - MPI_CHAR, task_data, - sizeof (callsite_stats_t), MPI_CHAR, - mpiPi.collectorRank, mpiPi.comm); + MPI_CHAR, task_data, + sizeof (callsite_stats_t), MPI_CHAR, + mpiPi.collectorRank, mpiPi.comm); if (mpiPi.rank == mpiPi.collectorRank) - { - sCount = 0; - sMax = 0; - sMin = DBL_MAX; - sCumulative = 0; - - for (j = 0; j < mpiPi.size; j++) - { - sCount += task_data[j].count; - sCumulative += task_data[j].cumulativeTime; - sMax = max (task_data[j].maxDur, sMax); - sMin = min (task_data[j].minDur, sMin); - - if (task_data[j].count > 0 && - (100.0 * task_data[j].cumulativeTime / - mpiPi.global_task_mpi_time[task_data[j].rank]) - >= mpiPi.reportPrintThreshold) - { - fprintf (fp, - mpiP_Report_Formats[MPIP_CALLSITE_TIME_RANK_FMT] - [mpiPi.reportFormat], - &(mpiPi.lookup[task_stats->op - mpiPi_BASE]. - name[4]), av[i]->csid, task_data[j].rank, - task_data[j].count, task_data[j].maxDur / 1000.0, - task_data[j].cumulativeTime / (task_data[j].count * - 1000.0), - task_data[j].minDur / 1000.0, - 100.0 * task_data[j].cumulativeTime / - (mpiPi.global_task_app_time[task_data[j].rank] * - 1e6), - 100.0 * task_data[j].cumulativeTime / - mpiPi.global_task_mpi_time[task_data[j].rank]); - } - } - if (sCount > 0) - { - fprintf (fp, - mpiP_Report_Formats[MPIP_CALLSITE_TIME_SUMMARY_FMT] - [mpiPi.reportFormat], - &(mpiPi.lookup[task_data[j - 1].op - mpiPi_BASE]. - name[4]), av[i]->csid, "*", sCount, sMax / 1000.0, - sCumulative / (sCount * 1000.0), sMin / 1000.0, - mpiPi.global_app_time > - 0 ? 100.0 * sCumulative / (mpiPi.global_app_time * - 1e6) : 0, - mpiPi.global_mpi_time > - 0 ? 100.0 * sCumulative / mpiPi.global_mpi_time : 0); - fprintf (fp, "\n"); - } - } + { + sCount = 0; + sMax = 0; + sMin = DBL_MAX; + sCumulative = 0; + + for (j = 0; j < mpiPi.size; j++) + { + sCount += task_data[j].count; + sCumulative += task_data[j].cumulativeTime; + sMax = max (task_data[j].maxDur, sMax); + sMin = min (task_data[j].minDur, sMin); + + if (task_data[j].count > 0 && + (100.0 * task_data[j].cumulativeTime / + mpiPi.global_task_mpi_time[task_data[j].rank]) + >= mpiPi.reportPrintThreshold) + { + fprintf (fp, + mpiP_Report_Formats[MPIP_CALLSITE_TIME_RANK_FMT] + [mpiPi.reportFormat], + &(mpiPi.lookup[task_stats->op - mpiPi_BASE]. + name[4]), av[i]->csid, task_data[j].rank, + task_data[j].count, task_data[j].maxDur / 1000.0, + task_data[j].cumulativeTime / (task_data[j].count * + 1000.0), + task_data[j].minDur / 1000.0, + 100.0 * task_data[j].cumulativeTime / + (mpiPi.global_task_app_time[task_data[j].rank] * + 1e6), + 100.0 * task_data[j].cumulativeTime / + mpiPi.global_task_mpi_time[task_data[j].rank]); + } + } + if (sCount > 0) + { + fprintf (fp, + mpiP_Report_Formats[MPIP_CALLSITE_TIME_SUMMARY_FMT] + [mpiPi.reportFormat], + &(mpiPi.lookup[task_data[j - 1].op - mpiPi_BASE]. + name[4]), av[i]->csid, "*", sCount, sMax / 1000.0, + sCumulative / (sCount * 1000.0), sMin / 1000.0, + mpiPi.global_app_time > + 0 ? 100.0 * sCumulative / (mpiPi.global_app_time * + 1e6) : 0, + mpiPi.global_mpi_time > + 0 ? 100.0 * sCumulative / mpiPi.global_mpi_time : 0); + fprintf (fp, "\n"); + } + } } @@ -2072,11 +2072,11 @@ mpiPi_coll_print_concise_callsite_time_info (FILE * fp) qsort (av, ac, sizeof (void *), callsite_sort_by_cumulative_time); snprintf (buf, 256, - "Callsite Time statistics (all callsites, milliseconds): %d", - ac); + "Callsite Time statistics (all callsites, milliseconds): %d", + ac); print_section_heading (fp, buf); fprintf (fp, "%-17s %4s %7s %9s %9s %9s %6s %6s\n", "Name", "Site", - "Tasks", "Max", "Mean", "Min", "MaxRnk", "MinRnk"); + "Tasks", "Max", "Mean", "Min", "MaxRnk", "MinRnk"); } PMPI_Bcast (&ac, 1, MPI_INT, mpiPi.collectorRank, mpiPi.comm); @@ -2089,75 +2089,75 @@ mpiPi_coll_print_concise_callsite_time_info (FILE * fp) for (i = 0; i < ac; i++) { if (mpiPi.rank == mpiPi.collectorRank) - task_stats = av[i]; + task_stats = av[i]; else - task_stats = &cs_buf; + task_stats = &cs_buf; /* Broadcast current call site to all tasks */ PMPI_Bcast (task_stats, sizeof (callsite_stats_t), - MPI_CHAR, mpiPi.collectorRank, mpiPi.comm); + MPI_CHAR, mpiPi.collectorRank, mpiPi.comm); /* Search for task local entry for the current call site */ task_stats->rank = mpiPi.rank; if (h_search - (mpiPi.task_callsite_stats, task_stats, - (void **) &task_lookup) == NULL) - { - task_lookup = &cs_buf; - task_lookup->count = 0; - task_lookup->cumulativeTime = 0; - task_lookup->cumulativeTimeSquared = 0; - task_lookup->maxDur = 0; - task_lookup->minDur = DBL_MAX; - task_lookup->cumulativeDataSent = 0; - task_lookup->cumulativeIO = 0; - task_lookup->maxDataSent = 0; - task_lookup->minDataSent = DBL_MAX; - task_lookup->maxIO = 0; - task_lookup->minIO = DBL_MAX; - task_lookup->arbitraryMessageCount = 0; - task_lookup->rank = mpiPi.rank; - } + (mpiPi.task_callsite_stats, task_stats, + (void **) &task_lookup) == NULL) + { + task_lookup = &cs_buf; + task_lookup->count = 0; + task_lookup->cumulativeTime = 0; + task_lookup->cumulativeTimeSquared = 0; + task_lookup->maxDur = 0; + task_lookup->minDur = DBL_MAX; + task_lookup->cumulativeDataSent = 0; + task_lookup->cumulativeIO = 0; + task_lookup->maxDataSent = 0; + task_lookup->minDataSent = DBL_MAX; + task_lookup->maxIO = 0; + task_lookup->minIO = DBL_MAX; + task_lookup->arbitraryMessageCount = 0; + task_lookup->rank = mpiPi.rank; + } tot_tasks = 0; task_flag = task_lookup->count > 0 ? 1 : 0; /* Get minimum aggregate time and rank for this call site */ if (task_lookup->cumulativeTime > 0) - local_min_time.val = task_lookup->cumulativeTime; + local_min_time.val = task_lookup->cumulativeTime; else - local_min_time.val = DBL_MAX; + local_min_time.val = DBL_MAX; local_min_time.rank = mpiPi.rank; PMPI_Reduce (&local_min_time, &min_time, 1, MPI_DOUBLE_INT, MPI_MINLOC, - mpiPi.collectorRank, mpiPi.comm); + mpiPi.collectorRank, mpiPi.comm); /* Get maximum aggregate time and rank for this call site */ local_max_time.val = task_lookup->cumulativeTime; local_max_time.rank = mpiPi.rank; PMPI_Reduce (&local_max_time, &max_time, 1, MPI_DOUBLE_INT, MPI_MAXLOC, - mpiPi.collectorRank, mpiPi.comm); + mpiPi.collectorRank, mpiPi.comm); /* Get sum of aggregate time for all tasks for this call site */ PMPI_Reduce (&(task_lookup->cumulativeTime), &tot_time, 1, MPI_DOUBLE, - MPI_SUM, mpiPi.collectorRank, mpiPi.comm); + MPI_SUM, mpiPi.collectorRank, mpiPi.comm); /* Get the number of tasks with non-zero values for this call site */ PMPI_Reduce (&task_flag, &tot_tasks, 1, MPI_LONG_LONG, MPI_SUM, - mpiPi.collectorRank, mpiPi.comm); + mpiPi.collectorRank, mpiPi.comm); /* Print summary statistics for this call site */ if (mpiPi.rank == mpiPi.collectorRank) - { - fprintf (fp, - mpiP_Report_Formats[MPIP_CALLSITE_TIME_CONCISE_FMT] - [mpiPi.reportFormat], - &(mpiPi.lookup[av[i]->op - mpiPi_BASE].name[4]), - av[i]->csid, tot_tasks, max_time.val / 1000.0, - tot_time / (tot_tasks * 1000), min_time.val / 1000.0, - max_time.rank, min_time.rank); - } + { + fprintf (fp, + mpiP_Report_Formats[MPIP_CALLSITE_TIME_CONCISE_FMT] + [mpiPi.reportFormat], + &(mpiPi.lookup[av[i]->op - mpiPi_BASE].name[4]), + av[i]->csid, tot_tasks, max_time.val / 1000.0, + tot_time / (tot_tasks * 1000), min_time.val / 1000.0, + max_time.rank, min_time.rank); + } } if (mpiPi.rank == mpiPi.collectorRank) @@ -2187,20 +2187,20 @@ mpiPi_coll_print_concise_callsite_sent_info (FILE * fp) h_gather_data (mpiPi.global_callsite_stats_agg, &ac, (void ***) &av); qsort (av, ac, sizeof (void *), callsite_sort_by_cumulative_size); for (i = 0, callsite_count = 0; i < ac; i++) - { - if (av[i]->cumulativeDataSent > 0) - callsite_count++; - } + { + if (av[i]->cumulativeDataSent > 0) + callsite_count++; + } if (callsite_count > 0) - { + { - snprintf (buf, 256, - "Callsite Message Sent statistics (all callsites, bytes sent): %d", - callsite_count); - print_section_heading (fp, buf); - fprintf (fp, "%-17s %4s %7s %9s %9s %9s %6s %6s\n", "Name", "Site", - "Tasks", "Max", "Mean", "Min", "MaxRnk", "MinRnk"); - } + snprintf (buf, 256, + "Callsite Message Sent statistics (all callsites, bytes sent): %d", + callsite_count); + print_section_heading (fp, buf); + fprintf (fp, "%-17s %4s %7s %9s %9s %9s %6s %6s\n", "Name", "Site", + "Tasks", "Max", "Mean", "Min", "MaxRnk", "MinRnk"); + } } PMPI_Bcast (&callsite_count, 1, MPI_INT, mpiPi.collectorRank, mpiPi.comm); @@ -2213,82 +2213,82 @@ mpiPi_coll_print_concise_callsite_sent_info (FILE * fp) for (i = 0, ci = 0; i < callsite_count; i++, ci++) { if (mpiPi.rank == mpiPi.collectorRank) - { - task_stats = av[ci]; - while (task_stats->cumulativeDataSent == 0) - { - ci++; - task_stats = av[ci]; - } - } + { + task_stats = av[ci]; + while (task_stats->cumulativeDataSent == 0) + { + ci++; + task_stats = av[ci]; + } + } else - task_stats = &cs_buf; + task_stats = &cs_buf; /* Broadcast current call site to all tasks */ PMPI_Bcast (task_stats, sizeof (callsite_stats_t), - MPI_CHAR, mpiPi.collectorRank, mpiPi.comm); + MPI_CHAR, mpiPi.collectorRank, mpiPi.comm); /* Search for task local entry for the current call site */ task_stats->rank = mpiPi.rank; if (h_search - (mpiPi.task_callsite_stats, task_stats, - (void **) &task_lookup) == NULL) - { - task_lookup = &cs_buf; - task_lookup->count = 0; - task_lookup->cumulativeTime = 0; - task_lookup->cumulativeTimeSquared = 0; - task_lookup->maxDur = 0; - task_lookup->minDur = DBL_MAX; - task_lookup->cumulativeDataSent = 0; - task_lookup->cumulativeIO = 0; - task_lookup->maxDataSent = 0; - task_lookup->minDataSent = DBL_MAX; - task_lookup->maxIO = 0; - task_lookup->minIO = DBL_MAX; - task_lookup->arbitraryMessageCount = 0; - task_lookup->rank = mpiPi.rank; - } + (mpiPi.task_callsite_stats, task_stats, + (void **) &task_lookup) == NULL) + { + task_lookup = &cs_buf; + task_lookup->count = 0; + task_lookup->cumulativeTime = 0; + task_lookup->cumulativeTimeSquared = 0; + task_lookup->maxDur = 0; + task_lookup->minDur = DBL_MAX; + task_lookup->cumulativeDataSent = 0; + task_lookup->cumulativeIO = 0; + task_lookup->maxDataSent = 0; + task_lookup->minDataSent = DBL_MAX; + task_lookup->maxIO = 0; + task_lookup->minIO = DBL_MAX; + task_lookup->arbitraryMessageCount = 0; + task_lookup->rank = mpiPi.rank; + } tot_tasks = 0; task_flag = task_lookup->cumulativeDataSent > 0 ? 1 : 0; /* Get minimum aggregate sent and rank for this call site */ if (task_lookup->cumulativeDataSent > 0) - local_min_sent.val = task_lookup->cumulativeDataSent; + local_min_sent.val = task_lookup->cumulativeDataSent; else - local_min_sent.val = DBL_MAX; + local_min_sent.val = DBL_MAX; local_min_sent.rank = mpiPi.rank; PMPI_Reduce (&local_min_sent, &min_sent, 1, MPI_DOUBLE_INT, MPI_MINLOC, - mpiPi.collectorRank, mpiPi.comm); + mpiPi.collectorRank, mpiPi.comm); /* Get maximum aggregate sent and rank for this call site */ local_max_sent.val = task_lookup->cumulativeDataSent; local_max_sent.rank = mpiPi.rank; PMPI_Reduce (&local_max_sent, &max_sent, 1, MPI_DOUBLE_INT, MPI_MAXLOC, - mpiPi.collectorRank, mpiPi.comm); + mpiPi.collectorRank, mpiPi.comm); /* Get sum of aggregate sent for all tasks for this call site */ PMPI_Reduce (&(task_lookup->cumulativeDataSent), &tot_sent, 1, - MPI_DOUBLE, MPI_SUM, mpiPi.collectorRank, mpiPi.comm); + MPI_DOUBLE, MPI_SUM, mpiPi.collectorRank, mpiPi.comm); /* Get the number of tasks with non-zero values for this call site */ PMPI_Reduce (&task_flag, &tot_tasks, 1, MPI_LONG_LONG, MPI_SUM, - mpiPi.collectorRank, mpiPi.comm); + mpiPi.collectorRank, mpiPi.comm); /* Print summary statistics for this call site */ if (mpiPi.rank == mpiPi.collectorRank) - { - fprintf (fp, - mpiP_Report_Formats[MPIP_CALLSITE_MESS_CONCISE_FMT] - [mpiPi.reportFormat], - &(mpiPi.lookup[av[ci]->op - mpiPi_BASE].name[4]), - av[ci]->csid, tot_tasks, max_sent.val, - tot_sent / tot_tasks, min_sent.val, max_sent.rank, - min_sent.rank); - } + { + fprintf (fp, + mpiP_Report_Formats[MPIP_CALLSITE_MESS_CONCISE_FMT] + [mpiPi.reportFormat], + &(mpiPi.lookup[av[ci]->op - mpiPi_BASE].name[4]), + av[ci]->csid, tot_tasks, max_sent.val, + tot_sent / tot_tasks, min_sent.val, max_sent.rank, + min_sent.rank); + } } if (mpiPi.rank == mpiPi.collectorRank) @@ -2322,20 +2322,20 @@ mpiPi_coll_print_concise_callsite_io_info (FILE * fp) h_gather_data (mpiPi.global_callsite_stats_agg, &ac, (void ***) &av); qsort (av, ac, sizeof (void *), callsite_sort_by_cumulative_io); for (i = 0, callsite_count = 0; i < ac; i++) - { - if (av[i]->cumulativeIO > 0) - callsite_count++; - } + { + if (av[i]->cumulativeIO > 0) + callsite_count++; + } if (callsite_count > 0) - { + { - snprintf (buf, 256, - "Callsite I/O statistics (all callsites, bytes): %d", - callsite_count); - print_section_heading (fp, buf); - fprintf (fp, "%-17s %4s %7s %9s %9s %9s %6s %6s\n", "Name", "Site", - "Tasks", "Max", "Mean", "Min", "MaxRnk", "MinRnk"); - } + snprintf (buf, 256, + "Callsite I/O statistics (all callsites, bytes): %d", + callsite_count); + print_section_heading (fp, buf); + fprintf (fp, "%-17s %4s %7s %9s %9s %9s %6s %6s\n", "Name", "Site", + "Tasks", "Max", "Mean", "Min", "MaxRnk", "MinRnk"); + } } PMPI_Bcast (&callsite_count, 1, MPI_INT, mpiPi.collectorRank, mpiPi.comm); @@ -2348,82 +2348,82 @@ mpiPi_coll_print_concise_callsite_io_info (FILE * fp) for (i = 0, ci = 0; i < callsite_count; i++, ci++) { if (mpiPi.rank == mpiPi.collectorRank) - { - /* Find next call site with IO activity */ - task_stats = av[ci]; - while (task_stats->cumulativeIO == 0) - { - ci++; - task_stats = av[ci]; - } - } + { + /* Find next call site with IO activity */ + task_stats = av[ci]; + while (task_stats->cumulativeIO == 0) + { + ci++; + task_stats = av[ci]; + } + } else - task_stats = &cs_buf; + task_stats = &cs_buf; /* Broadcast current call site to all tasks */ PMPI_Bcast (task_stats, sizeof (callsite_stats_t), - MPI_CHAR, mpiPi.collectorRank, mpiPi.comm); + MPI_CHAR, mpiPi.collectorRank, mpiPi.comm); /* Search for task local entry for the current call site */ task_stats->rank = mpiPi.rank; if (h_search - (mpiPi.task_callsite_stats, task_stats, - (void **) &task_lookup) == NULL) - { - task_lookup = &cs_buf; - task_lookup->count = 0; - task_lookup->cumulativeTime = 0; - task_lookup->cumulativeTimeSquared = 0; - task_lookup->maxDur = 0; - task_lookup->minDur = DBL_MAX; - task_lookup->cumulativeDataSent = 0; - task_lookup->cumulativeIO = 0; - task_lookup->maxDataSent = 0; - task_lookup->minDataSent = DBL_MAX; - task_lookup->maxIO = 0; - task_lookup->minIO = DBL_MAX; - task_lookup->arbitraryMessageCount = 0; - task_lookup->rank = mpiPi.rank; - } + (mpiPi.task_callsite_stats, task_stats, + (void **) &task_lookup) == NULL) + { + task_lookup = &cs_buf; + task_lookup->count = 0; + task_lookup->cumulativeTime = 0; + task_lookup->cumulativeTimeSquared = 0; + task_lookup->maxDur = 0; + task_lookup->minDur = DBL_MAX; + task_lookup->cumulativeDataSent = 0; + task_lookup->cumulativeIO = 0; + task_lookup->maxDataSent = 0; + task_lookup->minDataSent = DBL_MAX; + task_lookup->maxIO = 0; + task_lookup->minIO = DBL_MAX; + task_lookup->arbitraryMessageCount = 0; + task_lookup->rank = mpiPi.rank; + } tot_tasks = 0; task_flag = task_lookup->cumulativeIO > 0 ? 1 : 0; /* Get minimum aggregate io and rank for this call site */ if (task_lookup->cumulativeIO > 0) - local_min_io.val = task_lookup->cumulativeIO; + local_min_io.val = task_lookup->cumulativeIO; else - local_min_io.val = DBL_MAX; + local_min_io.val = DBL_MAX; local_min_io.rank = mpiPi.rank; PMPI_Reduce (&local_min_io, &min_io, 1, MPI_DOUBLE_INT, MPI_MINLOC, - mpiPi.collectorRank, mpiPi.comm); + mpiPi.collectorRank, mpiPi.comm); /* Get maximum aggregate io and rank for this call site */ local_max_io.val = task_lookup->cumulativeIO; local_max_io.rank = mpiPi.rank; PMPI_Reduce (&local_max_io, &max_io, 1, MPI_DOUBLE_INT, MPI_MAXLOC, - mpiPi.collectorRank, mpiPi.comm); + mpiPi.collectorRank, mpiPi.comm); /* Get sum of aggregate io for all tasks for this call site */ PMPI_Reduce (&(task_lookup->cumulativeIO), &tot_io, 1, MPI_DOUBLE, - MPI_SUM, mpiPi.collectorRank, mpiPi.comm); + MPI_SUM, mpiPi.collectorRank, mpiPi.comm); /* Get the number of tasks with non-zero values for this call site */ PMPI_Reduce (&task_flag, &tot_tasks, 1, MPI_LONG_LONG, MPI_SUM, - mpiPi.collectorRank, mpiPi.comm); + mpiPi.collectorRank, mpiPi.comm); /* Print summary statistics for this call site */ if (mpiPi.rank == mpiPi.collectorRank) - { - fprintf (fp, - mpiP_Report_Formats[MPIP_CALLSITE_MESS_CONCISE_FMT] - [mpiPi.reportFormat], - &(mpiPi.lookup[av[ci]->op - mpiPi_BASE].name[4]), - av[ci]->csid, tot_tasks, max_io.val, tot_io / tot_tasks, - min_io.val, max_io.rank, min_io.rank); - } + { + fprintf (fp, + mpiP_Report_Formats[MPIP_CALLSITE_MESS_CONCISE_FMT] + [mpiPi.reportFormat], + &(mpiPi.lookup[av[ci]->op - mpiPi_BASE].name[4]), + av[ci]->csid, tot_tasks, max_io.val, tot_io / tot_tasks, + min_io.val, max_io.rank, min_io.rank); + } } if (mpiPi.rank == mpiPi.collectorRank) @@ -2453,20 +2453,20 @@ mpiPi_coll_print_concise_callsite_rma_info (FILE * fp) h_gather_data (mpiPi.global_callsite_stats_agg, &ac, (void ***) &av); qsort (av, ac, sizeof (void *), callsite_sort_by_cumulative_rma); for (i = 0, callsite_count = 0; i < ac; i++) - { - if (av[i]->cumulativeRMA > 0) - callsite_count++; - } + { + if (av[i]->cumulativeRMA > 0) + callsite_count++; + } if (callsite_count > 0) - { + { - snprintf (buf, 256, - "Callsite RMA Target statistics (all callsites, bytes): %d", - callsite_count); - print_section_heading (fp, buf); - fprintf (fp, "%-17s %4s %7s %9s %9s %9s %6s %6s\n", "Name", "Site", - "Tasks", "Max", "Mean", "Min", "MaxRnk", "MinRnk"); - } + snprintf (buf, 256, + "Callsite RMA Target statistics (all callsites, bytes): %d", + callsite_count); + print_section_heading (fp, buf); + fprintf (fp, "%-17s %4s %7s %9s %9s %9s %6s %6s\n", "Name", "Site", + "Tasks", "Max", "Mean", "Min", "MaxRnk", "MinRnk"); + } } PMPI_Bcast (&callsite_count, 1, MPI_INT, mpiPi.collectorRank, mpiPi.comm); @@ -2479,83 +2479,83 @@ mpiPi_coll_print_concise_callsite_rma_info (FILE * fp) for (i = 0, ci = 0; i < callsite_count; i++, ci++) { if (mpiPi.rank == mpiPi.collectorRank) - { - task_stats = av[ci]; - while (task_stats->cumulativeRMA == 0) - { - ci++; - task_stats = av[ci]; - } - } + { + task_stats = av[ci]; + while (task_stats->cumulativeRMA == 0) + { + ci++; + task_stats = av[ci]; + } + } else - task_stats = &cs_buf; + task_stats = &cs_buf; /* Broadcast current call site to all tasks */ PMPI_Bcast (task_stats, sizeof (callsite_stats_t), - MPI_CHAR, mpiPi.collectorRank, mpiPi.comm); + MPI_CHAR, mpiPi.collectorRank, mpiPi.comm); /* Search for task local entry for the current call site */ task_stats->rank = mpiPi.rank; if (h_search - (mpiPi.task_callsite_stats, task_stats, - (void **) &task_lookup) == NULL) - { - task_lookup = &cs_buf; - task_lookup->count = 0; - task_lookup->cumulativeTime = 0; - task_lookup->cumulativeTimeSquared = 0; - task_lookup->maxDur = 0; - task_lookup->minDur = DBL_MAX; - task_lookup->cumulativeDataSent = 0; - task_lookup->cumulativeIO = 0; - task_lookup->cumulativeRMA = 0; - task_lookup->maxDataSent = 0; - task_lookup->minDataSent = DBL_MAX; - task_lookup->maxIO = 0; - task_lookup->minIO = DBL_MAX; - task_lookup->arbitraryMessageCount = 0; - task_lookup->rank = mpiPi.rank; - } + (mpiPi.task_callsite_stats, task_stats, + (void **) &task_lookup) == NULL) + { + task_lookup = &cs_buf; + task_lookup->count = 0; + task_lookup->cumulativeTime = 0; + task_lookup->cumulativeTimeSquared = 0; + task_lookup->maxDur = 0; + task_lookup->minDur = DBL_MAX; + task_lookup->cumulativeDataSent = 0; + task_lookup->cumulativeIO = 0; + task_lookup->cumulativeRMA = 0; + task_lookup->maxDataSent = 0; + task_lookup->minDataSent = DBL_MAX; + task_lookup->maxIO = 0; + task_lookup->minIO = DBL_MAX; + task_lookup->arbitraryMessageCount = 0; + task_lookup->rank = mpiPi.rank; + } tot_tasks = 0; task_flag = task_lookup->cumulativeRMA > 0 ? 1 : 0; /* Get minimum aggregate sent and rank for this call site */ if (task_lookup->cumulativeRMA > 0) - local_min_sent.val = task_lookup->cumulativeRMA; + local_min_sent.val = task_lookup->cumulativeRMA; else - local_min_sent.val = DBL_MAX; + local_min_sent.val = DBL_MAX; local_min_sent.rank = mpiPi.rank; PMPI_Reduce (&local_min_sent, &min_sent, 1, MPI_DOUBLE_INT, MPI_MINLOC, - mpiPi.collectorRank, mpiPi.comm); + mpiPi.collectorRank, mpiPi.comm); /* Get maximum aggregate sent and rank for this call site */ local_max_sent.val = task_lookup->cumulativeRMA; local_max_sent.rank = mpiPi.rank; PMPI_Reduce (&local_max_sent, &max_sent, 1, MPI_DOUBLE_INT, MPI_MAXLOC, - mpiPi.collectorRank, mpiPi.comm); + mpiPi.collectorRank, mpiPi.comm); /* Get sum of aggregate sent for all tasks for this call site */ PMPI_Reduce (&(task_lookup->cumulativeRMA), &tot_sent, 1, - MPI_DOUBLE, MPI_SUM, mpiPi.collectorRank, mpiPi.comm); + MPI_DOUBLE, MPI_SUM, mpiPi.collectorRank, mpiPi.comm); /* Get the number of tasks with non-zero values for this call site */ PMPI_Reduce (&task_flag, &tot_tasks, 1, MPI_LONG_LONG, MPI_SUM, - mpiPi.collectorRank, mpiPi.comm); + mpiPi.collectorRank, mpiPi.comm); /* Print summary statistics for this call site */ if (mpiPi.rank == mpiPi.collectorRank) - { - fprintf (fp, - mpiP_Report_Formats[MPIP_CALLSITE_MESS_CONCISE_FMT] - [mpiPi.reportFormat], - &(mpiPi.lookup[av[ci]->op - mpiPi_BASE].name[4]), - av[ci]->csid, tot_tasks, max_sent.val, - tot_sent / tot_tasks, min_sent.val, max_sent.rank, - min_sent.rank); - } + { + fprintf (fp, + mpiP_Report_Formats[MPIP_CALLSITE_MESS_CONCISE_FMT] + [mpiPi.reportFormat], + &(mpiPi.lookup[av[ci]->op - mpiPi_BASE].name[4]), + av[ci]->csid, tot_tasks, max_sent.val, + tot_sent / tot_tasks, min_sent.val, max_sent.rank, + min_sent.rank); + } } if (mpiPi.rank == mpiPi.collectorRank) @@ -2580,38 +2580,38 @@ mpiPi_coll_print_all_callsite_sent_info (FILE * fp) int malloc_check = 1; PMPI_Bcast (&mpiPi.global_mpi_sent_count, 1, MPI_LONG_LONG, - mpiPi.collectorRank, mpiPi.comm); + mpiPi.collectorRank, mpiPi.comm); if (mpiPi.global_mpi_sent_count > 0) { /* Gather global callsite information at collectorRank and print header */ if (mpiPi.rank == mpiPi.collectorRank) - { - h_gather_data (mpiPi.global_callsite_stats_agg, &ac, - (void ***) &av); - qsort (av, ac, sizeof (void *), callsite_sort_by_name_id_rank); - task_data = malloc (sizeof (callsite_stats_t) * mpiPi.size); - - if (task_data == NULL) - { - mpiPi_msg_warn - ("Failed to allocate space for task volume data\n"); - malloc_check = 0; - free (av); - } - else - { - sprintf (buf, - "Callsite Message Sent statistics (all, sent bytes)"); - print_section_heading (fp, buf); - fprintf (fp, "%-17s %4s %4s %7s %9s %9s %9s %9s\n", "Name", - "Site", "Rank", "Count", "Max", "Mean", "Min", "Sum"); - } - } + { + h_gather_data (mpiPi.global_callsite_stats_agg, &ac, + (void ***) &av); + qsort (av, ac, sizeof (void *), callsite_sort_by_name_id_rank); + task_data = malloc (sizeof (callsite_stats_t) * mpiPi.size); + + if (task_data == NULL) + { + mpiPi_msg_warn + ("Failed to allocate space for task volume data\n"); + malloc_check = 0; + free (av); + } + else + { + sprintf (buf, + "Callsite Message Sent statistics (all, sent bytes)"); + print_section_heading (fp, buf); + fprintf (fp, "%-17s %4s %4s %7s %9s %9s %9s %9s\n", "Name", + "Site", "Rank", "Count", "Max", "Mean", "Min", "Sum"); + } + } /* Check whether collector malloc succeeded. */ PMPI_Bcast (&malloc_check, 1, MPI_INT, mpiPi.collectorRank, mpiPi.comm); if (malloc_check == 0) - return; + return; PMPI_Bcast (&ac, 1, MPI_INT, mpiPi.collectorRank, mpiPi.comm); @@ -2622,99 +2622,99 @@ mpiPi_coll_print_all_callsite_sent_info (FILE * fp) * Gather all task info at collectorRank */ for (i = 0; i < ac; i++) - { - if (mpiPi.rank == mpiPi.collectorRank) - task_stats = av[i]; - else - task_stats = &cs_buf; - - tot_data_sent = task_stats->cumulativeDataSent; - PMPI_Bcast (&tot_data_sent, 1, MPI_DOUBLE, mpiPi.collectorRank, - mpiPi.comm); - - if (tot_data_sent > 0) - { - PMPI_Bcast (task_stats, sizeof (callsite_stats_t), - MPI_CHAR, mpiPi.collectorRank, mpiPi.comm); - - task_stats->rank = mpiPi.rank; - - if (h_search - (mpiPi.task_callsite_stats, task_stats, - (void **) &task_lookup) == NULL) - { - task_lookup = &cs_buf; - task_lookup->count = 0; - task_lookup->cumulativeTime = 0; - task_lookup->cumulativeTimeSquared = 0; - task_lookup->maxDur = 0; - task_lookup->minDur = 0; - task_lookup->cumulativeDataSent = 0; - task_lookup->cumulativeIO = 0; - task_lookup->maxDataSent = 0; - task_lookup->minDataSent = 0; - task_lookup->maxIO = 0; - task_lookup->minIO = 0; - task_lookup->arbitraryMessageCount = 0; - task_lookup->op = 0; - } - - PMPI_Gather (task_lookup, sizeof (callsite_stats_t), - MPI_CHAR, task_data, - sizeof (callsite_stats_t), MPI_CHAR, - mpiPi.collectorRank, mpiPi.comm); - - if (mpiPi.rank == mpiPi.collectorRank) - { - sCount = 0; - sMax = 0; - sMin = DBL_MAX; - sCumulative = 0; - - for (j = 0; j < mpiPi.size; j++) - { - if (task_data[j].cumulativeDataSent > 0) - { - sCount += task_data[j].count; - sCumulative += task_data[j].cumulativeDataSent; - sMax = max (task_data[j].maxDataSent, sMax); - sMin = min (task_data[j].minDataSent, sMin); - - fprintf (fp, - mpiP_Report_Formats - [MPIP_CALLSITE_MESS_RANK_FMT] - [mpiPi.reportFormat], - &(mpiPi.lookup[av[i]->op - mpiPi_BASE]. - name[4]), av[i]->csid, task_data[j].rank, - task_data[j].count, - task_data[j].maxDataSent, - task_data[j].cumulativeDataSent / - task_data[j].count, - task_data[j].minDataSent, - task_data[j].cumulativeDataSent); - } - - } - if (sCumulative > 0) - { - fprintf (fp, - mpiP_Report_Formats - [MPIP_CALLSITE_MESS_SUMMARY_FMT] - [mpiPi.reportFormat], - &(mpiPi.lookup[av[i]->op - mpiPi_BASE]. - name[4]), av[i]->csid, "*", sCount, sMax, - sCumulative / sCount, sMin, sCumulative); - } - fprintf (fp, "\n"); - } - } - } + { + if (mpiPi.rank == mpiPi.collectorRank) + task_stats = av[i]; + else + task_stats = &cs_buf; + + tot_data_sent = task_stats->cumulativeDataSent; + PMPI_Bcast (&tot_data_sent, 1, MPI_DOUBLE, mpiPi.collectorRank, + mpiPi.comm); + + if (tot_data_sent > 0) + { + PMPI_Bcast (task_stats, sizeof (callsite_stats_t), + MPI_CHAR, mpiPi.collectorRank, mpiPi.comm); + + task_stats->rank = mpiPi.rank; + + if (h_search + (mpiPi.task_callsite_stats, task_stats, + (void **) &task_lookup) == NULL) + { + task_lookup = &cs_buf; + task_lookup->count = 0; + task_lookup->cumulativeTime = 0; + task_lookup->cumulativeTimeSquared = 0; + task_lookup->maxDur = 0; + task_lookup->minDur = 0; + task_lookup->cumulativeDataSent = 0; + task_lookup->cumulativeIO = 0; + task_lookup->maxDataSent = 0; + task_lookup->minDataSent = 0; + task_lookup->maxIO = 0; + task_lookup->minIO = 0; + task_lookup->arbitraryMessageCount = 0; + task_lookup->op = 0; + } + + PMPI_Gather (task_lookup, sizeof (callsite_stats_t), + MPI_CHAR, task_data, + sizeof (callsite_stats_t), MPI_CHAR, + mpiPi.collectorRank, mpiPi.comm); + + if (mpiPi.rank == mpiPi.collectorRank) + { + sCount = 0; + sMax = 0; + sMin = DBL_MAX; + sCumulative = 0; + + for (j = 0; j < mpiPi.size; j++) + { + if (task_data[j].cumulativeDataSent > 0) + { + sCount += task_data[j].count; + sCumulative += task_data[j].cumulativeDataSent; + sMax = max (task_data[j].maxDataSent, sMax); + sMin = min (task_data[j].minDataSent, sMin); + + fprintf (fp, + mpiP_Report_Formats + [MPIP_CALLSITE_MESS_RANK_FMT] + [mpiPi.reportFormat], + &(mpiPi.lookup[av[i]->op - mpiPi_BASE]. + name[4]), av[i]->csid, task_data[j].rank, + task_data[j].count, + task_data[j].maxDataSent, + task_data[j].cumulativeDataSent / + task_data[j].count, + task_data[j].minDataSent, + task_data[j].cumulativeDataSent); + } + + } + if (sCumulative > 0) + { + fprintf (fp, + mpiP_Report_Formats + [MPIP_CALLSITE_MESS_SUMMARY_FMT] + [mpiPi.reportFormat], + &(mpiPi.lookup[av[i]->op - mpiPi_BASE]. + name[4]), av[i]->csid, "*", sCount, sMax, + sCumulative / sCount, sMin, sCumulative); + } + fprintf (fp, "\n"); + } + } + } if (mpiPi.rank == mpiPi.collectorRank) - { - free (av); - free (task_data); - } + { + free (av); + free (task_data); + } } } @@ -2738,37 +2738,37 @@ mpiPi_coll_print_all_callsite_io_info (FILE * fp) #endif PMPI_Bcast (&mpiPi.global_mpi_io, 1, MPI_DOUBLE, mpiPi.collectorRank, - mpiPi.comm); + mpiPi.comm); if (mpiPi.global_mpi_io > 0) { /* Gather global callsite information at collectorRank and print header */ if (mpiPi.rank == mpiPi.collectorRank) - { - h_gather_data (mpiPi.global_callsite_stats_agg, &ac, - (void ***) &av); - qsort (av, ac, sizeof (void *), callsite_sort_by_name_id_rank); - task_data = malloc (sizeof (callsite_stats_t) * mpiPi.size); - - if (task_data == NULL) - { - mpiPi_msg_warn ("Failed to allocate space for task I/O data\n"); - malloc_check = 0; - free (av); - } - else - { - sprintf (buf, "Callsite I/O statistics (all, I/O bytes)"); - print_section_heading (fp, buf); - fprintf (fp, "%-17s %4s %4s %7s %9s %9s %9s %9s\n", "Name", - "Site", "Rank", "Count", "Max", "Mean", "Min", "Sum"); - } - } + { + h_gather_data (mpiPi.global_callsite_stats_agg, &ac, + (void ***) &av); + qsort (av, ac, sizeof (void *), callsite_sort_by_name_id_rank); + task_data = malloc (sizeof (callsite_stats_t) * mpiPi.size); + + if (task_data == NULL) + { + mpiPi_msg_warn ("Failed to allocate space for task I/O data\n"); + malloc_check = 0; + free (av); + } + else + { + sprintf (buf, "Callsite I/O statistics (all, I/O bytes)"); + print_section_heading (fp, buf); + fprintf (fp, "%-17s %4s %4s %7s %9s %9s %9s %9s\n", "Name", + "Site", "Rank", "Count", "Max", "Mean", "Min", "Sum"); + } + } /* Check whether collector malloc succeeded. */ PMPI_Bcast (&malloc_check, 1, MPI_INT, mpiPi.collectorRank, mpiPi.comm); if (malloc_check == 0) - return; + return; PMPI_Bcast (&ac, 1, MPI_INT, mpiPi.collectorRank, mpiPi.comm); @@ -2778,97 +2778,97 @@ mpiPi_coll_print_all_callsite_io_info (FILE * fp) * Gather all task info at collectorRank */ for (i = 0; i < ac; i++) - { - if (mpiPi.rank == mpiPi.collectorRank) - task_stats = av[i]; - else - task_stats = &cs_buf; - - tot_data_sent = task_stats->cumulativeIO; - PMPI_Bcast (&tot_data_sent, 1, MPI_DOUBLE, mpiPi.collectorRank, - mpiPi.comm); - - if (tot_data_sent > 0) - { - PMPI_Bcast (task_stats, sizeof (callsite_stats_t), - MPI_CHAR, mpiPi.collectorRank, mpiPi.comm); - - task_stats->rank = mpiPi.rank; - - if (h_search - (mpiPi.task_callsite_stats, task_stats, - (void **) &task_lookup) == NULL) - { - task_lookup = &cs_buf; - task_lookup->count = 0; - task_lookup->cumulativeTime = 0; - task_lookup->cumulativeTimeSquared = 0; - task_lookup->maxDur = 0; - task_lookup->minDur = 0; - task_lookup->cumulativeDataSent = 0; - task_lookup->cumulativeIO = 0; - task_lookup->maxDataSent = 0; - task_lookup->minDataSent = 0; - task_lookup->maxIO = 0; - task_lookup->minIO = 0; - task_lookup->arbitraryMessageCount = 0; - } - - PMPI_Gather (task_lookup, sizeof (callsite_stats_t), - MPI_CHAR, task_data, - sizeof (callsite_stats_t), MPI_CHAR, - mpiPi.collectorRank, mpiPi.comm); - - if (mpiPi.rank == mpiPi.collectorRank) - { - sCount = 0; - sMax = 0; - sMin = DBL_MAX; - sCumulative = 0; - - for (j = 0; j < mpiPi.size; j++) - { - if (task_data[j].cumulativeIO > 0) - { - sCount += task_data[j].count; - sCumulative += task_data[j].cumulativeIO; - sMax = max (task_data[j].maxIO, sMax); - sMin = min (task_data[j].minIO, sMin); - - fprintf (fp, - mpiP_Report_Formats - [MPIP_CALLSITE_IO_RANK_FMT] - [mpiPi.reportFormat], - &(mpiPi.lookup - [task_data[j].op - mpiPi_BASE].name[4]), - av[i]->csid, task_data[j].rank, - task_data[j].count, task_data[j].maxIO, - task_data[j].cumulativeIO / - task_data[j].count, task_data[j].minIO, - task_data[j].cumulativeIO); - } - } - if (sCumulative > 0) - { - fprintf (fp, - mpiP_Report_Formats - [MPIP_CALLSITE_IO_SUMMARY_FMT] - [mpiPi.reportFormat], - &(mpiPi.lookup - [task_data[j - 1].op - mpiPi_BASE].name[4]), - av[i]->csid, "*", sCount, sMax, - sCumulative / sCount, sMin, sCumulative); - } - fprintf (fp, "\n"); - } - } - } + { + if (mpiPi.rank == mpiPi.collectorRank) + task_stats = av[i]; + else + task_stats = &cs_buf; + + tot_data_sent = task_stats->cumulativeIO; + PMPI_Bcast (&tot_data_sent, 1, MPI_DOUBLE, mpiPi.collectorRank, + mpiPi.comm); + + if (tot_data_sent > 0) + { + PMPI_Bcast (task_stats, sizeof (callsite_stats_t), + MPI_CHAR, mpiPi.collectorRank, mpiPi.comm); + + task_stats->rank = mpiPi.rank; + + if (h_search + (mpiPi.task_callsite_stats, task_stats, + (void **) &task_lookup) == NULL) + { + task_lookup = &cs_buf; + task_lookup->count = 0; + task_lookup->cumulativeTime = 0; + task_lookup->cumulativeTimeSquared = 0; + task_lookup->maxDur = 0; + task_lookup->minDur = 0; + task_lookup->cumulativeDataSent = 0; + task_lookup->cumulativeIO = 0; + task_lookup->maxDataSent = 0; + task_lookup->minDataSent = 0; + task_lookup->maxIO = 0; + task_lookup->minIO = 0; + task_lookup->arbitraryMessageCount = 0; + } + + PMPI_Gather (task_lookup, sizeof (callsite_stats_t), + MPI_CHAR, task_data, + sizeof (callsite_stats_t), MPI_CHAR, + mpiPi.collectorRank, mpiPi.comm); + + if (mpiPi.rank == mpiPi.collectorRank) + { + sCount = 0; + sMax = 0; + sMin = DBL_MAX; + sCumulative = 0; + + for (j = 0; j < mpiPi.size; j++) + { + if (task_data[j].cumulativeIO > 0) + { + sCount += task_data[j].count; + sCumulative += task_data[j].cumulativeIO; + sMax = max (task_data[j].maxIO, sMax); + sMin = min (task_data[j].minIO, sMin); + + fprintf (fp, + mpiP_Report_Formats + [MPIP_CALLSITE_IO_RANK_FMT] + [mpiPi.reportFormat], + &(mpiPi.lookup + [task_data[j].op - mpiPi_BASE].name[4]), + av[i]->csid, task_data[j].rank, + task_data[j].count, task_data[j].maxIO, + task_data[j].cumulativeIO / + task_data[j].count, task_data[j].minIO, + task_data[j].cumulativeIO); + } + } + if (sCumulative > 0) + { + fprintf (fp, + mpiP_Report_Formats + [MPIP_CALLSITE_IO_SUMMARY_FMT] + [mpiPi.reportFormat], + &(mpiPi.lookup + [task_data[j - 1].op - mpiPi_BASE].name[4]), + av[i]->csid, "*", sCount, sMax, + sCumulative / sCount, sMin, sCumulative); + } + fprintf (fp, "\n"); + } + } + } if (mpiPi.rank == mpiPi.collectorRank) - { - free (av); - free (task_data); - } + { + free (av); + free (task_data); + } } } @@ -2889,37 +2889,37 @@ mpiPi_coll_print_all_callsite_rma_info (FILE * fp) int malloc_check = 1; PMPI_Bcast (&mpiPi.global_mpi_rma, 1, MPI_DOUBLE, mpiPi.collectorRank, - mpiPi.comm); + mpiPi.comm); if (mpiPi.global_mpi_rma > 0) { /* Gather global callsite information at collectorRank and print header */ if (mpiPi.rank == mpiPi.collectorRank) - { - h_gather_data (mpiPi.global_callsite_stats_agg, &ac, - (void ***) &av); - qsort (av, ac, sizeof (void *), callsite_sort_by_name_id_rank); - task_data = malloc (sizeof (callsite_stats_t) * mpiPi.size); - - if (task_data == NULL) - { - mpiPi_msg_warn ("Failed to allocate space for task RMA data\n"); - malloc_check = 0; - free (av); - } - else - { - sprintf (buf, "Callsite RMA statistics (all, origin bytes)"); - print_section_heading (fp, buf); - fprintf (fp, "%-17s %4s %4s %7s %9s %9s %9s %9s\n", "Name", - "Site", "Rank", "Count", "Max", "Mean", "Min", "Sum"); - } - } + { + h_gather_data (mpiPi.global_callsite_stats_agg, &ac, + (void ***) &av); + qsort (av, ac, sizeof (void *), callsite_sort_by_name_id_rank); + task_data = malloc (sizeof (callsite_stats_t) * mpiPi.size); + + if (task_data == NULL) + { + mpiPi_msg_warn ("Failed to allocate space for task RMA data\n"); + malloc_check = 0; + free (av); + } + else + { + sprintf (buf, "Callsite RMA statistics (all, origin bytes)"); + print_section_heading (fp, buf); + fprintf (fp, "%-17s %4s %4s %7s %9s %9s %9s %9s\n", "Name", + "Site", "Rank", "Count", "Max", "Mean", "Min", "Sum"); + } + } /* Check whether collector malloc succeeded. */ PMPI_Bcast (&malloc_check, 1, MPI_INT, mpiPi.collectorRank, mpiPi.comm); if (malloc_check == 0) - return; + return; PMPI_Bcast (&ac, 1, MPI_INT, mpiPi.collectorRank, mpiPi.comm); @@ -2929,98 +2929,98 @@ mpiPi_coll_print_all_callsite_rma_info (FILE * fp) * Gather all task info at collectorRank */ for (i = 0; i < ac; i++) - { - if (mpiPi.rank == mpiPi.collectorRank) - task_stats = av[i]; - else - task_stats = &cs_buf; - - tot_data_sent = task_stats->cumulativeRMA; - PMPI_Bcast (&tot_data_sent, 1, MPI_DOUBLE, mpiPi.collectorRank, - mpiPi.comm); - - if (tot_data_sent > 0) - { - PMPI_Bcast (task_stats, sizeof (callsite_stats_t), - MPI_CHAR, mpiPi.collectorRank, mpiPi.comm); - - task_stats->rank = mpiPi.rank; - - if (h_search - (mpiPi.task_callsite_stats, task_stats, - (void **) &task_lookup) == NULL) - { - task_lookup = &cs_buf; - task_lookup->count = 0; - task_lookup->cumulativeTime = 0; - task_lookup->cumulativeTimeSquared = 0; - task_lookup->maxDur = 0; - task_lookup->minDur = 0; - task_lookup->cumulativeDataSent = 0; - task_lookup->cumulativeIO = 0; - task_lookup->cumulativeRMA = 0; - task_lookup->maxDataSent = 0; - task_lookup->minDataSent = 0; - task_lookup->maxIO = 0; - task_lookup->minIO = 0; - task_lookup->arbitraryMessageCount = 0; - } - - PMPI_Gather (task_lookup, sizeof (callsite_stats_t), - MPI_CHAR, task_data, - sizeof (callsite_stats_t), MPI_CHAR, - mpiPi.collectorRank, mpiPi.comm); - - if (mpiPi.rank == mpiPi.collectorRank) - { - sCount = 0; - sMax = 0; - sMin = DBL_MAX; - sCumulative = 0; - - for (j = 0; j < mpiPi.size; j++) - { - if (task_data[j].cumulativeRMA > 0) - { - sCount += task_data[j].count; - sCumulative += task_data[j].cumulativeRMA; - sMax = max (task_data[j].maxRMA, sMax); - sMin = min (task_data[j].minRMA, sMin); - - fprintf (fp, - mpiP_Report_Formats - [MPIP_CALLSITE_IO_RANK_FMT] - [mpiPi.reportFormat], - &(mpiPi.lookup - [task_data[j].op - mpiPi_BASE].name[4]), - av[i]->csid, task_data[j].rank, - task_data[j].count, task_data[j].maxRMA, - task_data[j].cumulativeRMA / - task_data[j].count, task_data[j].minRMA, - task_data[j].cumulativeRMA); - } - } - if (sCumulative > 0) - { - fprintf (fp, - mpiP_Report_Formats - [MPIP_CALLSITE_IO_SUMMARY_FMT] - [mpiPi.reportFormat], - &(mpiPi.lookup - [task_data[j - 1].op - mpiPi_BASE].name[4]), - av[i]->csid, "*", sCount, sMax, - sCumulative / sCount, sMin, sCumulative); - } - fprintf (fp, "\n"); - } - } - } + { + if (mpiPi.rank == mpiPi.collectorRank) + task_stats = av[i]; + else + task_stats = &cs_buf; + + tot_data_sent = task_stats->cumulativeRMA; + PMPI_Bcast (&tot_data_sent, 1, MPI_DOUBLE, mpiPi.collectorRank, + mpiPi.comm); + + if (tot_data_sent > 0) + { + PMPI_Bcast (task_stats, sizeof (callsite_stats_t), + MPI_CHAR, mpiPi.collectorRank, mpiPi.comm); + + task_stats->rank = mpiPi.rank; + + if (h_search + (mpiPi.task_callsite_stats, task_stats, + (void **) &task_lookup) == NULL) + { + task_lookup = &cs_buf; + task_lookup->count = 0; + task_lookup->cumulativeTime = 0; + task_lookup->cumulativeTimeSquared = 0; + task_lookup->maxDur = 0; + task_lookup->minDur = 0; + task_lookup->cumulativeDataSent = 0; + task_lookup->cumulativeIO = 0; + task_lookup->cumulativeRMA = 0; + task_lookup->maxDataSent = 0; + task_lookup->minDataSent = 0; + task_lookup->maxIO = 0; + task_lookup->minIO = 0; + task_lookup->arbitraryMessageCount = 0; + } + + PMPI_Gather (task_lookup, sizeof (callsite_stats_t), + MPI_CHAR, task_data, + sizeof (callsite_stats_t), MPI_CHAR, + mpiPi.collectorRank, mpiPi.comm); + + if (mpiPi.rank == mpiPi.collectorRank) + { + sCount = 0; + sMax = 0; + sMin = DBL_MAX; + sCumulative = 0; + + for (j = 0; j < mpiPi.size; j++) + { + if (task_data[j].cumulativeRMA > 0) + { + sCount += task_data[j].count; + sCumulative += task_data[j].cumulativeRMA; + sMax = max (task_data[j].maxRMA, sMax); + sMin = min (task_data[j].minRMA, sMin); + + fprintf (fp, + mpiP_Report_Formats + [MPIP_CALLSITE_IO_RANK_FMT] + [mpiPi.reportFormat], + &(mpiPi.lookup + [task_data[j].op - mpiPi_BASE].name[4]), + av[i]->csid, task_data[j].rank, + task_data[j].count, task_data[j].maxRMA, + task_data[j].cumulativeRMA / + task_data[j].count, task_data[j].minRMA, + task_data[j].cumulativeRMA); + } + } + if (sCumulative > 0) + { + fprintf (fp, + mpiP_Report_Formats + [MPIP_CALLSITE_IO_SUMMARY_FMT] + [mpiPi.reportFormat], + &(mpiPi.lookup + [task_data[j - 1].op - mpiPi_BASE].name[4]), + av[i]->csid, "*", sCount, sMax, + sCumulative / sCount, sMin, sCumulative); + } + fprintf (fp, "\n"); + } + } + } if (mpiPi.rank == mpiPi.collectorRank) - { - free (av); - free (task_data); - } + { + free (av); + free (task_data); + } } } @@ -3056,37 +3056,37 @@ mpiPi_profile_print_concise (FILE * fp) mpiPi_print_top_time_sites (fp); mpiPi_print_top_sent_sites (fp); if (mpiPi.do_collective_stats_report) - mpiPi_print_top_collective_sent_sites (fp); + mpiPi_print_top_collective_sent_sites (fp); if (mpiPi.do_pt2pt_stats_report) - mpiPi_print_top_pt2pt_sent_sites (fp); + mpiPi_print_top_pt2pt_sent_sites (fp); mpiPi_print_top_io_sites (fp); mpiPi_print_top_rma_sites (fp); if (mpiPi.collective_report == 0) - { - if (mpiPi.print_callsite_detail) - { - mpiPi_print_callsites (fp); - mpiPi_print_concise_callsite_time_info (fp); - mpiPi_print_concise_callsite_sent_info (fp); - mpiPi_print_concise_callsite_io_info (fp); - mpiPi_print_concise_callsite_rma_info (fp); - } - } + { + if (mpiPi.print_callsite_detail) + { + mpiPi_print_callsites (fp); + mpiPi_print_concise_callsite_time_info (fp); + mpiPi_print_concise_callsite_sent_info (fp); + mpiPi_print_concise_callsite_io_info (fp); + mpiPi_print_concise_callsite_rma_info (fp); + } + } } if (mpiPi.collective_report == 1) { if (mpiPi.print_callsite_detail) - { - if (mpiPi.collectorRank == mpiPi.rank) - mpiPi_print_callsites (fp); + { + if (mpiPi.collectorRank == mpiPi.rank) + mpiPi_print_callsites (fp); - mpiPi_coll_print_concise_callsite_time_info (fp); - mpiPi_coll_print_concise_callsite_sent_info (fp); - mpiPi_coll_print_concise_callsite_io_info (fp); - mpiPi_coll_print_concise_callsite_rma_info (fp); - } + mpiPi_coll_print_concise_callsite_time_info (fp); + mpiPi_coll_print_concise_callsite_sent_info (fp); + mpiPi_coll_print_concise_callsite_io_info (fp); + mpiPi_coll_print_concise_callsite_rma_info (fp); + } } } @@ -3101,14 +3101,14 @@ mpiPi_profile_print_verbose (FILE * fp) mpiPi_print_verbose_task_info (fp); if (mpiPi.print_callsite_detail) - mpiPi_print_callsites (fp); + mpiPi_print_callsites (fp); mpiPi_print_top_time_sites (fp); mpiPi_print_top_sent_sites (fp); if (mpiPi.do_collective_stats_report) - mpiPi_print_top_collective_sent_sites (fp); + mpiPi_print_top_collective_sent_sites (fp); if (mpiPi.do_pt2pt_stats_report) - mpiPi_print_top_pt2pt_sent_sites (fp); + mpiPi_print_top_pt2pt_sent_sites (fp); mpiPi_print_top_io_sites (fp); mpiPi_print_top_rma_sites (fp); } @@ -3116,39 +3116,37 @@ mpiPi_profile_print_verbose (FILE * fp) if (mpiPi.print_callsite_detail) { if (mpiPi.collective_report == 1) - { - mpiPi_msg_debug0 ("Using collective process reporting routines\n"); - mpiPi_msg_debug0 - ("MEMORY : collective reporting memory allocation : %13ld\n", - sizeof (callsite_stats_t) * mpiPi.size); - - mpiPi_coll_print_all_callsite_time_info (fp); - mpiPi_coll_print_all_callsite_sent_info (fp); - mpiPi_coll_print_all_callsite_io_info (fp); - mpiPi_coll_print_all_callsite_rma_info (fp); - } + { + mpiPi_msg_debug0 ("Using collective process reporting routines\n"); + mpiPi_msg_debug0 + ("MEMORY : collective reporting memory allocation : %13ld\n", + sizeof (callsite_stats_t) * mpiPi.size); + + mpiPi_coll_print_all_callsite_time_info (fp); + mpiPi_coll_print_all_callsite_sent_info (fp); + mpiPi_coll_print_all_callsite_io_info (fp); + mpiPi_coll_print_all_callsite_rma_info (fp); + } else - { + { - if (mpiPi.collectorRank == mpiPi.rank) - { - mpiPi_msg_debug - ("Using standard process reporting routines aggregating data at process rank %d\n", - mpiPi.collectorRank); + if (mpiPi.collectorRank == mpiPi.rank) + { + mpiPi_msg_debug + ("Using standard process reporting routines aggregating data at process rank %d\n", + mpiPi.collectorRank); - mpiPi_print_all_callsite_time_info (fp); - mpiPi_print_all_callsite_sent_info (fp); - mpiPi_print_all_callsite_io_info (fp); - mpiPi_print_all_callsite_rma_info (fp); - } - } + mpiPi_print_all_callsite_time_info (fp); + mpiPi_print_all_callsite_sent_info (fp); + mpiPi_print_all_callsite_io_info (fp); + mpiPi_print_all_callsite_rma_info (fp); + } + } } } - - /* @@ -3158,13 +3156,13 @@ 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. @@ -3189,22 +3187,22 @@ 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, diff --git a/util.c b/util.c index b4a5700..1f0491c 100644 --- a/util.c +++ b/util.c @@ -4,7 +4,7 @@ Please see COPYRIGHT AND LICENSE information at the end of this file. - ----- + ----- util.c -- misc util functions @@ -51,7 +51,7 @@ GetBaseAppName (char *rawName) void mpiPi_getenv () -{ /* NEED TO ADD SANITY CHECKS HERE */ +{ /* NEED TO ADD SANITY CHECKS HERE */ char *cp = NULL; char *ep = NULL; @@ -69,213 +69,213 @@ mpiPi_getenv () char *sep = " \t,"; if (mpiPi.rank == 0) - mpiPi_msg ("Found MPIP environment variable [%s]\n", ep); + mpiPi_msg ("Found MPIP environment variable [%s]\n", ep); av[0] = "JUNK"; for (cp = strtok (ep, sep), ac = 1; (ac < 64) && (NULL != cp); ac++) - { - av[ac] = cp; - /*mpiPi_msg("av[%d] = %s\n", ac, av[ac]); */ - cp = strtok (NULL, sep); - } + { + av[ac] = cp; + /*mpiPi_msg("av[%d] = %s\n", ac, av[ac]); */ + cp = strtok (NULL, sep); + } av[ac] = NULL; for (; ((c = getopt (ac, av, "cdef:gk:lm:noprs:t:vx:yz")) != EOF);) - { - switch (c) - { - case 'f': - mpiPi.outputDir = optarg; - if (mpiPi.rank == 0) - mpiPi_msg ("Set the output directory to [%s].\n", - mpiPi.outputDir); - break; - - case 'g': - mpiPi_debug = 1; - if (mpiPi.rank == 0) - mpiPi_msg ("Enabled mpiPi debug mode.\n"); - break; - - case 's': - { - int defaultSize = mpiPi.tableSize; - mpiPi.tableSize = atoi (optarg); - if (mpiPi.tableSize < 2) - { - if (mpiPi.rank == 0) - mpiPi_msg_warn - ("-s tablesize invalid %d. Using default.\n", - mpiPi.tableSize); - mpiPi.tableSize = defaultSize; - } - if (mpiPi.tableSize < 128) - { - if (mpiPi.rank == 0) - mpiPi_msg_warn - ("tablesize small %d. Consider making it larger w/ -s.\n", - mpiPi.tableSize); - } - if (mpiPi.rank == 0) - mpiPi_msg - ("Set the callsite table size to [%d].\n", - mpiPi.tableSize); - } - break; - - case 'k': - { - mpiPi.stackDepth = atoi (optarg); - if (mpiPi.stackDepth < 0) - { - if (mpiPi.rank == 0) - mpiPi_msg_warn - ("-k stackdepth invalid %d. Using 0.\n", - mpiPi.stackDepth); - mpiPi.stackDepth = 0; - mpiPi.print_callsite_detail = 0; - } - if (mpiPi.stackDepth > MPIP_CALLSITE_STACK_DEPTH_MAX) - { - if (mpiPi.rank == 0) - mpiPi_msg_warn - ("stackdepth of %d too large. Using %d.\n", - mpiPi.stackDepth, MPIP_CALLSITE_STACK_DEPTH_MAX); - mpiPi.stackDepth = MPIP_CALLSITE_STACK_DEPTH_MAX; - } - else if (mpiPi.stackDepth > 4) - { - if (mpiPi.rank == 0) - mpiPi_msg_warn - ("stackdepth of %d is large. Consider making it smaller.\n", - mpiPi.stackDepth); - } - - // If the stack depth is 0, we are accumulating data - // for each MPI op (i.e. potentially multiple callsites), - // resulting in data that would not be useful for calculating COV. - if (mpiPi.stackDepth == 0) - mpiPi.calcCOV = 0; - - if (mpiPi.rank == 0) - mpiPi_msg - ("Set the callsite stack traceback depth to [%d].\n", - mpiPi.stackDepth); - } - break; - - case 't': - { - int defaultThreshold = mpiPi.reportPrintThreshold; - mpiPi.reportPrintThreshold = atof (optarg); - if (mpiPi.reportPrintThreshold < 0) - { - if (mpiPi.rank == 0) - mpiPi_msg_warn - ("-t report print threshold invalid %g. Using default.\n", - mpiPi.reportPrintThreshold); - mpiPi.reportPrintThreshold = defaultThreshold; - } - if (mpiPi.reportPrintThreshold >= 100) - { - if (mpiPi.rank == 0) - mpiPi_msg_warn - ("report print threshold large %g. Making it default.\n", - mpiPi.reportPrintThreshold); - mpiPi.reportPrintThreshold = defaultThreshold; - } - if (mpiPi.rank == 0) - mpiPi_msg - ("Set the report print threshold to [%3.2lf%%].\n", - mpiPi.reportPrintThreshold); - } - break; - - case 'o': - { - if (mpiPi.rank == 0) - mpiPi_msg_warn - ("Disabling MPIP at Init. Code must use Pcontrol to enable.\n"); - mpiPi.enabled = 0; - mpiPi.enabledCount = 0; - } - break; - - case 'n': - mpiPi.baseNames = 1; - break; - - case 'e': - mpiPi.reportFormat = MPIP_REPORT_FLT_FORMAT; - break; - - case 'c': - mpiPi.report_style = mpiPi_style_concise; - break; - - case 'v': - mpiPi.report_style = mpiPi_style_both; - break; - - case 'm': - mpiPi.messageCountThreshold = atoi (optarg); - mpiPi_msg_debug ("Set messageCountThreshold to %d\n", - mpiPi.messageCountThreshold); - break; - case 'x': - if (optarg != NULL) - { - mpiPi.appFullName = strdup (optarg); - mpiPi.av[0] = strdup (optarg); - mpiPi.appName = strdup (GetBaseAppName (mpiPi.appFullName)); - mpiPi_msg_debug ("Set mpiPi.appFullName to %s\n", - mpiPi.appFullName); - } - break; - case 'd': - /* Suppress/Activate printing of call site detail based on default. */ - mpiPi.print_callsite_detail ^= 1; - break; - - case 'l': - /* Use low-memory use approach using MPI collectives - for report generation */ - mpiPi.collective_report = 1; - break; - - case 'r': - /* Use collector task to aggregate all task data and - generate report */ - mpiPi.collective_report = 0; - break; - - case 'z': - mpiPi.disable_finalize_report = 1; - break; - - case 'y': - mpiPi.do_collective_stats_report = 1; - break; - - case 'p': - mpiPi.do_pt2pt_stats_report = 1; - break; - - case 'a': - case 'b': - case 'h': - case 'i': - case 'j': - case 'q': - case 'u': - case 'w': - default: - if (mpiPi.rank == 0) - mpiPi_msg_warn - ("Option flag (-%c) not recognized. Ignored.\n", c); - break; - } - } + { + switch (c) + { + case 'f': + mpiPi.outputDir = optarg; + if (mpiPi.rank == 0) + mpiPi_msg ("Set the output directory to [%s].\n", + mpiPi.outputDir); + break; + + case 'g': + mpiPi_debug = 1; + if (mpiPi.rank == 0) + mpiPi_msg ("Enabled mpiPi debug mode.\n"); + break; + + case 's': + { + int defaultSize = mpiPi.tableSize; + mpiPi.tableSize = atoi (optarg); + if (mpiPi.tableSize < 2) + { + if (mpiPi.rank == 0) + mpiPi_msg_warn + ("-s tablesize invalid %d. Using default.\n", + mpiPi.tableSize); + mpiPi.tableSize = defaultSize; + } + if (mpiPi.tableSize < 128) + { + if (mpiPi.rank == 0) + mpiPi_msg_warn + ("tablesize small %d. Consider making it larger w/ -s.\n", + mpiPi.tableSize); + } + if (mpiPi.rank == 0) + mpiPi_msg + ("Set the callsite table size to [%d].\n", + mpiPi.tableSize); + } + break; + + case 'k': + { + mpiPi.stackDepth = atoi (optarg); + if (mpiPi.stackDepth < 0) + { + if (mpiPi.rank == 0) + mpiPi_msg_warn + ("-k stackdepth invalid %d. Using 0.\n", + mpiPi.stackDepth); + mpiPi.stackDepth = 0; + mpiPi.print_callsite_detail = 0; + } + if (mpiPi.stackDepth > MPIP_CALLSITE_STACK_DEPTH_MAX) + { + if (mpiPi.rank == 0) + mpiPi_msg_warn + ("stackdepth of %d too large. Using %d.\n", + mpiPi.stackDepth, MPIP_CALLSITE_STACK_DEPTH_MAX); + mpiPi.stackDepth = MPIP_CALLSITE_STACK_DEPTH_MAX; + } + else if (mpiPi.stackDepth > 4) + { + if (mpiPi.rank == 0) + mpiPi_msg_warn + ("stackdepth of %d is large. Consider making it smaller.\n", + mpiPi.stackDepth); + } + + // If the stack depth is 0, we are accumulating data + // for each MPI op (i.e. potentially multiple callsites), + // resulting in data that would not be useful for calculating COV. + if (mpiPi.stackDepth == 0) + mpiPi.calcCOV = 0; + + if (mpiPi.rank == 0) + mpiPi_msg + ("Set the callsite stack traceback depth to [%d].\n", + mpiPi.stackDepth); + } + break; + + case 't': + { + int defaultThreshold = mpiPi.reportPrintThreshold; + mpiPi.reportPrintThreshold = atof (optarg); + if (mpiPi.reportPrintThreshold < 0) + { + if (mpiPi.rank == 0) + mpiPi_msg_warn + ("-t report print threshold invalid %g. Using default.\n", + mpiPi.reportPrintThreshold); + mpiPi.reportPrintThreshold = defaultThreshold; + } + if (mpiPi.reportPrintThreshold >= 100) + { + if (mpiPi.rank == 0) + mpiPi_msg_warn + ("report print threshold large %g. Making it default.\n", + mpiPi.reportPrintThreshold); + mpiPi.reportPrintThreshold = defaultThreshold; + } + if (mpiPi.rank == 0) + mpiPi_msg + ("Set the report print threshold to [%3.2lf%%].\n", + mpiPi.reportPrintThreshold); + } + break; + + case 'o': + { + if (mpiPi.rank == 0) + mpiPi_msg_warn + ("Disabling MPIP at Init. Code must use Pcontrol to enable.\n"); + mpiPi.enabled = 0; + mpiPi.enabledCount = 0; + } + break; + + case 'n': + mpiPi.baseNames = 1; + break; + + case 'e': + mpiPi.reportFormat = MPIP_REPORT_FLT_FORMAT; + break; + + case 'c': + mpiPi.report_style = mpiPi_style_concise; + break; + + case 'v': + mpiPi.report_style = mpiPi_style_both; + break; + + case 'm': + mpiPi.messageCountThreshold = atoi (optarg); + mpiPi_msg_debug ("Set messageCountThreshold to %d\n", + mpiPi.messageCountThreshold); + break; + case 'x': + if (optarg != NULL) + { + mpiPi.appFullName = strdup (optarg); + mpiPi.av[0] = strdup (optarg); + mpiPi.appName = strdup (GetBaseAppName (mpiPi.appFullName)); + mpiPi_msg_debug ("Set mpiPi.appFullName to %s\n", + mpiPi.appFullName); + } + break; + case 'd': + /* Suppress/Activate printing of call site detail based on default. */ + mpiPi.print_callsite_detail ^= 1; + break; + + case 'l': + /* Use low-memory use approach using MPI collectives + for report generation */ + mpiPi.collective_report = 1; + break; + + case 'r': + /* Use collector task to aggregate all task data and + generate report */ + mpiPi.collective_report = 0; + break; + + case 'z': + mpiPi.disable_finalize_report = 1; + break; + + case 'y': + mpiPi.do_collective_stats_report = 1; + break; + + case 'p': + mpiPi.do_pt2pt_stats_report = 1; + break; + + case 'a': + case 'b': + case 'h': + case 'i': + case 'j': + case 'q': + case 'u': + case 'w': + default: + if (mpiPi.rank == 0) + mpiPi_msg_warn + ("Option flag (-%c) not recognized. Ignored.\n", c); + break; + } + } } if (mpiPi.rank == 0) mpiPi_msg ("\n"); @@ -302,18 +302,18 @@ getProcExeLink () if (exelen == -1) { if (errno != ENOENT) - { - while (exelen == -1 && errno == ENAMETOOLONG) - { - insize += 256; - inbuf = realloc (inbuf, insize); - exelen = readlink (file, inbuf, insize); - } - inbuf[exelen] = '\0'; - return inbuf; - } + { + while (exelen == -1 && errno == ENAMETOOLONG) + { + insize += 256; + inbuf = realloc (inbuf, insize); + exelen = readlink (file, inbuf, insize); + } + inbuf[exelen] = '\0'; + return inbuf; + } else - free (inbuf); + free (inbuf); } else { @@ -342,19 +342,19 @@ getProcCmdLine (int *ac, char **av) if (infile != NULL) { while (!feof (infile)) - { - inbuf = malloc (MPIP_MAX_ARG_STRING_SIZE); - if (fread (inbuf, 1, MPIP_MAX_ARG_STRING_SIZE, infile) > 0) - { - arg_ptr = inbuf; - while (*arg_ptr != '\0') - { - av[i] = strdup (arg_ptr); - arg_ptr += strlen (av[i]) + 1; - i++; - } - } - } + { + inbuf = malloc (MPIP_MAX_ARG_STRING_SIZE); + if (fread (inbuf, 1, MPIP_MAX_ARG_STRING_SIZE, infile) > 0) + { + arg_ptr = inbuf; + while (*arg_ptr != '\0') + { + av[i] = strdup (arg_ptr); + arg_ptr += strlen (av[i]) + 1; + i++; + } + } + } *ac = i; free (inbuf); @@ -430,14 +430,14 @@ mpiPi_copy_given_args (int *ac, char **av, int av_len, int argc, char **argv) for (i = 0; i < mpiPi_argc; i++) { - int buf_len = EXECUTABLE_LEN; + int buf_len = EXECUTABLE_LEN; - extern void F77_MPIPI_GET_FORTRAN_ARG (int *, int *, char *, int *, - int); - F77_MPIPI_GET_FORTRAN_ARG (&i, &buf_len, buf, &len, EXECUTABLE_LEN); + extern void F77_MPIPI_GET_FORTRAN_ARG (int *, int *, char *, int *, + int); + F77_MPIPI_GET_FORTRAN_ARG (&i, &buf_len, buf, &len, EXECUTABLE_LEN); - buf[len < EXECUTABLE_LEN ? len : EXECUTABLE_LEN - 1] = 0; - av[i] = strdup (buf); + buf[len < EXECUTABLE_LEN ? len : EXECUTABLE_LEN - 1] = 0; + av[i] = strdup (buf); } } @@ -468,7 +468,7 @@ mpiP_format_address (void *pval, char *addr_buf) #endif if (strcmp (test_buf, "0x1") != 0) - strcpy (hex_prefix, "0x"); + strcpy (hex_prefix, "0x"); get_sys_info = 1; } @@ -493,13 +493,13 @@ 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. @@ -524,22 +524,22 @@ 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,