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);
/* register an LP with CODES/ROSS */
void lp_type_register(const char* name, const tw_lptype* type);
void trace_type_register(const char* name, const st_trace_type* type);
const st_trace_type* trace_type_lookup(const char* name);
void st_model_type_register(const char* name, const st_model_types* type);
const st_model_types* st_model_type_lookup(const char* name);
#ifdef __cplusplus
}
#endif
......
......@@ -63,8 +63,8 @@ struct model_net_method
revent_f mn_sample_rc_fn;
init_f mn_sample_init_fn;
final_f mn_sample_fini_fn;
void (*mn_trace_register)(st_trace_type *base_type);
const st_trace_type* (*mn_get_trace_type)();
void (*mn_model_stat_register)(st_model_types *base_type);
const st_model_types* (*mn_get_model_stat_types)();
};
extern struct model_net_method * method_array[];
......
......@@ -393,6 +393,7 @@ void model_net_set_msg_param(
/* returns pointer to LP information for simplenet module */
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
uint64_t model_net_get_packet_size(int net_id);
......
......@@ -91,6 +91,8 @@ struct terminal_message
tw_stime saved_hist_start_time;
tw_stime saved_sample_time;
tw_stime msg_start_time;
tw_stime saved_busy_time_ross;
tw_stime saved_fin_chunks_ross;
int saved_hist_num;
int saved_occupancy;
......
......@@ -3,6 +3,9 @@
#include <ross.h>
/* Functions used for ROSS event tracing */
extern void fattree_register_evtrace();
/* Global variable for modelnet output directory name */
extern char *modelnet_stats_dir;
......
......@@ -41,7 +41,7 @@ PARAMS
# bandwidth in GiB/s for compute node-router channels
cn_bandwidth="16.0";
# ROSS message size
message_size="592";
message_size="608";
# number of compute nodes connected to router, dictated by dragonfly config
# file
num_cns_per_router="2";
......
......@@ -23,6 +23,6 @@ PARAMS
local_bandwidth="5.25";
global_bandwidth="4.7";
cn_bandwidth="5.25";
message_size="592";
message_size="608";
routing="adaptive";
}
......@@ -31,6 +31,6 @@ PARAMS
cn_bandwidth="9.0";
router_delay="0";
link_delay="0";
message_size="592";
message_size="608";
routing="minimal";
}
......@@ -10,7 +10,7 @@ LPGROUPS
PARAMS
{
packet_size="512";
message_size="592";
message_size="608";
modelnet_order=( "torus" );
# scheduler options
modelnet_scheduler="fcfs";
......
......@@ -2197,6 +2197,46 @@ static void nw_add_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(
void *key, struct qhash_head *link)
{
......@@ -2299,6 +2339,9 @@ int modelnet_mpi_replay(MPI_Comm comm, int* argc, char*** argv )
nw_add_lp_type();
model_net_register();
if (g_st_ev_trace || g_st_model_stats)
nw_lp_register_model();
net_ids = model_net_configure(&num_nets);
// assert(num_nets == 1);
net_id = *net_ids;
......
......@@ -120,6 +120,45 @@ tw_lptype svr_lp = {
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 [] =
{
TWOPT_GROUP("Model net synthetic traffic " ),
......@@ -408,6 +447,9 @@ int main(
svr_add_lp_type();
if (g_st_ev_trace)
ft_svr_register_model_stats();
codes_mapping_setup();
......
......@@ -110,28 +110,39 @@ tw_lptype svr_lp = {
* 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 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;
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,
sizeof(int),
(ev_trace_f) svr_event_collect,
sizeof(int)},
sizeof(int),
(model_stat_f) svr_model_stat_collect,
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 [] =
......@@ -393,8 +404,8 @@ int main(
model_net_register();
svr_add_lp_type();
if (g_st_ev_trace)
svr_register_trace();
if (g_st_ev_trace || g_st_model_stats)
svr_register_model_types();
codes_mapping_setup();
......
......@@ -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 ",
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)"
" 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);
}
char rt_fn[MAX_NAME_LENGTH];
......
This diff is collapsed.
......@@ -166,21 +166,6 @@ struct ftree_qhash_entry
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 */
typedef enum event_t event_t;
typedef struct ft_terminal_state ft_terminal_state;
......@@ -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(!dump_topo) return;
fclose(*fout);
*fout = NULL;
}
}*/
/* sw IDs aren't unique, but level+ID info is */
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,
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)
{
if(!fout) 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)
*/
//if(NULL != getenv("OSM_ROUTING"))
rsw_port++;
// rsw_port++;
fprintf(fout, "\t\"H_%d\" -> \"S_%d_%d\" [comment=\"P1->P%d\"];\n",
term_id, rsw_lvl, rsw_id, rsw_port);
}
//fprintf(fout, "\t\"H_%d\" -> \"S_%d_%d\" [comment=\"P1->P%d\"];\n",
// term_id, rsw_lvl, rsw_id, rsw_port);
//}
void post_switch_init(switch_state *s, tw_lp *lp)
{
......@@ -1209,7 +1194,6 @@ void switch_init(switch_state * r, tw_lp * lp)
l0_base++;
}
if(p->num_levels == 3) {
int l2_base = 0;
if(p->ft_type == 0) {
/*for(int rep=0;rep<p->link_repetitions;rep++)*/{
int rep = 0;
......@@ -1824,6 +1808,7 @@ void switch_packet_receive_rc(switch_state * s,
s_arrive_r++;
#endif
int output_port = msg->saved_vc;
tw_rand_reverse_unif(lp->rng);
if(bf->c1)
{
tw_rand_reverse_unif(lp->rng);
......@@ -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)s;
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));
......@@ -2649,10 +2636,13 @@ int ft_get_output_port( switch_state * s, tw_bf * bf, fattree_message * msg,
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];
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) {
load = s->vc_occupancy[port] + s->queued_length[port];
outport = port;
......@@ -2734,7 +2724,7 @@ void fattree_terminal_final( ft_terminal_state * s, tw_lp * lp )
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 + 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,
s->finished_packets, (double)s->total_hops/s->finished_chunks,
s->busy_time);
......@@ -2974,6 +2964,41 @@ tw_lptype fattree_lps[] =
{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 */
static const tw_lptype* fattree_get_cn_lp_type(void)
{
......@@ -3002,62 +3027,91 @@ struct model_net_method fattree_method =
.mn_report_stats = fattree_report_stats,
// .model_net_method_find_local_device = 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
static int fattree_get_number_of_compute_nodes(void* topo) {
// TODO
(void)topo;
return -1;
}
static int fattree_get_number_of_routers(void* topo) {
// TODO
(void)topo;
return -1;
}
static double fattree_get_router_link_bandwidth(void* topo, router_id_t r1, router_id_t r2) {
// TODO
(void)topo;
(void)r1;
(void)r2;
return -1.0;
}
static double fattree_get_compute_node_bandwidth(void* topo, cn_id_t node) {
// TODO
(void)topo;
(void)node;
return -1.0;
}
static int fattree_get_router_neighbor_count(void* topo, router_id_t r) {
// TODO
(void)topo;
(void)r;
return 0;
}
static void fattree_get_router_neighbor_list(void* topo, router_id_t r, router_id_t* neighbors) {
// TODO
(void)topo;
(void)r;
(void)neighbors;
}
static int fattree_get_router_location(void* topo, router_id_t r, int32_t* location, int size) {
// TODO
(void)topo;
(void)r;
(void)location;
(void)size;
return 0;
}
static int fattree_get_compute_node_location(void* topo, cn_id_t node, int32_t* location, int size) {
// TODO
(void)topo;
(void)node;
(void)location;
(void)size;
return 0;
}
static router_id_t fattree_get_router_from_compute_node(void* topo, cn_id_t node) {
// TODO
(void)topo;
(void)node;
return -1;
}
static int fattree_get_router_compute_node_count(void* topo, router_id_t r) {
// TODO
(void)topo;
(void)r;
return 0;
}
static void fattree_get_router_compute_node_list(void* topo, router_id_t r, cn_id_t* nodes) {
// TODO
(void)topo;
(void)r;
(void)nodes;
}
cortex_topology fattree_cortex_topology = {
......
......@@ -53,6 +53,7 @@ typedef struct model_net_base_state {
// lp type and state of underlying model net method - cache here so we
// don't have to constantly look up
const tw_lptype *sub_type;
const st_model_types *sub_model_type;
void *sub_state;
} model_net_base_state;
......@@ -117,17 +118,54 @@ tw_lptype model_net_base_lp = {
* 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 mn_event_collect(model_net_wrap_msg *m, tw_lp *lp, char *buffer)
void mn_event_collect(model_net_wrap_msg *m, tw_lp *lp, char *buffer, int *collect_flag)
{
int type = (int) m->h.event_type;
memcpy(buffer, &type, sizeof(type));
// assigning large numbers to message types to make it easier to
// determine which messages are model net base LP msgs
int type;
void * sub_msg;
switch (m->h.event_type){
case MN_BASE_NEW_MSG:
type = 9000;
memcpy(buffer, &type, sizeof(type));
break;
case MN_BASE_SCHED_NEXT:
type = 9001;
memcpy(buffer, &type, sizeof(type));
break;
case MN_BASE_SAMPLE:
type = 9002;
memcpy(buffer, &type, sizeof(type));
break;
case MN_BASE_PASS:
sub_msg = ((char*)m)+msg_offsets[((model_net_base_state*)lp->cur_state)->net_id];
if (g_st_ev_trace == RB_TRACE || g_st_ev_trace == COMMIT_TRACE)
(((model_net_base_state*)lp->cur_state)->sub_model_type->rbev_trace)(sub_msg, lp, buffer, collect_flag);
else if (g_st_ev_trace == FULL_TRACE)
(((model_net_base_state*)lp->cur_state)->sub_model_type->ev_trace)(sub_msg, lp, buffer, collect_flag);
break;
default: // this shouldn't happen, but can help detect an issue
type = 9004;
break;
}
}
st_trace_type mn_trace_types = {
void mn_model_stat_collect(model_net_base_state *s, tw_lp *lp, char *buffer)
{
// need to call the model level stats collection fn
(*s->sub_model_type->model_stat_fn)(s->sub_state, lp, buffer);
return;
}
st_model_types mn_model_types[MAX_NETS];
st_model_types mn_model_base_type = {
(rbev_trace_f) mn_event_collect,
sizeof(int),
(ev_trace_f) mn_event_collect,
sizeof(int),
(model_stat_f) mn_model_stat_collect,
0
};
/**** END LP, EVENT PROCESSING FUNCTION DECLS ****/
......@@ -168,12 +206,14 @@ void model_net_base_register(int *do_config_nets){
&model_net_base_lp);
else
method_array[i]->mn_register(&model_net_base_lp);
if (g_st_ev_trace) // for ROSS event tracing
if (g_st_ev_trace || g_st_model_stats) // for ROSS event tracing
{
if (method_array[i]->mn_trace_register == NULL)
trace_type_register(model_net_lp_config_names[i], &mn_trace_types);
memcpy(&mn_model_types[i], &mn_model_base_type, sizeof(st_model_types));
if (method_array[i]->mn_model_stat_register == NULL)
st_model_type_register(model_net_lp_config_names[i], &mn_model_types[i]);
else
method_array[i]->mn_trace_register(&mn_trace_types);
method_array[i]->mn_model_stat_register(&mn_model_types[i]);
}
}
}
......@@ -376,6 +416,14 @@ void model_net_base_lp_init(
ns->sched_recv);
ns->sub_type = model_net_get_lp_type(ns->net_id);
/* some ROSS instrumentation setup */
if (g_st_ev_trace || g_st_model_stats)
{
ns->sub_model_type = model_net_get_model_stat_type(ns->net_id);
mn_model_types[ns->net_id].mstat_sz = ns->sub_model_type->mstat_sz;
}
// NOTE: some models actually expect LP state to be 0 initialized...
// *cough anything that uses mn_stats_array cough*
ns->sub_state = calloc(1, ns->sub_type->state_sz);
......@@ -415,7 +463,7 @@ void model_net_base_event(
tw_lp * lp){
if(m->h.magic != model_net_base_magic)
printf("\n LP ID mismatched %d ", lp->gid);
printf("\n LP ID mismatched %llu ", lp->gid);
assert(m->h.magic == model_net_base_magic);
......
......@@ -598,6 +598,11 @@ const tw_lptype* model_net_get_lp_type(int net_id)
return method_array[net_id]->mn_get_lp_type();
}
const st_model_types* model_net_get_model_stat_type(int net_id)
{
return method_array[net_id]->mn_get_model_stat_types();
}
void model_net_report_stats(int net_id)
{
if(net_id < 0 || net_id >= MAX_NETS)
......
......@@ -1454,7 +1454,7 @@ void slim_packet_send(terminal_state * s, tw_bf * bf, slim_terminal_message * ms
vc_occupancy_storage_terminal[s->terminal_id][0][index] = s->vc_occupancy[0]/s->params->chunk_size;
#endif
cur_entry = return_head(s->terminal_msgs, s->terminal_msgs_tail, 0);
rc_stack_push(lp, cur_entry, slim_delete_terminal_message_list, s->st);
rc_stack_push(lp, cur_entry, (void*)slim_delete_terminal_message_list, s->st);
s->terminal_length -= s->params->chunk_size;
cur_entry = s->terminal_msgs[0];
......@@ -3137,7 +3137,7 @@ slim_router_packet_send( router_state * s,
cur_entry = return_head(s->pending_msgs[output_port],
s->pending_msgs_tail[output_port], output_chan);
rc_stack_push(lp, cur_entry, slim_delete_terminal_message_list, s->st);
rc_stack_push(lp, cur_entry, (void*)slim_delete_terminal_message_list, s->st);
cur_entry = s->pending_msgs[output_port][3];
......
......@@ -458,7 +458,7 @@ static void codes_mapping_init(void)
tw_lpid nkp_per_pe = g_tw_nkp;
tw_lpid lpid, kpid;
const tw_lptype *lptype;
const st_trace_type *trace_type;
const st_model_types *trace_type;
/* have 16 kps per pe, this is the optimized configuration for ROSS custom mapping */
for(kpid = 0; kpid < nkp_per_pe; kpid++)
......@@ -489,10 +489,10 @@ static void codes_mapping_init(void)
else
/* sorry, const... */
tw_lp_settype(ross_lid, (tw_lptype*) lptype);
if (g_st_ev_trace)
if (g_st_ev_trace || g_st_model_stats)
{
trace_type = trace_type_lookup(lp_type_name);
st_evtrace_settype(ross_lid, (st_trace_type*) trace_type);
trace_type = st_model_type_lookup(lp_type_name);
st_model_settype(ross_lid, (st_model_types*) trace_type);
}
}
return;
......
......@@ -16,7 +16,7 @@ struct lp_name_mapping
{
const char* name;
const tw_lptype* type;
const st_trace_type* trace_type;
const st_model_types* trace_type;
};
static struct lp_name_mapping map_array[MAX_LP_TYPES];
......@@ -48,7 +48,7 @@ const tw_lptype* lp_type_lookup(const char* name)
}
// needs to be called after lp_type_register()
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)
{
int i;
......@@ -61,7 +61,7 @@ void trace_type_register(const char* name, const st_trace_type* type)
}
}
const st_trace_type* trace_type_lookup(const char* name)
const st_model_types* st_model_type_lookup(const char* name)
{
int i;
......
......@@ -10,7 +10,7 @@ LPGROUPS
PARAMS