Commit 0c3bcbcf authored by Misbah Mubarak's avatar Misbah Mubarak

Changing data type for bytes transferred, modifying reverse handler for MPI_Wait

parent e35f07f6
...@@ -194,7 +194,7 @@ struct codes_workload_op ...@@ -194,7 +194,7 @@ struct codes_workload_op
/* TODO: not sure why source rank is here */ /* TODO: not sure why source rank is here */
int source_rank;/* source rank of MPI send message */ int source_rank;/* source rank of MPI send message */
int dest_rank; /* dest rank of MPI send message */ int dest_rank; /* dest rank of MPI send message */
int64_t num_bytes; /* number of bytes to be transferred over the network */ uint64_t num_bytes; /* number of bytes to be transferred over the network */
int16_t data_type; /* MPI data type to be matched with the recv */ int16_t data_type; /* MPI data type to be matched with the recv */
int count; /* number of elements to be received */ int count; /* number of elements to be received */
int tag; /* tag of the message */ int tag; /* tag of the message */
...@@ -204,7 +204,7 @@ struct codes_workload_op ...@@ -204,7 +204,7 @@ struct codes_workload_op
/* TODO: not sure why source rank is here */ /* TODO: not sure why source rank is here */
int source_rank;/* source rank of MPI recv message */ int source_rank;/* source rank of MPI recv message */
int dest_rank;/* dest rank of MPI recv message */ int dest_rank;/* dest rank of MPI recv message */
int num_bytes; /* number of bytes to be transferred over the network */ uint64_t num_bytes; /* number of bytes to be transferred over the network */
int16_t data_type; /* MPI data type to be matched with the send */ int16_t data_type; /* MPI data type to be matched with the send */
int count; /* number of elements to be sent */ int count; /* number of elements to be sent */
int tag; /* tag of the message */ int tag; /* tag of the message */
......
...@@ -37,7 +37,7 @@ static int msg_size_hash_compare( ...@@ -37,7 +37,7 @@ static int msg_size_hash_compare(
/* NOTE: Message tracking works in sequential mode only! */ /* NOTE: Message tracking works in sequential mode only! */
int enable_msg_tracking = 0; int enable_msg_tracking = 0;
tw_lpid TRACK_LP = -1; tw_lpid TRACK_LP = 0;
int unmatched = 0; int unmatched = 0;
char workload_type[128]; char workload_type[128];
...@@ -794,15 +794,15 @@ static int notify_posted_wait(nw_state* s, ...@@ -794,15 +794,15 @@ static int notify_posted_wait(nw_state* s,
} }
/* reverse handler of MPI wait operation */ /* reverse handler of MPI wait operation */
static void codes_exec_mpi_wait_rc(nw_state* s, tw_lp* lp) static void codes_exec_mpi_wait_rc(nw_state* s, tw_bf * bf, tw_lp* lp)
{ {
if(s->wait_op) if(bf->c2)
{ {
struct pending_waits * wait_op = s->wait_op; struct pending_waits * wait_op = s->wait_op;
free(wait_op); free(wait_op);
s->wait_op = NULL; s->wait_op = NULL;
} }
else if(bf->c1)
{ {
codes_issue_next_event_rc(lp); codes_issue_next_event_rc(lp);
completed_requests * qi = rc_stack_pop(s->processed_ops); completed_requests * qi = rc_stack_pop(s->processed_ops);
...@@ -812,11 +812,12 @@ static void codes_exec_mpi_wait_rc(nw_state* s, tw_lp* lp) ...@@ -812,11 +812,12 @@ static void codes_exec_mpi_wait_rc(nw_state* s, tw_lp* lp)
} }
/* execute MPI wait operation */ /* execute MPI wait operation */
static void codes_exec_mpi_wait(nw_state* s, tw_lp* lp, struct codes_workload_op * mpi_op) static void codes_exec_mpi_wait(nw_state* s, tw_bf * bf, tw_lp* lp, struct codes_workload_op * mpi_op)
{ {
/* check in the completed receives queue if the request ID has already been completed.*/ /* check in the completed receives queue if the request ID has already been completed.*/
assert(!s->wait_op); assert(!s->wait_op);
dumpi_req_id req_id = mpi_op->u.wait.req_id; dumpi_req_id req_id = mpi_op->u.wait.req_id;
struct completed_requests* current = NULL; struct completed_requests* current = NULL;
struct qlist_head * ent = NULL; struct qlist_head * ent = NULL;
...@@ -825,12 +826,15 @@ static void codes_exec_mpi_wait(nw_state* s, tw_lp* lp, struct codes_workload_op ...@@ -825,12 +826,15 @@ static void codes_exec_mpi_wait(nw_state* s, tw_lp* lp, struct codes_workload_op
current = qlist_entry(ent, completed_requests, ql); current = qlist_entry(ent, completed_requests, ql);
if(current->req_id == req_id) if(current->req_id == req_id)
{ {
bf->c1=1;
qlist_del(&current->ql); qlist_del(&current->ql);
rc_stack_push(lp, current, free, s->processed_ops); rc_stack_push(lp, current, free, s->processed_ops);
codes_issue_next_event(lp); codes_issue_next_event(lp);
return; return;
} }
} }
bf->c2 = 1;
/* If not, add the wait operation in the pending 'waits' list. */ /* If not, add the wait operation in the pending 'waits' list. */
struct pending_waits* wait_op = malloc(sizeof(struct pending_waits)); struct pending_waits* wait_op = malloc(sizeof(struct pending_waits));
wait_op->op_type = mpi_op->op_type; wait_op->op_type = mpi_op->op_type;
...@@ -1199,6 +1203,7 @@ static void codes_exec_mpi_recv( ...@@ -1199,6 +1203,7 @@ static void codes_exec_mpi_recv(
recv_op->req_id = mpi_op->u.recv.req_id; recv_op->req_id = mpi_op->u.recv.req_id;
//printf("\n Req id %d bytes %d source %d tag %d ", recv_op->req_id, recv_op->num_bytes, recv_op->source_rank, recv_op->tag);
if(s->nw_id == (tw_lpid)TRACK_LP) if(s->nw_id == (tw_lpid)TRACK_LP)
printf("\n Receive op posted num bytes %llu source %d ", recv_op->num_bytes, printf("\n Receive op posted num bytes %llu source %d ", recv_op->num_bytes,
recv_op->source_rank); recv_op->source_rank);
...@@ -1328,7 +1333,7 @@ static void codes_exec_mpi_send(nw_state* s, ...@@ -1328,7 +1333,7 @@ static void codes_exec_mpi_send(nw_state* s,
local_m.fwd.req_id = mpi_op->u.send.req_id; local_m.fwd.req_id = mpi_op->u.send.req_id;
local_m.fwd.app_id = s->app_id; local_m.fwd.app_id = s->app_id;
if(mpi_op->u.send.num_bytes < EAGER_THRESHOLD) if(mpi_op->u.send.num_bytes < EAGER_THRESHOLD)
{ {
/* directly issue a model-net send */ /* directly issue a model-net send */
...@@ -1945,7 +1950,7 @@ static void get_next_mpi_operation_rc(nw_state* s, tw_bf * bf, nw_message * m, t ...@@ -1945,7 +1950,7 @@ static void get_next_mpi_operation_rc(nw_state* s, tw_bf * bf, nw_message * m, t
case CODES_WK_WAIT: case CODES_WK_WAIT:
{ {
s->num_wait--; s->num_wait--;
codes_exec_mpi_wait_rc(s, lp); codes_exec_mpi_wait_rc(s, bf, lp);
} }
break; break;
case CODES_WK_WAITALL: case CODES_WK_WAITALL:
...@@ -2044,7 +2049,8 @@ static void get_next_mpi_operation(nw_state* s, tw_bf * bf, nw_message * m, tw_l ...@@ -2044,7 +2049,8 @@ static void get_next_mpi_operation(nw_state* s, tw_bf * bf, nw_message * m, tw_l
{ {
//printf("\n MPI WAIT "); //printf("\n MPI WAIT ");
s->num_wait++; s->num_wait++;
codes_exec_mpi_wait(s, lp, &mpi_op); //TODO: Uncomment:
codes_exec_mpi_wait(s, bf, lp, &mpi_op);
} }
break; break;
case CODES_WK_BCAST: case CODES_WK_BCAST:
......
...@@ -327,7 +327,7 @@ void codes_workload_print_op( ...@@ -327,7 +327,7 @@ void codes_workload_print_op(
break; break;
case CODES_WK_SEND: case CODES_WK_SEND:
fprintf(f, "op: app:%d rank:%d type:send " fprintf(f, "op: app:%d rank:%d type:send "
"src:%d dst:%d bytes:%lld type:%d count:%d tag:%d " "src:%d dst:%d bytes:%llu type:%d count:%d tag:%d "
"start:%.5e end:%.5e\n", "start:%.5e end:%.5e\n",
app_id, rank, app_id, rank,
op->u.send.source_rank, op->u.send.dest_rank, op->u.send.source_rank, op->u.send.dest_rank,
...@@ -337,7 +337,7 @@ void codes_workload_print_op( ...@@ -337,7 +337,7 @@ void codes_workload_print_op(
break; break;
case CODES_WK_RECV: case CODES_WK_RECV:
fprintf(f, "op: app:%d rank:%d type:recv " fprintf(f, "op: app:%d rank:%d type:recv "
"src:%d dst:%d bytes:%d type:%d count:%d tag:%d " "src:%d dst:%d bytes:%llu type:%d count:%d tag:%d "
"start:%.5e end:%.5e\n", "start:%.5e end:%.5e\n",
app_id, rank, app_id, rank,
op->u.recv.source_rank, op->u.recv.dest_rank, op->u.recv.source_rank, op->u.recv.dest_rank,
...@@ -347,7 +347,7 @@ void codes_workload_print_op( ...@@ -347,7 +347,7 @@ void codes_workload_print_op(
break; break;
case CODES_WK_ISEND: case CODES_WK_ISEND:
fprintf(f, "op: app:%d rank:%d type:isend " fprintf(f, "op: app:%d rank:%d type:isend "
"src:%d dst:%d bytes:%lld type:%d count:%d tag:%d " "src:%d dst:%d bytes:%llu type:%d count:%d tag:%d "
"start:%.5e end:%.5e\n", "start:%.5e end:%.5e\n",
app_id, rank, app_id, rank,
op->u.send.source_rank, op->u.send.dest_rank, op->u.send.source_rank, op->u.send.dest_rank,
...@@ -357,7 +357,7 @@ void codes_workload_print_op( ...@@ -357,7 +357,7 @@ void codes_workload_print_op(
break; break;
case CODES_WK_IRECV: case CODES_WK_IRECV:
fprintf(f, "op: app:%d rank:%d type:irecv " fprintf(f, "op: app:%d rank:%d type:irecv "
"src:%d dst:%d bytes:%d type:%d count:%d tag:%d " "src:%d dst:%d bytes:%llu type:%d count:%d tag:%d "
"start:%.5e end:%.5e\n", "start:%.5e end:%.5e\n",
app_id, rank, app_id, rank,
op->u.recv.source_rank, op->u.recv.dest_rank, op->u.recv.source_rank, op->u.recv.dest_rank,
......
...@@ -116,7 +116,7 @@ static int dumpi_trace_nw_workload_load(const char* params, int app_id, int rank ...@@ -116,7 +116,7 @@ static int dumpi_trace_nw_workload_load(const char* params, int app_id, int rank
static void dumpi_trace_nw_workload_get_next(int app_id, int rank, struct codes_workload_op *op); static void dumpi_trace_nw_workload_get_next(int app_id, int rank, struct codes_workload_op *op);
/* get number of bytes from the workload data type and count */ /* get number of bytes from the workload data type and count */
static int64_t get_num_bytes(rank_mpi_context* my_ctx, dumpi_datatype dt); static uint64_t get_num_bytes(rank_mpi_context* my_ctx, dumpi_datatype dt);
/* computes the delay between MPI operations */ /* computes the delay between MPI operations */
static void update_compute_time(const dumpi_time* time, rank_mpi_context* my_ctx); static void update_compute_time(const dumpi_time* time, rank_mpi_context* my_ctx);
...@@ -440,7 +440,7 @@ int handleDUMPIIRecv(const dumpi_irecv *prm, uint16_t thread, const dumpi_time * ...@@ -440,7 +440,7 @@ int handleDUMPIIRecv(const dumpi_irecv *prm, uint16_t thread, const dumpi_time *
wrkld_per_rank.u.recv.tag = prm->tag; wrkld_per_rank.u.recv.tag = prm->tag;
wrkld_per_rank.u.recv.num_bytes = prm->count * get_num_bytes(myctx,prm->datatype); wrkld_per_rank.u.recv.num_bytes = prm->count * get_num_bytes(myctx,prm->datatype);
//assert(wrkld_per_rank.u.recv.num_bytes >= 0); assert(wrkld_per_rank.u.recv.num_bytes >= 0);
wrkld_per_rank.u.recv.source_rank = prm->source; wrkld_per_rank.u.recv.source_rank = prm->source;
wrkld_per_rank.u.recv.dest_rank = -1; wrkld_per_rank.u.recv.dest_rank = -1;
wrkld_per_rank.u.recv.req_id = prm->request; wrkld_per_rank.u.recv.req_id = prm->request;
...@@ -487,7 +487,6 @@ int handleDUMPIRecv(const dumpi_recv *prm, uint16_t thread, ...@@ -487,7 +487,6 @@ int handleDUMPIRecv(const dumpi_recv *prm, uint16_t thread,
(void)wall; (void)wall;
(void)perf; (void)perf;
//printf("\n irecv source %d count %d data type %d", prm->source, prm->count, prm->datatype);
rank_mpi_context* myctx = (rank_mpi_context*)uarg; rank_mpi_context* myctx = (rank_mpi_context*)uarg;
struct codes_workload_op wrkld_per_rank; struct codes_workload_op wrkld_per_rank;
...@@ -500,6 +499,7 @@ int handleDUMPIRecv(const dumpi_recv *prm, uint16_t thread, ...@@ -500,6 +499,7 @@ int handleDUMPIRecv(const dumpi_recv *prm, uint16_t thread,
wrkld_per_rank.u.recv.source_rank = prm->source; wrkld_per_rank.u.recv.source_rank = prm->source;
wrkld_per_rank.u.recv.dest_rank = -1; wrkld_per_rank.u.recv.dest_rank = -1;
//printf("\n recv source %d count %d data type %d bytes %lld ", prm->source, prm->count, prm->datatype, wrkld_per_rank.u.recv.num_bytes);
update_times_and_insert(&wrkld_per_rank, wall, myctx); update_times_and_insert(&wrkld_per_rank, wall, myctx);
return 0; return 0;
...@@ -933,7 +933,7 @@ int dumpi_trace_nw_workload_load(const char* params, int app_id, int rank) ...@@ -933,7 +933,7 @@ int dumpi_trace_nw_workload_load(const char* params, int app_id, int rank)
/* Data types are for 64-bit archs. Source: /* Data types are for 64-bit archs. Source:
* https://www.tutorialspoint.com/cprogramming/c_data_types.htm * https://www.tutorialspoint.com/cprogramming/c_data_types.htm
* */ * */
static int64_t get_num_bytes(rank_mpi_context* myctx, dumpi_datatype dt) static uint64_t get_num_bytes(rank_mpi_context* myctx, dumpi_datatype dt)
{ {
(void)myctx; (void)myctx;
......
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