Commit e8aa61e5 authored by Philip Carns's avatar Philip Carns

darshan 3.x workload parser

- contributed by Jian Peng <jpeng10@hawk.iit.edu>
parent aa8ab8a8
......@@ -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-darshan-posix-io-wrkld.c
LDADD += ${DARSHAN_LIBS}
TESTS += tests/workload/darshan-dump.sh
endif
......
......@@ -58,6 +58,7 @@ struct darshan_params
{
char log_file_path[MAX_NAME_LENGTH_WKLD];
int64_t aggregator_cnt;
int app_cnt;
};
struct recorder_params
......@@ -157,7 +158,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;
......@@ -275,7 +276,7 @@ int codes_workload_load(
const char* type,
const char* params,
int app_id,
int rank);
int rank, int *total_time);
/* Retrieves the next I/O operation to execute. the wkld_id is the
* identifier returned by the init() function. The op argument is a pointer
......@@ -313,6 +314,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
{
......@@ -320,10 +326,12 @@ struct codes_workload_method
void * (*codes_workload_read_config) (
ConfigHandle *handle, char const * section_name,
char const * annotation, int num_ranks);
int (*codes_workload_load)(const char* params, int app_id, int rank);
int (*codes_workload_load)(const char* params, int app_id, int rank, int *total_time);
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);
};
......
......@@ -294,6 +294,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 +302,18 @@ 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);
int id = codes_workload_load(type, wparams, 0, i);
//printf("loading %s, %d\n", type, i);
int total_time;
int id = codes_workload_load(type, wparams, 0, i, &total_time);
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);
......@@ -392,11 +399,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,
......@@ -142,7 +160,7 @@ int codes_workload_load(
const char* type,
const char* params,
int app_id,
int rank)
int rank, int *total_time)
{
init_workload_methods();
......@@ -155,7 +173,7 @@ int codes_workload_load(
if(strcmp(method_array[i]->method_name, type) == 0)
{
/* load appropriate workload generator */
ret = method_array[i]->codes_workload_load(params, app_id, rank);
ret = method_array[i]->codes_workload_load(params, app_id, rank, total_time);
if(ret < 0)
{
return(-1);
......@@ -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)
......@@ -328,6 +373,7 @@ void codes_workload_print_op(
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.
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