/** * @brief Start checks for finished operations in send/recv queues, * and post new sends/recvs if possible. * @param[in] me pointer to PE */ static void service_queues(tw_pe *me) { int changed; do { changed = test_q(&posted_recvs, me, recv_finish); changed |= test_q(&posted_sends, me, send_finish); changed |= recv_begin(me); changed |= send_begin(me); } while (changed); }
void tw_net_start(void) { if (MPI_Comm_size(MPI_COMM_ROSS, &world_size) != MPI_SUCCESS) tw_error(TW_LOC, "Cannot get MPI_Comm_size(MPI_COMM_ROSS)"); if( g_tw_mynode == 0) { printf("tw_net_start: Found world size to be %d \n", world_size ); } // Check after tw_nnodes is defined if(tw_nnodes() == 1 && g_tw_npe == 1) { // force the setting of SEQUENTIAL protocol if (g_tw_synchronization_protocol == NO_SYNCH) { g_tw_synchronization_protocol = SEQUENTIAL; } else if(g_tw_synchronization_protocol == CONSERVATIVE || g_tw_synchronization_protocol == OPTIMISTIC) { g_tw_synchronization_protocol = SEQUENTIAL; fprintf(stderr, "Warning: Defaulting to Sequential Simulation, not enought PEs defined.\n"); } } tw_pe_create(1); tw_pe_init(0, g_tw_mynode); //If we're in (some variation of) optimistic mode, we need this hash if (g_tw_synchronization_protocol == OPTIMISTIC || g_tw_synchronization_protocol == OPTIMISTIC_DEBUG || g_tw_synchronization_protocol == OPTIMISTIC_REALTIME) { g_tw_pe[0]->hash_t = tw_hash_create(); } else { g_tw_pe[0]->hash_t = NULL; } if (send_buffer < 1) tw_error(TW_LOC, "network send buffer must be >= 1"); if (read_buffer < 1) tw_error(TW_LOC, "network read buffer must be >= 1"); init_q(&posted_sends, "MPI send queue"); init_q(&posted_recvs, "MPI recv queue"); g_tw_net_device_size = read_buffer; // pre-post all the Irecv operations recv_begin( g_tw_pe[0] ); }