29 #define EVENT_SIZE(e) g_tw_event_msg_sz
44 "network read buffer size in # of events"),
48 "network send buffer size in # of events"),
70 MPI_Initialized(&initialized);
73 if (MPI_Init(argc, argv) != MPI_SUCCESS)
117 printf(
"tw_net_start: Found world size to be %d \n",
world_size );
127 fprintf(stderr,
"Warning: Defaulting to Sequential Simulation, not enough PEs defined.\n");
157 if (g_st_damaris_enabled)
158 st_damaris_ross_finalize();
162 if (MPI_Finalize() != MPI_SUCCESS)
168 if (MPI_Finalize() != MPI_SUCCESS)
233 "MPI_testsome failed with %u items in %s",
241 for (i = 0; i < ready; i++)
253 for (i = 0, n = 0; (
unsigned int)i < q->
cur; i++)
297 tw_error(
TW_LOC,
"Out of events in GVT! Consider increasing --extramem");
410 if (me->
id == dest_pe->
id) {
427 "Event recived by PE %u but meant for PE %u",
542 "Don't know how to finish send of owner=%u, cancel_q=%d",
641 "Don't know how to cancel event owned by %u",
670 MPI_UNSIGNED_LONG_LONG,
672 (
int)g_tw_masternode,
681 (
int)g_tw_masternode,
688 MPI_UNSIGNED_LONG_LONG,
690 (
int)g_tw_masternode,
697 MPI_UNSIGNED_LONG_LONG,
699 (
int)g_tw_masternode,
704 if (MPI_Reduce(&s->s_rio_load,
705 &me->
stats.s_rio_load,
707 MPI_UNSIGNED_LONG_LONG,
709 (
int)g_tw_masternode,
712 if (MPI_Reduce(&s->s_rio_lp_init,
713 &me->
stats.s_rio_lp_init,
715 MPI_UNSIGNED_LONG_LONG,
717 (
int)g_tw_masternode,
tw_synch g_tw_synchronization_protocol
Network transmission in progress.
unsigned int s_nsend_network
static unsigned int send_buffer
tw_lp * dest_lp
Destination LP ID.
tw_eventq event_q
Linked list of events sent to this PE.
void tw_net_cancel(tw_event *e)
Cancel the given remote event by either removing from the outq or sending an antimessage, depending on the status of the original positive send.
static tw_event * tw_event_grab(tw_pe *pe)
void tw_net_stop(void)
Stops the network library after simulation end.
struct st_lp_stats * lp_stats
void tw_error(const char *file, int line, const char *fmt,...) NORETURN
tw_lptype * type
Type of this LP, including service callbacks.
static void recv_finish(tw_pe *me, tw_event *e, char *buffer)
Determines how to handle the newly received event.
struct st_kp_stats * kp_stats
static struct act_q posted_sends
tw_statistics stats
per PE counters
static tw_event * tw_eventq_peek(tw_eventq *q)
tw_stime recv_ts
Actual time to be received.
void tw_comm_set(MPI_Comm comm)
Setup the MPI_COMM_ROSS communicator to use instead of MPI_COMM_WORLD.
static void tw_eventq_delete_any(tw_eventq *q, tw_event *e)
void tw_net_read(tw_pe *me)
starts service_queues() to poll network
tw_event * cancel_next
Next event in the cancel queue for the dest_pe.
static tw_clock tw_clock_read(void)
static void tw_event_free(tw_pe *, tw_event *)
map_f map
LP Mapping of LP gid -> remote PE routine.
tw_stime trans_msg_ts
Last transient messages' time stamp.
Holds the entire PE state.
const tw_optdef * tw_net_init(int *argc, char ***argv)
Initalize the network library and parse options.
Network transmission in progress.
tw_event * cancel_q
List of canceled events.
unsigned int tw_nnodes(void)
unsigned int s_nsend_network
static unsigned int read_buffer
void tw_net_barrier(void)
tw_stime tw_net_minimum(void)
Obtain the lowest timestamp inside the network buffers.
Keeps track of posted send or recv operations.
tw_kp * kp
kp – Kernel process that we belong to (must match pe).
Statistics tallied over the duration of the simulation.
unsigned int g_tw_net_device_size
void tw_hash_insert(void *h, tw_event *event, long pe)
unsigned int s_nread_network
#define TW_STIME_CMP(x, y)
static const tw_optdef mpi_opts[]
tw_event * abort_event
Placeholder event for when free_q is empty.
static void init_q(struct act_q *q, const char *name, unsigned int size)
Initializes queues used for posted sends and receives.
void * hash_t
Array of incoming events from remote pes, Note: only necessary for distributed DSR.
static int tw_gvt_inprogress(tw_pe *pe)
void tw_pq_enqueue(splay_tree *st, tw_event *e)
tw_event * cause_next
Next in parent's caused_by_me chain.
tw_lpid send_lp
sending LP ID for data collection uses
tw_event * caused_by_me
Start of event list caused by this event.
#define TWOPT_UINT(n, v, h)
tw_pq * pq
Priority queue used to sort events.
static int send_begin(tw_pe *me)
If there are any openings in the posted_sends queue, start sends for events in the outgoing queue...
tw_statistics * tw_net_statistics(tw_pe *me, tw_statistics *s)
Function to output the statistics.
static tw_event * tw_eventq_pop(tw_eventq *q)
unsigned int s_nread_network
double s_min_detected_offset
Pending network transmission.
static void tw_eventq_push(tw_eventq *q, tw_event *e)
struct tw_event::@0 state
static void tw_eventq_unshift(tw_eventq *q, tw_event *e)
unsigned char remote
Indicates union addr is in 'remote' storage.
tw_stime GVT
Global Virtual Time.
static struct act_q posted_recvs
tw_lp * src_lp
Sending LP ID.
static int recv_begin(tw_pe *me)
If there are any openings in the posted_recvs queue, post more Irecvs.
void tw_net_send(tw_event *e)
Adds the event to the outgoing queue of events to be sent, polls for finished sends, and attempts to start sends from outq.
void tw_net_start(void)
Starts the network library after option parsing.
static int test_q(struct act_q *q, tw_pe *me, void(*finish)(tw_pe *, tw_event *, char *))
Calls MPI_Testsome on the provided queue, to check for finished operations.
tw_stat s_events_past_end
static tw_lp * tw_getlocal_lp(tw_lpid gid)
tw_event * tw_hash_remove(void *h, tw_event *event, long pe)
void * tw_calloc(const char *file, int line, const char *for_who, size_t e_sz, size_t n)
static void service_queues(tw_pe *me)
Start checks for finished operations in send/recv queues, and post new sends/recvs if possible...
unsigned char cancel_q
Actively on a dest_lp->pe's cancel_q.
tw_stime last_time
Time of the current event being processed.
unsigned char cancel_asend
static void send_finish(tw_pe *me, tw_event *e, char *buffer)
Determines how to handle the buffer of event whose send operation just finished.
unsigned char owner
Owner of the next/prev pointers; see tw_event_owner.