Commit de244764 authored by Misbah Mubarak's avatar Misbah Mubarak
Browse files

Fixing queue ordering in reverse mode

parent f87d09a6
...@@ -2,9 +2,9 @@ LPGROUPS ...@@ -2,9 +2,9 @@ LPGROUPS
{ {
MODELNET_GRP MODELNET_GRP
{ {
repetitions="36"; repetitions="114";
nw-lp="2"; nw-lp="3";
modelnet_dragonfly="2"; modelnet_dragonfly="3";
dragonfly_router="1"; dragonfly_router="1";
} }
} }
...@@ -17,7 +17,7 @@ PARAMS ...@@ -17,7 +17,7 @@ PARAMS
chunk_size="64"; chunk_size="64";
# modelnet_scheduler="round-robin"; # modelnet_scheduler="round-robin";
num_vcs="1"; num_vcs="1";
num_routers="4"; num_routers="6";
local_vc_size="32768"; local_vc_size="32768";
global_vc_size="65536"; global_vc_size="65536";
cn_vc_size="32768"; cn_vc_size="32768";
......
...@@ -131,6 +131,9 @@ struct nw_state ...@@ -131,6 +131,9 @@ struct nw_state
struct qlist_head pending_recvs_queue; struct qlist_head pending_recvs_queue;
/* List of completed send/receive requests */ /* List of completed send/receive requests */
struct qlist_head completed_reqs; struct qlist_head completed_reqs;
/* Pending wait operation */
struct pending_waits * wait_op;
}; };
/* data for handling reverse computation. /* data for handling reverse computation.
...@@ -571,35 +574,46 @@ static void codes_exec_mpi_recv_rc(nw_state* ns, nw_message* m, tw_lp* lp, struc ...@@ -571,35 +574,46 @@ static void codes_exec_mpi_recv_rc(nw_state* ns, nw_message* m, tw_lp* lp, struc
{ {
num_bytes_recvd -= mpi_op->u.recv.num_bytes; num_bytes_recvd -= mpi_op->u.recv.num_bytes;
ns->recv_time = m->u.rc.saved_recv_time; ns->recv_time = m->u.rc.saved_recv_time;
if(m->u.rc.found_match > 0) if(m->u.rc.found_match >= 0)
{ {
rc_stack_pop(ns->matched_qitems); rc_stack_pop(ns->matched_qitems);
ns->recv_time = m->u.rc.saved_recv_time; ns->recv_time = m->u.rc.saved_recv_time;
int queue_count = qlist_count(&ns->arrival_queue);
mpi_msgs_queue * qi = rc_stack_pop(ns->matched_qitems); mpi_msgs_queue * qi = rc_stack_pop(ns->matched_qitems);
int index = 0; if(!m->u.rc.found_match)
struct qlist_head * ent = NULL; {
qlist_for_each(ent, &ns->arrival_queue) qlist_add(&qi->ql, &ns->arrival_queue);
}
else if(m->u.rc.found_match == queue_count)
{
qlist_add_tail(&qi->ql, &ns->arrival_queue);
}
else if(m->u.rc.found_match > 0 && m->u.rc.found_match < queue_count)
{ {
if(index == m->u.rc.found_match) int index = 1;
{ struct qlist_head * ent = NULL;
qlist_add(&qi->ql, &ent); qlist_for_each(ent, &ns->arrival_queue)
break; {
} if(index == m->u.rc.found_match)
index++; {
qlist_add(&qi->ql, ent);
break;
}
index++;
}
} }
codes_issue_next_event_rc(lp); codes_issue_next_event_rc(lp);
} }
else if(m->u.rc.found_match < 0) else if(m->u.rc.found_match < 0)
{ {
struct qlist_head * ent = qlist_pop_back(&ns->pending_recvs_queue); struct qlist_head * ent = qlist_pop_back(&ns->pending_recvs_queue);
mpi_msgs_queue * qi = qlist_entry(ent, mpi_msgs_queue, ql); mpi_msgs_queue * qi = qlist_entry(ent, mpi_msgs_queue, ql);
free(qi); free(qi);
if(mpi_op->op_type == CODES_WK_IRECV) if(mpi_op->op_type == CODES_WK_IRECV)
codes_issue_next_event_rc(lp); codes_issue_next_event_rc(lp);
} }
} }
...@@ -622,7 +636,6 @@ static void codes_exec_mpi_recv(nw_state* s, tw_lp* lp, nw_message * m, struct c ...@@ -622,7 +636,6 @@ static void codes_exec_mpi_recv(nw_state* s, tw_lp* lp, nw_message * m, struct c
recv_op->tag = mpi_op->u.recv.tag; recv_op->tag = mpi_op->u.recv.tag;
recv_op->req_id = mpi_op->u.recv.req_id; recv_op->req_id = mpi_op->u.recv.req_id;
dumpi_req_id req_id;
int found_matching_sends = rm_matching_send(s, lp, recv_op); int found_matching_sends = rm_matching_send(s, lp, recv_op);
/* save the req id inserted in the completed queue for reverse computation. */ /* save the req id inserted in the completed queue for reverse computation. */
...@@ -706,22 +719,34 @@ static void update_arrival_queue_rc(nw_state* s, tw_bf * bf, nw_message * m, tw_ ...@@ -706,22 +719,34 @@ static void update_arrival_queue_rc(nw_state* s, tw_bf * bf, nw_message * m, tw_
{ {
s->recv_time = m->u.rc.saved_recv_time; s->recv_time = m->u.rc.saved_recv_time;
codes_local_latency_reverse(lp); codes_local_latency_reverse(lp);
if(m->u.rc.found_match > 0) if(m->u.rc.found_match >= 0)
{ {
rc_stack_pop(s->matched_qitems); rc_stack_pop(s->matched_qitems);
mpi_msgs_queue * qi = rc_stack_pop(s->matched_qitems); mpi_msgs_queue * qi = rc_stack_pop(s->matched_qitems);
int queue_count = qlist_count(&s->pending_recvs_queue);
int index = 0;
struct qlist_head * ent = NULL; if(!m->u.rc.found_match)
qlist_for_each(ent, &s->pending_recvs_queue) {
qlist_add(&qi->ql, &s->pending_recvs_queue);
}
else if(m->u.rc.found_match == queue_count)
{
qlist_add_tail(&qi->ql, &s->pending_recvs_queue);
}
else if(m->u.rc.found_match > 0 && m->u.rc.found_match < queue_count)
{ {
if(index == m->u.rc.found_match) int index = 1;
{ struct qlist_head * ent = NULL;
qlist_add(&qi->ql, &ent); qlist_for_each(ent, &s->pending_recvs_queue)
break; {
} if(index == m->u.rc.found_match)
index++; {
qlist_add(&qi->ql, ent);
break;
}
index++;
}
} }
} }
else if(m->u.rc.found_match < 0) else if(m->u.rc.found_match < 0)
...@@ -735,8 +760,6 @@ static void update_arrival_queue_rc(nw_state* s, tw_bf * bf, nw_message * m, tw_ ...@@ -735,8 +760,6 @@ static void update_arrival_queue_rc(nw_state* s, tw_bf * bf, nw_message * m, tw_
/* once an isend operation arrives, the pending receives queue is checked to find out if there is a irecv that has already been posted. If no isend has been posted, */ /* once an isend operation arrives, the pending receives queue is checked to find out if there is a irecv that has already been posted. If no isend has been posted, */
static void update_arrival_queue(nw_state* s, tw_bf * bf, nw_message * m, tw_lp * lp) static void update_arrival_queue(nw_state* s, tw_bf * bf, nw_message * m, tw_lp * lp)
{ {
int is_blocking = 0; /* checks if the recv operation was blocking or not */
m->u.rc.saved_recv_time = s->recv_time; m->u.rc.saved_recv_time = s->recv_time;
......
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