-#if 0
- // wait for all pending asynchronous comms to finish
- while (SIMIX_process_has_pending_comms(SIMIX_process_self())) {
- simcall_process_sleep(0.01);
- }
-#else
- int i;
- int size = smpi_comm_size(MPI_COMM_WORLD);
- int rank = smpi_comm_rank(MPI_COMM_WORLD);
- /* All non-root send & receive zero-length message. */
- if (rank > 0) {
- smpi_mpi_ssend (NULL, 0, MPI_BYTE, 0,
- COLL_TAG_BARRIER,
- MPI_COMM_WORLD);
- smpi_mpi_recv (NULL, 0, MPI_BYTE, 0,
- COLL_TAG_BARRIER,
- MPI_COMM_WORLD, MPI_STATUS_IGNORE);
- }
- /* The root collects and broadcasts the messages. */
- else {
- MPI_Request* requests;
- requests = (MPI_Request*)malloc( size * sizeof(MPI_Request) );
- for (i = 1; i < size; ++i) {
- requests[i] = smpi_mpi_irecv(NULL, 0, MPI_BYTE, MPI_ANY_SOURCE,
- COLL_TAG_BARRIER, MPI_COMM_WORLD
- );
- }
- smpi_mpi_waitall( size-1, requests+1, MPI_STATUSES_IGNORE );
- for (i = 1; i < size; ++i) {
- requests[i] = smpi_mpi_issend(NULL, 0, MPI_BYTE, i,
- COLL_TAG_BARRIER,
- MPI_COMM_WORLD
- );
- }
- smpi_mpi_waitall( size-1, requests+1, MPI_STATUSES_IGNORE );
- free( requests );
- }
-#endif
+ // This leads to an explosion of the search graph
+ // which cannot be reduced:
+ if(MC_is_active() || MC_record_replay_is_active())
+ return;
+
+ int index = smpi_process_index();
+ // wait for all pending asynchronous comms to finish
+ xbt_barrier_wait(process_data[index_to_process_data[index]]->finalization_barrier);