X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/8b04b1d0e11713e1931abfe15befbd9ebbd29893..8b9696f20b03e9968251c7d4eb34061ef0ede759:/src/smpi/smpi_replay.c diff --git a/src/smpi/smpi_replay.c b/src/smpi/smpi_replay.c index a57b594011..816ad8c516 100644 --- a/src/smpi/smpi_replay.c +++ b/src/smpi/smpi_replay.c @@ -965,15 +965,28 @@ void smpi_replay_init(int *argc, char***argv){ int smpi_replay_finalize(){ double sim_time= 1.; /* One active process will stop. Decrease the counter*/ - active_processes--; XBT_DEBUG("There are %lu elements in reqq[*]", xbt_dynar_length(reqq[smpi_comm_rank(MPI_COMM_WORLD)])); - xbt_dynar_free(&reqq[smpi_comm_rank(MPI_COMM_WORLD)]); + if (!xbt_dynar_is_empty(reqq[smpi_comm_rank(MPI_COMM_WORLD)])){ + int count_requests=xbt_dynar_length(reqq[smpi_comm_rank(MPI_COMM_WORLD)]); + MPI_Request requests[count_requests]; + MPI_Status status[count_requests]; + unsigned int i; + + xbt_dynar_foreach(reqq[smpi_comm_rank(MPI_COMM_WORLD)],i,requests[i]); + smpi_mpi_waitall(count_requests, requests, status); + active_processes--; + } else { + active_processes--; + } + + xbt_dynar_free_container(&(reqq[smpi_comm_rank(MPI_COMM_WORLD)])); + if(!active_processes){ /* Last process alive speaking */ /* end the simulated timer */ sim_time = smpi_process_simulated_elapsed(); - XBT_INFO("Simulation time %g", sim_time); + XBT_INFO("Simulation time %f", sim_time); _xbt_replay_action_exit(); xbt_free(reqq); reqq = NULL;