Commit bba8201b authored by Misbah Mubarak's avatar Misbah Mubarak

Adding Caitlin's vis related changes + fixing more warnings

parents 95a185b8 1348687f
This diff is collapsed.
...@@ -21,8 +21,8 @@ const tw_lptype* lp_type_lookup(const char* name); ...@@ -21,8 +21,8 @@ const tw_lptype* lp_type_lookup(const char* name);
/* register an LP with CODES/ROSS */ /* register an LP with CODES/ROSS */
void lp_type_register(const char* name, const tw_lptype* type); void lp_type_register(const char* name, const tw_lptype* type);
void trace_type_register(const char* name, const st_trace_type* type); void st_model_type_register(const char* name, const st_model_types* type);
const st_trace_type* trace_type_lookup(const char* name); const st_model_types* st_model_type_lookup(const char* name);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
......
...@@ -63,8 +63,8 @@ struct model_net_method ...@@ -63,8 +63,8 @@ struct model_net_method
revent_f mn_sample_rc_fn; revent_f mn_sample_rc_fn;
init_f mn_sample_init_fn; init_f mn_sample_init_fn;
final_f mn_sample_fini_fn; final_f mn_sample_fini_fn;
void (*mn_trace_register)(st_trace_type *base_type); void (*mn_model_stat_register)(st_model_types *base_type);
const st_trace_type* (*mn_get_trace_type)(); const st_model_types* (*mn_get_model_stat_types)();
}; };
extern struct model_net_method * method_array[]; extern struct model_net_method * method_array[];
......
...@@ -393,6 +393,7 @@ void model_net_set_msg_param( ...@@ -393,6 +393,7 @@ void model_net_set_msg_param(
/* returns pointer to LP information for simplenet module */ /* returns pointer to LP information for simplenet module */
const tw_lptype* model_net_get_lp_type(int net_id); const tw_lptype* model_net_get_lp_type(int net_id);
const st_model_types* model_net_get_model_stat_type(int net_id);
DEPRECATED DEPRECATED
uint64_t model_net_get_packet_size(int net_id); uint64_t model_net_get_packet_size(int net_id);
......
...@@ -91,6 +91,8 @@ struct terminal_message ...@@ -91,6 +91,8 @@ struct terminal_message
tw_stime saved_hist_start_time; tw_stime saved_hist_start_time;
tw_stime saved_sample_time; tw_stime saved_sample_time;
tw_stime msg_start_time; tw_stime msg_start_time;
tw_stime saved_busy_time_ross;
tw_stime saved_fin_chunks_ross;
int saved_hist_num; int saved_hist_num;
int saved_occupancy; int saved_occupancy;
......
...@@ -3,6 +3,9 @@ ...@@ -3,6 +3,9 @@
#include <ross.h> #include <ross.h>
/* Functions used for ROSS event tracing */
extern void fattree_register_evtrace();
/* Global variable for modelnet output directory name */ /* Global variable for modelnet output directory name */
extern char *modelnet_stats_dir; extern char *modelnet_stats_dir;
......
...@@ -41,7 +41,7 @@ PARAMS ...@@ -41,7 +41,7 @@ PARAMS
# bandwidth in GiB/s for compute node-router channels # bandwidth in GiB/s for compute node-router channels
cn_bandwidth="16.0"; cn_bandwidth="16.0";
# ROSS message size # ROSS message size
message_size="592"; message_size="608";
# number of compute nodes connected to router, dictated by dragonfly config # number of compute nodes connected to router, dictated by dragonfly config
# file # file
num_cns_per_router="2"; num_cns_per_router="2";
......
...@@ -23,6 +23,6 @@ PARAMS ...@@ -23,6 +23,6 @@ PARAMS
local_bandwidth="5.25"; local_bandwidth="5.25";
global_bandwidth="4.7"; global_bandwidth="4.7";
cn_bandwidth="5.25"; cn_bandwidth="5.25";
message_size="592"; message_size="608";
routing="adaptive"; routing="adaptive";
} }
...@@ -31,6 +31,6 @@ PARAMS ...@@ -31,6 +31,6 @@ PARAMS
cn_bandwidth="9.0"; cn_bandwidth="9.0";
router_delay="0"; router_delay="0";
link_delay="0"; link_delay="0";
message_size="592"; message_size="608";
routing="minimal"; routing="minimal";
} }
...@@ -10,7 +10,7 @@ LPGROUPS ...@@ -10,7 +10,7 @@ LPGROUPS
PARAMS PARAMS
{ {
packet_size="512"; packet_size="512";
message_size="592"; message_size="608";
modelnet_order=( "torus" ); modelnet_order=( "torus" );
# scheduler options # scheduler options
modelnet_scheduler="fcfs"; modelnet_scheduler="fcfs";
......
...@@ -2197,6 +2197,46 @@ static void nw_add_lp_type() ...@@ -2197,6 +2197,46 @@ 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
* can have a different function for rbev_trace_f and ev_trace_f
* but right now it is set to the same function for both
*/
void nw_lp_event_collect(nw_message *m, tw_lp *lp, char *buffer, int *collect_flag)
{
int type = m->msg_type;
memcpy(buffer, &type, sizeof(type));
}
/* can add in any model level data to be collected along with simulation engine data
* 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)
{
return;
}
st_model_types nw_lp_model_types[] = {
{(rbev_trace_f) nw_lp_event_collect,
sizeof(int),
(ev_trace_f) nw_lp_event_collect,
sizeof(int),
(model_stat_f) nw_lp_model_stat_collect,
0},
{0}
};
static const st_model_types *nw_lp_get_model_stat_types(void)
{
return(&nw_lp_model_types[0]);
}
void nw_lp_register_model()
{
st_model_type_register("nw-lp", nw_lp_get_model_stat_types());
}
/* end of ROSS event tracing setup */
static int msg_size_hash_compare( static int msg_size_hash_compare(
void *key, struct qhash_head *link) void *key, struct qhash_head *link)
{ {
...@@ -2299,6 +2339,9 @@ int modelnet_mpi_replay(MPI_Comm comm, int* argc, char*** argv ) ...@@ -2299,6 +2339,9 @@ int modelnet_mpi_replay(MPI_Comm comm, int* argc, char*** argv )
nw_add_lp_type(); nw_add_lp_type();
model_net_register(); model_net_register();
if (g_st_ev_trace || g_st_model_stats)
nw_lp_register_model();
net_ids = model_net_configure(&num_nets); net_ids = model_net_configure(&num_nets);
// assert(num_nets == 1); // assert(num_nets == 1);
net_id = *net_ids; net_id = *net_ids;
......
...@@ -120,6 +120,45 @@ tw_lptype svr_lp = { ...@@ -120,6 +120,45 @@ tw_lptype svr_lp = {
sizeof(svr_state), sizeof(svr_state),
}; };
/* setup for the ROSS event tracing
* can have a different function for rbev_trace_f and ev_trace_f
* but right now it is set to the same function for both
*/
void ft_svr_event_collect(svr_msg *m, tw_lp *lp, char *buffer, int *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
* 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)
{
return;
}
st_model_types ft_svr_model_types[] = {
{(rbev_trace_f) ft_svr_event_collect,
sizeof(int),
(ev_trace_f) ft_svr_event_collect,
sizeof(int),
(model_stat_f) ft_svr_model_stat_collect,
0},
{0}
};
static const st_model_types *ft_svr_get_model_stat_types(void)
{
return(&ft_svr_model_types[0]);
}
void ft_svr_register_model_stats()
{
st_model_type_register("server", ft_svr_get_model_stat_types());
}
const tw_optdef app_opt [] = const tw_optdef app_opt [] =
{ {
TWOPT_GROUP("Model net synthetic traffic " ), TWOPT_GROUP("Model net synthetic traffic " ),
...@@ -408,6 +447,9 @@ int main( ...@@ -408,6 +447,9 @@ int main(
svr_add_lp_type(); svr_add_lp_type();
if (g_st_ev_trace)
ft_svr_register_model_stats();
codes_mapping_setup(); codes_mapping_setup();
......
...@@ -110,28 +110,39 @@ tw_lptype svr_lp = { ...@@ -110,28 +110,39 @@ tw_lptype svr_lp = {
* can have a different function for rbev_trace_f and ev_trace_f * can have a different function for rbev_trace_f and ev_trace_f
* but right now it is set to the same function for both * but right now it is set to the same function for both
*/ */
void svr_event_collect(svr_msg *m, tw_lp *lp, char *buffer) void svr_event_collect(svr_msg *m, tw_lp *lp, char *buffer, int *collect_flag)
{ {
int type = (int) m->svr_event_type; int type = (int) m->svr_event_type;
memcpy(buffer, &type, sizeof(type)); memcpy(buffer, &type, sizeof(type));
} }
st_trace_type svr_trace_types[] = { /* can add in any model level data to be collected along with simulation engine data
* 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)
{
return;
}
st_model_types svr_model_types[] = {
{(rbev_trace_f) svr_event_collect, {(rbev_trace_f) svr_event_collect,
sizeof(int), sizeof(int),
(ev_trace_f) svr_event_collect, (ev_trace_f) svr_event_collect,
sizeof(int)}, sizeof(int),
(model_stat_f) svr_model_stat_collect,
0},
{0} {0}
}; };
static const st_trace_type *svr_get_trace_types(void) static const st_model_types *svr_get_model_stat_types(void)
{ {
return(&svr_trace_types[0]); return(&svr_model_types[0]);
} }
void svr_register_trace() void svr_register_model_types()
{ {
trace_type_register("server", svr_get_trace_types()); st_model_type_register("server", svr_get_model_stat_types());
} }
const tw_optdef app_opt [] = const tw_optdef app_opt [] =
...@@ -393,8 +404,8 @@ int main( ...@@ -393,8 +404,8 @@ int main(
model_net_register(); model_net_register();
svr_add_lp_type(); svr_add_lp_type();
if (g_st_ev_trace) if (g_st_ev_trace || g_st_model_stats)
svr_register_trace(); svr_register_model_types();
codes_mapping_setup(); codes_mapping_setup();
......
...@@ -1840,7 +1840,7 @@ void dragonfly_custom_rsample_fin(router_state * s, ...@@ -1840,7 +1840,7 @@ void dragonfly_custom_rsample_fin(router_state * s,
"link traffic for each of the %d links (int64_t) \nsample end time (double) forward events per sample \nreverse events per sample ", "link traffic for each of the %d links (int64_t) \nsample end time (double) forward events per sample \nreverse events per sample ",
p->radix, p->radix); p->radix, p->radix);
fprintf(fp, "\n\nOrdering of links \n%d local (router-router same group) channels \n%d global (router-router remote group)" fprintf(fp, "\n\nOrdering of links \n%d local (router-router same group) channels \n%d global (router-router remote group)"
" channels \n%d terminal channels", p->intra_grp_radix, p->num_global_channels); " channels \n %d terminal channels", p->intra_grp_radix, p->num_global_channels, p->num_cn);
fclose(fp); fclose(fp);
} }
char rt_fn[MAX_NAME_LENGTH]; char rt_fn[MAX_NAME_LENGTH];
......
This diff is collapsed.
...@@ -166,21 +166,6 @@ struct ftree_qhash_entry ...@@ -166,21 +166,6 @@ struct ftree_qhash_entry
struct qhash_head hash_link; struct qhash_head hash_link;
}; };
/* convert GiB/s and bytes to ns */
static tw_stime bytes_to_ns(uint64_t bytes, double GB_p_s)
{
tw_stime time;
/* bytes to GB */
time = ((double)bytes)/(1024.0*1024.0*1024.0);
/* GiB to s */
time = time / GB_p_s;
/* s to ns */
time = time * 1000.0 * 1000.0 * 1000.0;
return(time);
}
/* handles terminal and switch events like packet generate/send/receive/buffer */ /* handles terminal and switch events like packet generate/send/receive/buffer */
typedef enum event_t event_t; typedef enum event_t event_t;
typedef struct ft_terminal_state ft_terminal_state; typedef struct ft_terminal_state ft_terminal_state;
...@@ -564,13 +549,13 @@ static void dot_write_open_file(FILE **fout) ...@@ -564,13 +549,13 @@ static void dot_write_open_file(FILE **fout)
} }
} }
static void dot_write_close_file(FILE **fout) /*static void dot_write_close_file(FILE **fout)
{ {
if(!fout || !(*fout)) return; if(!fout || !(*fout)) return;
if(!dump_topo) return; if(!dump_topo) return;
fclose(*fout); fclose(*fout);
*fout = NULL; *fout = NULL;
} }*/
/* sw IDs aren't unique, but level+ID info is */ /* sw IDs aren't unique, but level+ID info is */
static void dot_write_switch_info(switch_state *s, int sw_gid, FILE *fout) static void dot_write_switch_info(switch_state *s, int sw_gid, FILE *fout)
...@@ -651,21 +636,21 @@ static void dot_write_sw2term_link(int lsw_lvl, int lsw_id, int lsw_port, ...@@ -651,21 +636,21 @@ static void dot_write_sw2term_link(int lsw_lvl, int lsw_id, int lsw_port,
term_id, lsw_lvl, lsw_id, lsw_port); term_id, lsw_lvl, lsw_id, lsw_port);
} }
static void dot_write_term2sw_link(int term_id, int rsw_lvl, int rsw_id, /*static void dot_write_term2sw_link(int term_id, int rsw_lvl, int rsw_id,
int rsw_port, FILE *fout) int rsw_port, FILE *fout)
{ {
if(!fout) return; if(!fout) return;
if(!dump_topo) return; if(!dump_topo) return;
/* add +1 to ports, since ibsim/opensm start with physical port number 1 *//* add +1 to ports, since ibsim/opensm start with physical port number 1
* (port 0 is internal sw port) * (port 0 is internal sw port)
*/ */
//if(NULL != getenv("OSM_ROUTING")) //if(NULL != getenv("OSM_ROUTING"))
rsw_port++; // rsw_port++;
fprintf(fout, "\t\"H_%d\" -> \"S_%d_%d\" [comment=\"P1->P%d\"];\n", //fprintf(fout, "\t\"H_%d\" -> \"S_%d_%d\" [comment=\"P1->P%d\"];\n",
term_id, rsw_lvl, rsw_id, rsw_port); // term_id, rsw_lvl, rsw_id, rsw_port);
} //}
void post_switch_init(switch_state *s, tw_lp *lp) void post_switch_init(switch_state *s, tw_lp *lp)
{ {
...@@ -1209,7 +1194,6 @@ void switch_init(switch_state * r, tw_lp * lp) ...@@ -1209,7 +1194,6 @@ void switch_init(switch_state * r, tw_lp * lp)
l0_base++; l0_base++;
} }
if(p->num_levels == 3) { if(p->num_levels == 3) {
int l2_base = 0;
if(p->ft_type == 0) { if(p->ft_type == 0) {
/*for(int rep=0;rep<p->link_repetitions;rep++)*/{ /*for(int rep=0;rep<p->link_repetitions;rep++)*/{
int rep = 0; int rep = 0;
...@@ -1824,6 +1808,7 @@ void switch_packet_receive_rc(switch_state * s, ...@@ -1824,6 +1808,7 @@ void switch_packet_receive_rc(switch_state * s,
s_arrive_r++; s_arrive_r++;
#endif #endif
int output_port = msg->saved_vc; int output_port = msg->saved_vc;
tw_rand_reverse_unif(lp->rng);
if(bf->c1) if(bf->c1)
{ {
tw_rand_reverse_unif(lp->rng); tw_rand_reverse_unif(lp->rng);
...@@ -2281,6 +2266,8 @@ void switch_buf_update(switch_state * s, tw_bf * bf, fattree_message * msg, ...@@ -2281,6 +2266,8 @@ void switch_buf_update(switch_state * s, tw_bf * bf, fattree_message * msg,
void ft_send_remote_event(ft_terminal_state * s, fattree_message * msg, tw_lp * lp, tw_bf * bf, char * event_data, int remote_event_size) void ft_send_remote_event(ft_terminal_state * s, fattree_message * msg, tw_lp * lp, tw_bf * bf, char * event_data, int remote_event_size)
{ {
(void)s;
void * tmp_ptr = model_net_method_get_edata(FATTREE, msg); void * tmp_ptr = model_net_method_get_edata(FATTREE, msg);
//tw_stime ts = g_tw_lookahead + bytes_to_ns(msg->remote_event_size_bytes, (1/s->params->cn_bandwidth)); //tw_stime ts = g_tw_lookahead + bytes_to_ns(msg->remote_event_size_bytes, (1/s->params->cn_bandwidth));
...@@ -2649,10 +2636,13 @@ int ft_get_output_port( switch_state * s, tw_bf * bf, fattree_message * msg, ...@@ -2649,10 +2636,13 @@ int ft_get_output_port( switch_state * s, tw_bf * bf, fattree_message * msg,
assert(end_port > start_port); assert(end_port > start_port);
outport = start_port; //outport = start_port;
// when occupancy is same, just choose random port
outport = tw_rand_integer(lp->rng, start_port, end_port-1);
int load = s->vc_occupancy[outport] + s->queued_length[outport]; int load = s->vc_occupancy[outport] + s->queued_length[outport];
if(load != 0) { if(load != 0) {
for(int port = start_port + 1; port < end_port; port++) { //for(int port = start_port + 1; port < end_port; port++) {
for(int port = start_port; port < end_port; port++) {
if(s->vc_occupancy[port] + s->queued_length[port] < load) { if(s->vc_occupancy[port] + s->queued_length[port] < load) {
load = s->vc_occupancy[port] + s->queued_length[port]; load = s->vc_occupancy[port] + s->queued_length[port];
outport = port; outport = port;
...@@ -2734,7 +2724,7 @@ void fattree_terminal_final( ft_terminal_state * s, tw_lp * lp ) ...@@ -2734,7 +2724,7 @@ void fattree_terminal_final( ft_terminal_state * s, tw_lp * lp )
if(!s->terminal_id) if(!s->terminal_id)
written = sprintf(s->output_buf, "# Format <LP id> <Terminal ID> <Total Data Size> <Aggregate packet latency> <# Flits/Packets finished> <Avg hops> <Busy Time>\n"); written = sprintf(s->output_buf, "# Format <LP id> <Terminal ID> <Total Data Size> <Aggregate packet latency> <# Flits/Packets finished> <Avg hops> <Busy Time>\n");
written += sprintf(s->output_buf + written, "%llu %u %ld %lf %ld %lf %lf\n", written += sprintf(s->output_buf + written, "%llu %u %lld %lf %ld %lf %lf\n",
LLU(lp->gid), s->terminal_id, s->total_msg_size, s->total_time, LLU(lp->gid), s->terminal_id, s->total_msg_size, s->total_time,
s->finished_packets, (double)s->total_hops/s->finished_chunks, s->finished_packets, (double)s->total_hops/s->finished_chunks,
s->busy_time); s->busy_time);
...@@ -2974,6 +2964,41 @@ tw_lptype fattree_lps[] = ...@@ -2974,6 +2964,41 @@ tw_lptype fattree_lps[] =
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0}, {NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0},
}; };
/* For ROSS event tracing */
void fattree_event_collect(fattree_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));
}
// TODO will need to separate fattree_method into one for terminal and one for switch
// in order to use the ROSS model stats collection
st_model_types fattree_model_types[] = {
{(rbev_trace_f) fattree_event_collect,
sizeof(int),
(ev_trace_f) fattree_event_collect,
sizeof(int),
NULL,
0},
{NULL, 0, NULL, 0, NULL, 0}
};
static const st_model_types *fattree_get_model_stat_types(void)
{
return(&fattree_model_types[0]);
}
static void fattree_register_model_stats(st_model_types *base_type)
{
st_model_type_register(LP_CONFIG_NM, base_type);
st_model_type_register("fattree_switch", &fattree_model_types[0]);
//trace_type_register("fattree_switch", base_type);
}
/*** END of ROSS event tracing additions */
/* returns the fattree lp type for lp registration */ /* returns the fattree lp type for lp registration */
static const tw_lptype* fattree_get_cn_lp_type(void) static const tw_lptype* fattree_get_cn_lp_type(void)
{ {
...@@ -3002,62 +3027,91 @@ struct model_net_method fattree_method = ...@@ -3002,62 +3027,91 @@ struct model_net_method fattree_method =
.mn_report_stats = fattree_report_stats, .mn_report_stats = fattree_report_stats,
// .model_net_method_find_local_device = NULL, // .model_net_method_find_local_device = NULL,
.mn_collective_call = NULL, .mn_collective_call = NULL,
.mn_collective_call_rc = NULL .mn_collective_call_rc = NULL,
.mn_model_stat_register = fattree_register_model_stats,
.mn_get_model_stat_types = fattree_get_model_stat_types
}; };
#ifdef ENABLE_CORTEX #ifdef ENABLE_CORTEX
static int fattree_get_number_of_compute_nodes(void* topo) { static int fattree_get_number_of_compute_nodes(void* topo) {
// TODO // TODO
(void)topo;
return -1; return -1;
} }
static int fattree_get_number_of_routers(void* topo) { static int fattree_get_number_of_routers(void* topo) {
// TODO // TODO
(void)topo;
return -1; return -1;
} }
static double fattree_get_router_link_bandwidth(void* topo, router_id_t r1, router_id_t r2) { static double fattree_get_router_link_bandwidth(void* topo, router_id_t r1, router_id_t r2) {
// TODO // TODO
(void)topo;
(void)r1;
(void)r2;
return -1.0; return -1.0;
} }
static double fattree_get_compute_node_bandwidth(void* topo, cn_id_t node) { static double fattree_get_compute_node_bandwidth(void* topo, cn_id_t node) {
// TODO // TODO
(void)topo;
(void)node;
return -1.0; return -1.0;
} }
static int fattree_get_router_neighbor_count(void* topo, router_id_t r) { static int fattree_get_router_neighbor_count(void* topo, router_id_t r) {
// TODO // TODO
(void)topo;
(void)r;
return 0; return 0;
} }
static void fattree_get_router_neighbor_list(void* topo, router_id_t r, router_id_t* neighbors) { static void fattree_get_router_neighbor_list(void* topo, router_id_t r, router_id_t* neighbors) {
// TODO // TODO
(void)topo;
(void)r;
(void)neighbors;
} }
static int fattree_get_router_location(void* topo, router_id_t r, int32_t* location, int size) { static int fattree_get_router_location(void* topo, router_id_t r, int32_t* location, int size) {
// TODO // TODO
(void)topo;
(void)r;
(void)location;
(void)size;
return 0; return 0;
} }
static int fattree_get_compute_node_location(void* topo, cn_id_t node, int32_t* location, int size) { static int fattree_get_compute_node_location(void* topo, cn_id_t node, int32_t* location, int size) {
// TODO // TODO
(void)topo;
(void)node;
(void)location;
(void)size;
return 0; return 0;
} }
static router_id_t fattree_get_router_from_compute_node(void* topo, cn_id_t node) { static router_id_t fattree_get_router_from_compute_node(void* topo, cn_id_t node) {
// TODO // TODO
(void)topo;
(void)node;
return -1; return -1;
} }
static int fattree_get_router_compute_node_count(void* topo, router_id_t r) { static int fattree_get_router_compute_node_count(void* topo, router_id_t r) {
// TODO // TODO
(void)topo;
(void)r;
return 0; return 0;
} }
static void fattree_get_router_compute_node_list(void* topo, router_id_t r, cn_id_t* nodes) { static void fattree_get_router_compute_node_list(void* topo, router_id_t r, cn_id_t* nodes) {
// TODO // TODO
(void)topo;
(void)r;
(void)nodes;
} }