Commit 339ed251 authored by Shane Snyder's avatar Shane Snyder

add support for slowest/fastest rank counters

parent d9750b49
......@@ -81,15 +81,11 @@ enum darshan_posix_indices
ACCESS2_COUNT,
ACCESS3_COUNT,
ACCESS4_COUNT,
DEVICE, /* device id reported by stat */
#endif
SIZE_AT_OPEN,
#if 0
FASTEST_RANK,
FASTEST_RANK_BYTES,
SLOWEST_RANK,
SLOWEST_RANK_BYTES,
#endif
POSIX_FASTEST_RANK,
POSIX_FASTEST_RANK_BYTES,
POSIX_SLOWEST_RANK,
POSIX_SLOWEST_RANK_BYTES,
POSIX_NUM_INDICES,
};
......@@ -108,13 +104,10 @@ enum darshan_posix_f_indices
POSIX_F_META_TIME, /* cumulative posix meta time */
POSIX_F_MAX_READ_TIME,
POSIX_F_MAX_WRITE_TIME,
/* Total I/O and meta time consumed by fastest and slowest ranks */
POSIX_F_FASTEST_RANK_TIME,
POSIX_F_SLOWEST_RANK_TIME,
#if 0
/* Total I/O and meta time consumed by fastest and slowest ranks,
* reported in either MPI or POSIX time depending on how the file
* was accessed.
*/
F_FASTEST_RANK_TIME,
F_SLOWEST_RANK_TIME,
F_VARIANCE_RANK_TIME,
F_VARIANCE_RANK_BYTES,
#endif
......
......@@ -36,6 +36,7 @@ static struct darshan_core_runtime *darshan_core = NULL;
static pthread_mutex_t darshan_core_mutex = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
static int my_rank = -1;
static int nprocs = -1;
static int darshan_mem_alignment = 1;
/* paths prefixed with the following directories are not traced by darshan */
char* darshan_path_exclusions[] = {
......
......@@ -198,7 +198,6 @@ static int my_rank = -1;
if(exclude) break; \
file = posix_file_by_name_setfd(__path, __ret); \
if(!file) break; \
/* CP_STAT_FILE(file, __path, __ret); */ \
file->file_record->rank = my_rank; \
if(__mode) \
DARSHAN_COUNTER_SET(file->file_record, POSIX_MODE, __mode); \
......@@ -332,10 +331,6 @@ static int my_rank = -1;
} while(0)
#define POSIX_RECORD_STAT(__file, __statbuf, __tm1, __tm2) do { \
if(!DARSHAN_COUNTER_VALUE((__file)->file_record, POSIX_STATS) && !DARSHAN_COUNTER_VALUE((__file)->file_record, POSIX_OPENS)){ \
DARSHAN_COUNTER_SET((__file)->file_record, FILE_ALIGNMENT, (__statbuf)->st_blksize); \
DARSHAN_COUNTER_SET((__file)->file_record, SIZE_AT_OPEN, (__statbuf)->st_size); \
}\
(__file)->file_record->rank = my_rank; \
DARSHAN_COUNTER_F_INC_NO_OVERLAP((__file)->file_record, __tm1, __tm2, (__file)->last_meta_end, POSIX_F_META_TIME); \
DARSHAN_COUNTER_INC((__file)->file_record, POSIX_STATS, 1); \
......@@ -1020,13 +1015,6 @@ int DARSHAN_DECL(__fxstat)(int vers, int fd, struct stat *buf)
if(ret < 0 || !S_ISREG(buf->st_mode))
return(ret);
/* TODO */
#if 0
/* skip logging if this was triggered internally */
if((void*)buf == (void*)&cp_stat_buf)
return(ret);
#endif
POSIX_LOCK();
posix_runtime_initialize();
file = posix_file_by_fd(fd);
......@@ -1054,13 +1042,6 @@ int DARSHAN_DECL(__fxstat64)(int vers, int fd, struct stat64 *buf)
if(ret < 0 || !S_ISREG(buf->st_mode))
return(ret);
/* TODO */
#if 0
/* skip logging if this was triggered internally */
if((void*)buf == (void*)&cp_stat_buf)
return(ret);
#endif
POSIX_LOCK();
posix_runtime_initialize();
file = posix_file_by_fd(fd);
......@@ -1469,6 +1450,7 @@ static void posix_prepare_for_reduction(
{
struct posix_file_runtime *file;
int i;
double posix_time;
assert(posix_runtime);
......@@ -1479,7 +1461,31 @@ static void posix_prepare_for_reduction(
sizeof(darshan_record_id), file);
assert(file);
/* TODO: any initialization before reduction */
posix_time =
file->file_record->fcounters[POSIX_F_READ_TIME] +
file->file_record->fcounters[POSIX_F_WRITE_TIME] +
file->file_record->fcounters[POSIX_F_META_TIME];
/* initialize fastest/slowest info prior to the reduction */
file->file_record->counters[POSIX_FASTEST_RANK] =
file->file_record->rank;
file->file_record->counters[POSIX_FASTEST_RANK_BYTES] =
file->file_record->counters[POSIX_BYTES_READ] +
file->file_record->counters[POSIX_BYTES_WRITTEN];
file->file_record->fcounters[POSIX_F_FASTEST_RANK_TIME] =
posix_time;
/* until reduction occurs, we assume that this rank is both
* the fastest and slowest. It is up to the reduction operator
* to find the true min and max.
*/
file->file_record->counters[POSIX_SLOWEST_RANK] =
file->file_record->counters[POSIX_FASTEST_RANK];
file->file_record->counters[POSIX_SLOWEST_RANK_BYTES] =
file->file_record->counters[POSIX_FASTEST_RANK_BYTES];
file->file_record->fcounters[POSIX_F_SLOWEST_RANK_TIME] =
file->file_record->fcounters[POSIX_F_FASTEST_RANK_TIME];
file->file_record->rank = -1;
}
......@@ -1620,6 +1626,48 @@ static void posix_record_reduction_op(
inoutfile->counters[POSIX_MAX_WRITE_TIME_SIZE];
}
/* min (zeroes are ok here; some procs don't do I/O) */
if(infile->fcounters[POSIX_F_FASTEST_RANK_TIME] <
inoutfile->fcounters[POSIX_F_FASTEST_RANK_TIME])
{
tmp_file.counters[POSIX_FASTEST_RANK] =
infile->counters[POSIX_FASTEST_RANK];
tmp_file.counters[POSIX_FASTEST_RANK_BYTES] =
infile->counters[POSIX_FASTEST_RANK_BYTES];
tmp_file.fcounters[POSIX_F_FASTEST_RANK_TIME] =
infile->fcounters[POSIX_F_FASTEST_RANK_TIME];
}
else
{
tmp_file.counters[POSIX_FASTEST_RANK] =
inoutfile->counters[POSIX_FASTEST_RANK];
tmp_file.counters[POSIX_FASTEST_RANK_BYTES] =
inoutfile->counters[POSIX_FASTEST_RANK_BYTES];
tmp_file.fcounters[POSIX_F_FASTEST_RANK_TIME] =
inoutfile->fcounters[POSIX_F_FASTEST_RANK_TIME];
}
/* max */
if(infile->fcounters[POSIX_F_SLOWEST_RANK_TIME] >
inoutfile->fcounters[POSIX_F_SLOWEST_RANK_TIME])
{
tmp_file.counters[POSIX_SLOWEST_RANK] =
infile->counters[POSIX_SLOWEST_RANK];
tmp_file.counters[POSIX_SLOWEST_RANK_BYTES] =
infile->counters[POSIX_SLOWEST_RANK_BYTES];
tmp_file.fcounters[POSIX_F_SLOWEST_RANK_TIME] =
infile->fcounters[POSIX_F_SLOWEST_RANK_TIME];
}
else
{
tmp_file.counters[POSIX_SLOWEST_RANK] =
inoutfile->counters[POSIX_SLOWEST_RANK];
tmp_file.counters[POSIX_SLOWEST_RANK_BYTES] =
inoutfile->counters[POSIX_SLOWEST_RANK_BYTES];
tmp_file.fcounters[POSIX_F_SLOWEST_RANK_TIME] =
inoutfile->fcounters[POSIX_F_SLOWEST_RANK_TIME];
}
/* update pointers */
*inoutfile = tmp_file;
inoutfile++;
......
......@@ -196,6 +196,10 @@ int main(int argc, char **argv)
"\t\tPOSIX_MAX_READ_TIME_SIZE:\t%"PRIu64"\n"
"\t\tPOSIX_MAX_WRITE_TIME_SIZE:\t%"PRIu64"\n"
"\t\tSIZE_AT_OPEN:\t%"PRIu64"\n"
"\t\tPOSIX_FASTEST_RANK:\t%"PRIu64"\n"
"\t\tPOSIX_FASTEST_RANK_BYTES:\t%"PRIu64"\n"
"\t\tPOSIX_SLOWEST_RANK:\t%"PRIu64"\n"
"\t\tPOSIX_SLOWEST_RANK_BYTES:\t%"PRIu64"\n"
"\t\tPOSIX_F_OPEN_TIMESTAMP:\t%lf\n"
"\t\tPOSIX_F_READ_START_TIMESTAMP:\t%lf\n"
"\t\tPOSIX_F_WRITE_START_TIMESTAMP:\t%lf\n"
......@@ -204,8 +208,11 @@ int main(int argc, char **argv)
"\t\tPOSIX_F_CLOSE_TIMESTAMP:\t%lf\n"
"\t\tPOSIX_F_READ_TIME:\t%lf\n"
"\t\tPOSIX_F_WRITE_TIME:\t%lf\n"
"\t\tPOSIX_F_META_TIME:\t%lf\n"
"\t\tPOSIX_F_MAX_READ_TIME:\t%lf\n"
"\t\tPOSIX_F_MAX_WRITE_TIME:\t%lf\n",
"\t\tPOSIX_F_MAX_WRITE_TIME:\t%lf\n"
"\t\tPOSIX_F_FASTEST_RANK_TIME:\t%lf\n"
"\t\tPOSIX_F_SLOWEST_RANK_TIME:\t%lf\n",
next_file.counters[POSIX_OPENS],
next_file.counters[POSIX_READS],
next_file.counters[POSIX_WRITES],
......@@ -232,6 +239,10 @@ int main(int argc, char **argv)
next_file.counters[POSIX_MAX_READ_TIME_SIZE],
next_file.counters[POSIX_MAX_WRITE_TIME_SIZE],
next_file.counters[SIZE_AT_OPEN],
next_file.counters[POSIX_FASTEST_RANK],
next_file.counters[POSIX_FASTEST_RANK_BYTES],
next_file.counters[POSIX_SLOWEST_RANK],
next_file.counters[POSIX_SLOWEST_RANK_BYTES],
next_file.fcounters[POSIX_F_OPEN_TIMESTAMP],
next_file.fcounters[POSIX_F_READ_START_TIMESTAMP],
next_file.fcounters[POSIX_F_WRITE_START_TIMESTAMP],
......@@ -240,8 +251,11 @@ int main(int argc, char **argv)
next_file.fcounters[POSIX_F_CLOSE_TIMESTAMP],
next_file.fcounters[POSIX_F_READ_TIME],
next_file.fcounters[POSIX_F_WRITE_TIME],
next_file.fcounters[POSIX_F_META_TIME],
next_file.fcounters[POSIX_F_MAX_READ_TIME],
next_file.fcounters[POSIX_F_MAX_WRITE_TIME]);
next_file.fcounters[POSIX_F_MAX_WRITE_TIME],
next_file.fcounters[POSIX_F_FASTEST_RANK_TIME],
next_file.fcounters[POSIX_F_SLOWEST_RANK_TIME]);
i++;
} while((ret = darshan_log_get_posix_file(fd, &next_file)) == 1);
......
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