Commit e12c9d6d authored by Nikhil's avatar Nikhil Committed by Misbah Mubarak

Portability fixes

Change-Id: Ied69812e2b6600c54a3e14cdf6aad8c99109f84d
parent c9438666
......@@ -112,7 +112,6 @@ struct em_cn_sample
};
/* handles terminal and router events like packet generate/send/receive/buffer */
typedef enum event_t event_t;
typedef struct terminal_state terminal_state;
typedef struct router_state router_state;
......@@ -189,6 +188,7 @@ enum event_t
R_ARRIVE,
R_BUFFER,
};
typedef enum event_t event_t;
/* whether the last hop of a packet was global, local or a terminal */
enum last_hop
......@@ -2496,40 +2496,45 @@ static void router_register(tw_lptype *base_type) {
lp_type_register(LP_CONFIG_NM_ROUT, base_type);
}
struct model_net_method express_mesh_method =
extern "C" {
struct model_net_method express_mesh_method =
{
.mn_configure = em_configure,
.mn_register = em_register,
.model_net_method_packet_event = em_packet_event,
.model_net_method_packet_event_rc = em_packet_event_rc,
.model_net_method_recv_msg_event = NULL,
.model_net_method_recv_msg_event_rc = NULL,
.mn_get_lp_type = em_get_cn_lp_type,
.mn_get_msg_sz = em_get_msg_sz,
.mn_report_stats = em_report_stats,
.mn_collective_call = NULL,
.mn_collective_call_rc = NULL,
//.mn_sample_fn = (event_f)em_sample_fn,
//.mn_sample_rc_fn = (revent_f)em_sample_rc_fn,
.mn_sample_init_fn = (init_f)em_sample_init,
//.mn_sample_fini_fn = (final_f)em_sample_fin
0,
em_configure,
em_register,
em_packet_event,
em_packet_event_rc,
NULL,
NULL,
em_get_cn_lp_type,
em_get_msg_sz,
em_report_stats,
NULL,
NULL,
NULL,//(event_f)em_sample_fn,
NULL,//(revent_f)em_sample_rc_fn,
(init_f)em_sample_init,
NULL//(final_f)em_sample_fin,
};
struct model_net_method express_mesh_router_method =
{
.mn_configure = NULL,
.mn_register = router_register,
.model_net_method_packet_event = NULL,
.model_net_method_packet_event_rc = NULL,
.model_net_method_recv_msg_event = NULL,
.model_net_method_recv_msg_event_rc = NULL,
.mn_get_lp_type = router_get_lp_type,
.mn_get_msg_sz = em_get_msg_sz,
.mn_report_stats = NULL, // not yet supported
.mn_collective_call = NULL,
.mn_collective_call_rc = NULL,
//.mn_sample_fn = (event_f)em_rsample_fn,
//.mn_sample_rc_fn = (revent_f)em_rsample_rc_fn,
.mn_sample_init_fn = (init_f)em_rsample_init,
//.mn_sample_fini_fn = (final_f)em_rsample_fin
0,
NULL,
router_register,
NULL,
NULL,
NULL,
NULL,
router_get_lp_type,
em_get_msg_sz,
NULL,
NULL,
NULL,
NULL,//(event_f)em_rsample_fn,
NULL,//(revent_f)em_rsample_rc_fn,
(init_f)em_rsample_init,
NULL//(final_f)em_rsample_fin,
};
}
......@@ -619,18 +619,22 @@ void handle_new_msg(
tw_stime exp_time = ((ns->node_copy_next_available_time[queue]
> tw_now(lp)) ? ns->node_copy_next_available_time[queue] : tw_now(lp));
exp_time += r->msg_size * codes_cn_delay;
exp_time -= tw_now(lp);
tw_stime delay = codes_local_latency(lp);
ns->node_copy_next_available_time[queue] = exp_time;
int remote_event_size = r->remote_event_size;
int self_event_size = r->self_event_size;
void *e_msg = (m+1);
if (remote_event_size > 0) {
tw_event *e = tw_event_new(r->final_dest_lp, exp_time - tw_now(lp), lp);
exp_time += delay;
tw_event *e = tw_event_new(r->final_dest_lp, exp_time, lp);
memcpy(tw_event_data(e), e_msg, remote_event_size);
tw_event_send(e);
e_msg = (char*)e_msg + remote_event_size;
}
if (self_event_size > 0) {
tw_event *e = tw_event_new(r->src_lp, exp_time - tw_now(lp), lp);
exp_time += delay;
tw_event *e = tw_event_new(r->src_lp, exp_time, lp);
memcpy(tw_event_data(e), e_msg, self_event_size);
tw_event_send(e);
}
......@@ -640,7 +644,7 @@ void handle_new_msg(
if(m->msg.m_base.isQueueReq) {
m->msg.m_base.save_ts = ns->next_available_time;
tw_stime exp_time = ((ns->next_available_time > tw_now(lp)) ? ns->next_available_time : tw_now(lp));
exp_time += ns->params->nic_seq_delay;
exp_time += ns->params->nic_seq_delay + codes_local_latency(lp);
ns->next_available_time = exp_time;
tw_event *e = tw_event_new(lp->gid, exp_time - tw_now(lp), lp);
model_net_wrap_msg *m_new = tw_event_data(e);
......@@ -721,6 +725,7 @@ void handle_new_msg_rc(
model_net_wrap_msg *m,
tw_lp *lp){
if(lp->gid == m->msg.m_base.req.dest_mn_lp) {
codes_local_latency_reverse(lp);
model_net_request *r = &m->msg.m_base.req;
int rep_id, offset;
codes_mapping_get_lp_info2(r->src_lp, NULL, NULL, NULL, &rep_id, &offset);
......@@ -729,6 +734,7 @@ void handle_new_msg_rc(
return;
}
if(m->msg.m_base.isQueueReq) {
codes_local_latency_reverse(lp);
ns->next_available_time = m->msg.m_base.save_ts;
return;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment