From: Marion Guthmuller Date: Tue, 29 Apr 2014 19:29:27 +0000 (+0200) Subject: model-checker : restore previous version of smpi_finalize if MC is enabled X-Git-Tag: v3_11~98^2~10 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/f006cbf895b9c72b1df7bb2985bacd2996331d0f?ds=inline model-checker : restore previous version of smpi_finalize if MC is enabled --- diff --git a/src/smpi/smpi_global.c b/src/smpi/smpi_global.c index d17f4bd9f6..1ac052ffae 100644 --- a/src/smpi/smpi_global.c +++ b/src/smpi/smpi_global.c @@ -128,44 +128,44 @@ void smpi_process_destroy(void) */ void smpi_process_finalize(void) { -#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 - ); + if(MC_is_active()){ + // wait for all pending asynchronous comms to finish + while (SIMIX_process_has_pending_comms(SIMIX_process_self())) { + simcall_process_sleep(0.01); } - 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 - ); + }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 ); } - smpi_mpi_waitall( size-1, requests+1, MPI_STATUSES_IGNORE ); - free( requests ); } -#endif } /**