Commit 30bb3be1 authored by Misbah Mubarak's avatar Misbah Mubarak

Merge branch 'darshan-3x-support' into 'master'

Darshan 3x support

See merge request !42
parents 96306239 24603a7f
......@@ -47,7 +47,7 @@ endif
if USE_DARSHAN
AM_CPPFLAGS += ${DARSHAN_CFLAGS} -DUSE_DARSHAN=1
src_libcodes_la_SOURCES += src/workload/methods/codes-darshan-io-wrkld.c
src_libcodes_la_SOURCES += src/workload/methods/codes-darshan3-io-wrkld.c
LDADD += ${DARSHAN_LIBS}
TESTS += tests/workload/darshan-dump.sh
endif
......
......@@ -57,7 +57,7 @@ struct iolang_params
struct darshan_params
{
char log_file_path[MAX_NAME_LENGTH_WKLD];
int64_t aggregator_cnt;
int app_cnt;
};
struct recorder_params
......@@ -146,7 +146,24 @@ enum codes_workload_op_type
/* for workloads that have events not yet handled
* (eg the workload language) */
CODES_WK_IGNORE
CODES_WK_IGNORE,
/* extended IO workload operations: MPI */
/* open */
CODES_WK_MPI_OPEN,
/* close */
CODES_WK_MPI_CLOSE,
/* write */
CODES_WK_MPI_WRITE,
/* read */
CODES_WK_MPI_READ,
/* collective open */
CODES_WK_MPI_COLL_OPEN,
/* collective_write */
CODES_WK_MPI_COLL_WRITE,
/* collective_read */
CODES_WK_MPI_COLL_READ,
};
/* I/O operation paramaters */
......@@ -157,7 +174,7 @@ struct codes_workload_op
*/
/* what type of operation this is */
int op_type;
enum codes_workload_op_type op_type;
/* currently only used by network workloads */
double start_time;
double end_time;
......@@ -313,6 +330,11 @@ void codes_workload_print_op(
int app_id,
int rank);
int codes_workload_get_time(const char *type,
const char * params,
int app_id,
int rank, double *read_time, double *write_time, int64_t *read_bytes, int64_t *written_bytes);
/* implementation structure */
struct codes_workload_method
{
......@@ -324,6 +346,8 @@ struct codes_workload_method
void (*codes_workload_get_next)(int app_id, int rank, struct codes_workload_op *op);
void (*codes_workload_get_next_rc2)(int app_id, int rank);
int (*codes_workload_get_rank_cnt)(const char* params, int app_id);
/* added for get all read or write time */
int (*codes_workload_get_time)(const char * params, int app_id, int rank, double *read_time, double *write_time, int64_t *read_bytes, int64_t *written_bytes);
};
......
......@@ -27,7 +27,6 @@ static struct option long_opts[] =
{"num-ranks", required_argument, NULL, 'n'},
{"start-rank", required_argument, NULL, 'r'},
{"d-log", required_argument, NULL, 'l'},
{"d-aggregator-cnt", required_argument, NULL, 'a'},
{"i-meta", required_argument, NULL, 'm'},
{"i-use-relpath", no_argument, NULL, 'p'},
{"r-trace-dir", required_argument, NULL, 'd'},
......@@ -53,7 +52,6 @@ void usage(){
"-s: print final workload stats\n"
"DARSHAN OPTIONS (darshan_io_workload)\n"
"--d-log: darshan log file\n"
"--d-aggregator-cnt: number of aggregators for collective I/O in darshan\n"
"IOLANG OPTIONS (iolang_workload)\n"
"--i-meta: i/o language kernel meta file path\n"
"--i-use-relpath: use i/o kernel path relative meta file path\n"
......@@ -133,9 +131,6 @@ int main(int argc, char *argv[])
case 'l':
strcpy(d_params.log_file_path, optarg);
break;
case 'a':
d_params.aggregator_cnt = atol(optarg);
break;
case 'm':
strcpy(i_params.io_kernel_meta_path, optarg);
break;
......@@ -206,11 +201,6 @@ int main(int argc, char *argv[])
usage();
return 1;
}
else if (d_params.aggregator_cnt == 0){
fprintf(stderr, "Expected \"--d-aggregator-cnt\" argument for darshan workload\n");
usage();
return 1;
}
else{
wparams = (char*)&d_params;
}
......@@ -294,6 +284,7 @@ int main(int argc, char *argv[])
/* if num_ranks not set, pull it from the workload */
if (n == -1){
//printf("Getting rank count\n");
n = codes_workload_get_rank_cnt(type, wparams, 0);
if (n == -1) {
fprintf(stderr,
......@@ -301,12 +292,17 @@ int main(int argc, char *argv[])
"Specify option --num-ranks\n");
return 1;
}
printf("rank count = %d\n", n);
}
for (i = start_rank ; i < start_rank+n; i++){
struct codes_workload_op op;
printf("loading %s, %d\n", type, i);
//printf("loading %s, %d\n", type, i);
int id = codes_workload_load(type, wparams, 0, i);
double total_read_time = 0.0, total_write_time = 0.0;
int64_t total_read_bytes = 0, total_written_bytes = 0;
codes_workload_get_time(type, wparams, 0, i, &total_read_time, &total_write_time, &total_read_bytes, &total_written_bytes);
printf("total_read_time = %f, total_write_time = %f\n", total_read_time, total_write_time);
assert(id != -1);
do {
codes_workload_get_next(id, 0, i, &op);
......@@ -321,16 +317,23 @@ int main(int argc, char *argv[])
num_barriers++;
break;
case CODES_WK_OPEN:
case CODES_WK_MPI_OPEN:
case CODES_WK_MPI_COLL_OPEN:
num_opens++;
break;
case CODES_WK_CLOSE:
case CODES_WK_MPI_CLOSE:
num_closes++;
break;
case CODES_WK_WRITE:
case CODES_WK_MPI_WRITE:
case CODES_WK_MPI_COLL_WRITE:
num_writes++;
write_size += op.u.write.size;
break;
case CODES_WK_READ:
case CODES_WK_MPI_READ:
case CODES_WK_MPI_COLL_READ:
num_reads++;
read_size += op.u.write.size;
break;
......@@ -392,11 +395,11 @@ int main(int argc, char *argv[])
{
if(i == 0)
{
int j;
printf("\n rank %d wait_all: ", i);
for(j = 0; j < op.u.waits.count; j++)
printf(" %d ", op.u.waits.req_ids[j]);
num_waitalls++;
int j;
printf("\n rank %d wait_all: ", i);
for(j = 0; j < op.u.waits.count; j++)
printf(" %d ", op.u.waits.req_ids[j]);
num_waitalls++;
}
}
break;
......
......@@ -13,14 +13,24 @@
/* list of available methods. These are statically compiled for now, but we
* could make generators optional via autoconf tests etc. if needed
*/
/* added by pj: differ POSIX and MPI IO in darshan 3.00*/
#define DARSHAN_POSIX_IO 1
#define DARSHAN_MPI_IO 0
extern struct codes_workload_method test_workload_method;
extern struct codes_workload_method iolang_workload_method;
#ifdef USE_DUMPI
extern struct codes_workload_method dumpi_trace_workload_method;
#endif
#ifdef USE_DARSHAN
extern struct codes_workload_method darshan_io_workload_method;
#if DARSHAN_POSIX_IO
extern struct codes_workload_method darshan_posix_io_workload_method;
#elif DARSHAN_MPI_IO
extern struct codes_workload_method darshan_mpi_io_workload_method;
#endif
#endif
#ifdef USE_RECORDER
extern struct codes_workload_method recorder_io_workload_method;
#endif
......@@ -34,8 +44,16 @@ static struct codes_workload_method const * method_array_default[] =
#ifdef USE_DUMPI
&dumpi_trace_workload_method,
#endif
#ifdef USE_DARSHAN
&darshan_io_workload_method,
/* added by pj: posix and mpi io */
#if DARSHAN_POSIX_IO
&darshan_posix_io_workload_method,
#elif DARNSHAN_MPI_IO
/* TODO: MPI_IO */
&darshan_mpi_io_workload_method,
#endif
#endif
#ifdef USE_RECORDER
&recorder_io_workload_method,
......@@ -264,15 +282,42 @@ void codes_workload_get_next_rc2(
method_array[wkld_id]->codes_workload_get_next_rc2(app_id, rank);
}
int codes_workload_get_time(const char *type, const char *params, int app_id,
int rank, double *read_time, double *write_time, int64_t *read_bytes, int64_t *written_bytes)
{
int i;
init_workload_methods();
//printf("entering rank count, method_array = %p \n", method_array);
for(i=0; method_array[i] != NULL; i++)
{
//printf("%p\n", method_array[i]);
//printf(" geting time:: method_array[%d]->method_name = %s, type = %s\n", i, method_array[i]->method_name, type);
if(strcmp(method_array[i]->method_name, type) == 0)
{
if (method_array[i]->codes_workload_get_time != NULL)
return method_array[i]->codes_workload_get_time(
params, app_id, rank, read_time, write_time, read_bytes, written_bytes);
else
return -1;
}
}
return 0;
}
int codes_workload_get_rank_cnt(
const char* type,
const char* params,
int app_id)
{
int i;
init_workload_methods();
//printf("entering rank count, method_array = %p \n", method_array);
for(i=0; method_array[i] != NULL; i++)
{
//printf("%p\n", method_array[i]);
//printf("method_array[%d]->method_name = %s, type = %s\n", i, method_array[i]->method_name, type);
if(strcmp(method_array[i]->method_name, type) == 0)
{
if (method_array[i]->codes_workload_get_rank_cnt != NULL)
......@@ -293,6 +338,8 @@ void codes_workload_print_op(
int app_id,
int rank)
{
char *name;
switch(op->op_type){
case CODES_WK_END:
fprintf(f, "op: app:%d rank:%d type:end\n", app_id, rank);
......@@ -306,28 +353,47 @@ void codes_workload_print_op(
app_id, rank, op->u.barrier.count, op->u.barrier.root);
break;
case CODES_WK_OPEN:
fprintf(f, "op: app:%d rank:%d type:open file_id:%llu flag:%d\n",
app_id, rank, LLU(op->u.open.file_id), op->u.open.create_flag);
case CODES_WK_MPI_OPEN:
case CODES_WK_MPI_COLL_OPEN:
if(op->op_type == CODES_WK_OPEN) name = "open";
if(op->op_type == CODES_WK_MPI_OPEN) name = "mpi_open";
if(op->op_type == CODES_WK_MPI_COLL_OPEN) name = "mpi_coll_open";
fprintf(f, "op: app:%d rank:%d type:%s file_id:%llu flag:%d\n",
app_id, rank, name, LLU(op->u.open.file_id), op->u.open.create_flag);
break;
case CODES_WK_CLOSE:
fprintf(f, "op: app:%d rank:%d type:close file_id:%llu\n",
app_id, rank, LLU(op->u.close.file_id));
case CODES_WK_MPI_CLOSE:
if(op->op_type == CODES_WK_CLOSE) name = "close";
if(op->op_type == CODES_WK_MPI_CLOSE) name = "mpi_close";
fprintf(f, "op: app:%d rank:%d type:%s file_id:%llu\n",
app_id, rank, name, LLU(op->u.close.file_id));
break;
case CODES_WK_WRITE:
fprintf(f, "op: app:%d rank:%d type:write "
case CODES_WK_MPI_WRITE:
case CODES_WK_MPI_COLL_WRITE:
if(op->op_type == CODES_WK_WRITE) name = "write";
if(op->op_type == CODES_WK_MPI_WRITE) name = "mpi_write";
if(op->op_type == CODES_WK_MPI_COLL_WRITE) name = "mpi_coll_write";
fprintf(f, "op: app:%d rank:%d type:%s "
"file_id:%llu off:%llu size:%llu\n",
app_id, rank, LLU(op->u.write.file_id), LLU(op->u.write.offset),
app_id, rank, name, LLU(op->u.write.file_id), LLU(op->u.write.offset),
LLU(op->u.write.size));
break;
case CODES_WK_READ:
fprintf(f, "op: app:%d rank:%d type:read "
case CODES_WK_MPI_READ:
case CODES_WK_MPI_COLL_READ:
if(op->op_type == CODES_WK_READ) name = "read";
if(op->op_type == CODES_WK_MPI_READ) name = "mpi_read";
if(op->op_type == CODES_WK_MPI_COLL_READ) name = "mpi_coll_read";
fprintf(f, "op: app:%d rank:%d type:%s "
"file_id:%llu off:%llu size:%llu\n",
app_id, rank, LLU(op->u.read.file_id), LLU(op->u.read.offset),
app_id, rank, name, LLU(op->u.read.file_id), LLU(op->u.read.offset),
LLU(op->u.read.size));
break;
case CODES_WK_SEND:
fprintf(f, "op: app:%d rank:%d type:send "
"src:%d dst:%d bytes:%"PRIu64" type:%d count:%d tag:%d "
"src:%d dst:%d bytes:%d type:%d count:%d tag:%d "
"start:%.5e end:%.5e\n",
app_id, rank,
op->u.send.source_rank, op->u.send.dest_rank,
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -5,4 +5,4 @@ if [ -z $srcdir ]; then
exit 1
fi
src/workload/codes-workload-dump --num-ranks 4 --type darshan_io_workload --d-log $srcdir/tests/workload/example.darshan.gz --d-aggregator-cnt 1
src/workload/codes-workload-dump --num-ranks 4 --type darshan_io_workload --d-log $srcdir/tests/workload/example.darshan
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