Commit d5efa583 authored by Sudheer Chunduri's avatar Sudheer Chunduri
Browse files

X-macro corrections

parent 5f40cfef
......@@ -15,76 +15,114 @@
'M'*0x10000+\
'P'*0x100+\
'I'*0x1)
#define APMPI_MPI_BLOCKING_P2P \
X(MPI_SEND) \
/*X(MPI_SSEND) \
X(MPI_RSEND) \
X(MPI_BSEND) \
X(MPI_SEND_INIT) \
X(MPI_SSEND_INIT) \
X(MPI_RSEND_INIT) \
X(MPI_BSEND_INIT) \ */ \
X(MPI_RECV) /*
X(MPI_RECV_INIT) \
X(MPI_SENDRECV) \
X(MPI_SENDRECV_REPLACE) \
Y(MPI_BLOCKING_P2P_CNT) */
#define APMPI_MPI_NONBLOCKING_P2P \
X(MPI_ISEND) \
X(MPI_ISSEND) \
X(MPI_IRSEND) \
X(MPI_IBSEND) \
X(MPI_IRECV) /*\
Y(MPI_NONBLOCKING_P2P_CNT) */
/*
X(MPI_ISEND_COUNT) \
X(MPI_IRECV_COUNT) \
X(MPI_BARRIER_COUNT) \
X(MPI_BCAST_COUNT) \
X(MPI_REDUCE_COUNT) \
*/
/*
X(MPI_ALLTOALL_COUNT) \
X(MPI_ALLTOALLV_COUNT) \
X(MPI_ALLGATHER_COUNT) \
X(MPI_ALLGATHERV_COUNT) \
X(MPI_GATHER_COUNT) \
X(MPI_GATHERV_COUNT) \
X(MPI_SCATTER_COUNT) \
X(MPI_SCATTERV_COUNT) \
X(MPI_REDUCE_SCATTER_COUNT) \
X(MPI_SCAN_COUNT) \
X(MPI_EXSCAN_COUNT) \
#define AMPI_MPI_P2P_MISC \
X(MPI_PROBE) \
*/
#define APMPI_MPI_BLOCKING_COLL \
/* X(MPI_BCAST) \
X(MPI_BARRIER) \
X(MPI_GATHER) \
X(MPI_GATHERV) \
X(MPI_SCATTER) \
X(MPI_SCATTERV) \
X(MPI_SCAN) \
X(MPI_ALLGATHER) \
X(MPI_ALLGATHERV) \
X(MPI_REDUCE) \
*/ X(MPI_ALLREDUCE) /* \
X(MPI_REDUCE_SCATTER) \
X(MPI_ALLTOALL) \
X(MPI_ALLTOALLV) \
X(MPI_ALLTOALLW) \
X(MPI_EXSCAN) \
Y(MPI_BLOCKING_COLL_CNT) */
#define I(a) \
Y(a ## _CALL_COUNT) \
Y(a ## _TOTAL_BYTES) \
Y(a ## _MSG_SIZE_AGG_0_256) \
Y(a ## _MSG_SIZE_AGG_256_1K) \
Y(a ## _MSG_SIZE_AGG_1K_8K) \
Y(a ## _MSG_SIZE_AGG_8K_256K) \
Y(a ## _MSG_SIZE_AGG_256K_1M) \
Y(a ## _MSG_SIZE_AGG_1M_PLUS) \
#define APMPI_PERF_COUNTERS \
Z(MPI_SEND) \
Z(MPI_RECV) \
Z(MPI_ALLREDUCE) \
X(APMPI_NUM_INDICES)
APMPI_MPI_BLOCKING_P2P \
/*APMPI_MPI_NONBLOCKING_P2P */\
APMPI_MPI_BLOCKING_COLL \
Z(APMPI_NUM_INDICES)
#define APMPI_PERF_F_COUNTERS \
Y(MPI_SEND) \
Y(MPI_RECV) \
Y(MPI_ALLREDUCE) \
X(APMPI_F_NUM_INDICES)
#define Z(a) \
X(a ## _CALL_COUNT), \
X(a ## _TOTAL_BYTES), \
X(a ## _MSG_SIZE_AGG_0_256), \
X(a ## _MSG_SIZE_AGG_256_1K), \
X(a ## _MSG_SIZE_AGG_1K_8K), \
X(a ## _MSG_SIZE_AGG_8K_256K), \
X(a ## _MSG_SIZE_AGG_256K_1M), \
X(a ## _MSG_SIZE_AGG_1M_PLUS), \
#define Y(a) \
X(a ## _TOTAL_TIME),
#define X(a) a
#define Y(a) a,
#define Z(a) a
#define X I
/* integer counters for the "MPI" example module */
enum darshan_apmpi_mpiop_indices
{
APMPI_PERF_COUNTERS
};
#undef X
/* per MPI op max and mean times */
/* aggregate (across all the ranks) per MPI op times */
#define F(a) \
Y(a ## _TOTAL_TIME) \
Y(a ## _MAX_TIME) \
Y(a ## _AVG_TIME) \
Y(a ## _AGG_MAX_TIME) \
Y(a ## _AGG_AVG_TIME) \
Y(a ## _AGG_F_VARIANCE_TIME)
#define APMPI_F_GLOBAL_COUNTERS \
Y(APMPI_F_TOTAL_MPITIME)\
Y(APMPI_F_VARIANCE_TOTAL_MPITIME)
#define APMPI_PERF_F_COUNTERS \
APMPI_MPI_BLOCKING_P2P /*
APMPI_MPI_NONBLOCKING_P2P */ \
APMPI_MPI_BLOCKING_COLL /*
APMPI_F_GLOBAL_COUNTERS */ \
Z(APMPI_F_NUM_INDICES)
/* variance of total MPI time across all ranks */\
/* NOTE: for shared records only */\
/*X(APMPI_F_VARIANCE_RANK_TOTAL_MPITIME) \ */
/*X(APMPI_F_VARIANCE_RANK_BYTES) */ \
/* float counters for the "MPI" example module */
#define X F
enum darshan_apmpi_f_mpiop_indices
{
APMPI_PERF_F_COUNTERS
};
#undef X
//undef Y
//undef Z
/*
#define X(a) a,
// integer counters for the "MPI" example module
enum darshan_apmpi_perf_indices
{
APMPI_PERF_COUNTERS
};
#undef Z
#undef Y
#undef X
*/
/* the darshan_apmpi_record structure encompasses the data/counters
* which would actually be logged to file by Darshan for the AP MPI
* module. This example implementation logs the following data for each
......
......@@ -196,7 +196,6 @@ void apmpi_runtime_initialize()
};
APMPI_LOCK();
/* don't do anything if already initialized */
if(apmpi_runtime)
......@@ -205,7 +204,6 @@ void apmpi_runtime_initialize()
return;
}
apmpi_buf_size = sizeof(struct darshan_apmpi_perf_record);
/* register the apmpi module with the darshan-core component */
......@@ -251,7 +249,6 @@ void apmpi_runtime_initialize()
APMPI_UNLOCK();
return;
}
capture(apmpi_runtime->perf_record, apmpi_runtime->rec_id);
initialize_counters();
......@@ -259,6 +256,90 @@ void apmpi_runtime_initialize()
return;
}
#if 0
static void apmpi_shared_record_variance(MPI_Comm mod_comm,
struct darshan_apmpi_perf_record *inrec_array, struct darshan_apmpi_perf_record *outrec_array,
int shared_rec_count)
{
MPI_Datatype var_dt;
MPI_Op var_op;
int i;
struct darshan_variance_dt *var_send_buf = NULL;
struct darshan_variance_dt *var_recv_buf = NULL;
PMPI_Type_contiguous(sizeof(struct darshan_variance_dt),
MPI_BYTE, &var_dt);
PMPI_Type_commit(&var_dt);
PMPI_Op_create(darshan_variance_reduce, 1, &var_op);
var_send_buf = malloc(shared_rec_count * sizeof(struct darshan_variance_dt));
if(!var_send_buf)
return;
if(my_rank == 0)
{
var_recv_buf = malloc(shared_rec_count * sizeof(struct darshan_variance_dt));
if(!var_recv_buf)
return;
}
/* get total i/o time variances for shared records */
for(i=0; i<shared_rec_count; i++)
{
var_send_buf[i].n = 1;
var_send_buf[i].S = 0;
var_send_buf[i].T = inrec_array[i].fcounters[MPIIO_F_READ_TIME] +
inrec_array[i].fcounters[MPIIO_F_WRITE_TIME] +
inrec_array[i].fcounters[MPIIO_F_META_TIME];
}
PMPI_Reduce(var_send_buf, var_recv_buf, shared_rec_count,
var_dt, var_op, 0, mod_comm);
if(my_rank == 0)
{
for(i=0; i<shared_rec_count; i++)
{
outrec_array[i].fcounters[MPIIO_F_VARIANCE_RANK_TIME] =
(var_recv_buf[i].S / var_recv_buf[i].n);
}
}
/* get total bytes moved variances for shared records */
for(i=0; i<shared_rec_count; i++)
{
var_send_buf[i].n = 1;
var_send_buf[i].S = 0;
var_send_buf[i].T = (double)
inrec_array[i].counters[MPIIO_BYTES_READ] +
inrec_array[i].counters[MPIIO_BYTES_WRITTEN];
}
PMPI_Reduce(var_send_buf, var_recv_buf, shared_rec_count,
var_dt, var_op, 0, mod_comm);
if(my_rank == 0)
{
for(i=0; i<shared_rec_count; i++)
{
outrec_array[i].fcounters[MPIIO_F_VARIANCE_RANK_BYTES] =
(var_recv_buf[i].S / var_recv_buf[i].n);
}
}
PMPI_Type_free(&var_dt);
PMPI_Op_free(&var_op);
free(var_send_buf);
free(var_recv_buf);
return;
}
#endif
/********************************************************************************
* shutdown function exported by this module for coordinating with darshan-core *
......@@ -273,6 +354,11 @@ static void apmpi_mpi_redux(
int shared_rec_count)
{
int i;
struct darshan_apmpi_perf_record *red_send_buf = NULL;
struct darshan_apmpi_perf_record *red_recv_buf = NULL;
MPI_Datatype red_type;
MPI_Op red_op;
APMPI_LOCK();
if (!apmpi_runtime)
......@@ -281,8 +367,8 @@ static void apmpi_mpi_redux(
return;
}
/* collect perf counters */
//capture(apmpi_runtime->perf_record, apmpi_runtime->rec_id);
capture(apmpi_runtime->perf_record, apmpi_runtime->rec_id);
APMPI_UNLOCK();
return;
......
......@@ -23,16 +23,21 @@
/* counter name strings for the MPI module */
//#define X(a) #a,
#define X(a) #a
#define Y(a) #a,
#define Z(a) #a
#define X I
char *apmpi_counter_names[] = {
APMPI_PERF_COUNTERS
};
#undef X
#define X F
char *apmpi_f_counter_names[] = {
APMPI_PERF_F_COUNTERS
};
#undef Y
#undef Z
#undef X
static int darshan_log_get_apmpi_rec(darshan_fd fd, void** buf_p);
static int darshan_log_put_apmpi_rec(darshan_fd fd, void* buf);
static void darshan_log_print_apmpi_rec(void *file_rec,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment