Commit 722c1fc4 authored by Jonathan Jenkins's avatar Jonathan Jenkins

add application id parameter to workload functions

currently ignored by all
parent 37ae6615
......@@ -186,19 +186,21 @@ struct codes_workload_op
struct {
int num_bytes;
} collective;
struct {
int count;
int16_t* req_ids;
} waits;
struct {
int16_t req_id;
} wait;
struct {
int count;
int16_t* req_ids;
} waits;
struct {
int16_t req_id;
} wait;
}u;
};
/* load and initialize workload of of type "type" with parameters specified by
* "params". The rank is the caller's relative rank within the collection
* of processes that will participate in this workload.
* of processes that will participate in this workload. The app_id is the
* "application" that the rank is participating in, used to differentiate
* between multiple, concurrent workloads
*
* This function is intended to be called by a compute node LP in a model
* and may be called multiple times over the course of a
......@@ -207,22 +209,41 @@ struct codes_workload_op
* Returns and identifier that can be used to retrieve operations later.
* Returns -1 on failure.
*/
int codes_workload_load(const char* type, const char* params, int rank);
int codes_workload_load(
const char* type,
const char* params,
int app_id,
int rank);
/* 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
* to a structure to be filled in with I/O operation information.
*/
void codes_workload_get_next(int wkld_id, int rank, struct codes_workload_op *op);
void codes_workload_get_next(
int wkld_id,
int app_id,
int rank,
struct codes_workload_op *op);
/* Reverse of the above function. */
void codes_workload_get_next_rc(int wkld_id, int rank, const struct codes_workload_op *op);
void codes_workload_get_next_rc(
int wkld_id,
int app_id,
int rank,
const struct codes_workload_op *op);
/* Retrieve the number of ranks contained in a workload */
int codes_workload_get_rank_cnt(const char* type, const char* params);
int codes_workload_get_rank_cnt(
const char* type,
const char* params,
int app_id);
/* for debugging/logging: print an individual operation to the specified file */
void codes_workload_print_op(FILE *f, struct codes_workload_op *op, int rank);
void codes_workload_print_op(
FILE *f,
struct codes_workload_op *op,
int app_id,
int rank);
/* NOTE: there is deliberately no finalize function; we don't have any
* reliable way to tell when a workload is truly done and will not
......@@ -236,6 +257,7 @@ void codes_workload_print_op(FILE *f, struct codes_workload_op *op, int rank);
* Local variables:
* c-indent-level: 4
* c-basic-offset: 4
* indent-tabs-mode: nil
* End:
*
* vim: ft=c ts=8 sts=4 sw=4 expandtab
......
......@@ -215,7 +215,7 @@ int main(int argc, char *argv[])
/* if num_ranks not set, pull it from the workload */
if (n == -1){
n = codes_workload_get_rank_cnt(type, wparams);
n = codes_workload_get_rank_cnt(type, wparams, 0);
if (n == -1) {
fprintf(stderr,
"Unable to get rank count from workload. "
......@@ -227,11 +227,11 @@ int main(int argc, char *argv[])
for (i = 0 ; i < n; i++){
struct codes_workload_op op;
printf("loading %s, %d\n", type, i);
int id = codes_workload_load(type, wparams, i);
int id = codes_workload_load(type, wparams, 0, i);
assert(id != -1);
do {
codes_workload_get_next(id, i, &op);
codes_workload_print_op(stdout, &op, i);
codes_workload_get_next(id, 0, i, &op);
codes_workload_print_op(stdout, &op, 0, i);
switch(op.op_type)
{
......
......@@ -18,9 +18,9 @@
struct codes_workload_method
{
char *method_name; /* name of the generator */
int (*codes_workload_load)(const char* params, int rank);
void (*codes_workload_get_next)(int rank, struct codes_workload_op *op);
int (*codes_workload_get_rank_cnt)(const char* params);
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);
int (*codes_workload_get_rank_cnt)(const char* params, int app_id);
};
#endif /* CODES_WORKLOAD_METHOD_H */
......
This diff is collapsed.
......@@ -44,9 +44,9 @@ struct rank_io_context
};
/* Darshan workload generator's implementation of the CODES workload API */
static int darshan_io_workload_load(const char *params, int rank);
static void darshan_io_workload_get_next(int rank, struct codes_workload_op *op);
static int darshan_io_workload_get_rank_cnt(const char *params);
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 int darshan_io_workload_get_rank_cnt(const char *params, int app_id);
static int darshan_rank_hash_compare(void *key, struct qhash_head *link);
/* Darshan I/O op data structure access (insert, remove) abstraction */
......@@ -105,7 +105,7 @@ static struct qhash_table *rank_tbl = NULL;
static int rank_tbl_pop = 0;
/* load the workload generator for this rank, given input params */
static int darshan_io_workload_load(const char *params, int rank)
static int darshan_io_workload_load(const char *params, int app_id, int rank)
{
darshan_params *d_params = (darshan_params *)params;
darshan_fd logfile_fd;
......@@ -201,7 +201,7 @@ static int darshan_io_workload_load(const char *params, int rank)
}
/* pull the next event (independent or collective) for this rank from its event context */
static void darshan_io_workload_get_next(int rank, struct codes_workload_op *op)
static void darshan_io_workload_get_next(int app_id, int rank, struct codes_workload_op *op)
{
int64_t my_rank = (int64_t)rank;
struct qhash_head *hash_link = NULL;
......@@ -252,7 +252,7 @@ static void darshan_io_workload_get_next(int rank, struct codes_workload_op *op)
return;
}
static int darshan_io_workload_get_rank_cnt(const char *params)
static int darshan_io_workload_get_rank_cnt(const char *params, int app_id)
{
darshan_params *d_params = (darshan_params *)params;
darshan_fd logfile_fd;
......@@ -1718,6 +1718,7 @@ static void file_sanity_check(
* Local variables:
* c-indent-level: 4
* c-basic-offset: 4
* indent-tabs-mode: nil
* End:
*
* vim: ft=c ts=8 sts=4 sw=4 expandtab
......
......@@ -43,10 +43,10 @@ typedef struct dumpi_op_data_array
} dumpi_op_data_array;
/* load the trace */
int dumpi_trace_nw_workload_load(const char* params, int rank);
int dumpi_trace_nw_workload_load(const char* params, int app_id, int rank);
/* dumpi implementation of get next operation in the workload */
void dumpi_trace_nw_workload_get_next(int rank, struct codes_workload_op *op);
void dumpi_trace_nw_workload_get_next(int app_id, int rank, struct codes_workload_op *op);
/* get number of bytes from the workload data type and count */
int get_num_bytes(dumpi_datatype dt);
......@@ -499,7 +499,7 @@ static int hash_rank_compare(void *key, struct qhash_head *link)
return 0;
}
int dumpi_trace_nw_workload_load(const char* params, int rank)
int dumpi_trace_nw_workload_load(const char* params, int app_id, int rank)
{
libundumpi_callbacks callbacks;
libundumpi_cbpair callarr[DUMPI_END_OF_STREAM];
......@@ -681,7 +681,7 @@ int get_num_bytes(dumpi_datatype dt)
}
}
void dumpi_trace_nw_workload_get_next(int rank, struct codes_workload_op *op)
void dumpi_trace_nw_workload_get_next(int app_id, int rank, struct codes_workload_op *op)
{
rank_mpi_context* temp_data;
struct qhash_head *hash_link = NULL;
......@@ -725,6 +725,7 @@ struct codes_workload_method dumpi_trace_workload_method =
* Local variables:
* c-indent-level: 4
* c-basic-offset: 4
* indent-tabs-mode: nil
* End:
*
* vim: ft=c ts=8 sts=4 sw=4 expandtab
......
......@@ -21,10 +21,10 @@
the BG/P storage model */
/* load the workload file */
int iolang_io_workload_load(const char* params, int rank);
int iolang_io_workload_load(const char* params, int app_id, int rank);
/* get next operation */
void iolang_io_workload_get_next(int rank, struct codes_workload_op *op);
void iolang_io_workload_get_next(int app_id, int rank, struct codes_workload_op *op);
/* mapping from bg/p operation enums to CODES workload operations enum */
static int convertTypes(int inst);
......@@ -55,7 +55,7 @@ struct codes_iolang_wrkld_state_per_rank
};
/* loads the workload file for each simulated MPI rank/ compute node LP */
int iolang_io_workload_load(const char* params, int rank)
int iolang_io_workload_load(const char* params, int app_id, int rank)
{
int t = -1;
iolang_params* i_param = (struct iolang_params*)params;
......@@ -126,7 +126,7 @@ static int convertTypes(int inst)
}
/* Gets the next operation specified in the workload file for the simulated MPI rank */
void iolang_io_workload_get_next(int rank, struct codes_workload_op *op)
void iolang_io_workload_get_next(int app_id, int rank, struct codes_workload_op *op)
{
/* If the number of simulated compute nodes per LP is initialized only then we get the next operation
else we return an error code may be? */
......
......@@ -54,8 +54,8 @@ struct rank_traces_context
};
/* CODES workload API functions for workloads generated from recorder traces*/
static int recorder_io_workload_load(const char *params, int rank);
static void recorder_io_workload_get_next(int rank, struct codes_workload_op *op);
static int recorder_io_workload_load(const char *params, int app_id, int rank);
static void recorder_io_workload_get_next(int app_id, int rank, struct codes_workload_op *op);
/* helper functions for recorder workload CODES API */
static int hash_rank_compare(void *key, struct qhash_head *link);
......@@ -73,7 +73,7 @@ static struct qhash_table *rank_tbl = NULL;
static int rank_tbl_pop = 0;
/* load the workload generator for this rank, given input params */
static int recorder_io_workload_load(const char *params, int rank)
static int recorder_io_workload_load(const char *params, int app_id, int rank)
{
recorder_params *r_params = (recorder_params *) params;
struct rank_traces_context *newv = NULL;
......@@ -337,7 +337,7 @@ static int recorder_io_workload_load(const char *params, int rank)
}
/* pull the next trace (independent or collective) for this rank from its trace context */
static void recorder_io_workload_get_next(int rank, struct codes_workload_op *op)
static void recorder_io_workload_get_next(int app_id, int rank, struct codes_workload_op *op)
{
struct qhash_head *hash_link = NULL;
struct rank_traces_context *tmp = NULL;
......
......@@ -15,8 +15,8 @@
#include "codes/codes-workload.h"
#include "src/workload/codes-workload-method.h"
static int test_workload_load(const char* params, int rank);
static void test_workload_get_next(int rank, struct codes_workload_op *op);
static int test_workload_load(const char* params, int app_id, int rank);
static void test_workload_get_next(int app_id, int rank, struct codes_workload_op *op);
/* state information for each rank that is retrieving requests */
struct wkload_stream_state
......@@ -38,7 +38,7 @@ struct codes_workload_method test_workload_method =
.codes_workload_get_next = test_workload_get_next,
};
static int test_workload_load(const char* params, int rank)
static int test_workload_load(const char* params, int app_id, int rank)
{
/* no params in this case; this example will work with any number of
* ranks
......@@ -88,7 +88,7 @@ static int test_workload_load(const char* params, int rank)
}
/* find the next workload operation to issue for this rank */
static void test_workload_get_next(int rank, struct codes_workload_op *op)
static void test_workload_get_next(int app_id, int rank, struct codes_workload_op *op)
{
struct wkload_stream_state* tmp = wkload_streams;
struct wkload_stream_state* tmp2 = wkload_streams;
......
......@@ -149,7 +149,7 @@ int load_workload(char *conf_path, int rank)
configuration_get_value(&config, "PARAMS", "aggregator_count", NULL, aggregator_count, 10);
d_params.aggregator_cnt = atol(aggregator_count);
return codes_workload_load(workload_type, (char *)&d_params, rank);
return codes_workload_load(workload_type, (char *)&d_params, 0, rank);
}
else if (strcmp(workload_type, "iolang_workload") == 0)
{
......@@ -164,7 +164,7 @@ int load_workload(char *conf_path, int rank)
i_params.num_cns = atoi(rank_count);
i_params.use_relpath = 1;
return codes_workload_load(workload_type, (char *)&i_params, rank);
return codes_workload_load(workload_type, (char *)&i_params, 0, rank);
}
else if (strcmp(workload_type, "recorder_io_workload") == 0) {
struct recorder_params r_params;
......@@ -176,7 +176,7 @@ int load_workload(char *conf_path, int rank)
configuration_get_value(&config, "PARAMS", "nprocs", NULL, nprocs, 10);
r_params.nprocs = atol(nprocs);
return codes_workload_load(workload_type, (char *)&r_params, rank);
return codes_workload_load(workload_type, (char *)&r_params, 0, rank);
}
else
......@@ -264,7 +264,7 @@ int main(int argc, char *argv[])
while (1)
{
/* get the next replay operation from the workload generator */
codes_workload_get_next(workload_id, myrank, &next_op);
codes_workload_get_next(workload_id, 0, myrank, &next_op);
if (next_op.op_type != CODES_WK_END)
{
......
......@@ -221,7 +221,7 @@ static void handle_client_op_loop_rev_event(
tw_lp * lp)
{
codes_workload_get_next_rc(ns->wkld_id, ns->my_rank, &m->op_rc);
codes_workload_get_next_rc(ns->wkld_id, 0, ns->my_rank, &m->op_rc);
switch(m->op_rc.op_type)
{
......@@ -302,11 +302,11 @@ static void handle_client_op_loop_event(
printf("codes_workload_load on gid: %ld\n", lp->gid);
if(strcmp(workload_type, "test") == 0)
ns->wkld_id = codes_workload_load("test", NULL, ns->my_rank);
ns->wkld_id = codes_workload_load("test", NULL, 0, ns->my_rank);
else
if(strcmp(workload_type, "iolang_workload") == 0)
{
ns->wkld_id = codes_workload_load("iolang_workload", (char*)&ioparams, ns->my_rank);
ns->wkld_id = codes_workload_load("iolang_workload", (char*)&ioparams, 0, ns->my_rank);
}
assert(ns->wkld_id > -1);
......@@ -316,7 +316,7 @@ static void handle_client_op_loop_event(
* inbound message for this function, so that we have it saved for
* reverse computation if needed.
*/
codes_workload_get_next(ns->wkld_id, ns->my_rank, &m->op_rc);
codes_workload_get_next(ns->wkld_id, 0, ns->my_rank, &m->op_rc);
/* NOTE: in this test model the LP is doing its own math to find the LP
* ID of servers just to do something simple. It knows that compute
......
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