Commit 239d62f0 authored by Jonathan Jenkins's avatar Jonathan Jenkins

fixes to make dumpi completely optional

parent 836505c8
...@@ -108,8 +108,7 @@ src_libcodes_base_a_SOURCES = \ ...@@ -108,8 +108,7 @@ src_libcodes_base_a_SOURCES = \
codes/codes-nw-workload.h \ codes/codes-nw-workload.h \
src/network-workload/codes-nw-workload.c \ src/network-workload/codes-nw-workload.c \
src/network-workload/codes-nw-workload-method.h \ src/network-workload/codes-nw-workload-method.h \
src/network-workload/codes-scala-trace-nw-wrkld.c \ src/network-workload/codes-scala-trace-nw-wrkld.c
src/network-workload/codes-dumpi-trace-nw-wrkld.c
# stealth testing of the template code (actual test is not run, just compiled as # stealth testing of the template code (actual test is not run, just compiled as
# a program - Make error signifies test failure) # a program - Make error signifies test failure)
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include "codes/codes-nw-workload.h" #include "codes/codes-nw-workload.h"
#include "codes/codes.h" #include "codes/codes.h"
char workload_type[128];
char workload_file[8192]; char workload_file[8192];
char offset_file[8192]; char offset_file[8192];
static int total_nw_lps = 8; static int total_nw_lps = 8;
...@@ -36,11 +37,29 @@ tw_peid nw_test_map(tw_lpid gid) ...@@ -36,11 +37,29 @@ tw_peid nw_test_map(tw_lpid gid)
void nw_test_init(nw_state* s, tw_lp* lp) void nw_test_init(nw_state* s, tw_lp* lp)
{ {
/* initialize the LP's and load the data */ /* initialize the LP's and load the data */
//scala_trace_params params; char * params;
//strcpy(params.offset_file_name, offset_file); scala_trace_params params_sc;
//strcpy(params.nw_wrkld_file_name, workload_file); #if USE_DUMPI
dumpi_trace_params params; dumpi_trace_params params_d;
strcpy(params.file_name, workload_file); #endif
if (strcmp(workload_type, "scalatrace") == 0){
if (params_sc.offset_file_name[0] == '\0'){
tw_error(TW_LOC, "required argument for scalatrace offset_file");
return;
}
strcpy(params_sc.offset_file_name, offset_file);
strcpy(params_sc.nw_wrkld_file_name, workload_file);
params = (char*)&params_sc;
}
else if (strcmp(workload_type, "dumpi") == 0){
#if USE_DUMPI
strcpy(params_d.file_name, workload_file);
params = (char*)&params_d;
#else
tw_error(TW_LOC, "dumpi support not enable");
return;
#endif
}
wrkld_id = codes_nw_workload_load("dumpi-trace-workload", (char*)&params, (int)lp->gid); wrkld_id = codes_nw_workload_load("dumpi-trace-workload", (char*)&params, (int)lp->gid);
tw_event *e; tw_event *e;
...@@ -84,6 +103,7 @@ void nw_test_event_handler_rc(nw_state* s, tw_bf * bf, nw_message * m, tw_lp * l ...@@ -84,6 +103,7 @@ void nw_test_event_handler_rc(nw_state* s, tw_bf * bf, nw_message * m, tw_lp * l
const tw_optdef app_opt [] = const tw_optdef app_opt [] =
{ {
TWOPT_GROUP("Network workload test"), TWOPT_GROUP("Network workload test"),
TWOPT_CHAR("workload_type", workload_type, "workload type (either \"scalatrace\" or \"dumpi\")"),
TWOPT_CHAR("workload_file", workload_file, "workload file name"), TWOPT_CHAR("workload_file", workload_file, "workload file name"),
TWOPT_CHAR("offset_file", offset_file, "offset file name"), TWOPT_CHAR("offset_file", offset_file, "offset file name"),
TWOPT_UINT("total_nw_lps", total_nw_lps, "total number of LPs"), TWOPT_UINT("total_nw_lps", total_nw_lps, "total number of LPs"),
...@@ -107,13 +127,14 @@ int main( int argc, char** argv ) ...@@ -107,13 +127,14 @@ int main( int argc, char** argv )
int i; int i;
char log[32]; char log[32];
workload_type[0]='\0';
tw_opt_add(app_opt); tw_opt_add(app_opt);
tw_init(&argc, &argv); tw_init(&argc, &argv);
if(strlen(workload_file) == 0 || total_nw_lps == 0) if(strlen(workload_file) == 0 || total_nw_lps == 0)
{ {
if(tw_ismaster()) if(tw_ismaster())
printf("\n Usage: mpirun -np n ./codes-nw-test --sync=1/2/3 --total_nw_lps=n --workload_file=workload-file-name"); printf("\n Usage: mpirun -np n ./codes-nw-test --sync=1/2/3 --total_nw_lps=n --workload_type=type --workload_file=workload-file-name");
tw_end(); tw_end();
return -1; return -1;
} }
......
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