Commit 7c34b6a4 authored by Sudheer Chunduri's avatar Sudheer Chunduri
Browse files

misc updates

parent 16acc29d
......@@ -50,7 +50,14 @@
#define Z(a) \
X(a ## _CALL_COUNT), \
X(a ## _MSG_SIZE),
X(a ## _TOTAL_BYTES), \
X(a ## _MSG_SIZE_AGG_0_256), \
X(a ## _MSG_SIZE_AGG_256_1K), \
X(a ## _MSG_SIZE_AGG_1K_32K), \
X(a ## _MSG_SIZE_AGG_32K_256K), \
X(a ## _MSG_SIZE_AGG_256K_1M), \
X(a ## _MSG_SIZE_AGG_1M_4M), \
X(a ## _MSG_SIZE_AGG_4M_PLUS), \
#define Y(a) \
X(a ## _TOTAL_TIME),
......@@ -67,8 +74,8 @@ enum darshan_apmpi_f_mpiop_indices
APMPI_PERF_F_COUNTERS
};
#undef X
#undef Y
#undef Z
//undef Y
//undef Z
/*
#define X(a) a,
// integer counters for the "MPI" example module
......
......@@ -22,6 +22,52 @@
#include "darshan-apmpi-log-format.h"
#include "darshan-apmpi-utils.h"
typedef long long ap_bytes_t;
#define BYTECOUNT(TYPE, COUNT) \
int tsize; \
PMPI_Type_size(TYPE, &tsize); \
ap_bytes_t bytes = (COUNT) * tsize
#define BYTECOUNTND(TYPE, COUNT) \
int tsize2; \
PMPI_Type_size(TYPE, &tsize2); \
bytes = (COUNT) * tsize2
/* increment histogram bucket depending on the given __value
*
* NOTE: This macro can be used to build a histogram of access
* sizes, offsets, etc. It assumes a 8-bucket histogram, with
* __bucket_base_p pointing to the first counter in the sequence
* of buckets (i.e., the smallest bucket). The size ranges of each
* bucket are:
* * 0 - 256 bytes
* * 256 - 1 KiB
* * 1 KiB - 32 KiB
* * 32 KiB - 256 KiB
* * 256 KiB - 1 MiB
* * 1 MiB - 4 MiB
* * 4 MiB +
*/
#define DARSHAN_MSG_BUCKET_INC(__bucket_base_p, __value) do {\
if(__value < 257) \
*(__bucket_base_p) += 1; \
else if(__value < 1025) \
*(__bucket_base_p + 1) += 1; \
else if(__value < 32769) \
*(__bucket_base_p + 2) += 1; \
else if(__value < 262145) \
*(__bucket_base_p + 3) += 1; \
else if(__value < 1048577) \
*(__bucket_base_p + 4) += 1; \
else if(__value < 4194305) \
*(__bucket_base_p + 5) += 1; \
else \
*(__bucket_base_p + 6) += 1; \
} while(0)
DARSHAN_FORWARD_DECL(PMPI_Send, int, (const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm));
DARSHAN_FORWARD_DECL(PMPI_Recv, int, (void *buf, int count, MPI_Datatype datatype, int source, int tag, MPI_Comm comm, MPI_Status *status));
#if 0
......@@ -286,6 +332,7 @@ int DARSHAN_DECL(MPI_Send)(const void *buf, int count, MPI_Datatype datatype, in
{
int ret;
double tm1, tm2;
int size;
MAP_OR_FAIL(PMPI_Send);
......@@ -295,6 +342,9 @@ int DARSHAN_DECL(MPI_Send)(const void *buf, int count, MPI_Datatype datatype, in
APMPI_PRE_RECORD();
// Lock around the count - lock only if MPI_THREAD_MULTIPLE is used ... locking mutex
apmpi_runtime->perf_record->counters[MPI_SEND_CALL_COUNT]++;
BYTECOUNT(datatype, count);
apmpi_runtime->perf_record->counters[MPI_SEND_TOTAL_BYTES] += bytes;
DARSHAN_MSG_BUCKET_INC(&(apmpi_runtime->perf_record->counters[MPI_SEND_MSG_SIZE_AGG_0_256]), bytes);
apmpi_runtime->perf_record->fcounters[MPI_SEND_TOTAL_TIME]+=(tm2-tm1);
APMPI_POST_RECORD();
return ret;
......@@ -314,6 +364,9 @@ int DARSHAN_DECL(MPI_Recv)(void *buf, int count, MPI_Datatype datatype, int sour
tm2 = darshan_core_wtime();
APMPI_PRE_RECORD();
apmpi_runtime->perf_record->counters[MPI_RECV_CALL_COUNT]++;
BYTECOUNT(datatype, count);
apmpi_runtime->perf_record->counters[MPI_RECV_TOTAL_BYTES] += bytes;
DARSHAN_MSG_BUCKET_INC(&(apmpi_runtime->perf_record->counters[MPI_RECV_MSG_SIZE_AGG_0_256]), bytes);
apmpi_runtime->perf_record->fcounters[MPI_RECV_TOTAL_TIME]+=(tm2-tm1);
APMPI_POST_RECORD();
return ret;
......@@ -422,6 +475,9 @@ int DARSHAN_DECL(MPI_Allreduce)(const void *sendbuf, void *recvbuf, int count, M
tm2 = darshan_core_wtime();
APMPI_PRE_RECORD();
apmpi_runtime->perf_record->counters[MPI_ALLREDUCE_CALL_COUNT]++;
BYTECOUNT(datatype, count);
apmpi_runtime->perf_record->counters[MPI_ALLREDUCE_TOTAL_BYTES] += bytes;
DARSHAN_MSG_BUCKET_INC(&(apmpi_runtime->perf_record->counters[MPI_ALLREDUCE_MSG_SIZE_AGG_0_256]), bytes);
apmpi_runtime->perf_record->fcounters[MPI_ALLREDUCE_TOTAL_TIME]+=(tm2-tm1);
APMPI_POST_RECORD();
return ret;
......
......@@ -22,12 +22,7 @@
/* counter name strings for the MPI module */
//#define X(a) #a,
#define Z(a) \
X(a ## _CALL_COUNT), \
X(a ## _MSG_SIZE),
#define Y(a) \
X(a ## _TOTAL_TIME),
#define X(a) #a
......@@ -38,8 +33,6 @@ char *apmpi_f_counter_names[] = {
APMPI_PERF_F_COUNTERS
};
#undef X
#undef Y
#undef Z
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,
......
......@@ -99,7 +99,7 @@ static void initialize_counters (void)
apxc_runtime->PAPI_event_set = PAPI_NULL;
PAPI_create_eventset(&apxc_runtime->PAPI_event_set);
/* start wtih first PAPI counter */
/* start with first PAPI counter */
for (i = AR_RTR_0_0_INQ_PRF_INCOMING_FLIT_VC0;
strcmp(PAPI_events[i], "APXC_NUM_INDICES") != 0;
i++)
......@@ -279,7 +279,7 @@ static void apxc_mpi_redux(
MPI_Comm router_comm;
APXC_LOCK();
printf("-------- ****** -------- Inside apxc_mpi_redux\n");
if (!apxc_runtime)
{
APXC_UNLOCK();
......
......@@ -138,14 +138,14 @@ static int darshan_log_get_apxc_rec(darshan_fd fd, void** buf_p)
}
else if (ret < 0)
{
// *buf_p = NULL;
// if (buffer) free(buffer);
*buf_p = NULL;
if (buffer) free(buffer);
return(-1);
}
else
{
// *buf_p = NULL;
// if (buffer) free(buffer);
*buf_p = NULL;
if (buffer) free(buffer);
return(0);
}
}
......
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