Commit a95782bd authored by Misbah Mubarak's avatar Misbah Mubarak

Updating the workload test to use the config file for the 'bgp_io_workload'...

Updating the workload test to use the config file for the 'bgp_io_workload' and 'test' workload types. Loads the workload file for the bgp_io_workload type. Tests for remaining operations are to be added
parent aa606824
......@@ -13,16 +13,17 @@
#define CODES_WORKLOAD_H
#include "ross.h"
#define MAX_NAME_LENGTH 512
typedef struct bgp_params bgp_params;
struct bgp_params
{
int num_cns_per_lp;
char* io_kernel_meta_path;
char* bgp_config_file;
char* io_kernel_path;
char* io_kernel_def_path;
char io_kernel_meta_path[MAX_NAME_LENGTH];
char bgp_config_file[MAX_NAME_LENGTH];
char io_kernel_path[MAX_NAME_LENGTH];
char io_kernel_def_path[MAX_NAME_LENGTH];
};
/* supported I/O operations */
......
1- To run the test use:
mpirun -np 4 ./codes-workload-test --sync=2 codes-workload-test.conf
2- To modify the codes-workload-test.conf file, change the 'workload_type' parameters. If using bgp_io_workload type, change the io_kernel_meta_path and bgp_config_file parameters according to your local path.
3- Currently, the bgp_io_workload type only loads the workload file. TODO: read the operations inside the workload file one by one, load the appropriate parameters and display them correctly.
......@@ -299,7 +299,15 @@ static void handle_client_op_loop_event(
{
/* first operation; initialize the desired workload generator */
printf("codes_workload_load on gid: %ld\n", lp->gid);
ns->wkld_id = codes_workload_load("test", NULL, ns->my_rank);
if(strcmp(workload_type, "test") == 0)
ns->wkld_id = codes_workload_load("test", NULL, ns->my_rank);
else
if(strcmp(workload_type, "bgp_io_workload") == 0)
{
ns->wkld_id = codes_workload_load("bgp_io_workload", (char*)&bgparams, ns->my_rank);
}
assert(ns->wkld_id > -1);
}
......@@ -307,7 +315,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, 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
......@@ -316,42 +324,46 @@ static void handle_client_op_loop_event(
switch(m->op_rc.op_type)
{
/* this first set of operation types are handled exclusively by the
* client
*/
case CODES_WK_END:
ns->completion_time = tw_now(lp);
printf("Client rank %d completed workload.\n", ns->my_rank);
/* stop issuing events; we are done */
return;
break;
/* this first set of operation types are handled exclusively by the
* client
*/
case CODES_WK_END:
ns->completion_time = tw_now(lp);
printf("Client rank %d completed workload.\n", ns->my_rank);
/* stop issuing events; we are done */
return;
break;
case CODES_WK_BARRIER:
printf("Client rank %d hit barrier.\n", ns->my_rank);
cn_enter_barrier(lp, m->op_rc.u.barrier.root, m->op_rc.u.barrier.count);
return;
break;
return;
break;
/*case CODES_WK_WRITE:
printf("Client rank %d initiate write operation size %d offset %d .\n", ns->my_rank, (int)m->op_rc.u.write.size, (int)m->op_rc.u.write.offset);
break;*/
case CODES_WK_DELAY:
printf("Client rank %d will delay for %f seconds.\n", ns->my_rank,
m->op_rc.u.delay.seconds);
m->op_rc.u.delay.seconds);
cn_delay(lp, m->op_rc.u.delay.seconds);
return;
return;
break;
/* "normal" io operations: we just calculate the destination and
* then continue after the switch block to send the specified
* operation to a server.
*/
case CODES_WK_OPEN:
case CODES_WK_OPEN:
printf("Client rank %d will issue an open request.\n", ns->my_rank);
dest_svr_id = g_num_clients + m->op_rc.u.open.file_id % g_num_servers;
break;
default:
assert(0);
break;
}
default:
//printf(" \n Operation not supported anymore (I/O language specific operations) ");
//assert(0);
return;
break;
}
svr_op_start(lp, dest_svr_id, &m->op_rc);
return;
}
......
......@@ -6,11 +6,14 @@
#ifndef CODES_WORKLOAD_TEST_CN_LP_H
#define CODES_WORKLOAD_TEST_CN_LP_H
#define MAX_NAME_LENGTH 512
#include <ross.h>
#include "codes/codes-workload.h"
extern tw_lptype client_lp;
char workload_type[MAX_NAME_LENGTH];
struct bgp_params bgparams;
void cn_op_complete(tw_lp *lp, tw_stime svc_time, tw_lpid gid);
void cn_op_complete_rc(tw_lp *lp);
......
......@@ -19,6 +19,7 @@
#include "codes/lp-io.h"
#include "codes/codes.h"
#include "codes/codes-workload.h"
#include "codes/configuration.h"
#include "codes-workload-test-svr-lp.h"
#include "codes-workload-test-cn-lp.h"
......@@ -30,6 +31,31 @@ const tw_optdef app_opt[] = {
TWOPT_END()
};
static int num_clients_per_lp = -1;
void workload_set_params()
{
config_lpgroups_t paramconf;
char io_kernel_meta_path[MAX_NAME_LENGTH];
char bgp_config_file[MAX_NAME_LENGTH];
configuration_get_lpgroups(&config, "PARAMS", &paramconf);
configuration_get_value(&config, "PARAMS", "workload_type", workload_type, MAX_NAME_LENGTH);
if(strcmp(workload_type,"bgp_io_workload") == 0)
{
strcpy(bgparams.io_kernel_path,"");
strcpy(bgparams.io_kernel_def_path, "");
configuration_get_value(&config, "PARAMS", "io_kernel_meta_path", io_kernel_meta_path, MAX_NAME_LENGTH);
strcpy(bgparams.io_kernel_meta_path, io_kernel_meta_path);
configuration_get_value(&config, "PARAMS", "bgp_config_file", bgp_config_file, MAX_NAME_LENGTH);
strcpy(bgparams.bgp_config_file, bgp_config_file);
bgparams.num_cns_per_lp = num_clients_per_lp;
}
}
int main(
int argc,
char **argv)
......@@ -55,8 +81,19 @@ int main(
exit(-1);
}
if(argc < 2)
{
printf("\n Usage: mpirun <args> --sync=2/3 mapping_file_name.conf (optional --nkp) ");
exit(-1);
}
lps_per_proc = (NUM_SERVERS+NUM_CLIENTS) / nprocs;
num_clients_per_lp = NUM_CLIENTS / nprocs;
configuration_load(argv[2], MPI_COMM_WORLD, &config);
tw_define_lps(lps_per_proc, 512, 0);
for(i=0; i<lps_per_proc; i++)
......@@ -77,6 +114,7 @@ int main(
return(-1);
}
workload_set_params();
tw_run();
ret = lp_io_flush(handle, MPI_COMM_WORLD);
......
PARAMS
{
workload_type = "bgp_io_workload";
io_kernel_meta_path = "/home/mubarm/codes_radix/codes-base/tests/workload/hybrid.meta.txt";
bgp_config_file = "/home/mubarm/codes_radix/codes-base/tests/workload/bgp.base.config";
}
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