/* runtime option for disabling computation time simulation */
staticintdisable_delay=0;
/* MPI_OP_GET_NEXT is for getting next MPI operation when the previous operation completes.
* MPI_SEND_ARRIVED is issued when a MPI message arrives at its destination (the message is transported by model-net and an event is invoked when it arrives.
* MPI_SEND_POSTED is issued when a MPI message has left the source LP (message is transported via model-net). */
enumMPI_NW_EVENTS
{
MPI_OP_GET_NEXT=1,
MPI_SEND_ARRIVED,
MPI_SEND_ARRIVED_CB,// for tracking message times on sender
MPI_SEND_POSTED,
};
/* stores pointers of pending MPI operations to be matched with their respective sends/receives. */
structmpi_msgs_queue
{
intop_type;
inttag;
intsource_rank;
intdest_rank;
intnum_bytes;
tw_stimereq_init_time;
dumpi_req_idreq_id;
structqlist_headql;
};
/* stores request IDs of completed MPI operations (Isends or Irecvs) */
structcompleted_requests
{
dumpi_req_idreq_id;
structqlist_headql;
};
/* for wait operations, store the pending operation and number of completed waits so far. */
/* state of the network LP. It contains the pointers to send/receive lists */
structnw_state
{
longnum_events_per_lp;
tw_lpidnw_id;
shortwrkld_end;
structrc_stack*processed_ops;
structrc_stack*matched_qitems;
/* count of sends, receives, collectives and delays */
unsignedlongnum_sends;
unsignedlongnum_recvs;
unsignedlongnum_cols;
unsignedlongnum_delays;
unsignedlongnum_wait;
unsignedlongnum_waitall;
unsignedlongnum_waitsome;
/* time spent by the LP in executing the app trace*/
doublestart_time;
doubleelapsed_time;
/* time spent in compute operations */
doublecompute_time;
/* time spent in message send/isend */
doublesend_time;
/* time spent in message receive */
doublerecv_time;
/* time spent in wait operation */
doublewait_time;
/* FIFO for isend messages arrived on destination */
structqlist_headarrival_queue;
/* FIFO for irecv messages posted but not yet matched with send operations */
structqlist_headpending_recvs_queue;
/* List of completed send/receive requests */
structqlist_headcompleted_reqs;
};
/* data for handling reverse computation.
* saved_matched_req holds the request ID of matched receives/sends for wait operations.
* ptr_match_op holds the matched MPI operation which are removed from the queues when a send is matched with the receive in forward event handler.
* network event being sent. op is the MPI operation issued by the network workloads API. rv_data holds the data for reverse computation (TODO: Fill this data structure only when the simulation runs in optimistic mode). */