Commit a645fe19 authored by Jonathan Jenkins's avatar Jonathan Jenkins
Browse files

refine workload configuration interface/impl

parent 8815fdde
...@@ -208,9 +208,14 @@ typedef struct ...@@ -208,9 +208,14 @@ typedef struct
void * params; void * params;
} codes_workload_config_return; } codes_workload_config_return;
// NOTE: some workloads (iolang, checkpoint) require information about the
// total number of ranks to correctly process traces/config files, etc. Other
// workload generators (darshan) ignore it
codes_workload_config_return codes_workload_read_config( codes_workload_config_return codes_workload_read_config(
ConfigHandle * handle, ConfigHandle * handle,
char const * section_name); char const * section_name,
char const * annotation,
int num_ranks);
void codes_workload_free_config_return(codes_workload_config_return *c); void codes_workload_free_config_return(codes_workload_config_return *c);
......
...@@ -26,7 +26,8 @@ struct codes_workload_method ...@@ -26,7 +26,8 @@ struct codes_workload_method
{ {
char *method_name; /* name of the generator */ char *method_name; /* name of the generator */
void * (*codes_workload_read_config) ( void * (*codes_workload_read_config) (
ConfigHandle *handle, char const * section_name); 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);
void (*codes_workload_get_next)(int app_id, int rank, struct codes_workload_op *op); void (*codes_workload_get_next)(int app_id, int rank, struct codes_workload_op *op);
int (*codes_workload_get_rank_cnt)(const char* params, int app_id); int (*codes_workload_get_rank_cnt)(const char* params, int app_id);
......
...@@ -72,7 +72,9 @@ static struct rank_queue *ranks = NULL; ...@@ -72,7 +72,9 @@ static struct rank_queue *ranks = NULL;
codes_workload_config_return codes_workload_read_config( codes_workload_config_return codes_workload_read_config(
ConfigHandle * handle, ConfigHandle * handle,
char const * section_name) char const * section_name,
char const * annotation,
int num_ranks)
{ {
char type[MAX_NAME_LENGTH_WKLD]; char type[MAX_NAME_LENGTH_WKLD];
codes_workload_config_return r; codes_workload_config_return r;
...@@ -80,7 +82,7 @@ codes_workload_config_return codes_workload_read_config( ...@@ -80,7 +82,7 @@ codes_workload_config_return codes_workload_read_config(
r.params = NULL; r.params = NULL;
int rc = configuration_get_value(handle, section_name, "type", int rc = configuration_get_value(handle, section_name, "type",
NULL, type, MAX_NAME_LENGTH_WKLD); annotation, type, MAX_NAME_LENGTH_WKLD);
if (rc <= 0) if (rc <= 0)
return r; return r;
...@@ -91,7 +93,8 @@ codes_workload_config_return codes_workload_read_config( ...@@ -91,7 +93,8 @@ codes_workload_config_return codes_workload_read_config(
if (m->codes_workload_read_config == NULL) if (m->codes_workload_read_config == NULL)
r.params = NULL; r.params = NULL;
else else
r.params = m->codes_workload_read_config(handle, section_name); r.params = m->codes_workload_read_config(handle, section_name,
annotation, num_ranks);
} }
} }
......
...@@ -29,7 +29,9 @@ enum checkpoint_status ...@@ -29,7 +29,9 @@ enum checkpoint_status
static void * checkpoint_workload_read_config( static void * checkpoint_workload_read_config(
ConfigHandle *handle, ConfigHandle *handle,
char const * section_name); char const * section_name,
char const * annotation,
int num_ranks);
static int checkpoint_workload_load(const char* params, int app_id, int rank); static int checkpoint_workload_load(const char* params, int app_id, int rank);
static void checkpoint_workload_get_next(int app_id, int rank, struct codes_workload_op *op); static void checkpoint_workload_get_next(int app_id, int rank, struct codes_workload_op *op);
...@@ -76,7 +78,9 @@ struct codes_workload_method checkpoint_workload_method = ...@@ -76,7 +78,9 @@ struct codes_workload_method checkpoint_workload_method =
static void * checkpoint_workload_read_config( static void * checkpoint_workload_read_config(
ConfigHandle *handle, ConfigHandle *handle,
char const * section_name) char const * section_name,
char const * annotation,
int num_ranks)
{ {
checkpoint_wrkld_params *p = malloc(sizeof(*p)); checkpoint_wrkld_params *p = malloc(sizeof(*p));
assert(p); assert(p);
...@@ -99,6 +103,8 @@ static void * checkpoint_workload_read_config( ...@@ -99,6 +103,8 @@ static void * checkpoint_workload_read_config(
&p->mtti); &p->mtti);
assert(!rc); assert(!rc);
p->nprocs = num_ranks;
return p; return p;
} }
......
...@@ -45,7 +45,9 @@ struct rank_io_context ...@@ -45,7 +45,9 @@ struct rank_io_context
static void * darshan_io_workload_read_config( static void * darshan_io_workload_read_config(
ConfigHandle * handle, ConfigHandle * handle,
char const * section_name); char const * section_name,
char const * annotation,
int num_ranks);
/* Darshan workload generator's implementation of the CODES workload API */ /* Darshan workload generator's implementation of the CODES workload API */
static int darshan_io_workload_load(const char *params, int app_id, int rank); static int darshan_io_workload_load(const char *params, int app_id, int rank);
static void darshan_io_workload_get_next(int app_id, int rank, struct codes_workload_op *op); static void darshan_io_workload_get_next(int app_id, int rank, struct codes_workload_op *op);
...@@ -110,7 +112,9 @@ static int rank_tbl_pop = 0; ...@@ -110,7 +112,9 @@ static int rank_tbl_pop = 0;
static void * darshan_io_workload_read_config( static void * darshan_io_workload_read_config(
ConfigHandle * handle, ConfigHandle * handle,
char const * section_name) char const * section_name,
char const * annotation,
int num_ranks)
{ {
darshan_params *d = malloc(sizeof(*d)); darshan_params *d = malloc(sizeof(*d));
assert(d); assert(d);
...@@ -118,16 +122,17 @@ static void * darshan_io_workload_read_config( ...@@ -118,16 +122,17 @@ static void * darshan_io_workload_read_config(
d->aggregator_cnt = -1; d->aggregator_cnt = -1;
int rc = configuration_get_value_relpath(handle, section_name, int rc = configuration_get_value_relpath(handle, section_name,
"darshan_log_file", NULL, d->log_file_path, "darshan_log_file", annotation, d->log_file_path,
MAX_NAME_LENGTH_WKLD); MAX_NAME_LENGTH_WKLD);
assert(rc > 0); assert(rc > 0);
int tmp; int tmp;
rc = configuration_get_value_int(&config, "workload", rc = configuration_get_value_int(&config, "workload",
"darshan_aggregator_count", NULL, &tmp); "darshan_aggregator_count", annotation, &tmp);
assert(rc == 0); assert(rc == 0);
d->aggregator_cnt = tmp; d->aggregator_cnt = tmp;
return d; return d;
} }
/* load the workload generator for this rank, given input params */ /* load the workload generator for this rank, given input params */
static int darshan_io_workload_load(const char *params, int app_id, int rank) static int darshan_io_workload_load(const char *params, int app_id, int rank)
{ {
......
...@@ -23,7 +23,9 @@ the BG/P storage model */ ...@@ -23,7 +23,9 @@ the BG/P storage model */
static void * iolang_io_workload_read_config( static void * iolang_io_workload_read_config(
ConfigHandle * handle, ConfigHandle * handle,
char const * section_name); char const * section_name,
char const * annotation,
int num_ranks);
/* load the workload file */ /* load the workload file */
static int iolang_io_workload_load(const char* params, int app_id, int rank); static int iolang_io_workload_load(const char* params, int app_id, int rank);
...@@ -63,7 +65,9 @@ struct codes_iolang_wrkld_state_per_rank ...@@ -63,7 +65,9 @@ struct codes_iolang_wrkld_state_per_rank
static void * iolang_io_workload_read_config( static void * iolang_io_workload_read_config(
ConfigHandle * handle, ConfigHandle * handle,
char const * section_name) char const * section_name,
char const * annotation,
int num_ranks)
{ {
iolang_params *p = malloc(sizeof(*p)); iolang_params *p = malloc(sizeof(*p));
assert(p); assert(p);
...@@ -73,13 +77,13 @@ static void * iolang_io_workload_read_config( ...@@ -73,13 +77,13 @@ static void * iolang_io_workload_read_config(
p->io_kernel_path[0] = '\0'; p->io_kernel_path[0] = '\0';
int rc = configuration_get_value_relpath(handle, section_name, int rc = configuration_get_value_relpath(handle, section_name,
"io_kernel_meta_path", NULL, p->io_kernel_meta_path, "io_kernel_meta_path", annotation, p->io_kernel_meta_path,
MAX_NAME_LENGTH_WKLD); MAX_NAME_LENGTH_WKLD);
assert(rc > 0); assert(rc > 0);
rc = configuration_get_value_int(handle, section_name, "num_ranks", NULL, rc = configuration_get_value_int(handle, section_name, "num_ranks",
&p->num_cns); annotation, &p->num_cns);
if (rc != 0) if (rc != 0)
p->num_cns = -1; p->num_cns = num_ranks;
return p; return p;
} }
......
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