...
 
Commits (9)
...@@ -89,6 +89,6 @@ LDADD += ${DUMPI_LIBS} ...@@ -89,6 +89,6 @@ LDADD += ${DUMPI_LIBS}
endif endif
if USE_RDAMARIS if USE_RDAMARIS
AM_CPPFLAGS += ${ROSS_Damaris_CFLAGS} -DUSE_RDAMARIS=1 AM_CPPFLAGS += ${RISA_CFLAGS} -DUSE_RDAMARIS=1
LDADD += ${ROSS_Damaris_LIBS} LDADD += ${RISA_LIBS}
endif endif
...@@ -7,7 +7,7 @@ LT_INIT ...@@ -7,7 +7,7 @@ LT_INIT
#WRAP SOME OPTION AROUND THIS - IT'S NOT REQUIRED FOR 99% OF CODES #WRAP SOME OPTION AROUND THIS - IT'S NOT REQUIRED FOR 99% OF CODES
AX_BOOST_BASE([1.66]) #AX_BOOST_BASE([1.66])
AC_CANONICAL_TARGET AC_CANONICAL_TARGET
AC_CANONICAL_SYSTEM AC_CANONICAL_SYSTEM
...@@ -89,15 +89,17 @@ AC_TRY_COMPILE([#include <mpi.h>], [int ret = MPI_Init(0, (void*)0)], ...@@ -89,15 +89,17 @@ AC_TRY_COMPILE([#include <mpi.h>], [int ret = MPI_Init(0, (void*)0)],
PKG_CHECK_MODULES_STATIC([ROSS], [ross], [], PKG_CHECK_MODULES_STATIC([ROSS], [ross], [],
[AC_MSG_ERROR([Could not find working ross installation via pkg-config])]) [AC_MSG_ERROR([Could not find working ross installation via pkg-config])])
#check for Damaris #check for RISA
AC_ARG_WITH([damaris],[AS_HELP_STRING([--with-damaris], AC_ARG_WITH([risa],[AS_HELP_STRING([--with-risa],
[build with ROSS-Damaris in situ analysis support])], [build with RISA (ROSS in situ analysis) support])],
[use_rdamaris=yes],[use_rdamaris=no]) [use_risa=yes],[use_risa=no])
if test "x${use_rdamaris}" = xyes ; then if test "x${use_risa}" = xyes ; then
PKG_CHECK_MODULES_STATIC([ROSS_Damaris], [ross-damaris], [], PKG_CHECK_MODULES_STATIC([RISA], [risa], [],
[AC_MSG_ERROR([Could not find working ROSS-Damaris installation via pkg-config])]) [AC_MSG_ERROR([Could not find working RISA installation via pkg-config])])
# PKG_CHECK_MODULES([RISA_PLUGINS], [risa], [],
# [AC_MSG_ERROR([Could not find the RISAplugins library from RISA via pkg-config])])
fi fi
AM_CONDITIONAL(USE_RDAMARIS, [test "x${use_rdamaris}" = xyes]) AM_CONDITIONAL(USE_RDAMARIS, [test "x${use_risa}" = xyes])
# check for enable-g # check for enable-g
AC_ARG_ENABLE([g],[AS_HELP_STRING([--enable-g], AC_ARG_ENABLE([g],[AS_HELP_STRING([--enable-g],
......
...@@ -1894,6 +1894,7 @@ YY_BUFFER_STATE CodesIOKernel__scan_bytes (yyconst char * yybytes, int _yybyte ...@@ -1894,6 +1894,7 @@ YY_BUFFER_STATE CodesIOKernel__scan_bytes (yyconst char * yybytes, int _yybyte
static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner) static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner)
{ {
(void) yyscanner;
(void) fprintf( stderr, "%s\n", msg ); (void) fprintf( stderr, "%s\n", msg );
exit( YY_EXIT_FAILURE ); exit( YY_EXIT_FAILURE );
} }
...@@ -2238,11 +2239,13 @@ static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner) ...@@ -2238,11 +2239,13 @@ static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner)
void *CodesIOKernel_alloc (yy_size_t size , yyscan_t yyscanner) void *CodesIOKernel_alloc (yy_size_t size , yyscan_t yyscanner)
{ {
(void) yyscanner;
return (void *) malloc( size ); return (void *) malloc( size );
} }
void *CodesIOKernel_realloc (void * ptr, yy_size_t size , yyscan_t yyscanner) void *CodesIOKernel_realloc (void * ptr, yy_size_t size , yyscan_t yyscanner)
{ {
(void) yyscanner;
/* The cast to (char *) in the following accommodates both /* The cast to (char *) in the following accommodates both
* implementations that use char* generic pointers, and those * implementations that use char* generic pointers, and those
* that use void* generic pointers. It works with the latter * that use void* generic pointers. It works with the latter
...@@ -2255,6 +2258,7 @@ void *CodesIOKernel_realloc (void * ptr, yy_size_t size , yyscan_t yyscanner) ...@@ -2255,6 +2258,7 @@ void *CodesIOKernel_realloc (void * ptr, yy_size_t size , yyscan_t yyscanner)
void CodesIOKernel_free (void * ptr , yyscan_t yyscanner) void CodesIOKernel_free (void * ptr , yyscan_t yyscanner)
{ {
(void) yyscanner;
free( (char *) ptr ); /* see CodesIOKernel_realloc() for (char *) cast */ free( (char *) ptr ); /* see CodesIOKernel_realloc() for (char *) cast */
} }
......
...@@ -365,7 +365,7 @@ void nw_test_finalize(nw_state* s, tw_lp* lp) ...@@ -365,7 +365,7 @@ void nw_test_finalize(nw_state* s, tw_lp* lp)
total_delays += s->num_delays; total_delays += s->num_delays;
total_collectives += s->num_cols; total_collectives += s->num_cols;
printf("\n LP %llu total sends %ld receives %ld wait_alls %ld waits %ld ", lp->gid, s->num_sends,s->num_recvs, s->num_waitall, s->num_wait); printf("\n LP %lu total sends %ld receives %ld wait_alls %ld waits %ld ", lp->gid, s->num_sends,s->num_recvs, s->num_waitall, s->num_wait);
avg_time += s->total_time; avg_time += s->total_time;
avg_compute_time += s->compute_time; avg_compute_time += s->compute_time;
avg_comm_time += (s->total_time - s->compute_time); avg_comm_time += (s->total_time - s->compute_time);
......
...@@ -55,8 +55,8 @@ static int num_net_traces = 0; ...@@ -55,8 +55,8 @@ static int num_net_traces = 0;
static int num_dumpi_traces = 0; static int num_dumpi_traces = 0;
static int64_t EAGER_THRESHOLD = 8192; static int64_t EAGER_THRESHOLD = 8192;
static long num_ops = 0; //static long num_ops = 0;
static int upper_threshold = 1048576; //static int upper_threshold = 1048576;
static int alloc_spec = 0; static int alloc_spec = 0;
static tw_stime self_overhead = 10.0; static tw_stime self_overhead = 10.0;
static tw_stime mean_interval = 100000; static tw_stime mean_interval = 100000;
...@@ -801,7 +801,7 @@ void arrive_syn_tr(nw_state * s, tw_bf * bf, nw_message * m, tw_lp * lp) ...@@ -801,7 +801,7 @@ void arrive_syn_tr(nw_state * s, tw_bf * bf, nw_message * m, tw_lp * lp)
// printf("\n Data arrived %d total data %ld ", m->fwd.num_bytes, s->syn_data); // printf("\n Data arrived %d total data %ld ", m->fwd.num_bytes, s->syn_data);
if(s->local_rank == 0) if(s->local_rank == 0)
{ {
printf("\n Data arrived %lld rank %llu total data %ld ", m->fwd.num_bytes, s->nw_id, s->syn_data); printf("\n Data arrived %ld rank %lu total data %ld ", m->fwd.num_bytes, s->nw_id, s->syn_data);
/* if(s->syn_data > upper_threshold) /* if(s->syn_data > upper_threshold)
if(s->local_rank == 0) if(s->local_rank == 0)
{ {
...@@ -836,6 +836,7 @@ static void print_msgs_queue(struct qlist_head * head, int is_send) ...@@ -836,6 +836,7 @@ static void print_msgs_queue(struct qlist_head * head, int is_send)
struct qlist_head * ent = NULL; struct qlist_head * ent = NULL;
mpi_msgs_queue * current = NULL; mpi_msgs_queue * current = NULL;
(void)current;
qlist_for_each(ent, head) qlist_for_each(ent, head)
{ {
current = qlist_entry(ent, mpi_msgs_queue, ql); current = qlist_entry(ent, mpi_msgs_queue, ql);
...@@ -2652,9 +2653,41 @@ static void nw_add_lp_type() ...@@ -2652,9 +2653,41 @@ static void nw_add_lp_type()
lp_type_register("nw-lp", nw_get_lp_type()); lp_type_register("nw-lp", nw_get_lp_type());
} }
/* setup for the ROSS event tracing /***** ROSS model instrumentation *****/
*/ void nw_lp_vt_sample_fn(nw_state *s, tw_bf *bf, tw_lp *lp);
void nw_lp_event_collect(nw_message *m, tw_lp *lp, char *buffer, int *collect_flag) void nw_lp_vt_sample_rc_fn(nw_state *s, tw_bf *bf, tw_lp *lp);
void nw_lp_rt_sample_fn(nw_state *s, tw_lp *lp);
void nw_lp_event_trace(nw_message *m, tw_lp *lp, char *buffer, int *collect_flag);
char nw_lp_name[] = "nw_server\0";
st_model_types nw_lp_model_types[] = {
{nw_lp_name,
NULL,
0,
(vts_event_f) nw_lp_vt_sample_fn,
(vts_revent_f) nw_lp_vt_sample_rc_fn,
(rt_event_f) nw_lp_rt_sample_fn,
(ev_trace_f) nw_lp_event_trace,
sizeof(int)},
{0}
};
void nw_lp_vt_sample_fn(nw_state *s, tw_bf *bf, tw_lp *lp)
{
(void)s;
(void)bf;
(void)lp;
}
void nw_lp_vt_sample_rc_fn(nw_state *s, tw_bf *bf, tw_lp *lp)
{
(void)s;
(void)bf;
(void)lp;
}
void nw_lp_event_trace(nw_message *m, tw_lp *lp, char *buffer, int *collect_flag)
{ {
(void)lp; (void)lp;
(void)collect_flag; (void)collect_flag;
...@@ -2663,30 +2696,12 @@ void nw_lp_event_collect(nw_message *m, tw_lp *lp, char *buffer, int *collect_fl ...@@ -2663,30 +2696,12 @@ void nw_lp_event_collect(nw_message *m, tw_lp *lp, char *buffer, int *collect_fl
memcpy(buffer, &type, sizeof(type)); memcpy(buffer, &type, sizeof(type));
} }
/* can add in any model level data to be collected along with simulation engine data void nw_lp_rt_sample_fn(nw_state *s, tw_lp *lp)
* in the ROSS instrumentation. Will need to update the last field in
* nw_lp_model_types[0] for the size of the data to save in each function call
*/
void nw_lp_model_stat_collect(nw_state *s, tw_lp *lp, char *buffer)
{ {
(void)s; (void)s;
(void)lp; (void)lp;
(void)buffer;
return;
} }
st_model_types nw_lp_model_types[] = {
{(ev_trace_f) nw_lp_event_collect,
sizeof(int),
(model_stat_f) nw_lp_model_stat_collect,
0,
NULL,
NULL,
0},
{NULL, 0, NULL, 0, NULL, NULL, 0}
};
static const st_model_types *nw_lp_get_model_stat_types(void) static const st_model_types *nw_lp_get_model_stat_types(void)
{ {
return(&nw_lp_model_types[0]); return(&nw_lp_model_types[0]);
...@@ -2696,7 +2711,7 @@ void nw_lp_register_model() ...@@ -2696,7 +2711,7 @@ void nw_lp_register_model()
{ {
st_model_type_register("nw-lp", nw_lp_get_model_stat_types()); st_model_type_register("nw-lp", nw_lp_get_model_stat_types());
} }
/* end of ROSS event tracing setup */ /***** End of ROSS Instrumentation *****/
static int msg_size_hash_compare( static int msg_size_hash_compare(
void *key, struct qhash_head *link) void *key, struct qhash_head *link)
......
...@@ -111,38 +111,53 @@ tw_lptype svr_lp = { ...@@ -111,38 +111,53 @@ tw_lptype svr_lp = {
sizeof(svr_state), sizeof(svr_state),
}; };
/* setup for the ROSS event tracing /***** ROSS model instrumentation *****/
*/ void custom_svr_vt_sample_fn(svr_state *s, tw_bf *bf, tw_lp *lp);
void custom_svr_event_collect(svr_msg *m, tw_lp *lp, char *buffer, int *collect_flag) void custom_svr_vt_sample_rc_fn(svr_state *s, tw_bf *bf, tw_lp *lp);
void custom_svr_rt_sample_fn(svr_state *s, tw_lp *lp);
void custom_svr_event_trace(svr_msg *m, tw_lp *lp, char *buffer, int *collect_flag);
char custom_svr_name[] = "dfly_custom_server\0";
st_model_types custom_svr_model_types[] = {
{custom_svr_name,
NULL,
0,
(vts_event_f) custom_svr_vt_sample_fn,
(vts_revent_f) custom_svr_vt_sample_rc_fn,
(rt_event_f) custom_svr_rt_sample_fn,
(ev_trace_f) custom_svr_event_trace,
sizeof(int)},
{0}
};
void custom_svr_vt_sample_fn(svr_state *s, tw_bf *bf, tw_lp *lp)
{ {
(void)s;
(void)bf;
(void)lp; (void)lp;
(void)collect_flag;
int type = (int) m->svr_event_type;
memcpy(buffer, &type, sizeof(type));
} }
/* can add in any model level data to be collected along with simulation engine data void custom_svr_vt_sample_rc_fn(svr_state *s, tw_bf *bf, tw_lp *lp)
* in the ROSS instrumentation. Will need to update the last field in
* svr_model_types[0] for the size of the data to save in each function call
*/
void custom_svr_model_stat_collect(svr_state *s, tw_lp *lp, char *buffer)
{ {
(void)s; (void)s;
(void)bf;
(void)lp; (void)lp;
(void)buffer;
return;
} }
st_model_types custom_svr_model_types[] = { void custom_svr_rt_sample_fn(svr_state *s, tw_lp *lp)
{(ev_trace_f) custom_svr_event_collect, {
sizeof(int), (void)s;
(model_stat_f) custom_svr_model_stat_collect, (void)lp;
0, }
NULL,
NULL, void custom_svr_event_trace(svr_msg *m, tw_lp *lp, char *buffer, int *collect_flag)
0}, {
{NULL, 0, NULL, 0, NULL, NULL, 0} (void)lp;
}; (void)collect_flag;
int type = (int) m->svr_event_type;
memcpy(buffer, &type, sizeof(type));
}
static const st_model_types *custom_svr_get_model_stat_types(void) static const st_model_types *custom_svr_get_model_stat_types(void)
{ {
...@@ -154,6 +169,8 @@ void custom_svr_register_model_types() ...@@ -154,6 +169,8 @@ void custom_svr_register_model_types()
st_model_type_register("nw-lp", custom_svr_get_model_stat_types()); st_model_type_register("nw-lp", custom_svr_get_model_stat_types());
} }
/***** End of ROSS Instrumentation *****/
const tw_optdef app_opt [] = const tw_optdef app_opt [] =
{ {
TWOPT_GROUP("Model net synthetic traffic " ), TWOPT_GROUP("Model net synthetic traffic " ),
...@@ -311,7 +328,7 @@ static void handle_kickoff_event( ...@@ -311,7 +328,7 @@ static void handle_kickoff_event(
int rand_node_intra_id = tw_rand_integer(lp->rng, 0, num_nodes_per_grp-1); int rand_node_intra_id = tw_rand_integer(lp->rng, 0, num_nodes_per_grp-1);
local_dest = (rand_group * num_nodes_per_grp) + rand_node_intra_id; local_dest = (rand_group * num_nodes_per_grp) + rand_node_intra_id;
printf("\n LP %ld sending to %ld num nodes %d ", local_id, local_dest, num_nodes); printf("\n LP %d sending to %ld num nodes %llu ", local_id, local_dest, num_nodes);
} }
assert(local_dest < num_nodes); assert(local_dest < num_nodes);
......
...@@ -110,6 +110,65 @@ tw_lptype svr_lp = { ...@@ -110,6 +110,65 @@ tw_lptype svr_lp = {
sizeof(svr_state), sizeof(svr_state),
}; };
/***** ROSS model instrumentation *****/
void svr_vt_sample_fn(svr_state *s, tw_bf *bf, tw_lp *lp);
void svr_vt_sample_rc_fn(svr_state *s, tw_bf *bf, tw_lp *lp);
void svr_rt_sample_fn(svr_state *s, tw_lp *lp);
void svr_event_trace(svr_msg *m, tw_lp *lp, char *buffer, int *collect_flag);
char svr_name[] = "dfly_plus_server\0";
st_model_types svr_model_types[] = {
{svr_name,
NULL,
0,
(vts_event_f) svr_vt_sample_fn,
(vts_revent_f) svr_vt_sample_rc_fn,
(rt_event_f) svr_rt_sample_fn,
(ev_trace_f) svr_event_trace,
sizeof(int)},
{0}
};
void svr_vt_sample_fn(svr_state *s, tw_bf *bf, tw_lp *lp)
{
(void)s;
(void)bf;
(void)lp;
}
void svr_vt_sample_rc_fn(svr_state *s, tw_bf *bf, tw_lp *lp)
{
(void)s;
(void)bf;
(void)lp;
}
void svr_rt_sample_fn(svr_state *s, tw_lp *lp)
{
(void)s;
(void)lp;
}
void svr_event_trace(svr_msg *m, tw_lp *lp, char *buffer, int *collect_flag)
{
(void)lp;
(void)collect_flag;
int type = (int) m->svr_event_type;
memcpy(buffer, &type, sizeof(type));
}
static const st_model_types *svr_get_model_stat_types(void)
{
return(&svr_model_types[0]);
}
void svr_register_model_types()
{
st_model_type_register("server", svr_get_model_stat_types());
}
/***** End of ROSS Instrumentation *****/
const tw_optdef app_opt [] = const tw_optdef app_opt [] =
{ {
TWOPT_GROUP("Model net synthetic traffic " ), TWOPT_GROUP("Model net synthetic traffic " ),
...@@ -437,6 +496,9 @@ int main( ...@@ -437,6 +496,9 @@ int main(
model_net_register(); model_net_register();
svr_add_lp_type(); svr_add_lp_type();
if (g_st_ev_trace || g_st_model_stats || g_st_use_analysis_lps)
svr_register_model_types();
codes_mapping_setup(); codes_mapping_setup();
net_ids = model_net_configure(&num_nets); net_ids = model_net_configure(&num_nets);
......
...@@ -122,42 +122,56 @@ tw_lptype svr_lp = { ...@@ -122,42 +122,56 @@ tw_lptype svr_lp = {
sizeof(svr_state), sizeof(svr_state),
}; };
/* setup for the ROSS event tracing /***** ROSS model instrumentation *****/
*/ void ft_svr_vt_sample_fn(svr_state *s, tw_bf *bf, tw_lp *lp);
void ft_svr_event_collect(svr_msg *m, tw_lp *lp, char *buffer, int *collect_flag) void ft_svr_vt_sample_rc_fn(svr_state *s, tw_bf *bf, tw_lp *lp);
void ft_svr_rt_sample_fn(svr_state *s, tw_lp *lp);
void ft_svr_event_trace(svr_msg *m, tw_lp *lp, char *buffer, int *collect_flag);
char ft_svr_name[] = "ft_server\0";
st_model_types ft_svr_model_types[] = {
{ft_svr_name,
NULL,
0,
(vts_event_f) ft_svr_vt_sample_fn,
(vts_revent_f) ft_svr_vt_sample_rc_fn,
(rt_event_f) ft_svr_rt_sample_fn,
(ev_trace_f) ft_svr_event_trace,
sizeof(int)},
{0}
};
void ft_svr_vt_sample_fn(svr_state *s, tw_bf *bf, tw_lp *lp)
{ {
(void)s;
(void)bf;
(void)lp; (void)lp;
(void)buffer; }
(void)collect_flag;
int type = (int) m->svr_event_type; void ft_svr_vt_sample_rc_fn(svr_state *s, tw_bf *bf, tw_lp *lp)
memcpy(buffer, &type, sizeof(type)); {
(void)s;
(void)bf;
(void)lp;
} }
/* can add in any model level data to be collected along with simulation engine data void ft_svr_rt_sample_fn(svr_state *s, tw_lp *lp)
* in the ROSS instrumentation. Will need to update the last field in
* ft_svr_model_types[0] for the size of the data to save in each function call
*/
void ft_svr_model_stat_collect(svr_state *s, tw_lp *lp, char *buffer)
{ {
(void)s; (void)s;
(void)lp; (void)lp;
}
void ft_svr_event_trace(svr_msg *m, tw_lp *lp, char *buffer, int *collect_flag)
{
(void)lp;
(void)buffer; (void)buffer;
(void)collect_flag;
return; int type = (int) m->svr_event_type;
memcpy(buffer, &type, sizeof(type));
} }
st_model_types ft_svr_model_types[] = {
{(ev_trace_f) ft_svr_event_collect,
sizeof(int),
(model_stat_f) ft_svr_model_stat_collect,
0,
NULL,
NULL,
0},
{NULL, 0, NULL, 0, NULL, NULL, 0}
};
static const st_model_types *ft_svr_get_model_stat_types(void) static const st_model_types *ft_svr_get_model_stat_types(void)
{ {
return(&ft_svr_model_types[0]); return(&ft_svr_model_types[0]);
...@@ -168,6 +182,8 @@ void ft_svr_register_model_stats() ...@@ -168,6 +182,8 @@ void ft_svr_register_model_stats()
st_model_type_register("server", ft_svr_get_model_stat_types()); st_model_type_register("server", ft_svr_get_model_stat_types());
} }
/***** End of ROSS Instrumentation *****/
const tw_optdef app_opt [] = const tw_optdef app_opt [] =
{ {
TWOPT_GROUP("Model net synthetic traffic " ), TWOPT_GROUP("Model net synthetic traffic " ),
...@@ -561,7 +577,7 @@ int main( ...@@ -561,7 +577,7 @@ int main(
int idx = 0; int idx = 0;
int gvt_computations; int gvt_computations;
long long total_events, rollbacks, net_events; long long total_events, rollbacks, net_events;
float running_time, efficiency, event_rate; float running_time = 0, efficiency = 0, event_rate = 0;
while (pch != NULL) while (pch != NULL)
{ {
pch = strtok (NULL, ","); pch = strtok (NULL, ",");
......
...@@ -120,38 +120,53 @@ tw_lptype svr_lp = { ...@@ -120,38 +120,53 @@ tw_lptype svr_lp = {
sizeof(svr_state), sizeof(svr_state),
}; };
/* setup for the ROSS event tracing /***** ROSS model instrumentation *****/
*/ void svr_vt_sample_fn(svr_state *s, tw_bf *bf, tw_lp *lp);
void svr_event_collect(svr_msg *m, tw_lp *lp, char *buffer, int *collect_flag) void svr_vt_sample_rc_fn(svr_state *s, tw_bf *bf, tw_lp *lp);
void svr_rt_sample_fn(svr_state *s, tw_lp *lp);
void svr_event_trace(svr_msg *m, tw_lp *lp, char *buffer, int *collect_flag);
char svr_name[] = "sfly_server\0";
st_model_types svr_model_types[] = {
{svr_name,
NULL,
0,
(vts_event_f) svr_vt_sample_fn,
(vts_revent_f) svr_vt_sample_rc_fn,
(rt_event_f) svr_rt_sample_fn,
(ev_trace_f) svr_event_trace,
sizeof(int)},
{0}
};
void svr_vt_sample_fn(svr_state *s, tw_bf *bf, tw_lp *lp)
{ {
(void)s;
(void)bf;
(void)lp; (void)lp;
(void)collect_flag;
int type = (int) m->svr_event_type;
memcpy(buffer, &type, sizeof(type));
} }
/* can add in any model level data to be collected along with simulation engine data void svr_vt_sample_rc_fn(svr_state *s, tw_bf *bf, tw_lp *lp)
* in the ROSS instrumentation. Will need to update the last field in
* svr_model_types[0] for the size of the data to save in each function call
*/
void svr_model_stat_collect(svr_state *s, tw_lp *lp, char *buffer)
{ {
(void)s; (void)s;
(void)bf;
(void)lp; (void)lp;
(void)buffer;
return;
} }
st_model_types svr_model_types[] = { void svr_rt_sample_fn(svr_state *s, tw_lp *lp)
{(ev_trace_f) svr_event_collect, {
sizeof(int), (void)s;
(model_stat_f) svr_model_stat_collect, (void)lp;
0, }
NULL,
NULL, void svr_event_trace(svr_msg *m, tw_lp *lp, char *buffer, int *collect_flag)
0}, {
{NULL, 0, NULL, 0, NULL, NULL, 0} (void)lp;
}; (void)collect_flag;
int type = (int) m->svr_event_type;
memcpy(buffer, &type, sizeof(type));
}
static const st_model_types *svr_get_model_stat_types(void) static const st_model_types *svr_get_model_stat_types(void)
{ {
...@@ -163,6 +178,8 @@ void svr_register_model_types() ...@@ -163,6 +178,8 @@ void svr_register_model_types()
st_model_type_register("server", svr_get_model_stat_types()); st_model_type_register("server", svr_get_model_stat_types());
} }
/***** End of ROSS Instrumentation *****/
const tw_optdef app_opt [] = const tw_optdef app_opt [] =
{ {
TWOPT_GROUP("Model net synthetic traffic " ), TWOPT_GROUP("Model net synthetic traffic " ),
...@@ -616,7 +633,7 @@ int main( ...@@ -616,7 +633,7 @@ int main(
int idx = 0; int idx = 0;
int gvt_computations; int gvt_computations;
long long total_events, rollbacks, net_events; long long total_events, rollbacks, net_events;
float running_time, efficiency, event_rate; float running_time = 0, efficiency = 0, event_rate = 0;
while (pch != NULL) while (pch != NULL)
{ {
pch = strtok (NULL, ","); pch = strtok (NULL, ",");
......
...@@ -107,38 +107,53 @@ tw_lptype svr_lp = { ...@@ -107,38 +107,53 @@ tw_lptype svr_lp = {
sizeof(svr_state), sizeof(svr_state),
}; };
/* setup for the ROSS event tracing /***** ROSS model instrumentation *****/
*/ void svr_vt_sample_fn(svr_state *s, tw_bf *bf, tw_lp *lp);
void svr_event_collect(svr_msg *m, tw_lp *lp, char *buffer, int *collect_flag) void svr_vt_sample_rc_fn(svr_state *s, tw_bf *bf, tw_lp *lp);
void svr_rt_sample_fn(svr_state *s, tw_lp *lp);
void svr_event_trace(svr_msg *m, tw_lp *lp, char *buffer, int *collect_flag);
char svr_name[] = "dfly_server\0";
st_model_types svr_model_types[] = {
{svr_name,
NULL,
0,
(vts_event_f) svr_vt_sample_fn,
(vts_revent_f) svr_vt_sample_rc_fn,
(rt_event_f) svr_rt_sample_fn,
(ev_trace_f) svr_event_trace,
sizeof(int)},
{0}
};
void svr_vt_sample_fn(svr_state *s, tw_bf *bf, tw_lp *lp)
{ {
(void)s;
(void)bf;
(void)lp; (void)lp;
(void)collect_flag;
int type = (int) m->svr_event_type;
memcpy(buffer, &type, sizeof(type));
} }
/* can add in any model level data to be collected along with simulation engine data void svr_vt_sample_rc_fn(svr_state *s, tw_bf *bf, tw_lp *lp)
* in the ROSS instrumentation. Will need to update the last field in
* svr_model_types[0] for the size of the data to save in each function call
*/
void svr_model_stat_collect(svr_state *s, tw_lp *lp, char *buffer)
{ {
(void)s; (void)s;
(void)bf;
(void)lp; (void)lp;
(void)buffer;
return;
} }
st_model_types svr_model_types[] = { void svr_rt_sample_fn(svr_state *s, tw_lp *lp)
{(ev_trace_f) svr_event_collect, {
sizeof(int), (void)s;
(model_stat_f) svr_model_stat_collect, (void)lp;
0, }
NULL,
NULL, void svr_event_trace(svr_msg *m, tw_lp *lp, char *buffer, int *collect_flag)
0}, {
{NULL, 0, NULL, 0, NULL, NULL, 0} (void)lp;
}; (void)collect_flag;
int type = (int) m->svr_event_type;
memcpy(buffer, &type, sizeof(type));
}
static const st_model_types *svr_get_model_stat_types(void) static const st_model_types *svr_get_model_stat_types(void)
{ {
...@@ -150,6 +165,8 @@ void svr_register_model_types() ...@@ -150,6 +165,8 @@ void svr_register_model_types()
st_model_type_register("server", svr_get_model_stat_types()); st_model_type_register("server", svr_get_model_stat_types());
} }
/***** End of ROSS Instrumentation *****/
const tw_optdef app_opt [] = const tw_optdef app_opt [] =
{ {
TWOPT_GROUP("Model net synthetic traffic " ), TWOPT_GROUP("Model net synthetic traffic " ),
......
...@@ -200,7 +200,7 @@ struct dfly_cn_sample ...@@ -200,7 +200,7 @@ struct dfly_cn_sample
tw_lpid terminal_id; tw_lpid terminal_id;
long fin_chunks_sample; long fin_chunks_sample;
long data_size_sample; long data_size_sample;
double fin_hops_sample; long fin_hops_sample;
tw_stime fin_chunks_time; tw_stime fin_chunks_time;
tw_stime busy_time_sample; tw_stime busy_time_sample;
tw_stime end_time; tw_stime end_time;
...@@ -272,7 +272,7 @@ struct terminal_state ...@@ -272,7 +272,7 @@ struct terminal_state
/* For sampling */ /* For sampling */
long fin_chunks_sample; long fin_chunks_sample;
long data_size_sample; long data_size_sample;
double fin_hops_sample; long fin_hops_sample;
tw_stime fin_chunks_time; tw_stime fin_chunks_time;
tw_stime busy_time_sample; tw_stime busy_time_sample;
...@@ -380,33 +380,218 @@ struct router_state ...@@ -380,33 +380,218 @@ struct router_state
struct dfly_router_sample ross_rsample; struct dfly_router_sample ross_rsample;
}; };
/* ROSS model instrumentation */ /***** ROSS model instrumentation *****/
void custom_dragonfly_event_collect(terminal_custom_message *m, tw_lp *lp, char *buffer, int *collect_flag); void custom_dragonfly_event_trace(terminal_custom_message *m, tw_lp *lp, char *buffer, int *collect_flag);
void custom_dragonfly_model_stat_collect(terminal_state *s, tw_lp *lp, char *buffer); void custom_dragonfly_rt_sample_fn(terminal_state *s, tw_lp *lp);
void custom_dfly_router_model_stat_collect(router_state *s, tw_lp *lp, char *buffer); void custom_dfly_router_rt_sample_fn(router_state *s, tw_lp *lp);
static void ross_custom_dragonfly_rsample_fn(router_state * s, tw_bf * bf, tw_lp * lp, struct dfly_router_sample *sample); static void custom_dragonfly_vt_rsample_fn(router_state * s, tw_bf * bf, tw_lp * lp);
static void ross_custom_dragonfly_rsample_rc_fn(router_state * s, tw_bf * bf, tw_lp * lp, struct dfly_router_sample *sample); static void custom_dragonfly_vt_rsample_rc_fn(router_state * s, tw_bf * bf, tw_lp * lp);
static void ross_custom_dragonfly_sample_fn(terminal_state * s, tw_bf * bf, tw_lp * lp, struct dfly_cn_sample *sample); static void custom_dragonfly_vt_sample_fn(terminal_state * s, tw_bf * bf, tw_lp * lp);
static void ross_custom_dragonfly_sample_rc_fn(terminal_state * s, tw_bf * bf, tw_lp * lp, struct dfly_cn_sample *sample); static void custom_dragonfly_vt_sample_rc_fn(terminal_state * s, tw_bf * bf, tw_lp * lp);
static char router_lp_name[] = "dfly_custom_router\0";
static char terminal_lp_name[] = "dfly_custom_terminal\0";
static const char* rvar_names[] = {
"router_id\0",
"busy_time\0",
"link_traffic\0"
};
static const char* tvar_names[] = {
"terminal_id\0",
"fin_chunks\0",
"data_size\0",
"fin_hops\0",
"fin_chunks_time\0",
"busy_time\0"
};
st_model_types custom_dragonfly_model_types[] = { static st_model_var router_vars[] = {
{(ev_trace_f) custom_dragonfly_event_collect, {rvar_names[0],
sizeof(int), MODEL_INT,
(model_stat_f) custom_dragonfly_model_stat_collect, 1},
sizeof(tw_lpid) + sizeof(long) * 2 + sizeof(double) + sizeof(tw_stime) *2, {rvar_names[1],
(sample_event_f) ross_custom_dragonfly_sample_fn, MODEL_DOUBLE,
(sample_revent_f) ross_custom_dragonfly_sample_rc_fn, 0}, // update in router_custom_setup() since it's based on the radix
sizeof(struct dfly_cn_sample) } , {rvar_names[2],
{(ev_trace_f) custom_dragonfly_event_collect, MODEL_LONG,
sizeof(int), 0} // update in router_custom_setup() since it's based on the radix
(model_stat_f) custom_dfly_router_model_stat_collect,
0, //updated in router_custom_setup() since it's based on the radix
(sample_event_f) ross_custom_dragonfly_rsample_fn,
(sample_revent_f) ross_custom_dragonfly_rsample_rc_fn,
0 } , //updated in router_custom_setup() since it's based on the radix
{NULL, 0, NULL, 0, NULL, NULL, 0}
}; };
/* End of ROSS model stats collection */
static st_model_var terminal_vars[] = {
{tvar_names[0],
MODEL_INT,
1},
{tvar_names[1],
MODEL_LONG,
1},
{tvar_names[2],
MODEL_LONG,
1},
{tvar_names[3],
MODEL_LONG,
1},
{tvar_names[4],
MODEL_DOUBLE,
1},
{tvar_names[5],
MODEL_DOUBLE,
1}
};
#define custom_dfly_num_tvars 6
#define custom_dfly_num_rvars 3
st_model_types custom_dragonfly_model_types[] = {
{terminal_lp_name,
terminal_vars,
custom_dfly_num_tvars,
(vts_event_f) custom_dragonfly_vt_sample_fn,
(vts_revent_f) custom_dragonfly_vt_sample_rc_fn,
(rt_event_f) custom_dragonfly_rt_sample_fn,
(ev_trace_f) custom_dragonfly_event_trace,
sizeof(int)},
{router_lp_name,
router_vars,
custom_dfly_num_rvars,
(vts_event_f) custom_dragonfly_vt_rsample_fn,
(vts_revent_f) custom_dragonfly_vt_rsample_rc_fn,
(rt_event_f) custom_dfly_router_rt_sample_fn,
(ev_trace_f) custom_dragonfly_event_trace,
sizeof(int)},
{0}};
static void custom_dragonfly_vt_rsample_fn(router_state * s, tw_bf * bf, tw_lp * lp)
{
(void)lp;
(void)bf;
const dragonfly_param * p = s->params;
int i = 0;
int router_id = (int)s->router_id;
st_save_model_variable(lp, rvar_names[0], &router_id);
st_save_model_variable(lp, rvar_names[1], s->ross_rsample.busy_time);
st_save_model_variable(lp, rvar_names[2], s->ross_rsample.link_traffic_sample);
/* clear up the current router stats */
for( i = 0; i < p->radix; i++)
{
s->ross_rsample.busy_time[i] = 0;
s->ross_rsample.link_traffic_sample[i] = 0;
}
}
static void custom_dragonfly_vt_rsample_rc_fn(router_state * s, tw_bf * bf, tw_lp * lp)
{
(void)lp;
(void)bf;
size_t data_size;
double *rc_busy_time = (double*)st_get_model_variable(lp, rvar_names[1], &data_size);
memcpy(s->ross_rsample.busy_time, rc_busy_time, data_size);
long *rc_link_traffic = (long*)st_get_model_variable(lp, rvar_names[2], &data_size);
memcpy(s->ross_rsample.link_traffic_sample, rc_link_traffic, data_size);
}
static void custom_dragonfly_vt_sample_fn(terminal_state * s, tw_bf * bf, tw_lp * lp)
{
(void)bf;
int terminal_id = (int)s->terminal_id;
st_save_model_variable(lp, tvar_names[0], &terminal_id);
st_save_model_variable(lp, tvar_names[1], &s->ross_sample.fin_chunks_sample);
st_save_model_variable(lp, tvar_names[2], &s->ross_sample.data_size_sample);
st_save_model_variable(lp, tvar_names[3], &s->ross_sample.fin_hops_sample);
st_save_model_variable(lp, tvar_names[4], &s->ross_sample.fin_chunks_time);
st_save_model_variable(lp, tvar_names[5], &s->ross_sample.busy_time_sample);
memset(&s->ross_sample, 0, sizeof(s->ross_sample));
}
static void custom_dragonfly_vt_sample_rc_fn(terminal_state * s, tw_bf * bf, tw_lp * lp)
{
(void)lp;
(void)bf;
size_t data_size;
s->ross_sample.fin_chunks_sample = *(long*)st_get_model_variable(lp, tvar_names[1], &data_size);
s->ross_sample.data_size_sample = *(long*)st_get_model_variable(lp, tvar_names[2], &data_size);
s->ross_sample.fin_hops_sample = *(long*)st_get_model_variable(lp, tvar_names[3], &data_size);
s->ross_sample.fin_chunks_time = *(double*)st_get_model_variable(lp, tvar_names[4], &data_size);
s->ross_sample.busy_time_sample = *(double*)st_get_model_variable(lp, tvar_names[5], &data_size);
}
void custom_dragonfly_event_trace(terminal_custom_message *m, tw_lp *lp, char *buffer, int *collect_flag)
{
(void)lp;
(void)collect_flag;
int type = (int) m->type;
memcpy(buffer, &type, sizeof(type));
}
// GVT-based and real time sampling callback for terminals
void custom_dragonfly_rt_sample_fn(terminal_state *s, tw_lp *lp)
{
(void)lp;
int terminal_id = (int)s->terminal_id;
st_save_model_variable(lp, tvar_names[0], &terminal_id);
st_save_model_variable(lp, tvar_names[1], &s->fin_chunks_ross_sample);
st_save_model_variable(lp, tvar_names[2], &s->data_size_ross_sample);
st_save_model_variable(lp, tvar_names[3], &s->fin_hops_ross_sample);
st_save_model_variable(lp, tvar_names[4], &s->fin_chunks_time_ross_sample);
st_save_model_variable(lp, tvar_names[5], &s->busy_time_ross_sample);
s->fin_chunks_ross_sample = 0;
s->data_size_ross_sample = 0;
s->fin_hops_ross_sample = 0;
s->fin_chunks_time_ross_sample = 0;
s->busy_time_ross_sample = 0;
}
// GVT-based and real time sampling callback for routers
void custom_dfly_router_rt_sample_fn(router_state *s, tw_lp *lp)
{
(void)lp;
const dragonfly_param * p = s->params;
int i;
int router_id = (int)s->router_id;
st_save_model_variable(lp, rvar_names[0], &router_id);
st_save_model_variable(lp, rvar_names[1], &s->busy_time_ross_sample[0]);
st_save_model_variable(lp, rvar_names[2], &s->link_traffic_ross_sample[0]);
/* clear up the current router stats */
for( i = 0; i < p->radix; i++)
{
s->busy_time_ross_sample[i] = 0;
s->link_traffic_ross_sample[i] = 0;
}
}
static const st_model_types *custom_dragonfly_get_model_types(void)
{
return(&custom_dragonfly_model_types[0]);
}
static const st_model_types *custom_dfly_router_get_model_types(void)
{
return(&custom_dragonfly_model_types[1]);
}
static void custom_dragonfly_register_model_types(st_model_types *base_type)
{
st_model_type_register(LP_CONFIG_NM_TERM, base_type);
}
static void custom_router_register_model_types(st_model_types *base_type)
{
st_model_type_register(LP_CONFIG_NM_ROUT, base_type);
}
/***** End of ROSS Instrumentation *****/
static short routing = MINIMAL; static short routing = MINIMAL;
...@@ -1056,13 +1241,14 @@ void router_custom_setup(router_state * r, tw_lp * lp) ...@@ -1056,13 +1241,14 @@ void router_custom_setup(router_state * r, tw_lp * lp)
r->busy_time = (tw_stime*)malloc(p->radix * sizeof(tw_stime)); r->busy_time = (tw_stime*)malloc(p->radix * sizeof(tw_stime));
r->busy_time_sample = (tw_stime*)malloc(p->radix * sizeof(tw_stime)); r->busy_time_sample = (tw_stime*)malloc(p->radix * sizeof(tw_stime));
/* set up for ROSS stats sampling */ /* set up for ROSS Instrumentation */
r->link_traffic_ross_sample = (int64_t*)calloc(p->radix, sizeof(int64_t)); r->link_traffic_ross_sample = (int64_t*)calloc(p->radix, sizeof(int64_t));
r->busy_time_ross_sample = (tw_stime*)calloc(p->radix, sizeof(tw_stime)); r->busy_time_ross_sample = (tw_stime*)calloc(p->radix, sizeof(tw_stime));
if (g_st_model_stats) if (g_st_model_stats)
lp->model_types->mstat_sz = sizeof(tw_lpid) + (sizeof(int64_t) + sizeof(tw_stime)) * p->radix; {
if (g_st_use_analysis_lps && g_st_model_stats) lp->model_types->model_vars[1].num_elems = p->radix;
lp->model_types->sample_struct_sz = sizeof(struct dfly_router_sample) + (sizeof(tw_stime) + sizeof(int64_t)) * p->radix; lp->model_types->model_vars[2].num_elems = p->radix;
}
r->ross_rsample.busy_time = (tw_stime*)calloc(p->radix, sizeof(tw_stime)); r->ross_rsample.busy_time = (tw_stime*)calloc(p->radix, sizeof(tw_stime));
r->ross_rsample.link_traffic_sample = (int64_t*)calloc(p->radix, sizeof(int64_t)); r->ross_rsample.link_traffic_sample = (int64_t*)calloc(p->radix, sizeof(int64_t));
...@@ -1491,7 +1677,7 @@ static void packet_send(terminal_state * s, tw_bf * bf, terminal_custom_message ...@@ -1491,7 +1677,7 @@ static void packet_send(terminal_state * s, tw_bf * bf, terminal_custom_message
if(cur_entry->msg.packet_ID == LLU(TRACK_PKT) && lp->gid == T_ID) if(cur_entry->msg.packet_ID == LLU(TRACK_PKT) && lp->gid == T_ID)
printf("\n Packet %llu generated at terminal %d dest %llu size %llu num chunks %llu router-id %d %d", printf("\n Packet %llu generated at terminal %d dest %llu size %llu num chunks %llu router-id %d %lu",
cur_entry->msg.packet_ID, s->terminal_id, LLU(cur_entry->msg.dest_terminal_id), cur_entry->msg.packet_ID, s->terminal_id, LLU(cur_entry->msg.dest_terminal_id),
LLU(cur_entry->msg.packet_size), LLU(num_chunks), s->router_id, router_id); LLU(cur_entry->msg.packet_size), LLU(num_chunks), s->router_id, router_id);
...@@ -1720,7 +1906,7 @@ static void packet_arrive(terminal_state * s, tw_bf * bf, terminal_custom_messag ...@@ -1720,7 +1906,7 @@ static void packet_arrive(terminal_state * s, tw_bf * bf, terminal_custom_messag
assert(lp->gid == msg->dest_terminal_id); assert(lp->gid == msg->dest_terminal_id);
if(msg->packet_ID == LLU(TRACK_PKT) && msg->src_terminal_id == T_ID) if(msg->packet_ID == LLU(TRACK_PKT) && msg->src_terminal_id == T_ID)
printf("\n Packet %d arrived at lp %llu hops %d ", msg->sender_lp, LLU(lp->gid), msg->my_N_hop); printf("\n Packet %lu arrived at lp %llu hops %d ", msg->sender_lp, LLU(lp->gid), msg->my_N_hop);
tw_stime ts = g_tw_lookahead + s->params->credit_delay + tw_rand_unif(lp->rng); tw_stime ts = g_tw_lookahead + s->params->credit_delay + tw_rand_unif(lp->rng);
...@@ -1896,94 +2082,6 @@ static void packet_arrive(terminal_state * s, tw_bf * bf, terminal_custom_messag ...@@ -1896,94 +2082,6 @@ static void packet_arrive(terminal_state * s, tw_bf * bf, terminal_custom_messag
return; return;
} }
static void ross_custom_dragonfly_rsample_fn(router_state * s, tw_bf * bf, tw_lp * lp, struct dfly_router_sample *sample)
{
(void)lp;
(void)bf;
const dragonfly_param * p = s->params;
int i = 0;
sample->router_id = s->router_id;
sample->end_time = tw_now(lp);
sample->fwd_events = s->ross_rsample.fwd_events;
sample->rev_events = s->ross_rsample.rev_events;
sample->busy_time = (tw_stime*)((&sample->rev_events) + 1);
sample->link_traffic_sample = (int64_t*)((&sample->busy_time[0]) + p->radix);
for(; i < p->radix; i++)
{
sample->busy_time[i] = s->ross_rsample.busy_time[i];
sample->link_traffic_sample[i] = s->ross_rsample.link_traffic_sample[i];
}
/* clear up the current router stats */
s->ross_rsample.fwd_events = 0;
s->ross_rsample.rev_events = 0;
for( i = 0; i < p->radix; i++)
{
s->ross_rsample.busy_time[i] = 0;
s->ross_rsample.link_traffic_sample[i] = 0;
}
}
static void ross_custom_dragonfly_rsample_rc_fn(router_state * s, tw_bf * bf, tw_lp * lp, struct dfly_router_sample *sample)
{
(void)lp;
(void)bf;
const dragonfly_param * p = s->params;
int i =0;
for(; i < p->radix; i++)
{
s->ross_rsample.busy_time[i] = sample->busy_time[i];
s->ross_rsample.link_traffic_sample[i] = sample->link_traffic_sample[i];
}
s->ross_rsample.fwd_events = sample->fwd_events;
s->ross_rsample.rev_events = sample->rev_events;
}
static void ross_custom_dragonfly_sample_fn(terminal_state * s, tw_bf * bf, tw_lp * lp, struct dfly_cn_sample *sample)
{
(void)lp;
(void)bf;
sample->terminal_id = s->terminal_id;
sample->fin_chunks_sample = s->ross_sample.fin_chunks_sample;
sample->data_size_sample = s->ross_sample.data_size_sample;
sample->fin_hops_sample = s->ross_sample.fin_hops_sample;
sample->fin_chunks_time = s->ross_sample.fin_chunks_time;
sample->busy_time_sample = s->ross_sample.busy_time_sample;
sample->end_time = tw_now(lp);
sample->fwd_events = s->ross_sample.fwd_events;
sample->rev_events = s->ross_sample.rev_events;
s->ross_sample.fin_chunks_sample = 0;
s->ross_sample.data_size_sample = 0;
s->ross_sample.fin_hops_sample = 0;
s->ross_sample.fwd_events = 0;
s->ross_sample.rev_events = 0;
s->ross_sample.fin_chunks_time = 0;
s->ross_sample.busy_time_sample = 0;
}
static void ross_custom_dragonfly_sample_rc_fn(terminal_state * s, tw_bf * bf, tw_lp * lp, struct dfly_cn_sample *sample)
{
(void)lp;
(void)bf;
s->ross_sample.busy_time_sample = sample->busy_time_sample;
s->ross_sample.fin_chunks_time = sample->fin_chunks_time;
s->ross_sample.fin_hops_sample = sample->fin_hops_sample;
s->ross_sample.data_size_sample = sample->data_size_sample;
s->ross_sample.fin_chunks_sample = sample->fin_chunks_sample;
s->ross_sample.fwd_events = sample->fwd_events;
s->ross_sample.rev_events = sample->rev_events;
}
void dragonfly_custom_rsample_init(router_state * s, void dragonfly_custom_rsample_init(router_state * s,
tw_lp * lp) tw_lp * lp)
{ {
...@@ -2509,7 +2607,7 @@ get_next_stop(router_state * s, ...@@ -2509,7 +2607,7 @@ get_next_stop(router_state * s,
next_stop[select_chan] % num_routers_per_mgrp, &router_dest_id); next_stop[select_chan] % num_routers_per_mgrp, &router_dest_id);
if(msg->packet_ID == LLU(TRACK_PKT) && msg->src_terminal_id == T_ID) if(msg->packet_ID == LLU(TRACK_PKT) && msg->src_terminal_id == T_ID)
printf("\n Next stop is %ld ", next_stop[select_chan]); printf("\n Next stop is %d ", next_stop[select_chan]);
return router_dest_id; return router_dest_id;
} }
...@@ -2556,7 +2654,7 @@ get_next_stop(router_state * s, ...@@ -2556,7 +2654,7 @@ get_next_stop(router_state * s,
dest_lp = dests[select_chan]; dest_lp = dests[select_chan];
} }
if(msg->packet_ID == LLU(TRACK_PKT) && msg->src_terminal_id == T_ID) if(msg->packet_ID == LLU(TRACK_PKT) && msg->src_terminal_id == T_ID)
printf("\n Next stop is %ld ", dest_lp); printf("\n Next stop is %d ", dest_lp);
codes_mapping_get_lp_id(lp_group_name, LP_CONFIG_NM_ROUT, s->anno, 0, dest_lp / num_routers_per_mgrp, codes_mapping_get_lp_id(lp_group_name, LP_CONFIG_NM_ROUT, s->anno, 0, dest_lp / num_routers_per_mgrp,
dest_lp % num_routers_per_mgrp, &router_dest_id); dest_lp % num_routers_per_mgrp, &router_dest_id);
...@@ -3636,111 +3734,6 @@ tw_lptype dragonfly_custom_lps[] = ...@@ -3636,111 +3734,6 @@ tw_lptype dragonfly_custom_lps[] =
}; };
} }
/* ROSS Instrumentation layer */
// event tracing callback - used router and terminal LPs
void custom_dragonfly_event_collect(terminal_custom_message *m, tw_lp *lp, char *buffer, int *collect_flag)
{
(void)lp;
(void)collect_flag;
int type = (int) m->type;
memcpy(buffer, &type, sizeof(type));
}
// GVT-based and real time sampling callback for terminals
void custom_dragonfly_model_stat_collect(terminal_state *s, tw_lp *lp, char *buffer)
{
(void)lp;
int index = 0;
tw_lpid id = 0;
long tmp = 0;
tw_stime tmp2 = 0;
id = s->terminal_id;
memcpy(&buffer[index], &id, sizeof(id));
index += sizeof(id);
tmp = s->fin_chunks_ross_sample;
memcpy(&buffer[index], &tmp, sizeof(tmp));
index += sizeof(tmp);
s->fin_chunks_ross_sample = 0;
tmp = s->data_size_ross_sample;
memcpy(&buffer[index], &tmp, sizeof(tmp));
index += sizeof(tmp);
s->data_size_ross_sample = 0;
tmp = s->fin_hops_ross_sample;
memcpy(&buffer[index], &tmp, sizeof(tmp));
index += sizeof(tmp);
s->fin_hops_ross_sample = 0;
tmp2 = s->fin_chunks_time_ross_sample;
memcpy(&buffer[index], &tmp2, sizeof(tmp2));
index += sizeof(tmp2);
s->fin_chunks_time_ross_sample = 0;
tmp2 = s->busy_time_ross_sample;
memcpy(&buffer[index], &tmp2, sizeof(tmp2));
index += sizeof(tmp2);
s->busy_time_ross_sample = 0;
return;
}
// GVT-based and real time sampling callback for routers
void custom_dfly_router_model_stat_collect(router_state *s, tw_lp *lp, char *buffer)
{
(void)lp;
const dragonfly_param * p = s->params;
int i, index = 0;
tw_lpid id = 0;
tw_stime tmp = 0;
int64_t tmp2 = 0;
id = s->router_id;
memcpy(&buffer[index], &id, sizeof(id));
index += sizeof(id);
for(i = 0; i < p->radix; i++)
{
tmp = s->busy_time_ross_sample[i];
memcpy(&buffer[index], &tmp, sizeof(tmp));
index += sizeof(tmp);
s->busy_time_ross_sample[i] = 0;
tmp2 = s->link_traffic_ross_sample[i];
memcpy(&buffer[index], &tmp2, sizeof(tmp2));
index += sizeof(tmp2);
s->link_traffic_ross_sample[i] = 0;
}
return;
}
static const st_model_types *custom_dragonfly_get_model_types(void)
{
return(&custom_dragonfly_model_types[0]);
}
static const st_model_types *custom_dfly_router_get_model_types(void)
{
return(&custom_dragonfly_model_types[1]);
}
static void custom_dragonfly_register_model_types(st_model_types *base_type)
{
st_model_type_register(LP_CONFIG_NM_TERM, base_type);
}
static void custom_router_register_model_types(st_model_types *base_type)
{
st_model_type_register(LP_CONFIG_NM_ROUT, base_type);
}
/*** END of ROSS Instrumentation support */
/* returns the dragonfly lp type for lp registration */ /* returns the dragonfly lp type for lp registration */
static const tw_lptype* dragonfly_custom_get_cn_lp_type(void) static const tw_lptype* dragonfly_custom_get_cn_lp_type(void)
{ {
......
...@@ -494,32 +494,220 @@ struct router_state ...@@ -494,32 +494,220 @@ struct router_state
struct dfly_router_sample ross_rsample; struct dfly_router_sample ross_rsample;
}; };
/* ROSS model instrumentation */ /***** ROSS model instrumentation *****/
void dfly_plus_event_collect(terminal_plus_message *m, tw_lp *lp, char *buffer, int *collect_flag); void dfly_plus_event_trace(terminal_plus_message *m, tw_lp *lp, char *buffer, int *collect_flag);
void dfly_plus_model_stat_collect(terminal_state *s, tw_lp *lp, char *buffer); void dfly_plus_rt_sample_fn(terminal_state *s, tw_lp *lp);
void dfly_plus_router_model_stat_collect(router_state *s, tw_lp *lp, char *buffer); void dfly_plus_router_rt_sample_fn(router_state *s, tw_lp *lp);
static void ross_dfly_plus_rsample_fn(router_state * s, tw_bf * bf, tw_lp * lp, struct dfly_router_sample *sample); static void dragonfly_plus_vt_rsample_fn(router_state * s, tw_bf * bf, tw_lp * lp);
static void ross_dfly_plus_rsample_rc_fn(router_state * s, tw_bf * bf, tw_lp * lp, struct dfly_router_sample *sample); static void dragonfly_plus_vt_rsample_rc_fn(router_state * s, tw_bf * bf, tw_lp * lp);
static void ross_dfly_plus_sample_fn(terminal_state * s, tw_bf * bf, tw_lp * lp, struct dfly_cn_sample *sample); static void dragonfly_plus_vt_sample_fn(terminal_state * s, tw_bf * bf, tw_lp * lp);
static void ross_dfly_plus_sample_rc_fn(terminal_state * s, tw_bf * bf, tw_lp * lp, struct dfly_cn_sample *sample); static void dragonfly_plus_vt_sample_rc_fn(terminal_state * s, tw_bf * bf, tw_lp * lp);
static char router_lp_name[] = "dfly_plus_router\0";
static char terminal_lp_name[] = "dfly_plus_terminal\0";
static const char* rvar_names[] = {
"router_id\0",
"busy_time\0",
"link_traffic\0"
};
static const char* tvar_names[] = {
"terminal_id\0",
"fin_chunks\0",
"data_size\0",
"fin_hops\0",
"fin_chunks_time\0",
"busy_time\0"
};
static st_model_var router_vars[] = {
{rvar_names[0],
MODEL_INT,
1},
{rvar_names[1],
MODEL_DOUBLE,
0}, // update in router_plus_setup() since it's based on the radix
{rvar_names[2],
MODEL_LONG,
0} // update in router_plus_setup() since it's based on the radix
};
static st_model_var terminal_vars[] = {
{tvar_names[0],
MODEL_INT,
1},
{tvar_names[1],
MODEL_LONG,
1},
{tvar_names[2],
MODEL_LONG,
1},
{tvar_names[3],
MODEL_LONG,
1},
{tvar_names[4],
MODEL_DOUBLE,
1},
{tvar_names[5],
MODEL_DOUBLE,
1}
};
#define dfly_plus_num_tvars 6
#define dfly_plus_num_rvars 3
st_model_types dfly_plus_model_types[] = { st_model_types dfly_plus_model_types[] = {
{(ev_trace_f) dfly_plus_event_collect, {terminal_lp_name,
sizeof(int), terminal_vars,
(model_stat_f) dfly_plus_model_stat_collect, dfly_plus_num_tvars,
sizeof(tw_lpid) + sizeof(long) * 2 + sizeof(double) + sizeof(tw_stime) *2, (vts_event_f) dragonfly_plus_vt_sample_fn,
(sample_event_f) ross_dfly_plus_sample_fn, (vts_revent_f) dragonfly_plus_vt_sample_rc_fn,
(sample_revent_f) ross_dfly_plus_sample_rc_fn, (rt_event_f) dfly_plus_rt_sample_fn,
sizeof(struct dfly_cn_sample) } , (ev_trace_f) dfly_plus_event_trace,
{(ev_trace_f) dfly_plus_event_collect, sizeof(int)},
sizeof(int), {router_lp_name,
(model_stat_f) dfly_plus_router_model_stat_collect, router_vars,
0, //updated in router_plus_setup() since it's based on the radix dfly_plus_num_rvars,
(sample_event_f) ross_dfly_plus_rsample_fn, (vts_event_f) dragonfly_plus_vt_rsample_fn,
(sample_revent_f) ross_dfly_plus_rsample_rc_fn, (vts_revent_f) dragonfly_plus_vt_rsample_rc_fn,
0 } , //updated in router_plus_setup() since it's based on the radix (rt_event_f) dfly_plus_router_rt_sample_fn,
{NULL, 0, NULL, 0, NULL, NULL, 0} (ev_trace_f) dfly_plus_event_trace,
sizeof(int)},
{0}
}; };
static void dragonfly_plus_vt_rsample_fn(router_state * s, tw_bf * bf, tw_lp * lp)
{
(void)lp;
(void)bf;
const dragonfly_plus_param * p = s->params;
int i = 0;
int router_id = (int)s->router_id;
st_save_model_variable(lp, rvar_names[0], &router_id);
st_save_model_variable(lp, rvar_names[1], s->ross_rsample.busy_time);
st_save_model_variable(lp, rvar_names[2], s->ross_rsample.link_traffic_sample);
/* clear up the current router stats */
for( i = 0; i < p->radix; i++)
{
s->ross_rsample.busy_time[i] = 0;
s->ross_rsample.link_traffic_sample[i] = 0;
}
}
static void dragonfly_plus_vt_rsample_rc_fn(router_state * s, tw_bf * bf, tw_lp * lp)
{
(void)lp;
(void)bf;
size_t data_size;
double *rc_busy_time = (double*)st_get_model_variable(lp, rvar_names[1], &data_size);
memcpy(s->ross_rsample.busy_time, rc_busy_time, data_size);
long *rc_link_traffic = (long*)st_get_model_variable(lp, rvar_names[2], &data_size);
memcpy(s->ross_rsample.link_traffic_sample, rc_link_traffic, data_size);
}
static void dragonfly_plus_vt_sample_fn(terminal_state * s, tw_bf * bf, tw_lp * lp)
{
(void)lp;
(void)bf;
int terminal_id = (int)s->terminal_id;
st_save_model_variable(lp, tvar_names[0], &terminal_id);
st_save_model_variable(lp, tvar_names[1], &s->ross_sample.fin_chunks_sample);
st_save_model_variable(lp, tvar_names[2], &s->ross_sample.data_size_sample);
st_save_model_variable(lp, tvar_names[3], &s->ross_sample.fin_hops_sample);
st_save_model_variable(lp, tvar_names[4], &s->ross_sample.fin_chunks_time);
st_save_model_variable(lp, tvar_names[5], &s->ross_sample.busy_time_sample);
memset(&s->ross_sample, 0, sizeof(s->ross_sample));
}
static void dragonfly_plus_vt_sample_rc_fn(terminal_state * s, tw_bf * bf, tw_lp * lp)
{
(void)lp;
(void)bf;
size_t data_size;
s->ross_sample.fin_chunks_sample = *(long*)st_get_model_variable(lp, tvar_names[1], &data_size);
s->ross_sample.data_size_sample = *(long*)st_get_model_variable(lp, tvar_names[2], &data_size);
s->ross_sample.fin_hops_sample = *(long*)st_get_model_variable(lp, tvar_names[3], &data_size);
s->ross_sample.fin_chunks_time = *(double*)st_get_model_variable(lp, tvar_names[4], &data_size);
s->ross_sample.busy_time_sample = *(double*)st_get_model_variable(lp, tvar_names[5], &data_size);
}
// event tracing callback - used router and terminal LPs
void dfly_plus_event_trace(terminal_plus_message *m, tw_lp *lp, char *buffer, int *collect_flag)
{
(void)lp;
(void)collect_flag;
int type = (int) m->type;
memcpy(buffer, &type, sizeof(type));
}
// GVT-based and real time sampling callback for terminals
void dfly_plus_rt_sample_fn(terminal_state *s, tw_lp *lp)
{
(void)lp;
int terminal_id = (int)s->terminal_id;
st_save_model_variable(lp, tvar_names[0], &terminal_id);
st_save_model_variable(lp, tvar_names[1], &s->fin_chunks_ross_sample);
st_save_model_variable(lp, tvar_names[2], &s->data_size_ross_sample);
st_save_model_variable(lp, tvar_names[3], &s->fin_hops_ross_sample);
st_save_model_variable(lp, tvar_names[4], &s->fin_chunks_time_ross_sample);
st_save_model_variable(lp, tvar_names[5], &s->busy_time_ross_sample);
s->fin_chunks_ross_sample = 0;
s->data_size_ross_sample = 0;
s->fin_hops_ross_sample = 0;
s->fin_chunks_time_ross_sample = 0;
s->busy_time_ross_sample = 0;
}
// GVT-based and real time sampling callback for routers
void dfly_plus_router_rt_sample_fn(router_state *s, tw_lp *lp)
{
(void)lp;
const dragonfly_plus_param * p = s->params;
int i;
int router_id = (int)s->router_id;
st_save_model_variable(lp, rvar_names[0], &router_id);
st_save_model_variable(lp, rvar_names[1], &s->busy_time_ross_sample[0]);
st_save_model_variable(lp, rvar_names[2], &s->link_traffic_ross_sample[0]);
/* clear up the current router stats */
for( i = 0; i < p->radix; i++)
{
s->busy_time_ross_sample[i] = 0;
s->link_traffic_ross_sample[i] = 0;
}
}
static const st_model_types *dfly_plus_get_model_types(void)
{
return(&dfly_plus_model_types[0]);
}
static const st_model_types *dfly_plus_router_get_model_types(void)
{
return(&dfly_plus_model_types[1]);
}
static void dfly_plus_register_model_types(st_model_types *base_type)
{
st_model_type_register(LP_CONFIG_NM_TERM, base_type);
}
static void dfly_plus_router_register_model_types(st_model_types *base_type)
{
st_model_type_register(LP_CONFIG_NM_ROUT, base_type);
}
/*** END of ROSS Instrumentation support */
/* End of ROSS model instrumentation */ /* End of ROSS model instrumentation */
int dragonfly_plus_get_assigned_router_id(int terminal_id, const dragonfly_plus_param *p); int dragonfly_plus_get_assigned_router_id(int terminal_id, const dragonfly_plus_param *p);
...@@ -1299,13 +1487,14 @@ void router_plus_setup(router_state *r, tw_lp *lp) ...@@ -1299,13 +1487,14 @@ void router_plus_setup(router_state *r, tw_lp *lp)
r->busy_time = (tw_stime *) calloc(p->radix, sizeof(tw_stime)); r->busy_time = (tw_stime *) calloc(p->radix, sizeof(tw_stime));
r->busy_time_sample = (tw_stime *) calloc(p->radix, sizeof(tw_stime)); r->busy_time_sample = (tw_stime *) calloc(p->radix, sizeof(tw_stime));
/* set up for ROSS stats sampling */ /* set up for ROSS Instrumentation */
r->link_traffic_ross_sample = (int64_t*)calloc(p->radix, sizeof(int64_t)); r->link_traffic_ross_sample = (int64_t*)calloc(p->radix, sizeof(int64_t));
r->busy_time_ross_sample = (tw_stime*)calloc(p->radix, sizeof(tw_stime)); r->busy_time_ross_sample = (tw_stime*)calloc(p->radix, sizeof(tw_stime));
if (g_st_model_stats) if (g_st_model_stats)
lp->model_types->mstat_sz = sizeof(tw_lpid) + (sizeof(int64_t) + sizeof(tw_stime)) * p->radix; {
if (g_st_use_analysis_lps && g_st_model_stats) lp->model_types->model_vars[1].num_elems = p->radix;
lp->model_types->sample_struct_sz = sizeof(struct dfly_router_sample) + (sizeof(tw_stime) + sizeof(int64_t)) * p->radix; lp->model_types->model_vars[2].num_elems = p->radix;