Skip to content

Commit

Permalink
intermediate LLNL#2
Browse files Browse the repository at this point in the history
  • Loading branch information
artpol84 committed Jun 7, 2019
1 parent 11f9be3 commit a264f6c
Show file tree
Hide file tree
Showing 8 changed files with 181 additions and 27 deletions.
32 changes: 32 additions & 0 deletions mpiP-histogram.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#include "mpiP-histogram.h"

void
init_histogram (mpiPi_histogram_t * h, int first_bin_max, int size,
int *intervals)
{
h->first_bin_max = first_bin_max;
h->hist_size = size;
h->bin_intervals = intervals;
}

static int
get_histogram_bin (mpiPi_histogram_t * h, int val)
{
int wv = val;
int bin;

bin = 0;

if (h->bin_intervals == NULL)
{
while (wv > h->first_bin_max && bin < h->hist_size)
{
wv >>= 1;
bin++;
}
}
else /* Add code for custom intervals later */
{
}
return bin;
}
17 changes: 17 additions & 0 deletions mpiP-histogram.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#ifndef MPIPHISTOGRAM_H
#define MPIPHISTOGRAM_H

#include <stdio.h>

typedef struct _mpiPi_histogram
{
int first_bin_max;
int hist_size;
int *bin_intervals;
} mpiPi_histogram_t;

void init_histogram (mpiPi_histogram_t * h, int first_bin_max, int size,
int *intervals);
static int get_histogram_bin (mpiPi_histogram_t * h, int val);

#endif // MPIPHISTOGRAM_H
96 changes: 96 additions & 0 deletions mpiP-statistics.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@


static int
mpiPi_callsite_stats_pc_hashkey (const void *p)
{
int res = 0;
int i;
callsite_stats_t *csp = (callsite_stats_t *) p;
MPIP_CALLSITE_STATS_COOKIE_ASSERT (csp);
for (i = 0; i < MPIP_CALLSITE_STACK_DEPTH; i++)
{
res ^= (unsigned) (long) csp->pc[i];
}
return 52271 ^ csp->op ^ res ^ csp->rank;
}

static int
mpiPi_callsite_stats_pc_comparator (const void *p1, const void *p2)
{
int i;
callsite_stats_t *csp_1 = (callsite_stats_t *) p1;
callsite_stats_t *csp_2 = (callsite_stats_t *) p2;
MPIP_CALLSITE_STATS_COOKIE_ASSERT (csp_1);
MPIP_CALLSITE_STATS_COOKIE_ASSERT (csp_2);

#define express(f) {if ((csp_1->f) > (csp_2->f)) {return 1;} if ((csp_1->f) < (csp_2->f)) {return -1;}}
express (op);
express (rank);

for (i = 0; i < MPIP_CALLSITE_STACK_DEPTH; i++)
{
express (pc[i]);
}
#undef express

return 0;
}

static int
mpiPi_callsite_stats_src_hashkey (const void *p)
{
int res = 0;
callsite_stats_t *csp = (callsite_stats_t *) p;
MPIP_CALLSITE_STATS_COOKIE_ASSERT (csp);
return 52271 ^ csp->op ^ res ^ csp->rank ^ csp->csid;
}

static int
mpiPi_callsite_stats_src_comparator (const void *p1, const void *p2)
{
callsite_stats_t *csp_1 = (callsite_stats_t *) p1;
callsite_stats_t *csp_2 = (callsite_stats_t *) p2;
MPIP_CALLSITE_STATS_COOKIE_ASSERT (csp_1);
MPIP_CALLSITE_STATS_COOKIE_ASSERT (csp_2);

#define express(f) {if ((csp_1->f) > (csp_2->f)) {return 1;} if ((csp_1->f) < (csp_2->f)) {return -1;}}
express (op);
express (csid);
express (rank);
#undef express

return 0;
}

static int
mpiPi_callsite_stats_MPI_id_hashkey (const void *p)
{
callsite_stats_t *csp = (callsite_stats_t *) p;
MPIP_CALLSITE_STATS_COOKIE_ASSERT (csp);
return 52271 ^ csp->op;
}

static int
mpiPi_callsite_stats_src_id_hashkey (const void *p)
{
int res = 0;
callsite_stats_t *csp = (callsite_stats_t *) p;
MPIP_CALLSITE_STATS_COOKIE_ASSERT (csp);
return 52271 ^ csp->op ^ res ^ csp->csid;
}

static int
mpiPi_callsite_stats_src_id_comparator (const void *p1, const void *p2)
{
callsite_stats_t *csp_1 = (callsite_stats_t *) p1;
callsite_stats_t *csp_2 = (callsite_stats_t *) p2;
MPIP_CALLSITE_STATS_COOKIE_ASSERT (csp_1);
MPIP_CALLSITE_STATS_COOKIE_ASSERT (csp_2);

#define express(f) {if ((csp_1->f) > (csp_2->f)) {return 1;} if ((csp_1->f) < (csp_2->f)) {return -1;}}
express (op);
express (csid);
#undef express

return 0;
}
33 changes: 33 additions & 0 deletions mpiP-statistics.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#ifndef MPIPCALLSITE_STATS_H
#define MPIPCALLSITE_STATS_H

typedef struct _callsite_stats
{
unsigned op;
unsigned rank;
int csid;
long long count;
double cumulativeTime;
double cumulativeTimeSquared;
double maxDur;
double minDur;
double maxDataSent;
double minDataSent;
double maxIO;
double minIO;
double maxRMA;
double minRMA;
double cumulativeDataSent;
double cumulativeIO;
double cumulativeRMA;
long long arbitraryMessageCount;
double *siteData;
int siteDataIdx;
void *pc[MPIP_CALLSITE_STACK_DEPTH_MAX];
char *filename[MPIP_CALLSITE_STACK_DEPTH_MAX];
char *functname[MPIP_CALLSITE_STACK_DEPTH_MAX];
int lineno[MPIP_CALLSITE_STACK_DEPTH_MAX];
long cookie;
} callsite_stats_t;

#endif // MPIPCALLSITE_STATS_H
3 changes: 2 additions & 1 deletion mpiP-threads.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
#define MPIP_THREADS_H

#include "mpiPi_def.h"
#include "thread_safe_list.h"
#include "mpiP-tslist.h"
#include "mpiP-hash.h"
#include "mpiP-statistics.h"

typedef struct {
int enabled;
Expand Down
2 changes: 1 addition & 1 deletion thread_safe_list.c → mpiP-tslist.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include <stdlib.h>
#include <unistd.h>
#include "arch.h"
#include "thread_safe_list.h"
#include "mpiP-tslist.h"

mpiP_tslist_t *mpiP_tslist_create()
{
Expand Down
File renamed without changes.
25 changes: 0 additions & 25 deletions mpiPi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1225,31 +1225,6 @@ mpiPi_update_callsite_stats (unsigned op, unsigned rank, void **pc,
return;
}


static int
get_histogram_bin (mpiPi_histogram_t * h, int val)
{
int wv = val;
int bin;

bin = 0;

if (h->bin_intervals == NULL)
{
while (wv > h->first_bin_max && bin < h->hist_size)
{
wv >>= 1;
bin++;
}
}
else /* Add code for custom intervals later */
{
}

return bin;
}


void
mpiPi_update_collective_stats (int op, double dur, double size,
MPI_Comm * comm)
Expand Down

0 comments on commit a264f6c

Please sign in to comment.